Modified cases in suite test_bmc_network_conf
- Let user to specify Ethernet Interface name by channel number while
running, if not, the channel number default is 1.
- Fixed typo from ${multicaste_ip} to ${multicast_ip}.
Change-Id: Ic626aa1c7b32c36289ff28a01b4a785f5e5500fc
Signed-off-by: Tony Lee <tony.lee@quantatw.com>
diff --git a/lib/bmc_network_utils.robot b/lib/bmc_network_utils.robot
index 15d80ce..096cd5e 100644
--- a/lib/bmc_network_utils.robot
+++ b/lib/bmc_network_utils.robot
@@ -55,8 +55,10 @@
# link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
# inet xx.xx.xx.xx/24 brd xx.xx.xx.xx scope global eth0
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
${cmd_output} ${stderr} ${rc}= BMC Execute Command
- ... /sbin/ip addr | grep eth0
+ ... /sbin/ip addr | grep ${ethernet_interface}
# Get line having IP address details.
${lines}= Get Lines Containing String ${cmd_output} inet
@@ -353,8 +355,11 @@
# "VLANEnable": false,
# "VLANId": 0
# }
+
+
${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['${CHANNEL_NUMBER}']['name']}
+
@{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses
[Return] @{network_configurations}
@@ -389,7 +394,10 @@
Append To List ${patch_list} ${ip_data}
${data}= Create Dictionary IPv4StaticAddresses=${patch_list}
- Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data}
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
+ Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
... valid_status_codes=[${valid_status_codes}]
Return From Keyword If '${valid_status_codes}' != '${HTTP_OK}'
@@ -429,7 +437,10 @@
# Run patch command only if given IP is found on BMC
${data}= Create Dictionary IPv4StaticAddresses=${patch_list}
- Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data}
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
+ Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
... valid_status_codes=[${valid_status_codes}]
# Note: Network restart takes around 15-18s after patch request processing
diff --git a/redfish/managers/test_bmc_network_conf.robot b/redfish/managers/test_bmc_network_conf.robot
index 3ee5d16..3d82259 100644
--- a/redfish/managers/test_bmc_network_conf.robot
+++ b/redfish/managers/test_bmc_network_conf.robot
@@ -80,7 +80,10 @@
[Documentation] Get MAC address and verify it's existence on the BMC.
[Tags] Get_MAC_Address_And_Verify
- ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI}
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
+ ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
${macaddr}= Get From Dictionary ${resp.dict} MACAddress
Validate MAC On BMC ${macaddr}
@@ -432,7 +435,7 @@
[Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
# ip subnet_mask gateway valid_status_codes
- ${test_ipv4_addr} ${test_subnet_mask} ${multicaste_ip} ${HTTP_BAD_REQUEST}
+ ${test_ipv4_addr} ${test_subnet_mask} ${multicast_ip} ${HTTP_BAD_REQUEST}
Configure Broadcast IP For Gateway
[Documentation] Configure broadcast IP for gateway and expect an error.
@@ -559,7 +562,10 @@
[Documentation] Verify that nameservers obtained via Redfish do not
... match those found in /etc/resolv.conf.
- ${redfish_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} StaticNameServers
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
+ ${redfish_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers
${resolve_conf_nameservers}= CLI Get Nameservers
Rqprint Vars redfish_nameservers resolve_conf_nameservers
@@ -578,8 +584,11 @@
# static_name_servers A list of static name server IPs to be
# configured on the BMC.
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
# Currently BMC is sending 500 response code instead of 400 for invalid scenarios.
- Redfish.Patch ${REDFISH_NW_ETH0_URI} body={'StaticNameServers': ${static_name_servers}}
+ Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body={'StaticNameServers': ${static_name_servers}}
... valid_status_codes=[${valid_status_codes}, ${HTTP_INTERNAL_SERVER_ERROR}]
# Patch operation takes 1 to 3 seconds to set new value.
@@ -608,7 +617,11 @@
Redfish.Login
- ${original_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} StaticNameServers
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
+ ${original_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers
+
Rprint Vars original_nameservers
# Set suite variables to trigger restoration during teardown.
Set Suite Variable ${original_nameservers}