Network base test suite for verifying configuration
Changes:
- New test suite.
Added Test Cases:
- Get IP Address And Verify
- Get Netmask And Verify
Tested: On latest Master build.
Change-Id: Ib14db42328a9443fa21414393a693be57c788460
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
diff --git a/data/variables.py b/data/variables.py
index 9f0d6de..642dc13 100755
--- a/data/variables.py
+++ b/data/variables.py
@@ -143,6 +143,8 @@
REDFISH_BASE_URI = '/redfish/v1/'
REDFISH_SESSION = REDFISH_BASE_URI + 'SessionService/Sessions'
REDFISH_SESSION_URI = 'SessionService/Sessions/'
+REDFISH_NW_ETH0 = 'Managers/bmc/EthernetInterfaces/eth0/'
+REDFISH_NW_ETH0_URI = REDFISH_BASE_URI + REDFISH_NW_ETH0
# Boot options and URI variables.
POWER_ON = 'On'
diff --git a/redfish/managers/test_bmc_network_conf.robot b/redfish/managers/test_bmc_network_conf.robot
new file mode 100644
index 0000000..9194739
--- /dev/null
+++ b/redfish/managers/test_bmc_network_conf.robot
@@ -0,0 +1,103 @@
+*** Settings ***
+Documentation Network interface configuration and verification
+ ... tests.
+
+Resource ../../lib/bmc_redfish_resource.robot
+Resource ../../lib/bmc_network_utils.robot
+Resource ../../lib/openbmc_ffdc.robot
+
+Test Setup Test Setup Execution
+Test Teardown Test Teardown Execution
+
+*** Test Cases ***
+
+Get IP Address And Verify
+ [Documentation] Get IP Address And Verify.
+ [Tags] Get_IP_Address_And_Verify
+
+ : FOR ${network_configuration} IN @{network_configurations}
+ \ Validate IP On BMC ${network_configuration['Address']}
+
+Get Netmask And Verify
+ [Documentation] Get Netmask And Verify.
+ [Tags] Get_Netmask_And_Verify
+
+ : FOR ${network_configuration} IN @{network_configurations}
+ \ Validate Netmask On BMC ${network_configuration['SubnetMask']}
+
+*** Keywords ***
+
+Test Setup Execution
+ [Documentation] Test setup execution.
+
+ redfish.Login
+
+ @{network_configurations}= Get Network Configuration
+ Set Test Variable @{network_configurations}
+
+ # Get BMC IP address and prefix length.
+ ${ip_data}= Get BMC IP Info
+ Set Test Variable ${ip_data}
+
+Get Network Configuration
+ [Documentation] Get network configuration.
+
+ # Sample output:
+ #{
+ # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface",
+ # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0",
+ # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface",
+ # "Description": "Management Network Interface",
+ # "IPv4Addresses": [
+ # {
+ # "Address": "169.254.xx.xx",
+ # "AddressOrigin": "IPv4LinkLocal",
+ # "Gateway": "0.0.0.0",
+ # "SubnetMask": "255.255.0.0"
+ # },
+ # {
+ # "Address": "xx.xx.xx.xx",
+ # "AddressOrigin": "Static",
+ # "Gateway": "xx.xx.xx.1",
+ # "SubnetMask": "xx.xx.xx.xx"
+ # }
+ # ],
+ # "Id": "eth0",
+ # "MACAddress": "xx:xx:xx:xx:xx:xx",
+ # "Name": "Manager Ethernet Interface",
+ # "SpeedMbps": 0,
+ # "VLAN": {
+ # "VLANEnable": false,
+ # "VLANId": 0
+ # }
+
+ ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI}
+ @{network_configurations}= Get From Dictionary ${resp.dict} IPv4Addresses
+ [Return] @{network_configurations}
+
+Validate IP On BMC
+ [Documentation] Validate IP on BMC.
+ [Arguments] ${ip}
+
+ # Description of the argument(s):
+ # ip IP address to be verified.
+
+ # Get IP address details on BMC using IP command.
+ @{ip_data}= Get BMC IP Info
+ Should Contain Match ${ip_data} ${ip}/*
+ ... msg=IP address does not exist.
+
+Validate Netmask On BMC
+ [Documentation] Validate netmask on BMC.
+ [Arguments] ${netmask}
+
+ # Description of the argument(s):
+ # netmask netmask value to be verified.
+
+ # TBD- openbmc/openbmc-test-automation#1541
+
+Test Teardown Execution
+ [Documentation] Test teardown execution.
+
+ FFDC On Test Case Fail
+ redfish.Logout