blob: 359b1fd98f5d4b61dd7c99169f3dfb7211258166 [file] [log] [blame]
Gunaseelaned0eb1b2017-08-08 08:12:12 -05001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# Copyright 2017-present Radisys Corporation
16#
17# Licensed under the Apache License, Version 2.0 (the "License");
18# you may not use this file except in compliance with the License.
19# You may obtain a copy of the License at
20#
21# http://www.apache.org/licenses/LICENSE-2.0
22#
23# Unless required by applicable law or agreed to in writing, software
24# distributed under the License is distributed on an "AS IS" BASIS,
25# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26# See the License for the specific language governing permissions and
27# limitations under the License.
28
29
Gunaseelaned0eb1b2017-08-08 08:12:12 -050030*** Settings ***
Kailash Khalasi8c34e852017-09-27 13:50:05 -070031Documentation Test suite for checking default maas,xos and onos containers and fabric switch default services and maas cli commands
32Library OperatingSystem
33Library ../cord-api/Framework/utils/onosUtils.py
34Resource ../cord-api/Framework/utils/utils.robot
Gunaseelaned0eb1b2017-08-08 08:12:12 -050035
36*** Variables ***
Kailash Khalasi8c34e852017-09-27 13:50:05 -070037@{MAAS_SERVICE_STATUS} start/running is running
38@{JUJU_SERVICE_STATUS} active is ready unknown
39@{LXD_CONTAINER_STATUS} RUNNING
40@{BOOT_RESOURCES_OUTPUT} ubuntu/trusty
41${FABRIC_SWITCH_PROMPT} \#
42${FABRIC_SWITCH_USER} root
43${FABRIC_SWITCH_PASSWD} onl
44@{FABRIC_SERVICE_STATUS} is running
45${IP_PATTERN} (\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)
46${public_iface} eth2
47${num_nodes} 2
48${num_of_switches} 4
Gunaseelaned0eb1b2017-08-08 08:12:12 -050049
50*** Test Cases ***
Kailash Khalasi8c34e852017-09-27 13:50:05 -070051Verify Headnode Interfaces
52 [Documentation] Verifies the headnode interface is up and has external connectivity
53 Verify HeadNode Interfaces Detected
54 Test Ping ${public_iface} www.opennetworking.org
Gunaseelaned0eb1b2017-08-08 08:12:12 -050055
Kailash Khalasi8c34e852017-09-27 13:50:05 -070056Get Compute Node and Fabric Info
57 [Documentation] Get all information pretaining to the compute nodes and fabric
58 ${nodes}= Create List
59 ${hostnames}= Create List
60 ${hostname_prefixes}= Create List
61 ${node_ips}= Create List
62 ${node_data_ips}= Create List
63 ${node_count} Run cord prov list | grep node | wc -l
64 ${node_count}= Convert To Integer ${node_count}
65 Log ${node_count}
66 ##Get hostname
67 : FOR ${INDEX} IN RANGE 1 ${node_count}+1
68 \ ${hostname}= Run cord prov list | grep node | awk '{print $2}' | sed -n ${INDEX}p
69 \ Append To List ${hostnames} ${hostname}
70 ##Get hostname prefixes
71 : FOR ${INDEX} IN RANGE 0 ${node_count}
72 \ ${hostname_prefix}= Remove String ${hostnames[${INDEX}]} .cord.lab
73 \ Append To List ${hostname_prefixes} ${hostname_prefix}
74 ##Get compute node data ips
75 ${cordvtnnodes}= ONOS Command Execute onos-cord 8102 cordvtn-nodes | grep fabric
76 ${nds}= Split To Lines ${cordvtnnodes}
77 : FOR ${i} IN @{nds}
78 \ ${data_ip}= Get Compute Node IP ${i}
79 \ Append To List ${node_data_ips} ${data_ip}
80 ##Get compute node ips
81 : FOR ${i} IN @{hostname_prefixes}
82 \ ${node_ip}= Run cord harvest list | grep ${i} | awk '{print $4}'
83 \ Append To List ${node_ips} ${node_ip}
84 @{switch_ips}= Discover FABRIC IPs
85 Set Suite Variable ${switch_ips}
86 Set Suite Variable ${hostnames}
87 Set Suite Variable ${hostname_prefixes}
88 Set Suite Variable ${node_ips}
89 Set Suite Variable ${node_data_ips}
90
91Verify Compute Nodes Pingability
92 [Documentation] Verifies that the two compute nodes can ping each other
93 [Tags] fabric
94 ##Verify pingablilty across compute nodes
95 : FOR ${i} IN @{node_data_ips}
96 \ ${result}= Run ssh -A ubuntu@${i} "ping -c 3 ${node_data_ips[0]}"
97 \ Should Contain ${result} 64 bytes
98 \ Should Not Contain ${result} Destination Host Unreachable
99 \ ${result}= Run ssh -A ubuntu@${i} "ping -c 3 ${node_data_ips[1]}"
100 \ Should Contain ${result} 64 bytes
101 \ Should Not Contain ${result} Destination Host Unreachable
102
103Verify Compute Nodes to Fabric Pingability
104 [Documentation] Verifies that the two compute nodes can ping the switches
105 [Tags] fabric
106 ##Verify pingability from compute nodes to fabric
107 ${switch_len}= Get Length ${switch_ips}
108 : FOR ${INDEX} IN RANGE 0 ${switch_len}
109 \ ${result}= Run ssh -A ubuntu@${node_data_ips[0]} "ping -c 3 ${switch_ips[${INDEX}]}"
110 \ Should Contain ${result} 64 bytes
111 \ Should Not Contain ${result} Destination Host Unreachable
112 \ ${result}= Run ssh -A ubuntu@${node_data_ips[1]} "ping -c 3 ${switch_ips[${INDEX}]}"
113 \ Should Contain ${result} 64 bytes
114 \ Should Not Contain ${result} Destination Host Unreachable
115
116Verify CordVTN Nodes
117 [Documentation] Verifies that the cordvtn app running in onos identifies the nodes and devices (fabric)
118 ${nodes}= Execute ONOS Command onos-cord 8102 cordvtn-nodes
119 : FOR ${i} IN @{node_ips}
120 \ ${node_1}= Get Lines Containing String ${nodes} ${i}
121 \ Should Contain ${node_1} COMPLETE
122 \ Should Contain ${node_1} ${i}
123 ${ports}= Execute ONOS Command onos-cord 8102 cordvtn-ports
124 ${devices}= Execute ONOS Command onos-fabric 8101 devices
125 @{switch_ips}= Discover FABRIC IPs
126 : FOR ${i} IN @{switch_ips}
127 \ Should Contain ${devices} ${i}
128
129Verify MAAS Service State
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500130 [Template] Verify MAAS Service
131 maas-dhcpd
132 maas-regiond
133 maas-clusterd
134 maas-proxy
135 bind9
136
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700137Verify MAAS Containers State
138 [Template] Verify Containers
139 maas-automation
140 maas-switchq
141 maas-provisioner
142 maas-allocator
143 maas-harvester
144 maas-generator
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500145
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700146Verify XOS Containers State
147 [Template] Verify Containers
148 xos-gui
149 xos-ws
150 chameleon
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500151 xos-ui
152 onos-synchronizer
153 vrouter-synchronizer
154 exampleservice-synchronizer
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700155 vsg-synchronizer
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500156 vtn-synchronizer
157 vtr-synchronizer
158 fabric-synchronizer
159 openstack-synchronizer
160 xos-postgres
161
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700162Verify ONOS Containers State
163 [Template] Verify Containers
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500164 onosproject/onos
165 xos/onos
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700166
167Verify Other Containers State
168 [Template] Verify Containers
169 redis
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500170 mavenrepo
171 registry-mirror
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500172
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700173Verify Juju Services State
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500174 [Template] Verify JUJU Service
175 ceilometer
176 ceilometer-agent
177 glance
178 keystone
179 mongodb
180 nagios
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700181 neutron-api
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500182 nova-cloud-controller
183 nova-compute
184 openstack-dashboard
185 percona-cluster
186 rabbitmq-server
187
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700188Verify Openstack LXD Containers State
189 [Template] Verify Openstack LXD Containers
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500190 ceilometer
191 glance
192 keystone
193 mongodb
194 nagios
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700195 neutron-api
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500196 nova-cloud-controller
197 openstack-dashboard
198 percona-cluster
199 rabbitmq-server
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500200
201Verify MAAS CLI commands
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700202 [Tags] notready
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500203 Login MAAS Server
204 Verify MAAS CLI Commands boot-resources read | jq 'map(select(.type == "Synced"))' ubuntu/trusty
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700205 Verify MAAS CLI Commands devices list | jq '.' | jq '.[]'.hostname | wc -l ${num_of_switches}
206 #Verify MAAS CLI Commands events query | jq '.' | jq .events[].id | wc -l 100
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500207 Verify MAAS CLI Commands fabrics read | jq '.' | jq .[].name | wc -l 4
208 Verify MAAS CLI Commands networks read | jq '.' | jq .[].name | wc -l 4
209 Verify MAAS CLI Commands node-groups list | jq '.' | jq .[].status | wc -l 1
210 Verify MAAS CLI Commands subnets read | jq '.' | jq .[].name | wc -l 4
211 Verify MAAS CLI Commands nodes list | jq '.' | jq .[].substatus_name | wc -l 1
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700212 Verify MAAS CLI Commands zones read | jq '.' | jq .[].name | wc -l 2
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500213 Logout MAAS Server
214
215Verify Fabric Switch Service
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700216 [Tags] fabric
217 @{switch_ips}= Discover FABRIC IPs
218 : FOR ${i} IN @{switch_ips}
219 \ Verify Fabric Switch Service ${i} faultd
220 \ Verify Fabric Switch Service ${i} netplug
221 \ Verify Fabric Switch Service ${i} onlp-snmpd
222 \ Verify Fabric Switch Service ${i} onlpd
223 \ Verify Fabric Switch Service ${i} rsyslog
224 \ Verify Fabric Switch Service ${i} snmpd
225 \ Verify Fabric Switch Service ${i} ssh
226 \ Verify Fabric Switch Service ${i} udev
227 \ Verify Fabric Switch Service ${i} watchdog
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500228
229*** Keywords ***
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700230Verify HeadNode Interfaces Detected
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500231 ${cmd}= Catenate SEPARATOR=| sudo ethtool mgmtbr grep 'Link detected:' awk '{ print $3 }'
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700232 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500233 Should Contain ${output} yes msg= mgmtbr is not detected !!!. Reason:
234 ${cmd}= Catenate SEPARATOR=| sudo ethtool fabric grep 'Link detected:' awk '{ print $3 }'
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700235 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500236 Should Contain ${output} yes msg= fabric interface is not detected !!!. Reason:
237
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700238Verify Containers
239 [Arguments] ${name}
240 ${container_id}= Get Docker Container ID ${name}
241 ${output}= Run docker inspect --format="{{ .State.Running }}" ${container_id}
242 Should Contain ${output} true msg=${name} is not running !!!. Reason:
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500243
244Verify MAAS Service
245 [Arguments] ${name}
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700246 ${cmd}= Catenate sudo service ${name} status
247 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500248 Should Contain Any ${output} @{MAAS_SERVICE_STATUS} msg= ${name} is not running !!!. Reason:
249
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500250Verify JUJU Service
251 [Arguments] ${name}
252 ${cmd} Catenate SEPARATOR=| juju status --format=tabular grep -v grep grep ${name}/0 awk '{ print $2,$7,$8,$9,$10}'
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700253 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500254 Should Contain Any ${output} @{JUJU_SERVICE_STATUS} msg= ${name} is not running !!!. Reason:
255
256Verify Openstack LXD Containers
257 [Arguments] ${name}
258 ${cmd} Catenate SEPARATOR=| sudo lxc list grep -v grep grep ${name}-1 awk '{ print $2,$4 }'
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700259 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500260 Should Contain Any ${output} @{LXD_CONTAINER_STATUS} msg= ${name} is not running !!!. Reason:
261
262Verify MAAS CLI Commands
263 [Arguments] ${name} ${expected}
264 ${cmd} Catenate maas cord ${name}
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700265 ${output}= Run ${cmd}
266 Should Contain ${output} ${expected} msg=Reason:
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500267
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700268Login MAAS Server
269 ${cmd} Catenate maas login cord http://localhost/MAAS/api/1.0 $(sudo maas-region-admin apikey --user=cord)
270 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500271 Should Contain ${output} You are now logged in to the MAAS msg= MAAS login failure !!!. Reason:
272
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700273Logout MAAS Server
274 ${cmd} Catenate maas logout cord
275 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500276
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700277Discover FABRIC IPs
278 ${switches}= Run cord prov list | grep fabric | awk '{print $4}'
279 @{switch_ips}= Split To Lines ${switches}
280 [Return] ${switch_ips}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500281
282Verify Fabric Switch Service
283 [Arguments] ${ip} ${name}
Kailash Khalasi8c34e852017-09-27 13:50:05 -0700284 ${cmd}= Catenate service ${name} status
285 ${output}= Run Command On Remote System ${ip} ${cmd} ${FABRIC_SWITCH_USER} ${FABRIC_SWITCH_PASSWD} ${FABRIC_SWITCH_PROMPT} 60s False
286 Should Contain Any ${output} @{FABRIC_SERVICE_STATUS} msg= ${name} is not running !!!. Reason: