Modified cases in suite test_bmc_network_mac
- Let user to specify Ethernet Interface name by channel number while
running, if not, the channel number default is 1.
Change-Id: Ib67b6bcb279c8c6b05b8b7650f6ff640fa97fb27
Signed-off-by: Tony Lee <tony.lee@quantatw.com>
diff --git a/lib/bmc_network_utils.robot b/lib/bmc_network_utils.robot
index 096cd5e..0bd6403 100644
--- a/lib/bmc_network_utils.robot
+++ b/lib/bmc_network_utils.robot
@@ -20,10 +20,13 @@
# Description of argument(s):
# mac_address The mac address (e.g. 00:01:6c:80:02:28).
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
Should Not Be Empty ${mac_address}
Open Connection And Log In
${bmc_mac_addr} ${stderr} ${rc}= BMC Execute Command
- ... cat /sys/class/net/eth0/address
+ ... cat /sys/class/net/${ethernet_interface}/address
Run Keyword If '${mac_address.lower()}' != '${bmc_mac_addr.lower()}'
... Set MAC Address
@@ -35,13 +38,16 @@
# Description of argument(s):
# mac_address The mac address (e.g. 00:01:6c:80:02:28).
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
Write fw_setenv ethaddr ${mac_address}
OBMC Reboot (off)
# Take SSH session post BMC reboot.
Open Connection And Log In
${bmc_mac_addr} ${stderr} ${rc}= BMC Execute Command
- ... cat /sys/class/net/eth0/address
+ ... cat /sys/class/net/${ethernet_interface}/address
Should Be Equal ${bmc_mac_addr} ${mac_address} ignore_case=True
@@ -99,8 +105,11 @@
# Sample output of "ip addr | grep ether":
# link/ether xx.xx.xx.xx.xx.xx brd ff:ff:ff:ff:ff:ff
+ ${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 ether
+ ... /sbin/ip addr | grep ${ethernet_interface} -A 1 | grep ether
# Split the line and return MAC address.
# Split list data:
diff --git a/redfish/managers/test_bmc_network_mac.robot b/redfish/managers/test_bmc_network_mac.robot
index f89dc65..182f7ec 100644
--- a/redfish/managers/test_bmc_network_mac.robot
+++ b/redfish/managers/test_bmc_network_mac.robot
@@ -122,9 +122,11 @@
[Documentation] Do suite setup tasks.
Redfish.Login
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
# Get BMC MAC address.
- ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI}
+ ${resp}= redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']}
Validate MAC On BMC ${initial_mac_address}
@@ -140,17 +142,20 @@
# mac_address MAC address of BMC.
# expected_result Expected status of MAC configuration.
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
Redfish.Login
${payload}= Create Dictionary MACAddress=${mac_address}
- Redfish.Patch ${REDFISH_NW_ETH0_URI} body=&{payload}
+ Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{payload}
... valid_status_codes=[200, 400, 500]
# After any modification on network interface, BMC restarts network
# module, wait until it is reachable.
Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
- ... redfish.Get ${REDFISH_NW_ETH0_URI}
+ ... redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
# Verify whether new MAC address is populated on BMC system.
# It should not allow to configure invalid settings.