Fix for default gateway issue
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
Change-Id: I15d2110b4acd087d37ba616f32c852febdadc2b6
diff --git a/lib/bmc_network_utils.robot b/lib/bmc_network_utils.robot
index 3c5592e..b4c6c79 100644
--- a/lib/bmc_network_utils.robot
+++ b/lib/bmc_network_utils.robot
@@ -522,3 +522,16 @@
... Should Be Equal ${status} ${True}
... msg=Configuration of valid IP Failed.
+
+Get BMC Default Gateway
+ [Documentation] Get system default gateway.
+
+ ${route_info}= Get BMC Route Info
+
+ ${lines}= Get Lines Containing String ${route_info} default via
+ @{gateway_list}= Split To Lines ${lines}
+
+ # Extract first default gateway and return.
+ @{default_gw}= Split String ${gateway_list[0]}
+
+ [Return] ${default_gw[2]}
diff --git a/redfish/managers/test_bmc_network_conf.robot b/redfish/managers/test_bmc_network_conf.robot
index f396a61..fa98581 100644
--- a/redfish/managers/test_bmc_network_conf.robot
+++ b/redfish/managers/test_bmc_network_conf.robot
@@ -10,6 +10,7 @@
Test Setup Test Setup Execution
Test Teardown Test Teardown Execution
+Suite Setup Suite Setup Execution
Force Tags Network_Conf_Test
@@ -18,7 +19,6 @@
${test_ipv4_addr} 10.7.7.7
${test_ipv4_invalid_addr} 0.0.1.a
${test_subnet_mask} 255.255.0.0
-${test_gateway} 10.7.7.1
${broadcast_ip} 10.7.7.255
${loopback_ip} 127.0.0.2
${multicast_ip} 224.6.6.6
@@ -600,3 +600,9 @@
Rprint Vars original_nameservers
# Set suite variables to trigger restoration during teardown.
Set Suite Variable ${original_nameservers}
+
+Suite Setup Execution
+ [Documentation] Do suite setup execution.
+
+ ${test_gateway}= Get BMC Default Gateway
+ Set Suite Variable ${test_gateway}