blob: 85536e7fb05775d92c7305d018a22766d092d15d [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
You Wang046fa862017-11-21 13:13:26 -080036${FABRIC} on
You Wange9206102017-11-17 12:15:11 -080037${DOCKER_CONTAINERS_FILE} ${CURDIR}/../diag/dockerContainers.json
Gunaseelaned0eb1b2017-08-08 08:12:12 -050038
39*** Test Cases ***
Kailash Khalasi2f567a42017-09-27 13:50:05 -070040Verify Headnode Interfaces
You Wangbe30ffe2017-12-14 16:16:50 -080041 [Tags] fabric notready
Kailash Khalasi2f567a42017-09-27 13:50:05 -070042 [Documentation] Verifies the headnode interface is up and has external connectivity
43 Verify HeadNode Interfaces Detected
You Wange9206102017-11-17 12:15:11 -080044 Test Ping ${PUBLIC_IFACE} www.opennetworking.org
Gunaseelaned0eb1b2017-08-08 08:12:12 -050045
Kailash Khalasi2f567a42017-09-27 13:50:05 -070046Get Compute Node and Fabric Info
47 [Documentation] Get all information pretaining to the compute nodes and fabric
48 ${nodes}= Create List
49 ${hostnames}= Create List
50 ${hostname_prefixes}= Create List
51 ${node_ips}= Create List
52 ${node_data_ips}= Create List
53 ${node_count} Run cord prov list | grep node | wc -l
54 ${node_count}= Convert To Integer ${node_count}
55 Log ${node_count}
56 ##Get hostname
57 : FOR ${INDEX} IN RANGE 1 ${node_count}+1
58 \ ${hostname}= Run cord prov list | grep node | awk '{print $2}' | sed -n ${INDEX}p
59 \ Append To List ${hostnames} ${hostname}
60 ##Get hostname prefixes
61 : FOR ${INDEX} IN RANGE 0 ${node_count}
62 \ ${hostname_prefix}= Remove String ${hostnames[${INDEX}]} .cord.lab
63 \ Append To List ${hostname_prefixes} ${hostname_prefix}
64 ##Get compute node data ips
65 ${cordvtnnodes}= ONOS Command Execute onos-cord 8102 cordvtn-nodes | grep fabric
66 ${nds}= Split To Lines ${cordvtnnodes}
67 : FOR ${i} IN @{nds}
68 \ ${data_ip}= Get Compute Node IP ${i}
69 \ Append To List ${node_data_ips} ${data_ip}
70 ##Get compute node ips
71 : FOR ${i} IN @{hostname_prefixes}
72 \ ${node_ip}= Run cord harvest list | grep ${i} | awk '{print $4}'
73 \ Append To List ${node_ips} ${node_ip}
74 @{switch_ips}= Discover FABRIC IPs
75 Set Suite Variable ${switch_ips}
76 Set Suite Variable ${hostnames}
77 Set Suite Variable ${hostname_prefixes}
78 Set Suite Variable ${node_ips}
79 Set Suite Variable ${node_data_ips}
80
You Wange9206102017-11-17 12:15:11 -080081Verify Compute Nodes Pingability Through Fabric
82 [Documentation] Verifies that the two compute nodes can ping each other through the fabric
Kailash Khalasi2f567a42017-09-27 13:50:05 -070083 [Tags] fabric
84 ##Verify pingablilty across compute nodes
You Wange9206102017-11-17 12:15:11 -080085 : FOR ${src} IN @{hostname_prefixes}
86 \ Ping All Compute Nodes Through Fabric ${src}
Kailash Khalasi2f567a42017-09-27 13:50:05 -070087
88Verify Compute Nodes to Fabric Pingability
89 [Documentation] Verifies that the two compute nodes can ping the switches
90 [Tags] fabric
91 ##Verify pingability from compute nodes to fabric
You Wange9206102017-11-17 12:15:11 -080092 : FOR ${src} IN @{hostname_prefixes}
93 \ Ping All Fabric Switches ${src}
Kailash Khalasi2f567a42017-09-27 13:50:05 -070094
95Verify CordVTN Nodes
96 [Documentation] Verifies that the cordvtn app running in onos identifies the nodes and devices (fabric)
97 ${nodes}= Execute ONOS Command onos-cord 8102 cordvtn-nodes
98 : FOR ${i} IN @{node_ips}
99 \ ${node_1}= Get Lines Containing String ${nodes} ${i}
You Wang046fa862017-11-21 13:13:26 -0800100 \ Run Keyword If "${FABRIC}" == "on" Verify CordVTN Node ${node_1} COMPLETE ${i}
101 \ Run Keyword If "${FABRIC}" == "off" Verify CordVTN Node ${node_1} DEVICE_CREATED ${i}
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700102 ${ports}= Execute ONOS Command onos-cord 8102 cordvtn-ports
103 ${devices}= Execute ONOS Command onos-fabric 8101 devices
104 @{switch_ips}= Discover FABRIC IPs
105 : FOR ${i} IN @{switch_ips}
106 \ Should Contain ${devices} ${i}
107
108Verify MAAS Service State
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500109 [Template] Verify MAAS Service
110 maas-dhcpd
111 maas-regiond
112 maas-clusterd
113 maas-proxy
114 bind9
115
You Wange9206102017-11-17 12:15:11 -0800116Verify Docker Containers State
117 ${dockerContainers} utils.jsonToList ${DOCKER_CONTAINERS_FILE} docker-containers-${CORD_PROFILE}
118 : FOR ${container} IN @{dockerContainers}
Kailash Khalasi055904b2018-02-20 09:48:21 -0800119 \ Run Keyword And Continue On Failure Verify Containers ${container}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500120
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700121Verify Juju Services State
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500122 [Template] Verify JUJU Service
123 ceilometer
124 ceilometer-agent
125 glance
126 keystone
127 mongodb
128 nagios
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700129 neutron-api
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500130 nova-cloud-controller
131 nova-compute
132 openstack-dashboard
133 percona-cluster
134 rabbitmq-server
135
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700136Verify Openstack LXD Containers State
137 [Template] Verify Openstack LXD Containers
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500138 ceilometer
139 glance
140 keystone
141 mongodb
142 nagios
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700143 neutron-api
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500144 nova-cloud-controller
145 openstack-dashboard
146 percona-cluster
147 rabbitmq-server
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500148
149Verify MAAS CLI commands
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700150 [Tags] notready
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500151 Login MAAS Server
152 Verify MAAS CLI Commands boot-resources read | jq 'map(select(.type == "Synced"))' ubuntu/trusty
You Wange9206102017-11-17 12:15:11 -0800153 Verify MAAS CLI Commands devices list | jq '.' | jq '.[]'.hostname | wc -l ${NUM_OF_SWITCHES}
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700154 #Verify MAAS CLI Commands events query | jq '.' | jq .events[].id | wc -l 100
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500155 Verify MAAS CLI Commands fabrics read | jq '.' | jq .[].name | wc -l 4
156 Verify MAAS CLI Commands networks read | jq '.' | jq .[].name | wc -l 4
157 Verify MAAS CLI Commands node-groups list | jq '.' | jq .[].status | wc -l 1
158 Verify MAAS CLI Commands subnets read | jq '.' | jq .[].name | wc -l 4
159 Verify MAAS CLI Commands nodes list | jq '.' | jq .[].substatus_name | wc -l 1
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700160 Verify MAAS CLI Commands zones read | jq '.' | jq .[].name | wc -l 2
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500161 Logout MAAS Server
162
163Verify Fabric Switch Service
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700164 [Tags] fabric
165 @{switch_ips}= Discover FABRIC IPs
166 : FOR ${i} IN @{switch_ips}
167 \ Verify Fabric Switch Service ${i} faultd
168 \ Verify Fabric Switch Service ${i} netplug
169 \ Verify Fabric Switch Service ${i} onlp-snmpd
170 \ Verify Fabric Switch Service ${i} onlpd
171 \ Verify Fabric Switch Service ${i} rsyslog
172 \ Verify Fabric Switch Service ${i} snmpd
173 \ Verify Fabric Switch Service ${i} ssh
174 \ Verify Fabric Switch Service ${i} udev
175 \ Verify Fabric Switch Service ${i} watchdog
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500176
177*** Keywords ***
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700178Verify HeadNode Interfaces Detected
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500179 ${cmd}= Catenate SEPARATOR=| sudo ethtool mgmtbr grep 'Link detected:' awk '{ print $3 }'
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700180 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500181 Should Contain ${output} yes msg= mgmtbr is not detected !!!. Reason:
182 ${cmd}= Catenate SEPARATOR=| sudo ethtool fabric grep 'Link detected:' awk '{ print $3 }'
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700183 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500184 Should Contain ${output} yes msg= fabric interface is not detected !!!. Reason:
185
You Wang046fa862017-11-21 13:13:26 -0800186Verify CordVTN Node
187 [Arguments] ${node} ${status} ${ip}
188 Should Contain ${node} ${status}
189 Should Contain ${node} ${ip}
190
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700191Verify Containers
192 [Arguments] ${name}
193 ${container_id}= Get Docker Container ID ${name}
194 ${output}= Run docker inspect --format="{{ .State.Running }}" ${container_id}
195 Should Contain ${output} true msg=${name} is not running !!!. Reason:
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500196
197Verify MAAS Service
198 [Arguments] ${name}
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700199 ${cmd}= Catenate sudo service ${name} status
200 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500201 Should Contain Any ${output} @{MAAS_SERVICE_STATUS} msg= ${name} is not running !!!. Reason:
202
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500203Verify JUJU Service
204 [Arguments] ${name}
205 ${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 -0700206 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500207 Should Contain Any ${output} @{JUJU_SERVICE_STATUS} msg= ${name} is not running !!!. Reason:
208
209Verify Openstack LXD Containers
210 [Arguments] ${name}
211 ${cmd} Catenate SEPARATOR=| sudo lxc list grep -v grep grep ${name}-1 awk '{ print $2,$4 }'
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700212 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500213 Should Contain Any ${output} @{LXD_CONTAINER_STATUS} msg= ${name} is not running !!!. Reason:
214
215Verify MAAS CLI Commands
216 [Arguments] ${name} ${expected}
217 ${cmd} Catenate maas cord ${name}
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700218 ${output}= Run ${cmd}
219 Should Contain ${output} ${expected} msg=Reason:
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500220
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700221Login MAAS Server
222 ${cmd} Catenate maas login cord http://localhost/MAAS/api/1.0 $(sudo maas-region-admin apikey --user=cord)
223 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500224 Should Contain ${output} You are now logged in to the MAAS msg= MAAS login failure !!!. Reason:
225
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700226Logout MAAS Server
227 ${cmd} Catenate maas logout cord
228 ${output}= Run ${cmd}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500229
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700230Discover FABRIC IPs
231 ${switches}= Run cord prov list | grep fabric | awk '{print $4}'
232 @{switch_ips}= Split To Lines ${switches}
233 [Return] ${switch_ips}
Gunaseelaned0eb1b2017-08-08 08:12:12 -0500234
235Verify Fabric Switch Service
236 [Arguments] ${ip} ${name}
Kailash Khalasi2f567a42017-09-27 13:50:05 -0700237 ${cmd}= Catenate service ${name} status
238 ${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 -0800239 Should Contain Any ${output} @{FABRIC_SERVICE_STATUS} msg= ${name} is not running !!!. Reason:
240
241Ping All Compute Nodes Through Fabric
242 [Arguments] ${src_ip}
243 : FOR ${dst_ip} IN @{node_data_ips}
244 \ Verify Ping ubuntu ${src_ip} ${dst_ip}
245
246Ping All Fabric Switches
247 [Arguments] ${src_ip}
248 : FOR ${dst_ip} IN @{switch_ips}
249 \ Verify Ping ubuntu ${src_ip} ${dst_ip}
250
251Verify Ping
252 [Arguments] ${srcName} ${srcIP} ${dst}
253 ${result}= Run ssh ${srcName}@${srcIP} "ping -c 3 ${dst}"
254 Should Contain ${result} 64 bytes
255 Should Not Contain ${result} Destination Host Unreachable