blob: 1cc2e20abea69cd45acef1a1c3517875eadf917b [file] [log] [blame]
Gunaseelaned0eb1b2017-08-08 08:12:12 -05001# Copyright 2017-present Radisys Corporation
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
Gunaseelaned0eb1b2017-08-08 08:12:12 -050016*** Settings ***
Kailash Khalasi2f567a42017-09-27 13:50:05 -070017Documentation Test suite for checking default maas,xos and onos containers and fabric switch default services and maas cli commands
18Library OperatingSystem
19Library ../cord-api/Framework/utils/onosUtils.py
You Wange9206102017-11-17 12:15:11 -080020Library ../cord-api/Framework/utils/utils.py
Kailash Khalasi2f567a42017-09-27 13:50:05 -070021Resource ../cord-api/Framework/utils/utils.robot
Gunaseelaned0eb1b2017-08-08 08:12:12 -050022
23*** Variables ***
Kailash Khalasi2f567a42017-09-27 13:50:05 -070024@{MAAS_SERVICE_STATUS} start/running is running
25@{JUJU_SERVICE_STATUS} active is ready unknown
26@{LXD_CONTAINER_STATUS} RUNNING
27@{BOOT_RESOURCES_OUTPUT} ubuntu/trusty
28${FABRIC_SWITCH_PROMPT} \#
29${FABRIC_SWITCH_USER} root
30${FABRIC_SWITCH_PASSWD} onl
31@{FABRIC_SERVICE_STATUS} is running
32${IP_PATTERN} (\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)
You Wange9206102017-11-17 12:15:11 -080033${PUBLIC_IFACE} eth2
34${NUM_OF_SWITCHES} 4
35${CORD_PROFILE} rcord
36${DOCKER_CONTAINERS_FILE} ${CURDIR}/../diag/dockerContainers.json
Gunaseelaned0eb1b2017-08-08 08:12:12 -050037
38*** Test Cases ***
Kailash Khalasi2f567a42017-09-27 13:50:05 -070039Verify Headnode Interfaces
You Wange9206102017-11-17 12:15:11 -080040 [Tags] fabric
Kailash Khalasi2f567a42017-09-27 13:50:05 -070041 [Documentation] Verifies the headnode interface is up and has external connectivity
42 Verify HeadNode Interfaces Detected
You Wange9206102017-11-17 12:15:11 -080043 Test Ping ${PUBLIC_IFACE} www.opennetworking.org
Gunaseelaned0eb1b2017-08-08 08:12:12 -050044
Kailash Khalasi2f567a42017-09-27 13:50:05 -070045Get Compute Node and Fabric Info
46 [Documentation] Get all information pretaining to the compute nodes and fabric
47 ${nodes}= Create List
48 ${hostnames}= Create List
49 ${hostname_prefixes}= Create List
50 ${node_ips}= Create List
51 ${node_data_ips}= Create List
52 ${node_count} Run cord prov list | grep node | wc -l
53 ${node_count}= Convert To Integer ${node_count}
54 Log ${node_count}
55 ##Get hostname
56 : FOR ${INDEX} IN RANGE 1 ${node_count}+1
57 \ ${hostname}= Run cord prov list | grep node | awk '{print $2}' | sed -n ${INDEX}p
58 \ Append To List ${hostnames} ${hostname}
59 ##Get hostname prefixes
60 : FOR ${INDEX} IN RANGE 0 ${node_count}
61 \ ${hostname_prefix}= Remove String ${hostnames[${INDEX}]} .cord.lab
62 \ Append To List ${hostname_prefixes} ${hostname_prefix}
63 ##Get compute node data ips
64 ${cordvtnnodes}= ONOS Command Execute onos-cord 8102 cordvtn-nodes | grep fabric
65 ${nds}= Split To Lines ${cordvtnnodes}
66 : FOR ${i} IN @{nds}
67 \ ${data_ip}= Get Compute Node IP ${i}
68 \ Append To List ${node_data_ips} ${data_ip}
69 ##Get compute node ips
70 : FOR ${i} IN @{hostname_prefixes}
71 \ ${node_ip}= Run cord harvest list | grep ${i} | awk '{print $4}'
72 \ Append To List ${node_ips} ${node_ip}
73 @{switch_ips}= Discover FABRIC IPs
74 Set Suite Variable ${switch_ips}
75 Set Suite Variable ${hostnames}
76 Set Suite Variable ${hostname_prefixes}
77 Set Suite Variable ${node_ips}
78 Set Suite Variable ${node_data_ips}
79
You Wange9206102017-11-17 12:15:11 -080080Verify Compute Nodes Pingability Through Fabric
81 [Documentation] Verifies that the two compute nodes can ping each other through the fabric
Kailash Khalasi2f567a42017-09-27 13:50:05 -070082 [Tags] fabric
83 ##Verify pingablilty across compute nodes
You Wange9206102017-11-17 12:15:11 -080084 : FOR ${src} IN @{hostname_prefixes}
85 \ Ping All Compute Nodes Through Fabric ${src}
Kailash Khalasi2f567a42017-09-27 13:50:05 -070086
87Verify Compute Nodes to Fabric Pingability
88 [Documentation] Verifies that the two compute nodes can ping the switches
89 [Tags] fabric
90 ##Verify pingability from compute nodes to fabric
You Wange9206102017-11-17 12:15:11 -080091 : FOR ${src} IN @{hostname_prefixes}
92 \ Ping All Fabric Switches ${src}
Kailash Khalasi2f567a42017-09-27 13:50:05 -070093
94Verify CordVTN Nodes
95 [Documentation] Verifies that the cordvtn app running in onos identifies the nodes and devices (fabric)
96 ${nodes}= Execute ONOS Command onos-cord 8102 cordvtn-nodes
97 : FOR ${i} IN @{node_ips}
98 \ ${node_1}= Get Lines Containing String ${nodes} ${i}
99 \ Should Contain ${node_1} COMPLETE
100 \ Should Contain ${node_1} ${i}
101 ${ports}= Execute ONOS Command onos-cord 8102 cordvtn-ports
102 ${devices}= Execute ONOS Command onos-fabric 8101 devices
103 @{switch_ips}= Discover FABRIC IPs
104 : FOR ${i} IN @{switch_ips}
105 \ Should Contain ${devices} ${i}
106
107Verify MAAS Service State
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500108 [Template] Verify MAAS Service
109 maas-dhcpd
110 maas-regiond
111 maas-clusterd
112 maas-proxy
113 bind9
114
You Wange9206102017-11-17 12:15:11 -0800115Verify Docker Containers State
116 ${dockerContainers} utils.jsonToList ${DOCKER_CONTAINERS_FILE} docker-containers-${CORD_PROFILE}
117 : FOR ${container} IN @{dockerContainers}
118 \ Verify Containers ${container}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500119
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700120Verify Juju Services State
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500121 [Template] Verify JUJU Service
122 ceilometer
123 ceilometer-agent
124 glance
125 keystone
126 mongodb
127 nagios
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700128 neutron-api
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500129 nova-cloud-controller
130 nova-compute
131 openstack-dashboard
132 percona-cluster
133 rabbitmq-server
134
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700135Verify Openstack LXD Containers State
136 [Template] Verify Openstack LXD Containers
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500137 ceilometer
138 glance
139 keystone
140 mongodb
141 nagios
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700142 neutron-api
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500143 nova-cloud-controller
144 openstack-dashboard
145 percona-cluster
146 rabbitmq-server
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500147
148Verify MAAS CLI commands
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700149 [Tags] notready
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500150 Login MAAS Server
151 Verify MAAS CLI Commands boot-resources read | jq 'map(select(.type == "Synced"))' ubuntu/trusty
You Wange9206102017-11-17 12:15:11 -0800152 Verify MAAS CLI Commands devices list | jq '.' | jq '.[]'.hostname | wc -l ${NUM_OF_SWITCHES}
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700153 #Verify MAAS CLI Commands events query | jq '.' | jq .events[].id | wc -l 100
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500154 Verify MAAS CLI Commands fabrics read | jq '.' | jq .[].name | wc -l 4
155 Verify MAAS CLI Commands networks read | jq '.' | jq .[].name | wc -l 4
156 Verify MAAS CLI Commands node-groups list | jq '.' | jq .[].status | wc -l 1
157 Verify MAAS CLI Commands subnets read | jq '.' | jq .[].name | wc -l 4
158 Verify MAAS CLI Commands nodes list | jq '.' | jq .[].substatus_name | wc -l 1
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700159 Verify MAAS CLI Commands zones read | jq '.' | jq .[].name | wc -l 2
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500160 Logout MAAS Server
161
162Verify Fabric Switch Service
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700163 [Tags] fabric
164 @{switch_ips}= Discover FABRIC IPs
165 : FOR ${i} IN @{switch_ips}
166 \ Verify Fabric Switch Service ${i} faultd
167 \ Verify Fabric Switch Service ${i} netplug
168 \ Verify Fabric Switch Service ${i} onlp-snmpd
169 \ Verify Fabric Switch Service ${i} onlpd
170 \ Verify Fabric Switch Service ${i} rsyslog
171 \ Verify Fabric Switch Service ${i} snmpd
172 \ Verify Fabric Switch Service ${i} ssh
173 \ Verify Fabric Switch Service ${i} udev
174 \ Verify Fabric Switch Service ${i} watchdog
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500175
176*** Keywords ***
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700177Verify HeadNode Interfaces Detected
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500178 ${cmd}= Catenate SEPARATOR=| sudo ethtool mgmtbr grep 'Link detected:' awk '{ print $3 }'
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700179 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500180 Should Contain ${output} yes msg= mgmtbr is not detected !!!. Reason:
181 ${cmd}= Catenate SEPARATOR=| sudo ethtool fabric grep 'Link detected:' awk '{ print $3 }'
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700182 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500183 Should Contain ${output} yes msg= fabric interface is not detected !!!. Reason:
184
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700185Verify Containers
186 [Arguments] ${name}
187 ${container_id}= Get Docker Container ID ${name}
188 ${output}= Run docker inspect --format="{{ .State.Running }}" ${container_id}
189 Should Contain ${output} true msg=${name} is not running !!!. Reason:
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500190
191Verify MAAS Service
192 [Arguments] ${name}
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700193 ${cmd}= Catenate sudo service ${name} status
194 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500195 Should Contain Any ${output} @{MAAS_SERVICE_STATUS} msg= ${name} is not running !!!. Reason:
196
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500197Verify JUJU Service
198 [Arguments] ${name}
199 ${cmd} Catenate SEPARATOR=| juju status --format=tabular grep -v grep grep ${name}/0 awk '{ print $2,$7,$8,$9,$10}'
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700200 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500201 Should Contain Any ${output} @{JUJU_SERVICE_STATUS} msg= ${name} is not running !!!. Reason:
202
203Verify Openstack LXD Containers
204 [Arguments] ${name}
205 ${cmd} Catenate SEPARATOR=| sudo lxc list grep -v grep grep ${name}-1 awk '{ print $2,$4 }'
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700206 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500207 Should Contain Any ${output} @{LXD_CONTAINER_STATUS} msg= ${name} is not running !!!. Reason:
208
209Verify MAAS CLI Commands
210 [Arguments] ${name} ${expected}
211 ${cmd} Catenate maas cord ${name}
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700212 ${output}= Run ${cmd}
213 Should Contain ${output} ${expected} msg=Reason:
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500214
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700215Login MAAS Server
216 ${cmd} Catenate maas login cord http://localhost/MAAS/api/1.0 $(sudo maas-region-admin apikey --user=cord)
217 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500218 Should Contain ${output} You are now logged in to the MAAS msg= MAAS login failure !!!. Reason:
219
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700220Logout MAAS Server
221 ${cmd} Catenate maas logout cord
222 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500223
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700224Discover FABRIC IPs
225 ${switches}= Run cord prov list | grep fabric | awk '{print $4}'
226 @{switch_ips}= Split To Lines ${switches}
227 [Return] ${switch_ips}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500228
229Verify Fabric Switch Service
230 [Arguments] ${ip} ${name}
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700231 ${cmd}= Catenate service ${name} status
232 ${output}= Run Command On Remote System ${ip} ${cmd} ${FABRIC_SWITCH_USER} ${FABRIC_SWITCH_PASSWD} ${FABRIC_SWITCH_PROMPT} 60s False
You Wange9206102017-11-17 12:15:11 -0800233 Should Contain Any ${output} @{FABRIC_SERVICE_STATUS} msg= ${name} is not running !!!. Reason:
234
235Ping All Compute Nodes Through Fabric
236 [Arguments] ${src_ip}
237 : FOR ${dst_ip} IN @{node_data_ips}
238 \ Verify Ping ubuntu ${src_ip} ${dst_ip}
239
240Ping All Fabric Switches
241 [Arguments] ${src_ip}
242 : FOR ${dst_ip} IN @{switch_ips}
243 \ Verify Ping ubuntu ${src_ip} ${dst_ip}
244
245Verify Ping
246 [Arguments] ${srcName} ${srcIP} ${dst}
247 ${result}= Run ssh ${srcName}@${srcIP} "ping -c 3 ${dst}"
248 Should Contain ${result} 64 bytes
249 Should Not Contain ${result} Destination Host Unreachable