blob: 95109a4243464c9ca703c6c60c76779ac6c4ff9b [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
58*** Test Cases ***
59
60Test Perform BBSim Sanity
61 [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows
62 ... Also Restart Auth (ATT), Restart Dhcp (ATT and TT), Igmp Join and Leave (TT)
Matteo Scandoloa80b4732020-09-04 13:51:10 -070063 [Tags] bbsimSanity
Matteo Scandolo4f920392021-03-02 15:15:47 -080064 [Setup] Run Keyword Start Logging BBSimSanity
65 FOR ${I} IN RANGE 0 ${iteration_count}
66 Perform BBSim Sanity Test
Matteo Scandoloa80b4732020-09-04 13:51:10 -070067 END
68 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
69 ... AND Stop Logging BBSimSanity
70
71*** Keywords ***
72
73Perform ONU Igmp Join and Leave
74 [Documentation] This keyword performs Igmp Leave and Join for ONU
75 [Arguments] ${bbsim_pod} ${of_id} ${onu} ${onu_port}
76 FOR ${Z} IN RANGE 0 ${igmp_join_leave_count}
77 List Service ${NAMESPACE} ${bbsim_pod}
78 JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} join
79 Sleep 2s
80 List Service ${NAMESPACE} ${bbsim_pod}
81 List ONUs ${NAMESPACE} ${bbsim_pod}
82 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
83 ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
84 JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} leave
85 Sleep 2s
86 List Service ${NAMESPACE} ${bbsim_pod}
87 List ONUs ${NAMESPACE} ${bbsim_pod}
88 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
89 ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port} False
90 END
91
Matteo Scandolo4f920392021-03-02 15:15:47 -080092Perform BBSim Sanity Test
93 [Documentation] Runs the sanity test on multiple OLTs
94
95 Run Keyword Setup
96 FOR ${J} IN RANGE 0 ${num_olts}
97 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
98 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
99 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
100 ... ${olt_serial_number}
101 ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J}
102 ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel}
103 Perform BBSim Sanity Test Per OLT ${bbsim_pod} ${of_id} ${olt_serial_number} ${onu_count}
104 END
105 Run Keyword Delete All Devices and Verify
106
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700107Perform BBSim Sanity Test Per OLT
108 [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows
109 ... Also Restart Auth (ATT), Restart Dhcp (ATT and TT), Igmp Join and Leave (TT)
110 [Arguments] ${bbsim_pod} ${of_id} ${olt_serial_number} ${num_onus}
111 FOR ${I} IN RANGE 0 ${num_all_onus}
112 ${src}= Set Variable ${hosts.src[${I}]}
113 ${dst}= Set Variable ${hosts.dst[${I}]}
114 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
115 ${onu_device_id}= Get Device ID From SN ${src['onu']}
116 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
117 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
118 # Check ONU port is Enabled in ONOS
119 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
120 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
121 Run Keyword If "${workflow}"=="ATT"
122 ... Run Keywords
123 # Verify ONU in AAA-Users (valid only for ATT)
124 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
125 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
126 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
127 # Restart Auth and Verify (valid only for ATT)
128 ... AND Execute ONOS CLI Command on open connection ${onos_ssh_connection}
129 ... aaa-reset-all-devices
130 ... AND Restart Auth ${NAMESPACE} ${bbsim_pod} ${src['onu']}
131 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
132 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
133 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
134 # Add Subscriber
135 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
136 ... Execute ONOS CLI Command on open connection ${onos_ssh_connection}
137 ... volt-add-subscriber-access ${of_id} ${onu_port}
138 # Verify that no pending flows exist for the ONU port
139 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
140 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
141 # Verify subscriber dhcp allocations (valid only for ATT and TT)
142 Run Keyword If "${workflow}"=="ATT" or "${workflow}"=="TT"
143 ... Run Keywords
144 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
145 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
146 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
147 # Restart Dhcp and Verify (valid only for ATT and TT)
148 ... AND Execute ONOS CLI Command on open connection ${onos_ssh_connection}
149 ... dhcpl2relay-remove-allocation ${of_id} ${onu_port}
150 ... AND Restart DHCP ${NAMESPACE} ${bbsim_pod} ${src['onu']}
151 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
152 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
153 ... AND List ONUs ${NAMESPACE} ${bbsim_pod}
154 # Perform Igmp Join and Leave (valid only for TT)
155 Run Keyword If "${workflow}"=="TT"
156 ... Perform ONU Igmp Join and Leave ${bbsim_pod} ${of_id} ${src['onu']} ${onu_port}
157 END
158
159Setup Suite
160 [Documentation] Set up the test suite
161 Common Test Suite Setup
162 #send igmp file to onos (valid only for TT)
163 ${onos_netcfg_file}= Get Variable Value ${onos_netcfg.file}
164 Run Keyword If '${workflow}'=='TT' and '${has_dataplane}'=='False' and '${onos_netcfg_file}'!='${None}'
165 ... Send File To Onos ${onos_netcfg_file} apps/
166 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
167 Set Suite Variable ${onos_ssh_connection}
168
169Teardown Suite
170 [Documentation] Replaces the Suite Teardown in utils.robot.
171 ... Cleans up and checks all ONU ports disabled in ONOS.
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700172 Close All ONOS SSH Connections