blob: 246ef223cd33b40064bc05b94aa7d293bae03346 [file] [log] [blame]
Prashanth Kattie79c5402017-06-08 07:40:49 -05001*** Settings ***
2Documentation Network interface and functionalities test module.
3
4Resource ../lib/rest_client.robot
5Resource ../lib/utils.robot
6Resource ../lib/bmc_network_utils.robot
7
8Force Tags Network_Test
9
10Library String
11Library SSHLibrary
12
13Test Setup Test Init Setup
14
15*** Test Cases ***
16
17Get BMC IPv4 Address And Verify
18 [Documentation] Get BMC IPv4 address and verify.
19 [Tags] Get_BMC_IPv4_Address_And_Verify
20
21 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
22 \ ${ipv4_addr}= Read Attribute ${ipv4_uri} Address
23 \ Validate IP on BMC ${ipv4_addr}
24
25Verify IPv4 Prefix Length
26 [Documentation] Get prefix length and verify.
27 [Tags] Verify_IPv4_Prefix_Length
28
29 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
30 \ ${prefix_length}= Read Attribute ${ipv4_uri} PrefixLength
31 \ Validate Prefix Length On BMC ${prefix_length}
32
33Verify Gateway Address
34 [Documentation] Get gateway address and verify.
35 [Tags] Verify_Gateway_Address
36
37 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
38 \ ${gw_ip}= Read Attribute ${ipv4_uri} Gateway
39 \ Validate Route On BMC ${gw_ip}
40
41Verify MAC Address
42 [Documentation] Get MAC address and verify.
43 [Tags] Verify_MAC_Address
44 ${macaddr}= Read Attribute ${XYZ_NETWORK_MANAGER}/eth0 MACAddress
45 Validate MAC On BMC ${macaddr}
46
47*** Keywords ***
48
49Test Init Setup
50 [Documentation] Network setup.
51 Open Connection And Login
52
53 @{IPv4_URI_List}= Get IPv4 URI List
54 Set Test Variable @{IPv4_URI_List}
55
56 # Get BMC IP address and prefix length.
57 ${ip_data}= Get BMC IP Info
58 Set Test Variable ${ip_data}
59
60Get IPv4 URI List
61 [Documentation] Get all IPv4 URIs.
62
63 # Sample output:
64 # "data": [
65 # "/xyz/openbmc_project/network/eth0/ipv4/e9767624",
66 # "/xyz/openbmc_project/network/eth0/ipv4/31f4ce8b"
67 # ],
68
69 @{ipv4_uri_list}= Read Properties ${XYZ_NETWORK_MANAGER}/eth0/ipv4/
70 Should Not Be Empty ${ipv4_uri_list} msg=IPv4 URI list is empty.
71
72 [Return] @{ipv4_uri_list}
73
74Validate IP on BMC
75 [Documentation] Validate IP on BMC.
76 [Arguments] ${ip_address}
77
78 # Description of the argument(s):
79 # ip_address IP address of the system.
80 # ip_data Suite variable which has list of IP address
81 # and prefix length values.
82
83 Should Contain Match ${ip_data} ${ip_address}*
84 ... msg=IP address does not exist.
85
86Validate Prefix Length On BMC
87 [Documentation] Validate prefix length on BMC.
88 [Arguments] ${prefix_length}
89
90 # Description of the argument(s):
91 # prefix_length It indicates netmask, netmask value 255.255.255.0
92 # is equal to prefix length 24.
93 # ip_data Suite variable which has list of IP address and
94 # prefix length values.
95
96 Should Contain Match ${ip_data} */${prefix_length}
97 ... msg=Prefix length does not exist.
98
99Validate Route On BMC
100 [Documentation] Validate route.
101 [Arguments] ${gw_ip}
102
103 # Description of the argument(s):
104 # gw_ip Gateway IP address.
105
106 ${route_info}= Get BMC Route Info
107 Should Contain ${route_info} ${gw_ip}
108 ... msg=Gateway IP address not matching.
109
110Validate MAC on BMC
111 [Documentation] Validate MAC on BMC.
112 [Arguments] ${macaddr}
113
114 # Description of the argument(s):
115 # macaddr MAC address of the BMC.
116
117 ${system_mac}= Get BMC MAC Address
118
119 Should Contain ${system_mac} ${macaddr}
120 ... ignore_case=True msg=MAC address does not exist.