IPMI in-band network configuration test.
Verify IP address, default gateway,
MAC address, mode with IPMI LAN print.
Resolves openbmc/openbmc-test-automation#937
Change-Id: Iec611a1c24ef924ae6564902894273fd668abc43
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index 3b29b5d..081d4b9 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -1453,9 +1453,22 @@
... ${time['universal_time_seconds']} - ${time['rtc_time_seconds']}
Should Be True ${time_diff} < ${time_diff_max}
+
Watchdog Object Should Exist
[Documentation] Check that watchdog object exists.
${resp}= OpenBMC Get Request ${WATCHDOG_URI}host0
Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
... msg=Expected watchdog object does not exist.
+
+
+Validate IP On BMC
+ [Documentation] Validate IP address is present in set of IP addresses.
+ [Arguments] ${ip_address} ${ip_data}
+
+ # Description of argument(s):
+ # ip_address IP address to check (e.g. xx.xx.xx.xx).
+ # ip_data Set of the IP addresses present.
+
+ Should Contain Match ${ip_data} ${ip_address}/*
+ ... msg=${ip_address} not found in the list provided.
diff --git a/tests/ipmi/test_general_ipmi.robot b/tests/ipmi/test_general_ipmi.robot
index 5a344b8..3872400 100644
--- a/tests/ipmi/test_general_ipmi.robot
+++ b/tests/ipmi/test_general_ipmi.robot
@@ -5,7 +5,9 @@
Resource ../../lib/openbmc_ffdc.robot
Resource ../lib/boot_utils.robot
Library ../../lib/ipmi_utils.py
+Resource ../../lib/bmc_network_utils.robot
+Suite Setup Suite Setup Execution
Test Teardown FFDC On Test Case Fail
*** Variables ***
@@ -53,6 +55,7 @@
... AssetTag
Should Be Equal As Strings ${asset_tag} ${random_string}
+
Verify Get And Set Management Controller ID String
[Documentation] Verify get and set management controller ID string.
[Tags] Verify_Get_And_Set_Management_Controller_ID_String
@@ -81,6 +84,7 @@
# Get the management controller ID and verify.
Get Management Controller ID String And Verify ${initial_mc_id}
+
Verify Chassis Identify via IPMI
[Documentation] Verify "chassis identify" using IPMI command.
[Tags] Verify_Chassis_Identify_via_IPMI
@@ -99,6 +103,7 @@
Sleep 10s
Verify Identify LED State Off
+
Verify Chassis Identify Off And Force Identify On via IPMI
[Documentation] Verify "chassis identify" off
... and "force identify on" via IPMI.
@@ -112,6 +117,7 @@
Run IPMI Standard Command chassis identify 0
Verify Identify LED State Off
+
Test Watchdog Reset Via IPMI And Verify Using REST
[Documentation] Test watchdog reset via IPMI and verify using REST.
[Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
@@ -133,6 +139,7 @@
... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
... msg=Watchdog timer didn't reset.
+
Test Watchdog Off Via IPMI And Verify Using REST
[Documentation] Test watchdog off via IPMI and verify using REST.
[Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
@@ -325,8 +332,64 @@
... msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}.
+Retrieve Default Gateway Via IPMI And Verify Using REST
+ [Documentation] Retrieve default gateway from LAN print using IPMI.
+ [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST
+
+ # Fetch "Default Gateway" from IPMI LAN print.
+ ${default_gateway_ipmi}= Fetch Details From LAN Print Default Gateway IP
+
+ # Verify "Default Gateway" using REST.
+ Read Attribute ${NETWORK_MANAGER}/config DefaultGateway
+ ... expected_value=${default_gateway_ipmi}
+
+
+Retrieve MAC Address Via IPMI And Verify Using REST
+ [Documentation] Retrieve MAC Address from LAN print using IPMI.
+ [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST
+
+ # Fetch "MAC Address" from IPMI LAN print.
+ ${mac_address_ipmi}= Fetch Details From LAN Print MAC Address
+
+ # Verify "MAC Address" using REST.
+ ${mac_address_rest}= Get BMC MAC Address
+ Should Be Equal ${mac_address_ipmi} ${mac_address_rest}
+ ... msg=Verification of MAC address from lan print using IPMI failed.
+
+
+Retrieve Network Mode Via IPMI And Verify Using REST
+ [Documentation] Retrieve network mode from LAN print using IPMI.
+ [Tags] Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST
+
+ # Fetch "Mode" from IPMI LAN print.
+ ${network_mode_ipmi}= Fetch Details From LAN Print Source
+
+ # Verify "Mode" using REST.
+ ${network_mode_rest}= Read Attribute
+ ... ${NETWORK_MANAGER}/eth0 DHCPEnabled
+ Run Keyword If '${network_mode_ipmi}' == 'Static Address'
+ ... Should Be Equal ${network_mode_rest} ${0}
+ ... msg=Verification of network setting failed.
+ ... ELSE IF '${network_mode_ipmi}' == 'DHCP'
+ ... Should Be Equal ${network_mode_rest} ${1}
+ ... msg=Verification of network setting failed.
+
+
+Retrieve IP Address Via IPMI And Verify With BMC Details
+ [Documentation] Retrieve IP address from LAN print using IPMI.
+ [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details
+
+ # Fetch "IP Address" from IPMI LAN print.
+ ${ip_addr_ipmi}= Fetch Details From LAN Print IP Address
+
+ # Verify the IP address retrieved via IPMI with BMC IPs.
+ ${ip_address_rest}= Get BMC IP Info
+ Validate IP On BMC ${ip_addr_ipmi} ${ip_address_rest}
+
+
*** Keywords ***
+
Set Management Controller ID String
[Documentation] Set the management controller ID string.
[Arguments] ${string}
@@ -337,6 +400,7 @@
${set_mc_id_string}= Run IPMI Standard Command
... dcmi set_mc_id_string ${string}
+
Get Management Controller ID String And Verify
[Documentation] Get the management controller ID sting.
[Arguments] ${string}
@@ -348,6 +412,7 @@
Should Contain ${get_mc_id} ${string}
... msg=Command failed: get_mc_id.
+
Verify Identify LED State
[Documentation] Verify the identify LED state
... matches caller's expectations.
@@ -364,6 +429,7 @@
Should Be Equal ${resp} xyz.openbmc_project.Led.Physical.Action.${expected_state}
... msg=Unexpected LED state.
+
Set Watchdog Enabled Using REST
[Documentation] Set watchdog Enabled field using REST.
[Arguments] ${value}
@@ -374,3 +440,63 @@
${value_dict}= Create Dictionary data=${value}
${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
... data=${value_dict}
+
+
+Log LAN Print Details
+ [Documentation] Log IPMI LAN print details and return them as a string.
+
+ # Example:
+
+ # Set in Progress : Set Complete
+ # Auth Type Support : MD5
+ # Auth Type Enable : Callback : MD5
+ # : User : MD5
+ # : Operator : MD5
+ # : Admin : MD5
+ # : OEM : MD5
+ # IP Address Source : Static Address
+ # IP Address : xx.xx.xx.xx
+ # Subnet Mask : yy.yy.yy.yy
+ # MAC Address : xx.xx.xx.xx.xx.xx
+ # Default Gateway IP : xx.xx.xx.xx
+ # 802.1q VLAN ID : Disabled Cipher Suite
+ # Priv Max : Not Available
+ # Bad Password Threshold : Not Available
+
+ Login To OS Host
+ Check If IPMI Tool Exist
+
+ ${cmd_buf}= Catenate ${IPMI_INBAND_CMD} lan print
+
+ ${stdout} ${stderr} ${rc}= OS Execute Command ${cmd_buf}
+ Log ${stdout}
+ [Return] ${stdout}
+
+
+Fetch Details From LAN Print
+ [Documentation] Fetch details from LAN print.
+ [Arguments] ${field_name}
+
+ # Description of argument(s):
+ # ${field_name} Field name to be fetched from LAN print
+ # (e.g. "MAC Address", "Source").
+
+ ${stdout}= Log LAN Print Details
+ ${fetch_value}= Get Lines Containing String ${stdout} ${field_name}
+ ${value_fetch}= Fetch From Right ${fetch_value} :${SPACE}
+ [Return] ${value_fetch}
+
+
+Suite Setup Execution
+ [Documentation] Do the suite setup execution tasks.
+
+ Should Not Be Empty
+ ... ${OS_HOST} msg=You must provide DNS name/IP of the OS host.
+ Should Not Be Empty
+ ... ${OS_USERNAME} msg=You must provide OS host user name.
+ Should Not Be Empty
+ ... ${OS_PASSWORD} msg=You must provide OS host user password.
+
+ # Boot To OS
+ REST Power On quiet=${1}
+