blob: 3c3b03ff3a93781e488774602d52aefec72fb639 [file] [log] [blame]
Kailash22179672019-03-18 20:24:55 -07001# 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*** Settings ***
16Documentation Test various E2E conditions for seba-in-a-box
17Suite Setup Setup
18Suite Teardown Teardown
Kailashca7900f2019-03-20 16:17:33 -070019#Test Teardown Debug Tests
Kailash22179672019-03-18 20:24:55 -070020Library Collections
21Library String
22Library OperatingSystem
23Library XML
24Library RequestsLibrary
25Library bbsim_utils.py
26Library ../../Framework/utils/utils.py
Kailash22179672019-03-18 20:24:55 -070027Library ../../Framework/restApi.py
28Resource ../../Framework/Subscriber.robot
29Resource ../../Framework/ATTWorkFlowDriver.robot
30Resource ../../Framework/Kubernetes.robot
31Resource ../../Framework/ONU.robot
32Resource ../../Framework/DHCP.robot
33Variables ../../Properties/RestApiProperties.py
34
35*** Variables ***
36${number_of_onus} 16
Kailash39443402019-03-19 13:21:04 -070037${timeout} 300s
Kailash1ec47872019-04-12 19:14:05 -070038${olt_sn} BBSIMOLT000
Kailash22179672019-03-18 20:24:55 -070039
40*** Test Cases ***
41Create Subscriber and Whitelist for ONUs
42 [Documentation] Creates whitelists in ATT-WF for each onu device
43 [Tags] create
44 ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
45 ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
46 ${rcord_service_id}= Get Service Owner Id /xosapi/v1/rcord/rcordservices
Kailash22179672019-03-18 20:24:55 -070047 @{subscribers}= Generate Subscribers ${number_of_onus} ${rcord_service_id}
48 : FOR ${subscriber} IN @{subscribers}
Kailash22179672019-03-18 20:24:55 -070049 \ CORD Post ${VOLT_SUBSCRIBER} ${subscriber}
50 @{whitelists}= Generate Whitelists ${number_of_onus} ${att_workflow_service_id}
51 : FOR ${whitelist} IN @{whitelists}
Kailash22179672019-03-18 20:24:55 -070052 \ CORD Post ${ATT_WHITELIST} ${whitelist}
Kailash490e70b2019-04-09 06:54:01 -070053 CORD Post ${VOLT_DEVICE} {'device_type': 'openolt', 'host': 'bbsim.voltha.svc', 'port': 50060, 'switch_datapath_id': 'of:0000000000000002', 'switch_port': '3', 'outer_tpid': '0x8100', 'uplink': '65536', 'nas_id': 'NAS_ID', 'serial_number': '${olt_sn}', 'volt_service_id': ${volt_service_id}}
Kailash22179672019-03-18 20:24:55 -070054
Kailash498bf1c2019-03-18 21:05:05 -070055Validate ONUs in VOLTHA
Kailash39443402019-03-19 13:21:04 -070056 [Documentation] Verify number of onus that appear in voltha and its states
Kailash498bf1c2019-03-18 21:05:05 -070057 [Tags] voltha
Kailash39443402019-03-19 13:21:04 -070058 Wait Until Keyword Succeeds ${timeout} 5s Validate Voltha ${number_of_onus}
59
60Validate OLT and AAA-Users in ONOS
61 [Documentation] Verify olt devices in ONOS and all onus are authenticated via AAA app
62 [Tags] onos
Kailashec8abf82019-04-09 16:07:59 -070063 Wait Until Keyword Succeeds ${timeout} 1s OLT Device in ONOS
64 Wait Until Keyword Succeeds ${timeout} 5s Verify Number of AAA-Users ${number_of_onus}
Kailash498bf1c2019-03-18 21:05:05 -070065
66Validate ONUs in XOS
Kailash39443402019-03-19 13:21:04 -070067 [Documentation] Validates All ONU Devices are discovered in XOS
Kailash22179672019-03-18 20:24:55 -070068 [Tags] onudiscovery
Kailash3020bef2019-06-20 10:23:46 -070069 Wait Until Keyword Succeeds ${timeout} 60s Validate Number of ONU Devices ${number_of_onus}
Kailash22179672019-03-18 20:24:55 -070070
Kailash498bf1c2019-03-18 21:05:05 -070071Validate ONU States in XOS
Kailash22179672019-03-18 20:24:55 -070072 [Documentation] Validates All ONU Device states are "enabled" and "active"
73 [Tags] onustates
74 : FOR ${onu} IN @{serial_numbers}
Kailash39443402019-03-19 13:21:04 -070075 \ Wait Until Keyword Succeeds ${timeout} 5s Validate ONU States ACTIVE ENABLED ${onu}
76
Kailash Khalasi190e47f2019-04-30 21:38:24 +000077Validate Hosts and DHCP Allocations in ONOS
78 [Documentation] Verify number of hosts in ONOS match number of onus and verify number of DHCP allocations
Kailash39443402019-03-19 13:21:04 -070079 [Tags] onosdhcp
Kailash Khalasi190e47f2019-04-30 21:38:24 +000080 #Wait Until Keyword Succeeds ${timeout} 5s Validate Hosts in ONOS ${number_of_onus}
Kailash3020bef2019-06-20 10:23:46 -070081 Wait Until Keyword Succeeds ${timeout} 60s Validate DHCP Allocations ${number_of_onus}
Kailash39443402019-03-19 13:21:04 -070082
83Validate ATT WF Driver SIs
Kailash Khalasi190e47f2019-04-30 21:38:24 +000084 [Documentation] Validates all service instances per onu devices become "approved" and "dhcpdiscovered"
Kailash39443402019-03-19 13:21:04 -070085 [Tags] serviceinstances
86 : FOR ${onu} IN @{serial_numbers}
87 \ Wait Until Keyword Succeeds ${timeout} 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${onu}
88 \ Wait Until Keyword Succeeds ${timeout} 5s Validate ATT Workflow Driver SI DHCP State DHCPACK ${onu}
Kailash22179672019-03-18 20:24:55 -070089
Kailash22179672019-03-18 20:24:55 -070090*** Keywords ***
91Setup
Kailash45ab7e92019-06-10 13:12:05 -070092 ${server_ip}= Get Environment Variable SERVER_IP 127.0.0.1
Kailash22179672019-03-18 20:24:55 -070093 ${port}= Get Environment Variable SERVER_PORT 30001
94 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
Kailash39443402019-03-19 13:21:04 -070095 ${voltha_auth}= Create List voltha admin
96 ${onos_auth}= Create List karaf karaf
Kailash22179672019-03-18 20:24:55 -070097 ${HEADERS} Create Dictionary Content-Type=application/json
Kailash498bf1c2019-03-18 21:05:05 -070098 Create Session XOS http://${server_ip}:${port} auth=${AUTH} headers=${HEADERS}
Kailash39443402019-03-19 13:21:04 -070099 Create Session VOLTHA http://${server_ip}:30125 auth=${VOLTHA_AUTH} headers=${HEADERS}
100 Create Session ONOS http://${server_ip}:30120 auth=${ONOS_AUTH}
Kailash22179672019-03-18 20:24:55 -0700101 @{container_list}= Create List
102 Append To List ${container_list} att-workflow-att-workflow-driver
103 Append To List ${container_list} seba-services-volt
104 Append To List ${container_list} seba-services-rcord
105 Append To List ${container_list} seba-services-fabric-crossconnect
106 Append To List ${container_list} seba-services-onos-service
107 Append To List ${container_list} xos-core
108 Append To List ${container_list} vcore
109 Set Suite Variable ${container_list}
110
111Teardown
Kailash22179672019-03-18 20:24:55 -0700112 Delete All Sessions
Kailash22179672019-03-18 20:24:55 -0700113
114Validate Number of ONU Devices
115 [Arguments] ${expected_onus}
116 ${resp}= CORD Get ${ONU_DEVICE}
Kailash498bf1c2019-03-18 21:05:05 -0700117 Validate ONUs in Response ${resp} ${expected_onus}
118
119Validate Voltha
120 [Arguments] ${expected_onus}
121 ${resp}= Get Request VOLTHA api/v1/devices
122 Log ${resp.content}
123 Should Be Equal As Strings ${resp.status_code} 200
124 Validate ONUs in Response ${resp} ${expected_onus}
Kailash39443402019-03-19 13:21:04 -0700125 Validate ONU States in Voltha ${resp}
Kailash498bf1c2019-03-18 21:05:05 -0700126
127Validate ONUs in Response
128 [Arguments] ${resp} ${expected_onus}
Kailash22179672019-03-18 20:24:55 -0700129 ${jsondata}= To Json ${resp.content}
Kailash498bf1c2019-03-18 21:05:05 -0700130 Should Not Be Empty ${jsondata['items']}
Kailash22179672019-03-18 20:24:55 -0700131 ${length}= Get Length ${jsondata['items']}
132 @{serial_numbers}= Create List
133 : FOR ${INDEX} IN RANGE 0 ${length}
134 \ ${value}= Get From List ${jsondata['items']} ${INDEX}
135 \ ${sn}= Get From Dictionary ${value} serial_number
136 \ ${contains}= Evaluate "BBSM" in """${sn}"""
137 \ Run Keyword if '${contains}' == 'True' Append To List ${serial_numbers} ${sn}
138 Set Suite Variable ${serial_numbers}
139 ${length_of_bbsim_onus}= Get Length ${serial_numbers}
140 Should Be Equal as Integers ${length_of_bbsim_onus} ${expected_onus}
141
Kailash39443402019-03-19 13:21:04 -0700142Validate ONU States in Voltha
143 [Arguments] ${resp}
144 ${jsondata}= To Json ${resp.content}
145 Should Not Be Empty ${jsondata['items']}
146 ${length}= Get Length ${jsondata['items']}
147 @{serial_numbers}= Create List
148 : FOR ${INDEX} IN RANGE 0 ${length}
149 \ ${value}= Get From List ${jsondata['items']} ${INDEX}
150 \ ${admin_state}= Get From Dictionary ${value} admin_state
151 \ ${oper_status}= Get From Dictionary ${value} oper_status
152 \ Should Be Equal As Strings ${admin_state} ENABLED
153 \ Should Be Equal As Strings ${oper_status} ACTIVE
154
Kailash498bf1c2019-03-18 21:05:05 -0700155CORD Get
156 [Documentation] Make a GET call to XOS
157 [Arguments] ${service}
158 ${resp}= Get Request XOS ${service}
159 Log ${resp.content}
160 Should Be Equal As Strings ${resp.status_code} 200
161 [Return] ${resp}
162
163CORD Post
164 [Documentation] Make a POST call to XOS
165 [Arguments] ${service} ${data}
166 ${data}= Evaluate json.dumps(${data}) json
167 ${resp}= Post Request XOS uri=${service} data=${data}
168 Log ${resp.content}
169 Should Be Equal As Strings ${resp.status_code} 200
170 [Return] ${resp}
Kailashdc5e78b2019-03-19 09:24:23 -0700171
172CORD Delete
173 [Documentation] Make a DELETE call to the CORD controller
174 [Arguments] ${service} ${data_id}
175 ${resp}= Delete Request XOS uri=${service}/${data_id}
176 Log ${resp.content}
177 Should Be Equal As Strings ${resp.status_code} 200
178 [Return] ${resp}
Kailash39443402019-03-19 13:21:04 -0700179
180Verify Number of AAA-Users
181 [Arguments] ${expected_onus}
Kailash5e9c1612019-05-22 10:22:55 -0700182 ${aaa_users}= Execute ONOS Command aaa-users | grep AUTHORIZED | wc -l
Kailash39443402019-03-19 13:21:04 -0700183 Should Contain ${aaa_users} ${expected_onus}
184
185Validate Hosts in ONOS
186 [Arguments] ${expected_onus}
187 ${hosts}= Execute ONOS Command hosts | grep -v 65537 | wc -l
188 Should Contain ${hosts} ${expected_onus}
189
190Validate DHCP Allocations
191 [Arguments] ${expected_onus}
Kailash5e9c1612019-05-22 10:22:55 -0700192 ${allocations}= Execute ONOS Command dhcpl2relay-allocations | grep DHCPACK | wc -l
Kailash39443402019-03-19 13:21:04 -0700193 Should Contain ${allocations} ${expected_onus}
194
195OLT Device in ONOS
196 ${resp}= Get Request ONOS onos/v1/devices
197 ${jsondata}= To Json ${resp.content}
198 Should Not Be Empty ${jsondata['devices']}
199 ${length}= Get Length ${jsondata['devices']}
200 @{serial_numbers}= Create List
201 : FOR ${INDEX} IN RANGE 0 ${length}
202 \ ${value}= Get From List ${jsondata['devices']} ${INDEX}
203 \ ${sn}= Get From Dictionary ${value} serial
204 \ ${dpid}= Get From Dictionary ${value} id
205 Should Be Equal As Strings ${dpid} of:0000626273696d76
Kailash54860e32019-03-21 09:56:30 -0700206 Should Be Equal As Strings ${sn} ${olt_sn}
Kailash39443402019-03-19 13:21:04 -0700207
208Execute ONOS Command
209 [Arguments] ${cmd}
210 ${conn_id}= SSHLibrary.Open Connection localhost port=30115 prompt=onos> timeout=300s
211 SSHLibrary.Login karaf karaf
212 ${output}= SSHLibrary.Execute Command ${cmd}
213 SSHLibrary.Close Connection
214 [Return] ${output}
215
216Debug Tests
217 ${flows}= Execute ONOS Command flows
218 ${onos_logs}= Execute ONOS Command log:display
219 Log ${flows}
220 Log ${onos_logs}