Disable DHCP On Eth1 And Verify DHCP IP Erased
Changes:
- Added test case.
- Adding Channel Number.
Tested:
Tested on BMC Environment.
Change-Id: Id07d43fadda1fb5b2014a96e20330fd39e4315bf
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/lib/bmc_network_utils.robot b/lib/bmc_network_utils.robot
index 334386e..698809c 100644
--- a/lib/bmc_network_utils.robot
+++ b/lib/bmc_network_utils.robot
@@ -816,7 +816,11 @@
Get IPv4 DHCP Enabled Status
[Documentation] Return IPv4 DHCP enabled status from redfish URI.
+ [Arguments] ${channel_number}=${1}
+ # Description of argument(s):
+ # channel_number Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1").
+
${active_channel_config}= Get Active Channel Config
${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
${resp}= Redfish.Get Attribute ${REDFISH_NW_ETH_IFACE}${ethernet_interface} DHCPv4
diff --git a/redfish/managers/test_bmc_network_conf.robot b/redfish/managers/test_bmc_network_conf.robot
index 3acd08e..a5301d5 100644
--- a/redfish/managers/test_bmc_network_conf.robot
+++ b/redfish/managers/test_bmc_network_conf.robot
@@ -791,7 +791,7 @@
# - And set the same as static IP address
Redfish.Login
- ${DHCPEnabled}= Get IPv4 DHCP Enabled Status
+ ${DHCPEnabled}= Get IPv4 DHCP Enabled Status ${1}
Set Suite Variable ${DHCPEnabled}
Run Keyword If ${DHCPEnabled}==True
diff --git a/redfish/managers/test_multiple_interfaces_dhcp.robot b/redfish/managers/test_multiple_interfaces_dhcp.robot
index 2ac1ca7..8f818cd 100644
--- a/redfish/managers/test_multiple_interfaces_dhcp.robot
+++ b/redfish/managers/test_multiple_interfaces_dhcp.robot
@@ -44,7 +44,7 @@
[Teardown] Set DHCPEnabled To Enable Or Disable True eth1
Set DHCPEnabled To Enable Or Disable False eth1
- ${DHCPEnabled}= Get IPv4 DHCP Enabled Status
+ ${DHCPEnabled}= Get IPv4 DHCP Enabled Status ${2}
Should Be Equal ${DHCPEnabled} ${False}
Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
@@ -55,7 +55,7 @@
[Setup] Set DHCPEnabled To Enable Or Disable False eth1
Set DHCPEnabled To Enable Or Disable True eth1
- ${DHCPEnabled}= Get IPv4 DHCP Enabled Status
+ ${DHCPEnabled}= Get IPv4 DHCP Enabled Status ${2}
Should Be Equal ${DHCPEnabled} ${True}
Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
@@ -87,7 +87,7 @@
Set DHCPEnabled To Enable Or Disable True eth1
# Check the value of DHCPEnabled on eth0 is not impacted.
- ${DHCPEnabled}= Get IPv4 DHCP Enabled Status
+ ${DHCPEnabled}= Get IPv4 DHCP Enabled Status ${1}
Should Be Equal ${DHCPEnabled} ${False}
# Getting eth0 details after enabling DHCP.
@@ -119,6 +119,20 @@
Should Be Equal ${gateway_before} ${gateway_after}
Should Be Equal ${subnetmask_before} ${subnetmask_after}
+Disable DHCP On Eth1 And Verify DHCP IP Erased
+ [Documentation] Disable DHCP on Eth1 and verify DHCP IP erased.
+ [Tags] Disable_DHCP_On_Eth1_And_Verify_DHCP_IP_Erased
+ [Teardown] Set DHCPEnabled To Enable Or Disable True eth1
+
+ Set DHCPEnabled To Enable Or Disable False eth1
+ ${DHCPEnabled}= Get IPv4 DHCP Enabled Status ${2}
+ Should Be Equal ${DHCPEnabled} ${False}
+
+ ${dhcp_ip_list}= Get Network Configuration Using Channel Number ${2}
+
+ Should Be Empty ${dhcp_ip_list}
+ ... msg=From switching from DHCP to Static DHCP IP is not erased.
+
*** Keywords ***
Set DHCPEnabled To Enable Or Disable
@@ -182,8 +196,8 @@
Restore Configuration
[Documentation] Restore the configuration to Both Static Network
- Run Keyword If '${CHANNEL_NUMBER}' == '1' Add IP Address ${OPENBMC_HOST} ${eth0_subnet_mask} ${eth0_gateway}
- ... ELSE IF '${CHANNEL_NUMBER}' == '2' Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway}
+ Run Keyword If '${CHANNEL_NUMBER}' == '${1}' Add IP Address ${OPENBMC_HOST} ${eth0_subnet_mask} ${eth0_gateway}
+ ... ELSE IF '${CHANNEL_NUMBER}' == '{2}' Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway}
Get Network Configuration Using Channel Number
[Documentation] Get ethernet interface.