blob: f0593d901342960fb40b9ccdcb6db5de9d9a6fd4 [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 -060022Get Netmask And Verify
23 [Documentation] Get Netmask And Verify.
George Keishing5d467552019-02-08 23:30:48 -060024 [Tags] Get_Netmask_And_Verify
Prashanth Kattif58cce02019-02-06 03:05:14 -060025
26 : FOR ${network_configuration} IN @{network_configurations}
Prashanth Katti747ce9d2019-02-07 07:23:48 -060027 \ Verify Netmask On BMC ${network_configuration['SubnetMask']}
28
Prashanth Katti2ec9d8b2019-02-12 05:20:19 -060029Get Gateway And Verify
30 [Documentation] Get gateway and verify it's existence on the BMC.
31 [Tags] Get_Gateway_And_Verify
32
33 : FOR ${network_configuration} IN @{network_configurations}
34 \ Verify Gateway On BMC ${network_configuration['Gateway']}
35
36Get MAC Address And Verify
37 [Documentation] Get MAC address and verify it's existence on the BMC.
38 [Tags] Get_MAC_Address_And_Verify
39
40 ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI}
41 ${macaddr}= Get From Dictionary ${resp.dict} MACAddress
42 Validate MAC On BMC ${macaddr}
Prashanth Kattif58cce02019-02-06 03:05:14 -060043
44*** Keywords ***
45
46Test Setup Execution
47 [Documentation] Test setup execution.
48
49 redfish.Login
50
51 @{network_configurations}= Get Network Configuration
52 Set Test Variable @{network_configurations}
53
54 # Get BMC IP address and prefix length.
55 ${ip_data}= Get BMC IP Info
56 Set Test Variable ${ip_data}
57
Prashanth Katti747ce9d2019-02-07 07:23:48 -060058
Prashanth Kattif58cce02019-02-06 03:05:14 -060059Get Network Configuration
60 [Documentation] Get network configuration.
61
62 # Sample output:
63 #{
64 # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface",
65 # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0",
66 # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface",
67 # "Description": "Management Network Interface",
68 # "IPv4Addresses": [
69 # {
70 # "Address": "169.254.xx.xx",
71 # "AddressOrigin": "IPv4LinkLocal",
72 # "Gateway": "0.0.0.0",
73 # "SubnetMask": "255.255.0.0"
74 # },
75 # {
76 # "Address": "xx.xx.xx.xx",
77 # "AddressOrigin": "Static",
78 # "Gateway": "xx.xx.xx.1",
79 # "SubnetMask": "xx.xx.xx.xx"
80 # }
81 # ],
82 # "Id": "eth0",
83 # "MACAddress": "xx:xx:xx:xx:xx:xx",
84 # "Name": "Manager Ethernet Interface",
85 # "SpeedMbps": 0,
86 # "VLAN": {
87 # "VLANEnable": false,
88 # "VLANId": 0
89 # }
90
91 ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI}
92 @{network_configurations}= Get From Dictionary ${resp.dict} IPv4Addresses
93 [Return] @{network_configurations}
94
George Keishing5d467552019-02-08 23:30:48 -060095
Prashanth Katti747ce9d2019-02-07 07:23:48 -060096Verify IP On BMC
97 [Documentation] Verify IP on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -060098 [Arguments] ${ip}
99
100 # Description of the argument(s):
101 # ip IP address to be verified.
102
103 # Get IP address details on BMC using IP command.
104 @{ip_data}= Get BMC IP Info
105 Should Contain Match ${ip_data} ${ip}/*
106 ... msg=IP address does not exist.
107
George Keishing5d467552019-02-08 23:30:48 -0600108
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600109Verify Netmask On BMC
110 [Documentation] Verify netmask on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600111 [Arguments] ${netmask}
112
113 # Description of the argument(s):
114 # netmask netmask value to be verified.
115
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600116 ${prefix_length}= Netmask Prefix Length ${netmask}
117
118 Should Contain Match ${ip_data} */${prefix_length}
119 ... msg=Prefix length does not exist.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600120
Prashanth Katti2ec9d8b2019-02-12 05:20:19 -0600121Verify Gateway On BMC
122 [Documentation] Verify gateway on BMC.
123 [Arguments] ${gateway_ip}=0.0.0.0
124
125 # Description of argument(s):
126 # gateway_ip Gateway IP address.
127
128 ${route_info}= Get BMC Route Info
129
130 # If gateway IP is empty or 0.0.0.0 it will not have route entry.
131
132 Run Keyword If '${gateway_ip}' == '0.0.0.0'
133 ... Pass Execution Gateway IP is "0.0.0.0".
134 ... ELSE
135 ... Should Contain ${route_info} ${gateway_ip}
136 ... msg=Gateway IP address not matching.
George Keishing5d467552019-02-08 23:30:48 -0600137
Prashanth Kattif58cce02019-02-06 03:05:14 -0600138Test Teardown Execution
139 [Documentation] Test teardown execution.
140
141 FFDC On Test Case Fail
142 redfish.Logout