Added vmi library keyword
-Modified bmc_network_utils keyword for arguments
-Added Get And Set Static VMI IP keyword
Change-Id: Ifabf0789961cec5089fac4e677cc3bb153034d34
Signed-off-by: shrsuman123 <shrsuman@in.ibm.com>
diff --git a/lib/bmc_network_utils.robot b/lib/bmc_network_utils.robot
index 56f1749..e7f02ba 100644
--- a/lib/bmc_network_utils.robot
+++ b/lib/bmc_network_utils.robot
@@ -238,7 +238,7 @@
# (e.g. "machine1" or "9.xx.xx.31").
# Non-pingable IP is unused IP address in the subnet.
- ${host_name} ${ip_addr}= Get Host Name IP
+ ${host_name} ${ip_addr}= Get Host Name IP ${host}
# Split IP address into network part and host part.
# IP address will have 4 octets xx.xx.xx.xx.
@@ -443,10 +443,14 @@
# "VLANEnable": false,
# "VLANId": 0
# }
+ [Arguments] ${network_active_channel}=${CHANNEL_NUMBER}
-
+ # Description of argument(s):
+ # network_active_channel Ethernet channel number (eg. 1 or 2)
+
${active_channel_config}= Get Active Channel Config
- ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
+ ${resp}= Redfish.Get
+ ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${network_active_channel}']['name']}
@{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses
[Return] @{network_configurations}
diff --git a/lib/external_intf/vmi_utils.robot b/lib/external_intf/vmi_utils.robot
index 980ba15..a90055c 100644
--- a/lib/external_intf/vmi_utils.robot
+++ b/lib/external_intf/vmi_utils.robot
@@ -6,6 +6,7 @@
Resource ../../lib/openbmc_ffdc.robot
Resource ../../lib/bmc_redfish_utils.robot
Resource ../../lib/state_manager.robot
+Resource ../../lib/bmc_network_utils.robot
Library ../../lib/bmc_network_utils.py
*** Variables ***
@@ -177,3 +178,22 @@
... /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth${i}
END
Should Be Equal ${resp["Members@odata.count"]} ${number_of_interfaces}
+
+Get And Set Static VMI IP
+ [Documentation] Get a suitable VMI IP and set it.
+ [Arguments] ${host}=${OPENBMC_HOST} ${network_active_channel}=${CHANNEL_NUMBER}
+ ... ${interface}=eth0 ${valid_status_code}=${HTTP_ACCEPTED}
+
+ # Description of argument(s):
+ # host BMC host name or IP address.
+ # network_active_channel Ethernet channel number (e.g.1 or 2).
+ # interface VMI interface (eg. eth0 or eth1).
+ # valid_status_code Expected valid status code from PATCH request. Default is HTTP_ACCEPTED.
+
+ ${vmi_ip}= Get First Non Pingable IP From Subnet ${host}
+ ${bmc_ip_data}= Get Network Configuration ${network_active_channel}
+
+ Set Static IPv4 Address To VMI And Verify ${vmi_ip} ${bmc_ip_data[0]['Gateway']}
+ ... ${bmc_ip_data[0]['SubnetMask']} ${valid_status_code} ${interface}
+
+ [Return] ${vmi_ip} ${bmc_ip_data}