blob: cc420ca4658dafec55ea3488a92ab8a5f69d4d87 [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
Hardik Windlass4288c6a2021-09-28 07:22:06 +000037${INFRA_NAMESPACE} default
Matteo Scandoloa80b4732020-09-04 13:51:10 -070038${timeout} 60s
39${of_id} 0
40${logical_id} 0
41${has_dataplane} False
42${external_libs} True
43${teardown_device} True
44${scripts} ../../scripts
45# determines the environment workflow: DT, TT or ATT (default)
46# example: -v workflow:TT
47${workflow} ATT
48# logging flag to enable Collect Logs, can be passed via the command line too
49# example: -v logging:True
50${logging} False
51# Per-test logging on failure is turned off by default; set this variable to enable
52${container_log_dir} ${None}
53# Number of times to perform ONU Igmp Join and Leave (valid only for TT)
54${igmp_join_leave_count} 1
Matteo Scandolo4f920392021-03-02 15:15:47 -080055# Number of times the Sanity test needs to be repeated as
56# we want to make sure you can disable/delete the device without needing to restart BBSim
57${iteration_count} 2
Matteo Scandoloa80b4732020-09-04 13:51:10 -070058
Matteo Scandolo7e519fb2021-08-13 11:35:16 -070059${suppressaddsubscriber} True
Matteo Scandolobfb74382021-05-10 15:45:16 -070060
Hardik Windlassb1bda362021-11-24 11:54:36 +000061# flag to choose the subscriber provisioning command type in ONOS
62# TT often provision a single services for a subscriber (eg: hsia, voip, ...) one after the other.
63# if set to True, command used is "volt-add-subscriber-unitag"
64# if set to False, comand used is "volt-add-subscriber-access"
65${unitag_sub} False
66
Matteo Scandoloa80b4732020-09-04 13:51:10 -070067*** Test Cases ***
68
69Test Perform BBSim Sanity
70 [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows
71 ... Also Restart Auth (ATT), Restart Dhcp (ATT and TT), Igmp Join and Leave (TT)
Matteo Scandoloa80b4732020-09-04 13:51:10 -070072 [Tags] bbsimSanity
Matteo Scandolo4f920392021-03-02 15:15:47 -080073 [Setup] Run Keyword Start Logging BBSimSanity
74 FOR ${I} IN RANGE 0 ${iteration_count}
75 Perform BBSim Sanity Test
Matteo Scandoloa80b4732020-09-04 13:51:10 -070076 END
77 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
78 ... AND Stop Logging BBSimSanity
79
80*** Keywords ***
81
82Perform ONU Igmp Join and Leave
83 [Documentation] This keyword performs Igmp Leave and Join for ONU
84 [Arguments] ${bbsim_pod} ${of_id} ${onu} ${onu_port}
85 FOR ${Z} IN RANGE 0 ${igmp_join_leave_count}
86 List Service ${NAMESPACE} ${bbsim_pod}
87 JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} join
88 Sleep 2s
89 List Service ${NAMESPACE} ${bbsim_pod}
90 List ONUs ${NAMESPACE} ${bbsim_pod}
91 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
92 ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
93 JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} leave
94 Sleep 2s
95 List Service ${NAMESPACE} ${bbsim_pod}
96 List ONUs ${NAMESPACE} ${bbsim_pod}
97 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
98 ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port} False
99 END
100
Matteo Scandolo4f920392021-03-02 15:15:47 -0800101Perform BBSim Sanity Test
102 [Documentation] Runs the sanity test on multiple OLTs
103
104 Run Keyword Setup
105 FOR ${J} IN RANGE 0 ${num_olts}
106 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
107 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
108 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
109 ... ${olt_serial_number}
110 ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J}
111 ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel}
112 Perform BBSim Sanity Test Per OLT ${bbsim_pod} ${of_id} ${olt_serial_number} ${onu_count}
113 END
114 Run Keyword Delete All Devices and Verify
115
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700116Perform BBSim Sanity Test Per OLT
117 [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows
118 ... Also Restart Auth (ATT), Restart Dhcp (ATT and TT), Igmp Join and Leave (TT)
Matteo Scandolobfb74382021-05-10 15:45:16 -0700119 ... Once the ONU tests are completed perform a SoftReboot on the OLT.
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700120 [Arguments] ${bbsim_pod} ${of_id} ${olt_serial_number} ${num_onus}
121 FOR ${I} IN RANGE 0 ${num_all_onus}
122 ${src}= Set Variable ${hosts.src[${I}]}
123 ${dst}= Set Variable ${hosts.dst[${I}]}
124 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
125 ${onu_device_id}= Get Device ID From SN ${src['onu']}
126 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
127 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
128 # Check ONU port is Enabled in ONOS
129 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Hardik Windlass39015672021-07-05 05:48:08 +0000130 ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700131 Run Keyword If "${workflow}"=="ATT"
132 ... Run Keywords
133 # Verify ONU in AAA-Users (valid only for ATT)
134 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
135 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
136 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
137 # Restart Auth and Verify (valid only for ATT)
TorstenThieme731a7592021-07-01 14:26:54 +0000138 ... AND Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700139 ... aaa-reset-all-devices
140 ... AND Restart Auth ${NAMESPACE} ${bbsim_pod} ${src['onu']}
141 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
142 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
143 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
144 # Add Subscriber
145 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
TorstenThieme731a7592021-07-01 14:26:54 +0000146 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700147 ... volt-add-subscriber-access ${of_id} ${onu_port}
148 # Verify that no pending flows exist for the ONU port
149 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
150 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
151 # Verify subscriber dhcp allocations (valid only for ATT and TT)
152 Run Keyword If "${workflow}"=="ATT" or "${workflow}"=="TT"
153 ... Run Keywords
154 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
155 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
156 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
157 # Restart Dhcp and Verify (valid only for ATT and TT)
TorstenThieme731a7592021-07-01 14:26:54 +0000158 ... AND Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700159 ... dhcpl2relay-remove-allocation ${of_id} ${onu_port}
160 ... AND Restart DHCP ${NAMESPACE} ${bbsim_pod} ${src['onu']}
161 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
162 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
163 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
164 # Perform Igmp Join and Leave (valid only for TT)
165 Run Keyword If "${workflow}"=="TT"
166 ... Perform ONU Igmp Join and Leave ${bbsim_pod} ${of_id} ${src['onu']} ${onu_port}
167 END
Matteo Scandolobfb74382021-05-10 15:45:16 -0700168 # Clean ONOS state before rebooting
TorstenThieme731a7592021-07-01 14:26:54 +0000169 Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} aaa-reset-all-devices
170 Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} dhcpl2relay-clear-allocations
Matteo Scandolobfb74382021-05-10 15:45:16 -0700171 # Perform OLT SoftReboot test
172 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
173 Reboot Device ${olt_device_id}
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700174 Wait Until Keyword Succeeds 120s 2s Device Is Available In ONOS
175 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id} false
Matteo Scandolobfb74382021-05-10 15:45:16 -0700176 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
177 ... Validate OLT Device ENABLED ACTIVE
178 ... REACHABLE ${olt_serial_number}
179 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
180 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
181 ... ELSE Perform Sanity Test
182 # Perform GRPC Disconnect test
183 Restart Grpc Server ${NAMESPACE} ${bbsim_pod} 5
184 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
185 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
Matteo Scandolo7e519fb2021-08-13 11:35:16 -0700186 ... ELSE Perform Sanity Test ${suppressaddsubscriber}
Matteo Scandolo1eacdd82021-06-28 10:32:19 +0200187 # wait untill the device is connected again before proceeding
188 Sleep 10
Matteo Scandolobfb74382021-05-10 15:45:16 -0700189
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700190
191Setup Suite
192 [Documentation] Set up the test suite
193 Common Test Suite Setup
194 #send igmp file to onos (valid only for TT)
195 ${onos_netcfg_file}= Get Variable Value ${onos_netcfg.file}
196 Run Keyword If '${workflow}'=='TT' and '${has_dataplane}'=='False' and '${onos_netcfg_file}'!='${None}'
197 ... Send File To Onos ${onos_netcfg_file} apps/
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700198
199Teardown Suite
200 [Documentation] Replaces the Suite Teardown in utils.robot.
201 ... Cleans up and checks all ONU ports disabled in ONOS.
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700202 Close All ONOS SSH Connections