blob: 433a53a72621afb708bb9e01985ae05fe5bf445d [file] [log] [blame]
*** 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
Library ../../lib/bmc_network_utils.py
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}
\ Verify 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}
\ Verify 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}
Verify IP On BMC
[Documentation] Verify 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.
Verify Netmask On BMC
[Documentation] Verify netmask on BMC.
[Arguments] ${netmask}
# Description of the argument(s):
# netmask netmask value to be verified.
${prefix_length}= Netmask Prefix Length ${netmask}
Should Contain Match ${ip_data} */${prefix_length}
... msg=Prefix length does not exist.
Test Teardown Execution
[Documentation] Test teardown execution.
FFDC On Test Case Fail
redfish.Logout