blob: e428cb7db7dac01639443c6886d3e38e824e5703 [file] [log] [blame]
Gilles Depatieb5682f82019-10-31 10:39:45 -04001#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 ***
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
34${long_timeout} 420
35${of_id} 0
36${logical_id} 0
Gilles Depatieb5682f82019-10-31 10:39:45 -040037${has_dataplane} True
38${external_libs} True
39${teardown_device} False
40
41*** Test Cases ***
42Activate Devices OLT/ONU
43 [Documentation] Validate deployment -> Empty Device List
44 ... create and enable device -> Preprovision and Enable
45 ... re-validate deployment -> Active OLT
46 [Tags] active
47 #test for empty device list
David Bainbridgef81cd642019-11-20 00:14:47 +000048 Test Empty Device List
Gilles Depatieb5682f82019-10-31 10:39:45 -040049 #create/preprovision device
50 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
51 Set Global Variable ${olt_device_id}
52 #validate olt states
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +053053 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
54 ... ${EMPTY} ${olt_device_id}
Gilles Depatieb5682f82019-10-31 10:39:45 -040055 #enable device
56 Enable Device ${olt_device_id}
57 #validate olt states
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +053058 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE ${EMPTY}
59 ... ${olt_device_id}
Gilles Depatieb5682f82019-10-31 10:39:45 -040060
61ONU Discovery
62 [Documentation] Discover lists of ONUS, their Serial Numbers and device id
63 [Tags] active
64 #build onu sn list
65 ${List_ONU_Serial} Create List
66 Set Suite Variable ${List_ONU_Serial}
67 Build ONU SN List ${List_ONU_Serial}
Gilles Depatieb5682f82019-10-31 10:39:45 -040068 #validate onu states
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +053069 Wait Until Keyword Succeeds ${long_timeout} 20s Validate ONU Devices ENABLED ACTIVE REACHABLE
70 ... ${List_ONU_Serial}
71
72Verify AAA-Users Authentication
73 [Documentation] Authenticating all AAA-users in onos
74 [Tags] VOL-1823 active
75 #build onu sn list
76 ${List_ONU_Serial} Create List
77 Set Suite Variable ${List_ONU_Serial}
78 Build ONU SN List ${List_ONU_Serial}
79 Wait Until Keyword Succeeds ${long_timeout} 60s Verify Number of AAA-Users ${k8s_node_ip} ${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
101 Wait Until Keyword Succeeds ${long_timeout} 5s Verify Eapol Flows Added ${k8s_node_ip} ${ONOS_SSH_PORT} 16
102
103Allocate DHCP To All ONU Devices
104 [Documentation] DHCP Allocation for all ONUs
105 [Tags] VOL-1824 active
106 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
107 Set Global Variable ${of_id}
108 FOR ${I} IN RANGE 0 ${num_onus}
109 ${src}= Set Variable ${hosts.src[${I}]}
110 ${dst}= Set Variable ${hosts.dst[${I}]}
111 ${onu_device_id}= Get Device ID From SN ${src['onu']}
112 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
113 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
114 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
115 ... Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
116 END
117
118Validate Total Number Of DHCP Allocations
119 [Documentation] Verify dhcp allocation for multiple ONU user
120 [Tags] VOL-1824 active
121 #validate total number of DHCP allocations
122 Wait Until Keyword Succeeds ${long_timeout} 20s Validate DHCP Allocations ${k8s_node_ip}
123 ... ${ONOS_SSH_PORT} 16
124 #validate DHCP allocation for each port
125 FOR ${I} IN RANGE 0 ${num_onus}
126 ${src}= Set Variable ${hosts.src[${I}]}
127 ${dst}= Set Variable ${hosts.dst[${I}]}
128 ${onu_device_id}= Get Device ID From SN ${src['onu']}
129 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
130 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
131 Wait Until Keyword Succeeds ${long_timeout} 20s Validate Subscriber DHCP Allocation ${k8s_node_ip}
132 ... ${ONOS_SSH_PORT} ${onu_port}
133 END
Gilles Depatieb5682f82019-10-31 10:39:45 -0400134
135Validate Logical Device
136 [Documentation] Verify that logical device exists and then verify its ports and flows
137 [Tags] active
138 #Verify logical device exists
139 ${logical_device_id}= Validate Logical Device
140 #Verify logical device ports
141 Validate Logical Device Ports ${logical_device_id}
142 #Verify logical device flows
143 Validate Logical Device Flows ${logical_device_id}
144
145Validate Peer Devices
146 [Documentation] Verify that peer lists matches up between that of ${olt_device_id}
147 ... and individual ONU device ids
148 [Tags] active
149 #Retrieve peer list from OLT
150 ${olt_peer_list}= Create List
151 Retrieve Peer List From OLT ${olt_peer_list}
152 Log ${olt_peer_list}
153 #Validate OLT peer id list
154 Validate OLT Peer Id List ${olt_peer_list}
155 #Validate ONU peer ids
156 Validate ONU Peer Id ${olt_device_id} ${List_ONU_Serial}
157
158*** Keywords ***
159Setup Suite
Andy Bavier88cd9f62019-11-26 16:22:33 -0700160 [Documentation] Set up the test suite
161 Common Test Suite Setup
Gilles Depatieb5682f82019-10-31 10:39:45 -0400162
163Teardown Suite
164 [Documentation] Clean up devices if desired
165 ... kills processes and cleans up interfaces on src+dst servers
166 Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip}
167 Run Keyword If ${has_dataplane} Clean Up Linux
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +0530168 Run Keyword If ${external_libs} Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400169 Run Keyword If ${teardown_device} Delete Device and Verify
David Bainbridgef81cd642019-11-20 00:14:47 +0000170 Run Keyword If ${teardown_device} Test Empty Device List
Gilles Depatieb5682f82019-10-31 10:39:45 -0400171 Run Keyword If ${teardown_device} Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
172 ... device-remove ${of_id}
173
174Clean Up Linux
175 [Documentation] Kill processes and clean up interfaces on src+dst servers
176 FOR ${I} IN RANGE 0 ${num_onus}
177 ${src}= Set Variable ${hosts.src[${I}]}
178 ${dst}= Set Variable ${hosts.dst[${I}]}
179 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
180 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
181 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src['ip']}
182 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
183 Run Keyword If '${dst['ip']}' != '${None}' Run Keyword And Ignore Error
184 ... Kill Linux Process [d]hcpd ${dst['ip']} ${dst['user']}
185 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
186 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
187 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
188 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
189 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
190 ... ${dst['container_type']} ${dst['container_name']}
191 END
192
193Delete Device and Verify
194 [Documentation] Disable -> Delete devices via voltctl and verify its removed
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +0530195 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400196 Should Be Equal As Integers ${rc} 0
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +0530197 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device DISABLED UNKNOWN REACHABLE
198 ... ${olt_serial_number}
199 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400200 Should Be Equal As Integers ${rc} 0
DEBASISH MOHAPATRO8d8b8db2020-02-07 13:04:14 +0530201 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}