IPMI: Modified Verify IPMI Inband Network Configuration testcase

Changes:
   - Modified Variables for ip, netmask and gateway.
   - Also verified changed static ip is communicable through
     external IPMI cmd.

Tested:
   - Ran ipmi/test_ipmi_network_configuration.robot

Change-Id: Ibdcf0efcd91d588a710d766dc578d25ac5eea94b
Signed-off-by: Ishwarya Mathi M <ishwaryamm@ami.com>
diff --git a/ipmi/test_ipmi_network_configuration.robot b/ipmi/test_ipmi_network_configuration.robot
index 6066103..573e5eb 100644
--- a/ipmi/test_ipmi_network_configuration.robot
+++ b/ipmi/test_ipmi_network_configuration.robot
@@ -9,6 +9,7 @@
 Library                ../lib/gen_robot_valid.py
 Library                ../lib/var_funcs.py
 Library                ../lib/bmc_network_utils.py
+Variables              ../data/ipmi_raw_cmd_table.py
 
 Suite Setup            Suite Setup Execution
 Suite Teardown         Redfish.Logout
@@ -22,11 +23,10 @@
 ${vlan_id_for_ipmi}     ${10}
 @{vlan_ids}             ${20}  ${30}
 ${interface}            eth0
-${ip}                   10.0.0.1
 ${initial_lan_config}   &{EMPTY}
 ${vlan_resource}        ${NETWORK_MANAGER}action/VLAN
-${netmask}              ${24}
-${gateway}              0.0.0.0
+${subnet_mask}          ${24}
+${gateway_ip}           0.0.0.0
 ${vlan_id_for_rest}     ${30}
 
 
@@ -35,7 +35,9 @@
 Verify IPMI Inband Network Configuration
     [Documentation]  Verify BMC network configuration via inband IPMI.
     [Tags]  Verify_IPMI_Inband_Network_Configuration
-    [Teardown]  Run Keywords  Restore Configuration  AND  FFDC On Test Case Fail
+    [Teardown]  Run Keywords  Restore Configuration  AND  set_base_url    https://${OPENBMC_HOST}:${HTTPS_PORT}
+    ...  AND  FFDC On Test Case Fail  AND
+    ...  Redfish.Login  AND  Run IPMI Command  ${IPMI_RAW_CMD['Device ID']['Get'][0]}
 
     Redfish Power On
 
@@ -47,6 +49,28 @@
     Valid Value  lan_print_output['Subnet Mask']  ["${NETMASK}"]
     Valid Value  lan_print_output['Default Gateway IP']  ["${GATEWAY}"]
 
+    # To verify changed static ip is communicable through external IPMI cmd.
+    Run External IPMI Raw Command  ${IPMI_RAW_CMD['Device ID']['Get'][0]}  H=${STATIC_IP}
+
+    set_base_url    https://${STATIC_IP}:${HTTPS_PORT}
+    Redfish.Login
+
+
+    ${ipv4_addresses}=  Redfish.Get Attribute
+    ...  ${REDFISH_NW_ETH_IFACE}${interface}  IPv4Addresses
+
+    FOR  ${ipv4_address}  IN  @{ipv4_addresses}
+        ${ip_address}=  Set Variable if  '${ipv4_address['Address']}' == '${STATIC_IP}'
+                        ...  ${ipv4_address}
+        Exit For Loop If  ${ip_address} != None
+    END
+
+    Should Be Equal  ${ip_address['AddressOrigin']}  Static
+    Should Be Equal  ${ip_address['SubnetMask']}  ${NETMASK}
+    Should Be Equal  ${ip_address['Gateway']}  ${GATEWAY}
+
+    Redfish.Logout
+
 
 Disable VLAN Via IPMI When Multiple VLAN Exist On BMC
     [Documentation]  Disable  VLAN Via IPMI When Multiple VLAN Exist On BMC.
@@ -69,11 +93,11 @@
     Create VLAN Via IPMI  ${vlan_id_for_ipmi}
 
     Run Inband IPMI Standard Command
-    ...  lan set ${CHANNEL_NUMBER} ipaddr ${ip}  login_host=${0}
+    ...  lan set ${CHANNEL_NUMBER} ipaddr ${STATIC_IP}  login_host=${0}
 
     ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
     Valid Value  lan_config['802.1q VLAN ID']  ['${vlan_id_for_ipmi}']
-    Valid Value  lan_config['IP Address']  ["${ip}"]
+    Valid Value  lan_config['IP Address']  ["${STATIC_IP}"]
 
 
 Create VLAN Via IPMI When LAN And VLAN Exist On BMC
@@ -113,14 +137,14 @@
    [Documentation]  Create VLAN when LAN and VLAN exist with IP address configured.
    [Tags]  Create_VLAN_When_LAN_And_VLAN_Exist_With_IP_Address_Configured
    [Setup]  Run Keywords  Create VLAN  ${vlan_id_for_rest}  interface=${interface}
-   ...  AND  Configure Network Settings On VLAN  ${vlan_id_for_rest}  ${ip}
+   ...  AND  Configure Network Settings On VLAN  ${vlan_id_for_rest}  ${STATIC_IP}
    ...  ${netmask}  ${gateway}  interface=${interface}
 
    Create VLAN Via IPMI   ${vlan_id_for_ipmi}
 
    ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
    Valid Value  lan_config['802.1q VLAN ID']  ['${vlan_id_for_ipmi}']
-   Valid Value  lan_config['IP Address']  ['${ip}']
+   Valid Value  lan_config['IP Address']  ['${STATIC_IP}']
 
 
 Create Multiple VLANs Via IPMI And Verify