blob: 9194739615b69a089487d5b5aab810f0c778c68f [file] [log] [blame]
Prashanth Kattif58cce02019-02-06 03:05:14 -06001*** Settings ***
2Documentation Network interface configuration and verification
3 ... tests.
4
5Resource ../../lib/bmc_redfish_resource.robot
6Resource ../../lib/bmc_network_utils.robot
7Resource ../../lib/openbmc_ffdc.robot
8
9Test Setup Test Setup Execution
10Test Teardown Test Teardown Execution
11
12*** Test Cases ***
13
14Get IP Address And Verify
15 [Documentation] Get IP Address And Verify.
16 [Tags] Get_IP_Address_And_Verify
17
18 : FOR ${network_configuration} IN @{network_configurations}
19 \ Validate IP On BMC ${network_configuration['Address']}
20
21Get Netmask And Verify
22 [Documentation] Get Netmask And Verify.
23 [Tags] Get_Netmask_And_Verify
24
25 : FOR ${network_configuration} IN @{network_configurations}
26 \ Validate Netmask On BMC ${network_configuration['SubnetMask']}
27
28*** Keywords ***
29
30Test Setup Execution
31 [Documentation] Test setup execution.
32
33 redfish.Login
34
35 @{network_configurations}= Get Network Configuration
36 Set Test Variable @{network_configurations}
37
38 # Get BMC IP address and prefix length.
39 ${ip_data}= Get BMC IP Info
40 Set Test Variable ${ip_data}
41
42Get Network Configuration
43 [Documentation] Get network configuration.
44
45 # Sample output:
46 #{
47 # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface",
48 # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0",
49 # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface",
50 # "Description": "Management Network Interface",
51 # "IPv4Addresses": [
52 # {
53 # "Address": "169.254.xx.xx",
54 # "AddressOrigin": "IPv4LinkLocal",
55 # "Gateway": "0.0.0.0",
56 # "SubnetMask": "255.255.0.0"
57 # },
58 # {
59 # "Address": "xx.xx.xx.xx",
60 # "AddressOrigin": "Static",
61 # "Gateway": "xx.xx.xx.1",
62 # "SubnetMask": "xx.xx.xx.xx"
63 # }
64 # ],
65 # "Id": "eth0",
66 # "MACAddress": "xx:xx:xx:xx:xx:xx",
67 # "Name": "Manager Ethernet Interface",
68 # "SpeedMbps": 0,
69 # "VLAN": {
70 # "VLANEnable": false,
71 # "VLANId": 0
72 # }
73
74 ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI}
75 @{network_configurations}= Get From Dictionary ${resp.dict} IPv4Addresses
76 [Return] @{network_configurations}
77
78Validate IP On BMC
79 [Documentation] Validate IP on BMC.
80 [Arguments] ${ip}
81
82 # Description of the argument(s):
83 # ip IP address to be verified.
84
85 # Get IP address details on BMC using IP command.
86 @{ip_data}= Get BMC IP Info
87 Should Contain Match ${ip_data} ${ip}/*
88 ... msg=IP address does not exist.
89
90Validate Netmask On BMC
91 [Documentation] Validate netmask on BMC.
92 [Arguments] ${netmask}
93
94 # Description of the argument(s):
95 # netmask netmask value to be verified.
96
97 # TBD- openbmc/openbmc-test-automation#1541
98
99Test Teardown Execution
100 [Documentation] Test teardown execution.
101
102 FFDC On Test Case Fail
103 redfish.Logout