Modify MAC and Verify BMC Reinitializing Linklocal
Changes:
Modify MAC and Verify BMC Reinitializing Linklocal
Tested:
Ran and Tested on BMC Environment.
Change-Id: Ic65a2fe6c67d04a9b6026071c8ad19fd3679a717
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/lib/bmc_network_utils.robot b/lib/bmc_network_utils.robot
index 8cfb367..3188c4f 100644
--- a/lib/bmc_network_utils.robot
+++ b/lib/bmc_network_utils.robot
@@ -934,3 +934,60 @@
# Check if newly added DNS server is configured on BMC.
CLI Get and Verify Name Servers ${static_name_servers} ${valid_status_codes}
+
+Configure MAC Settings
+ [Documentation] Configure MAC settings via Redfish.
+ [Arguments] ${mac_address} ${valid_status_code}=${HTTP_OK}
+
+ # Description of argument(s):
+ # mac_address MAC address of BMC.
+ # valid_status_code Expected response code, default is ${HTTP_OK}.
+
+ ${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_ETH_IFACE}${ethernet_interface} body=&{payload}
+ ... valid_status_codes=[${valid_status_code},${HTTP_NO_CONTENT},${HTTP_INTERNAL_SERVER_ERROR}]
+
+ # After any modification on network interface, BMC restarts network
+ # Note: Network restart takes around 15-18s after patch request processing.
+ Sleep ${NETWORK_TIMEOUT}s
+
+ 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.
+ ${status}= Run Keyword And Return Status
+ ... Validate MAC On BMC ${mac_address}
+
+ IF ${valid_status_code} == ${HTTP_BAD_REQUEST}
+ Should Be Equal ${status} ${False}
+ ... msg=Allowing the configuration of an invalid MAC.
+ ELSE
+ Should Be Equal ${status} ${True}
+ ... msg=Not allowing the configuration of a valid MAC.
+ END
+
+ Verify MAC Address Via FW_Env ${mac_address} ${valid_status_code}
+
+Verify MAC Address Via FW_Env
+ [Documentation] Verify MAC address on FW_Env.
+ [Arguments] ${mac_address} ${valid_status_code}=${HTTP_OK}
+
+ # Description of argument(s):
+ # mac_address MAC address of BMC.
+ # valid_status_code Expected response code, default is ${HTTP_OK}.
+
+ ${status}= Run Keyword And Return Status
+ ... Validate MAC On FW_Env ${mac_address}
+
+ IF ${valid_status_code} == ${HTTP_BAD_REQUEST}
+ Should Be Equal ${status} ${False}
+ ... msg=Allowing the configuration of an invalid MAC.
+ ELSE
+ Should Be Equal ${status} ${True}
+ ... msg=Not allowing the configuration of a valid MAC.
+ END
diff --git a/redfish/managers/test_bmc_ipv6.robot b/redfish/managers/test_bmc_ipv6.robot
index e508544..73d50a7 100644
--- a/redfish/managers/test_bmc_ipv6.robot
+++ b/redfish/managers/test_bmc_ipv6.robot
@@ -6,6 +6,7 @@
Resource ../../lib/openbmc_ffdc.robot
Resource ../../lib/bmc_ipv6_utils.robot
Resource ../../lib/external_intf/vmi_utils.robot
+Resource ../../lib/bmc_network_utils.robot
Library ../../lib/bmc_network_utils.py
Library Collections
Library Process
@@ -29,6 +30,7 @@
${prefix_length_def} None
${invalid_staticv6_gateway} 9.41.164.1
${linklocal_addr_format} fe80::[0-9a-f:]+$
+${new_mac_addr} AA:E2:84:14:28:79
*** Test Cases ***
@@ -275,6 +277,25 @@
... msg=IPv6 Linklocal address has changed after reboot.
+Modify MAC and Verify BMC Reinitializing Linklocal
+ [Documentation] Modify MAC and verify BMC reinitializing linklocal.
+ [Tags] Modify_MAC_and_Verify_BMC_Reinitializing_Linklocal
+ [Teardown] Configure MAC Settings ${original_address}
+
+ ${original_address}= Get BMC MAC Address
+ @{ipv6_addressorigin_list} ${ipv6_before_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
+
+ # Modify MAC Address Of Ethernet Interface.
+ Configure MAC Settings ${new_mac_addr}
+ Sleep 30s
+ Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
+ @{ipv6_addressorigin_list} ${ipv6_linklocal_after_addr}= Get Address Origin List And Address For Type LinkLocal
+
+ # Verify whether the linklocal has changed and is in the the correct format.
+ Check If Linklocal Address Is In Correct Format
+ Should Not Be Equal ${ipv6_before_linklocal_addr} ${ipv6_linklocal_after_addr}
+
+
*** Keywords ***
Suite Setup Execution
diff --git a/redfish/managers/test_bmc_network_mac.robot b/redfish/managers/test_bmc_network_mac.robot
index 0a075ea..0dc24f2 100644
--- a/redfish/managers/test_bmc_network_mac.robot
+++ b/redfish/managers/test_bmc_network_mac.robot
@@ -157,61 +157,3 @@
Validate MAC On BMC ${initial_mac_address}
Redfish.Logout
-
-
-Configure MAC Settings
- [Documentation] Configure MAC settings via Redfish.
- [Arguments] ${mac_address} ${valid_status_code}=${HTTP_OK}
-
- # Description of argument(s):
- # mac_address MAC address of BMC.
- # valid_status_code Expected response code, default is ${HTTP_OK}.
-
- ${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_ETH_IFACE}${ethernet_interface} body=&{payload}
- ... valid_status_codes=[${valid_status_code},${HTTP_NO_CONTENT},${HTTP_INTERNAL_SERVER_ERROR}]
-
- # After any modification on network interface, BMC restarts network
- # Note: Network restart takes around 15-18s after patch request processing.
- Sleep ${NETWORK_TIMEOUT}s
-
- 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.
- ${status}= Run Keyword And Return Status
- ... Validate MAC On BMC ${mac_address}
-
- IF ${valid_status_code} == ${HTTP_BAD_REQUEST}
- Should Be Equal ${status} ${False}
- ... msg=Allowing the configuration of an invalid MAC.
- ELSE
- Should Be Equal ${status} ${True}
- ... msg=Not allowing the configuration of a valid MAC.
- END
-
- Verify MAC Address Via FW_Env ${mac_address} ${valid_status_code}
-
-Verify MAC Address Via FW_Env
- [Documentation] Verify MAC address on FW_Env.
- [Arguments] ${mac_address} ${valid_status_code}=${HTTP_OK}
-
- # Description of argument(s):
- # mac_address MAC address of BMC.
- # valid_status_code Expected response code, default is ${HTTP_OK}.
-
- ${status}= Run Keyword And Return Status
- ... Validate MAC On FW_Env ${mac_address}
-
- IF ${valid_status_code} == ${HTTP_BAD_REQUEST}
- Should Be Equal ${status} ${False}
- ... msg=Allowing the configuration of an invalid MAC.
- ELSE
- Should Be Equal ${status} ${True}
- ... msg=Not allowing the configuration of a valid MAC.
- END