Change in Default Gateway
Changes:
- Fetch Default Gateway for eth0 and eth1
Tested:
Ran "Modify IPv4 Address And Verify on eth0 and eth1"
Change-Id: I203953b04d515cb1a3eaf270fdd87c00a14d800a
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/lib/bmc_network_utils.robot b/lib/bmc_network_utils.robot
index a0405b2..f3632f7 100644
--- a/lib/bmc_network_utils.robot
+++ b/lib/bmc_network_utils.robot
@@ -643,10 +643,21 @@
${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]}
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
+ # Extract the corresponding default gateway for eth0 and eth1
+ ${default_gw_line}= Get Lines Containing String ${lines} ${ethernet_interface}
+ ${default_gw}= Split String ${default_gw_line}
+
+ # Example of the output
+ # default_gw:
+ # [0]: default
+ # [1]: via
+ # [2]: xx.xx.xx.1
+ # [3]: dev
+ # [4]: eth1
[Return] ${default_gw[2]}