blob: ef185f925078668b40c4322568b4c8fcdfafbe17 [file] [log] [blame]
Matteo Scandoloa80b4732020-09-04 13:51:10 -07001# Copyright 2020 - 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 ***
Matteo Scandolo4f920392021-03-02 15:15:47 -080016Documentation Run tests On BBSim
Matteo Scandoloa80b4732020-09-04 13:51:10 -070017Suite Setup Setup Suite
18Suite Teardown Teardown Suite
19Test Setup Setup
20Test Teardown Teardown
21Library Collections
22Library String
23Library OperatingSystem
24Library XML
25Library RequestsLibrary
26Library ../../libraries/DependencyLibrary.py
27Resource ../../libraries/onos.robot
28Resource ../../libraries/voltctl.robot
29Resource ../../libraries/voltha.robot
30Resource ../../libraries/utils.robot
31Resource ../../libraries/k8s.robot
32Resource ../../libraries/bbsim.robot
33Resource ../../variables/variables.robot
34
35*** Variables ***
36${NAMESPACE} voltha
37${timeout} 60s
38${of_id} 0
39${logical_id} 0
40${has_dataplane} False
41${external_libs} True
42${teardown_device} True
43${scripts} ../../scripts
44# determines the environment workflow: DT, TT or ATT (default)
45# example: -v workflow:TT
46${workflow} ATT
47# logging flag to enable Collect Logs, can be passed via the command line too
48# example: -v logging:True
49${logging} False
50# Per-test logging on failure is turned off by default; set this variable to enable
51${container_log_dir} ${None}
52# Number of times to perform ONU Igmp Join and Leave (valid only for TT)
53${igmp_join_leave_count} 1
Matteo Scandolo4f920392021-03-02 15:15:47 -080054# Number of times the Sanity test needs to be repeated as
55# we want to make sure you can disable/delete the device without needing to restart BBSim
56${iteration_count} 2
Matteo Scandoloa80b4732020-09-04 13:51:10 -070057
Matteo Scandolobfb74382021-05-10 15:45:16 -070058
Matteo Scandoloa80b4732020-09-04 13:51:10 -070059*** Test Cases ***
60
61Test Perform BBSim Sanity
62 [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows
63 ... Also Restart Auth (ATT), Restart Dhcp (ATT and TT), Igmp Join and Leave (TT)
Matteo Scandoloa80b4732020-09-04 13:51:10 -070064 [Tags] bbsimSanity
Matteo Scandolo4f920392021-03-02 15:15:47 -080065 [Setup] Run Keyword Start Logging BBSimSanity
66 FOR ${I} IN RANGE 0 ${iteration_count}
67 Perform BBSim Sanity Test
Matteo Scandoloa80b4732020-09-04 13:51:10 -070068 END
69 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
70 ... AND Stop Logging BBSimSanity
71
72*** Keywords ***
73
74Perform ONU Igmp Join and Leave
75 [Documentation] This keyword performs Igmp Leave and Join for ONU
76 [Arguments] ${bbsim_pod} ${of_id} ${onu} ${onu_port}
77 FOR ${Z} IN RANGE 0 ${igmp_join_leave_count}
78 List Service ${NAMESPACE} ${bbsim_pod}
79 JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} join
80 Sleep 2s
81 List Service ${NAMESPACE} ${bbsim_pod}
82 List ONUs ${NAMESPACE} ${bbsim_pod}
83 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
84 ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
85 JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} leave
86 Sleep 2s
87 List Service ${NAMESPACE} ${bbsim_pod}
88 List ONUs ${NAMESPACE} ${bbsim_pod}
89 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
90 ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port} False
91 END
92
Matteo Scandolo4f920392021-03-02 15:15:47 -080093Perform BBSim Sanity Test
94 [Documentation] Runs the sanity test on multiple OLTs
95
96 Run Keyword Setup
97 FOR ${J} IN RANGE 0 ${num_olts}
98 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
99 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
100 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
101 ... ${olt_serial_number}
102 ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J}
103 ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel}
104 Perform BBSim Sanity Test Per OLT ${bbsim_pod} ${of_id} ${olt_serial_number} ${onu_count}
105 END
106 Run Keyword Delete All Devices and Verify
107
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700108Perform BBSim Sanity Test Per OLT
109 [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows
110 ... Also Restart Auth (ATT), Restart Dhcp (ATT and TT), Igmp Join and Leave (TT)
Matteo Scandolobfb74382021-05-10 15:45:16 -0700111 ... Once the ONU tests are completed perform a SoftReboot on the OLT.
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700112 [Arguments] ${bbsim_pod} ${of_id} ${olt_serial_number} ${num_onus}
113 FOR ${I} IN RANGE 0 ${num_all_onus}
114 ${src}= Set Variable ${hosts.src[${I}]}
115 ${dst}= Set Variable ${hosts.dst[${I}]}
116 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
117 ${onu_device_id}= Get Device ID From SN ${src['onu']}
118 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
119 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
120 # Check ONU port is Enabled in ONOS
121 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Hardik Windlass39015672021-07-05 05:48:08 +0000122 ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700123 Run Keyword If "${workflow}"=="ATT"
124 ... Run Keywords
125 # Verify ONU in AAA-Users (valid only for ATT)
126 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
127 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
128 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
129 # Restart Auth and Verify (valid only for ATT)
TorstenThieme731a7592021-07-01 14:26:54 +0000130 ... AND Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700131 ... aaa-reset-all-devices
132 ... AND Restart Auth ${NAMESPACE} ${bbsim_pod} ${src['onu']}
133 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
134 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
135 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
136 # Add Subscriber
137 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
TorstenThieme731a7592021-07-01 14:26:54 +0000138 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700139 ... volt-add-subscriber-access ${of_id} ${onu_port}
140 # Verify that no pending flows exist for the ONU port
141 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
142 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
143 # Verify subscriber dhcp allocations (valid only for ATT and TT)
144 Run Keyword If "${workflow}"=="ATT" or "${workflow}"=="TT"
145 ... Run Keywords
146 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
147 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
148 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
149 # Restart Dhcp and Verify (valid only for ATT and TT)
TorstenThieme731a7592021-07-01 14:26:54 +0000150 ... AND Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700151 ... dhcpl2relay-remove-allocation ${of_id} ${onu_port}
152 ... AND Restart DHCP ${NAMESPACE} ${bbsim_pod} ${src['onu']}
153 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
154 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
155 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
156 # Perform Igmp Join and Leave (valid only for TT)
157 Run Keyword If "${workflow}"=="TT"
158 ... Perform ONU Igmp Join and Leave ${bbsim_pod} ${of_id} ${src['onu']} ${onu_port}
159 END
Matteo Scandolobfb74382021-05-10 15:45:16 -0700160 # Clean ONOS state before rebooting
TorstenThieme731a7592021-07-01 14:26:54 +0000161 Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} aaa-reset-all-devices
162 Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} dhcpl2relay-clear-allocations
Matteo Scandolobfb74382021-05-10 15:45:16 -0700163 # Perform OLT SoftReboot test
164 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
165 Reboot Device ${olt_device_id}
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700166 Wait Until Keyword Succeeds 120s 2s Device Is Available In ONOS
167 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id} false
Matteo Scandolobfb74382021-05-10 15:45:16 -0700168 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
169 ... Validate OLT Device ENABLED ACTIVE
170 ... REACHABLE ${olt_serial_number}
171 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
172 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
173 ... ELSE Perform Sanity Test
174 # Perform GRPC Disconnect test
175 Restart Grpc Server ${NAMESPACE} ${bbsim_pod} 5
176 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
177 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
178 ... ELSE Perform Sanity Test
Matteo Scandolo1eacdd82021-06-28 10:32:19 +0200179 # wait untill the device is connected again before proceeding
180 Sleep 10
Matteo Scandolobfb74382021-05-10 15:45:16 -0700181
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700182
183Setup Suite
184 [Documentation] Set up the test suite
185 Common Test Suite Setup
186 #send igmp file to onos (valid only for TT)
187 ${onos_netcfg_file}= Get Variable Value ${onos_netcfg.file}
188 Run Keyword If '${workflow}'=='TT' and '${has_dataplane}'=='False' and '${onos_netcfg_file}'!='${None}'
189 ... Send File To Onos ${onos_netcfg_file} apps/
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700190
191Teardown Suite
192 [Documentation] Replaces the Suite Teardown in utils.robot.
193 ... Cleans up and checks all ONU ports disabled in ONOS.
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700194 Close All ONOS SSH Connections