blob: 433a53a72621afb708bb9e01985ae05fe5bf445d [file] [log] [blame]
Prashanth Kattif58cce02019-02-06 03:05:14 -06001*** Settings ***
2Documentation Network interface configuration and verification
3 ... tests.
4
George Keishing5d467552019-02-08 23:30:48 -06005Resource ../../lib/bmc_redfish_resource.robot
6Resource ../../lib/bmc_network_utils.robot
7Resource ../../lib/openbmc_ffdc.robot
Prashanth Katti747ce9d2019-02-07 07:23:48 -06008Library ../../lib/bmc_network_utils.py
Prashanth Kattif58cce02019-02-06 03:05:14 -06009
10Test Setup Test Setup Execution
11Test Teardown Test Teardown Execution
12
13*** Test Cases ***
14
15Get IP Address And Verify
16 [Documentation] Get IP Address And Verify.
George Keishing5d467552019-02-08 23:30:48 -060017 [Tags] Get_IP_Address_And_Verify
Prashanth Kattif58cce02019-02-06 03:05:14 -060018
19 : FOR ${network_configuration} IN @{network_configurations}
Prashanth Katti747ce9d2019-02-07 07:23:48 -060020 \ Verify IP On BMC ${network_configuration['Address']}
21
Prashanth Kattif58cce02019-02-06 03:05:14 -060022
23Get Netmask And Verify
24 [Documentation] Get Netmask And Verify.
George Keishing5d467552019-02-08 23:30:48 -060025 [Tags] Get_Netmask_And_Verify
Prashanth Kattif58cce02019-02-06 03:05:14 -060026
27 : FOR ${network_configuration} IN @{network_configurations}
Prashanth Katti747ce9d2019-02-07 07:23:48 -060028 \ Verify Netmask On BMC ${network_configuration['SubnetMask']}
29
Prashanth Kattif58cce02019-02-06 03:05:14 -060030
31*** Keywords ***
32
33Test Setup Execution
34 [Documentation] Test setup execution.
35
36 redfish.Login
37
38 @{network_configurations}= Get Network Configuration
39 Set Test Variable @{network_configurations}
40
41 # Get BMC IP address and prefix length.
42 ${ip_data}= Get BMC IP Info
43 Set Test Variable ${ip_data}
44
Prashanth Katti747ce9d2019-02-07 07:23:48 -060045
Prashanth Kattif58cce02019-02-06 03:05:14 -060046Get Network Configuration
47 [Documentation] Get network configuration.
48
49 # Sample output:
50 #{
51 # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface",
52 # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0",
53 # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface",
54 # "Description": "Management Network Interface",
55 # "IPv4Addresses": [
56 # {
57 # "Address": "169.254.xx.xx",
58 # "AddressOrigin": "IPv4LinkLocal",
59 # "Gateway": "0.0.0.0",
60 # "SubnetMask": "255.255.0.0"
61 # },
62 # {
63 # "Address": "xx.xx.xx.xx",
64 # "AddressOrigin": "Static",
65 # "Gateway": "xx.xx.xx.1",
66 # "SubnetMask": "xx.xx.xx.xx"
67 # }
68 # ],
69 # "Id": "eth0",
70 # "MACAddress": "xx:xx:xx:xx:xx:xx",
71 # "Name": "Manager Ethernet Interface",
72 # "SpeedMbps": 0,
73 # "VLAN": {
74 # "VLANEnable": false,
75 # "VLANId": 0
76 # }
77
78 ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI}
79 @{network_configurations}= Get From Dictionary ${resp.dict} IPv4Addresses
80 [Return] @{network_configurations}
81
George Keishing5d467552019-02-08 23:30:48 -060082
Prashanth Katti747ce9d2019-02-07 07:23:48 -060083Verify IP On BMC
84 [Documentation] Verify IP on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -060085 [Arguments] ${ip}
86
87 # Description of the argument(s):
88 # ip IP address to be verified.
89
90 # Get IP address details on BMC using IP command.
91 @{ip_data}= Get BMC IP Info
92 Should Contain Match ${ip_data} ${ip}/*
93 ... msg=IP address does not exist.
94
George Keishing5d467552019-02-08 23:30:48 -060095
Prashanth Katti747ce9d2019-02-07 07:23:48 -060096Verify Netmask On BMC
97 [Documentation] Verify netmask on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -060098 [Arguments] ${netmask}
99
100 # Description of the argument(s):
101 # netmask netmask value to be verified.
102
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600103 ${prefix_length}= Netmask Prefix Length ${netmask}
104
105 Should Contain Match ${ip_data} */${prefix_length}
106 ... msg=Prefix length does not exist.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600107
George Keishing5d467552019-02-08 23:30:48 -0600108
Prashanth Kattif58cce02019-02-06 03:05:14 -0600109Test Teardown Execution
110 [Documentation] Test teardown execution.
111
112 FFDC On Test Case Fail
113 redfish.Logout