blob: 06e5697cf0bf50f1eac574dc474d24d2002bd8ce [file] [log] [blame]
Joey Armstrong9fadcbe2024-01-17 19:00:37 -05001#Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
Gilles Depatieb5682f82019-10-31 10:39:45 -04002#
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 ***
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +053016Documentation Test suite that engages a larger number of ONU at the same which makes it a more realistic test
17... It is addaptable to either BBSim or Real H/W using a configuration file
Gilles Depatieb5682f82019-10-31 10:39:45 -040018Suite Setup Setup Suite
19Suite Teardown Teardown Suite
20Library Collections
21Library String
22Library OperatingSystem
23Library XML
24Library RequestsLibrary
25Library ../../libraries/DependencyLibrary.py
26Resource ../../libraries/onos.robot
27Resource ../../libraries/voltctl.robot
28Resource ../../libraries/utils.robot
29Resource ../../libraries/k8s.robot
30Resource ../../variables/variables.robot
31
32*** Variables ***
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +053033${timeout} 60s
Andy Baviere118e052020-03-06 12:49:24 -070034${long_timeout} 420
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +053035${of_id} 0
36${logical_id} 0
Gilles Depatieb5682f82019-10-31 10:39:45 -040037${has_dataplane} True
Gilles Depatieb5682f82019-10-31 10:39:45 -040038${teardown_device} False
39
40*** Test Cases ***
41Activate Devices OLT/ONU
42 [Documentation] Validate deployment -> Empty Device List
43 ... create and enable device -> Preprovision and Enable
44 ... re-validate deployment -> Active OLT
45 [Tags] active
46 #test for empty device list
David Bainbridgef81cd642019-11-20 00:14:47 +000047 Test Empty Device List
Gilles Depatieb5682f82019-10-31 10:39:45 -040048 #create/preprovision device
49 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
50 Set Global Variable ${olt_device_id}
51 #validate olt states
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +053052 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
Hardik Windlass8b446492021-06-10 06:25:23 +000053 ... ${olt_device_id} by_dev_id=True
Gilles Depatieb5682f82019-10-31 10:39:45 -040054 #enable device
55 Enable Device ${olt_device_id}
56 #validate olt states
Andy Baviere118e052020-03-06 12:49:24 -070057 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
Hardik Windlass8b446492021-06-10 06:25:23 +000058 ... ${olt_device_id} by_dev_id=True
Gilles Depatieb5682f82019-10-31 10:39:45 -040059
60ONU Discovery
61 [Documentation] Discover lists of ONUS, their Serial Numbers and device id
62 [Tags] active
63 #build onu sn list
64 ${List_ONU_Serial} Create List
65 Set Suite Variable ${List_ONU_Serial}
66 Build ONU SN List ${List_ONU_Serial}
Gilles Depatieb5682f82019-10-31 10:39:45 -040067 #validate onu states
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +053068 Wait Until Keyword Succeeds ${long_timeout} 20s Validate ONU Devices ENABLED ACTIVE REACHABLE
69 ... ${List_ONU_Serial}
70
71Verify AAA-Users Authentication
72 [Documentation] Authenticating all AAA-users in onos
73 [Tags] VOL-1823 active
74 #build onu sn list
75 ${List_ONU_Serial} Create List
76 Set Suite Variable ${List_ONU_Serial}
77 Build ONU SN List ${List_ONU_Serial}
Andy Baviere118e052020-03-06 12:49:24 -070078 Wait Until Keyword Succeeds ${long_timeout} 60s Verify Number of AAA-Users ${ONOS_SSH_IP}
79 ... ${ONOS_SSH_PORT} 16
Gilles Depatieb5682f82019-10-31 10:39:45 -040080
81Validate Device's Ports and Flows
82 [Documentation] Verify Ports and Flows listed for OLT and ONUs
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +053083 ... For OLT we validate the port types and numbers and for flows we simply verify that their numbers > 0
Gilles Depatieb5682f82019-10-31 10:39:45 -040084 ... For each ONU, we validate the port types and numbers for each and for flows.
85 ... For flows they should be == 0 at this stage
86 [Tags] active
87 #validate olt port types
88 Validate OLT Port Types PON_OLT ETHERNET_NNI
89 #validate olt flows
Andy Bavierac7e5972019-11-14 15:35:48 -070090 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows
Gilles Depatieb5682f82019-10-31 10:39:45 -040091 #validate onu port types
92 Validate ONU Port Types ${List_ONU_Serial} PON_ONU ETHERNET_UNI
93 #validate onu flows
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +053094 Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows ${List_ONU_Serial} ${num_onu_flows}
95
96Verify Total Number Of Eapol Flows
97 [Documentation] Verify Flows listed for ONUs
98 ... For 16 ONUs we validate the number of flows to be 16 eapol flows
99 [Tags] VOL-1823 active
100 #verify eapol flows added
Andy Baviere118e052020-03-06 12:49:24 -0700101 Wait Until Keyword Succeeds ${long_timeout} 5s Verify Eapol Flows Added ${ONOS_SSH_IP}
102 ... ${ONOS_SSH_PORT} 16
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +0530103
104Allocate DHCP To All ONU Devices
105 [Documentation] DHCP Allocation for all ONUs
106 [Tags] VOL-1824 active
107 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
108 Set Global Variable ${of_id}
109 FOR ${I} IN RANGE 0 ${num_onus}
110 ${src}= Set Variable ${hosts.src[${I}]}
111 ${dst}= Set Variable ${hosts.dst[${I}]}
Andy Baviere118e052020-03-06 12:49:24 -0700112 ${onu_device_id}= Get Device ID From SN ${src['onu']}
113 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
114 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +0530115 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
TorstenThieme4e2168e2021-06-22 14:01:47 +0000116 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Andy Baviere118e052020-03-06 12:49:24 -0700117 ... volt-add-subscriber-access ${of_id} ${onu_port}
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +0530118 END
119
120Validate Total Number Of DHCP Allocations
121 [Documentation] Verify dhcp allocation for multiple ONU user
122 [Tags] VOL-1824 active
123 #validate total number of DHCP allocations
Matteo Scandolo786aba42020-12-07 10:00:03 -0800124 FOR ${I} IN RANGE 0 ${num_olts}
125 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
Matteo Scandolob9953232020-12-07 14:24:47 -0800126 ${of_id}= Wait Until Keyword Succeeds 60s 5s Validate OLT Device in ONOS ${olt_serial_number}
TorstenThieme731a7592021-07-01 14:26:54 +0000127 Wait Until Keyword Succeeds ${long_timeout} 20s Validate DHCP Allocations ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Matteo Scandolob9953232020-12-07 14:24:47 -0800128 ... 16 ${of_id} BBSM
Matteo Scandolo786aba42020-12-07 10:00:03 -0800129 END
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +0530130 #validate DHCP allocation for each port
131 FOR ${I} IN RANGE 0 ${num_onus}
132 ${src}= Set Variable ${hosts.src[${I}]}
133 ${dst}= Set Variable ${hosts.dst[${I}]}
134 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Andy Baviere118e052020-03-06 12:49:24 -0700135 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
136 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
137 Wait Until Keyword Succeeds ${long_timeout} 20s Validate Subscriber DHCP Allocation ${ONOS_SSH_IP}
138 ... ${ONOS_SSH_PORT} ${onu_port}
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +0530139 END
Gilles Depatieb5682f82019-10-31 10:39:45 -0400140
141Validate Logical Device
142 [Documentation] Verify that logical device exists and then verify its ports and flows
143 [Tags] active
144 #Verify logical device exists
145 ${logical_device_id}= Validate Logical Device
146 #Verify logical device ports
147 Validate Logical Device Ports ${logical_device_id}
148 #Verify logical device flows
149 Validate Logical Device Flows ${logical_device_id}
150
151Validate Peer Devices
152 [Documentation] Verify that peer lists matches up between that of ${olt_device_id}
153 ... and individual ONU device ids
154 [Tags] active
155 #Retrieve peer list from OLT
156 ${olt_peer_list}= Create List
157 Retrieve Peer List From OLT ${olt_peer_list}
158 Log ${olt_peer_list}
159 #Validate OLT peer id list
160 Validate OLT Peer Id List ${olt_peer_list}
161 #Validate ONU peer ids
162 Validate ONU Peer Id ${olt_device_id} ${List_ONU_Serial}
163
Debasish28130d02020-03-16 11:05:26 +0000164Test Disable and Enable ONU
165 [Documentation] Perform disable/enable on the ONUs and validate test assertions
166 [Tags] active VOL-2732
167 FOR ${I} IN RANGE 0 ${num_onus}
168 ${src}= Set Variable ${hosts.src[${I}]}
169 ${dst}= Set Variable ${hosts.dst[${I}]}
170 ${onu_device_id}= Get Device ID From SN ${src['onu']}
171 Disable Device ${onu_device_id}
172 END
Andy Bavierf1f26ed2020-03-18 10:59:07 -0700173 Wait Until Keyword Succeeds ${long_timeout} 20s Validate ONU Devices
174 ... DISABLED UNKNOWN REACHABLE ${List_ONU_Serial} omci-admin-lock
Debasish28130d02020-03-16 11:05:26 +0000175 FOR ${I} IN RANGE 0 ${num_onus}
176 ${src}= Set Variable ${hosts.src[${I}]}
177 ${dst}= Set Variable ${hosts.dst[${I}]}
178 ${onu_device_id}= Get Device ID From SN ${src['onu']}
179 Enable Device ${onu_device_id}
180 END
Andy Bavierf1f26ed2020-03-18 10:59:07 -0700181 Wait Until Keyword Succeeds ${long_timeout} 20s Validate ONU Devices
182 ... ENABLED ACTIVE REACHABLE ${List_ONU_Serial}
Debasish28130d02020-03-16 11:05:26 +0000183
Gilles Depatieb5682f82019-10-31 10:39:45 -0400184*** Keywords ***
185Setup Suite
Andy Bavier88cd9f62019-11-26 16:22:33 -0700186 [Documentation] Set up the test suite
187 Common Test Suite Setup
Gilles Depatieb5682f82019-10-31 10:39:45 -0400188
189Teardown Suite
190 [Documentation] Clean up devices if desired
191 ... kills processes and cleans up interfaces on src+dst servers
ubuntu6b6e7d42020-03-02 12:35:42 -0800192 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400193 Run Keyword If ${has_dataplane} Clean Up Linux
Gilles Depatieb5682f82019-10-31 10:39:45 -0400194 Run Keyword If ${teardown_device} Delete Device and Verify
David Bainbridgef81cd642019-11-20 00:14:47 +0000195 Run Keyword If ${teardown_device} Test Empty Device List
TorstenThieme4e2168e2021-06-22 14:01:47 +0000196 Run Keyword If ${teardown_device} Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400197 ... device-remove ${of_id}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000198 Close All ONOS SSH Connections
Hardik Windlass81375222021-12-02 10:48:01 +0000199 Run Keyword If ${has_dataplane} Clean Up All Nodes
Gilles Depatieb5682f82019-10-31 10:39:45 -0400200
201Clean Up Linux
202 [Documentation] Kill processes and clean up interfaces on src+dst servers
203 FOR ${I} IN RANGE 0 ${num_onus}
204 ${src}= Set Variable ${hosts.src[${I}]}
205 ${dst}= Set Variable ${hosts.dst[${I}]}
206 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
207 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
208 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src['ip']}
209 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
210 Run Keyword If '${dst['ip']}' != '${None}' Run Keyword And Ignore Error
211 ... Kill Linux Process [d]hcpd ${dst['ip']} ${dst['user']}
212 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
213 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
214 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
215 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
216 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
217 ... ${dst['container_type']} ${dst['container_name']}
218 END
219
220Delete Device and Verify
221 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Matteo Scandolo5899be12020-11-11 15:38:07 -0800222 ${rc} ${output}= Run and Return Rc and Output voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400223 Should Be Equal As Integers ${rc} 0
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +0530224 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device DISABLED UNKNOWN REACHABLE
225 ... ${olt_serial_number}
Hardik Windlass7da42ca2020-03-13 14:25:44 +0530226 Delete Device ${olt_device_id}
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +0530227 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}