blob: 608580b221afa7024c52adc1c7678162813ec06b [file] [log] [blame]
TorstenThieme1619db22020-04-03 12:01:15 +00001*** Settings ***
TorstenThieme109683b2020-09-24 12:35:41 +00002Documentation Test states of ONU Go adapter with ATT workflows only (not for DT/TT workflow!)
TorstenThieme1619db22020-04-03 12:01:15 +00003Suite Setup Setup Suite
4Suite Teardown Teardown Suite
5Test Setup Setup
6Test Teardown Teardown
7Library Collections
8Library String
9Library OperatingSystem
10Library XML
11Library RequestsLibrary
12Library ../../libraries/DependencyLibrary.py
13Resource ../../libraries/onos.robot
14Resource ../../libraries/voltctl.robot
15Resource ../../libraries/voltha.robot
16Resource ../../libraries/utils.robot
17Resource ../../libraries/k8s.robot
18Resource ../../variables/variables.robot
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000019Resource Voltha_ONUUtilities.robot
TorstenThieme1619db22020-04-03 12:01:15 +000020
21*** Variables ***
TorstenThieme94e4ae42020-05-18 13:01:42 +000022${timeout} 180s
TorstenThieme1619db22020-04-03 12:01:15 +000023${of_id} 0
24${logical_id} 0
25${has_dataplane} True
26${external_libs} True
27${teardown_device} True
28${scripts} ../../scripts
29# Per-test logging on failure is turned off by default; set this variable to enable
30${container_log_dir} ${None}
TorstenThiemee0e5bba2020-08-05 11:20:13 +000031# state to test variable, can be passed via the command line too, valid values: 1-6
32# 1 -> activating-onu
33# 2 -> starting-openomci
34# 3 -> discovery-mibsync-complete
35# 4 -> initial-mib-downloaded
36# 5 -> tech-profile-config-download-success
37# 6 -> omci-flows-pushed
TorstenThieme87cd6202020-09-09 10:01:28 +000038# example: -v state2test:5
TorstenThieme66c91a82020-10-19 13:37:53 +000039# example: -v state2test:omci-flows-pushed
TorstenThieme1619db22020-04-03 12:01:15 +000040${state2test} 6
TorstenThiemee0e5bba2020-08-05 11:20:13 +000041# test mode variable, can be passed via the command line too, valid values: SingleState, Up2State, SingleStateTime
TorstenThieme87cd6202020-09-09 10:01:28 +000042# example: -v testmode:SingleStateTime
TorstenThieme1619db22020-04-03 12:01:15 +000043${testmode} SingleState
TorstenThieme87cd6202020-09-09 10:01:28 +000044# used tech profile, can be passed via the command line too, valid values: default (=1T1GEM), 1T4GEM, 1T8GEM
45# example: -v techprofile:1T4GEM
TorstenThiemee0e5bba2020-08-05 11:20:13 +000046${techprofile} default
TorstenThiemee0e5bba2020-08-05 11:20:13 +000047# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000048# example: -v debugmode:True
TorstenThieme401af432020-06-11 15:53:53 +000049${debugmode} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000050# logging flag to enable Collect Logs, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000051# example: -v logging:True
TorstenThieme5e324e42020-07-27 09:36:16 +000052${logging} False
TorstenThieme66c91a82020-10-19 13:37:53 +000053# if True execution will be paused before clean up, only use in case of manual testing, do not use in ci pipeline!
TorstenThieme87cd6202020-09-09 10:01:28 +000054# example: -v pausebeforecleanup:True
TorstenThiemeb41007d2020-06-22 12:14:12 +000055${pausebeforecleanup} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000056${data_dir} ../data
57
TorstenThieme1619db22020-04-03 12:01:15 +000058
59*** Test Cases ***
60ONU State Test
61 [Documentation] Validates the ONU Go adapter states
TorstenThieme66c91a82020-10-19 13:37:53 +000062 [Tags] sanityOnuGo StateTestOnuGo
TorstenThieme1619db22020-04-03 12:01:15 +000063 [Setup] Run Keywords Start Logging ONUStateTest
64 ... AND Setup Test
65 Run Keyword If ${has_dataplane} Clean Up Linux
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000066 FOR ${I} IN RANGE 0 ${num_olts}
67 #get olt serial number
68 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
69 #validate olt states
70 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
71 Enable Device ${olt_device_id}
72 END
TorstenThieme94e4ae42020-05-18 13:01:42 +000073 ${timeStart} = Get Current Date
74 Set Global Variable ${timeStart}
TorstenThieme1619db22020-04-03 12:01:15 +000075 Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test
76 ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test
TorstenThieme94e4ae42020-05-18 13:01:42 +000077 ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time
TorstenThieme1619db22020-04-03 12:01:15 +000078 ... ELSE Fail The testmode (${testmode}) is not valid!
TorstenThieme5e324e42020-07-27 09:36:16 +000079 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme1619db22020-04-03 12:01:15 +000080 ... AND Stop Logging ONUStateTest
81
TorstenThiemee0e5bba2020-08-05 11:20:13 +000082Check Loaded Tech Profile
83 [Documentation] Validates the loaded Tech Profile
84 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
85 ... Check will be executed only the reached ONU state is 5 (tech-profile-config-download-success) or higher
TorstenThieme66c91a82020-10-19 13:37:53 +000086 [Tags] functionalOnuGo CheckTechProfileOnuGo
TorstenThiemee0e5bba2020-08-05 11:20:13 +000087 [Setup] Start Logging ONUCheckTechProfile
TorstenThieme66c91a82020-10-19 13:37:53 +000088 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
89 ... Do Check Tech Profile
TorstenThieme5a205ba2020-09-29 08:08:29 +000090 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee0e5bba2020-08-05 11:20:13 +000091 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
92 ... AND Stop Logging ONUCheckTechProfile
93
TorstenThieme401af432020-06-11 15:53:53 +000094Onu Port Check
TorstenThieme87cd6202020-09-09 10:01:28 +000095 [Documentation] Validates that all the UNI ports show up in ONOS
TorstenThieme00958682020-06-19 11:29:31 +000096 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +000097 [Tags] functionalOnuGo PortTestOnuGo
TorstenThieme401af432020-06-11 15:53:53 +000098 [Setup] Start Logging ONUPortTest
TorstenThieme66c91a82020-10-19 13:37:53 +000099 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
100 ... Do Onu Port Check
TorstenThieme5a205ba2020-09-29 08:08:29 +0000101 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme5e324e42020-07-27 09:36:16 +0000102 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme401af432020-06-11 15:53:53 +0000103 ... AND Stop Logging ONUPortTest
104
TorstenThieme17756ea2020-11-11 14:09:47 +0000105Onu Etcd Data Check
106 [Documentation] Validates ONU data stored in ETCD
107 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
108 [Tags] functionalOnuGo EtcdDataOnuGo
109 [Setup] Start Logging ONUEtcdDataTest
110 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
111 ... Do Onu Etcd Data Check
112 ... ELSE Pass Execution ${skip_message} skipped
113 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
114 ... AND Stop Logging ONUEtcdDataTest
115
TorstenThieme109683b2020-09-24 12:35:41 +0000116Onu Flow Check
117 [Documentation] Validates the onu flows in ONOS and Voltha
118 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
mpagenkoc2e7ba52020-11-12 13:50:57 +0000119 [Tags] functionalOnuGo FlowTestOnuGo
TorstenThieme109683b2020-09-24 12:35:41 +0000120 [Setup] Start Logging ONUFlowTest
TorstenThieme66c91a82020-10-19 13:37:53 +0000121 Run Keyword If '${onu_state}'=='omci-flows-pushed' Do Onu Flow Check
TorstenThieme5a205ba2020-09-29 08:08:29 +0000122 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme109683b2020-09-24 12:35:41 +0000123 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
124 ... AND Stop Logging ONUFlowTest
125
TorstenThiemee3841a02020-09-23 08:20:43 +0000126Disable Enable Onu Device
127 [Documentation] Disables/enables ONU Device and check states
128 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000129 [Tags] functionalOnuGo DisableEnableOnuGo
TorstenThiemee3841a02020-09-23 08:20:43 +0000130 [Setup] Start Logging DisableEnableONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000131 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
132 ... Do Disable Enable Onu Test
TorstenThieme5a205ba2020-09-29 08:08:29 +0000133 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee3841a02020-09-23 08:20:43 +0000134 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
135 ... AND Stop Logging DisableEnableONUDevice
136
TorstenThieme015d5c02020-09-11 09:53:34 +0000137Reconcile Onu Device
138 [Documentation] Reconciles ONU Device and check state
139 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000140 [Tags] functionalOnuGo ReconcileOnuGo
TorstenThieme015d5c02020-09-11 09:53:34 +0000141 [Setup] Start Logging ReconcileONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000142 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
143 ... Do Reconcile Onu Device
TorstenThieme5a205ba2020-09-29 08:08:29 +0000144 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme015d5c02020-09-11 09:53:34 +0000145 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
146 ... AND Stop Logging ReconcileONUDevice
147
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000148Power Off Power On Onu Device
149 [Documentation] Power off and Power on of all ONU Devices and check state
150 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000151 [Tags] functionalOnuGo PowerOffPowerOnOnuGo
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000152 [Setup] Start Logging PowerOffPowerOnONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000153 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
154 ... Do Power Off Power On Onu Device
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000155 ... ELSE Pass Execution ${skip_message} skipped
156 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
157 ... AND Stop Logging PowerOffPowerOnONUDevice
158
TorstenThieme1fbe8082020-10-21 13:27:59 +0000159Soft Reboot Onu Device
160 [Documentation] Reboots softly all ONU Devices and check state
161 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
162 [Tags] functionalOnuGo SoftRebootOnuGo
163 [Setup] Start Logging SoftRebootONUDevice
164 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
165 ... Do Soft Reboot Onu Device
166 ... ELSE Pass Execution ${skip_message} skipped
167 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
168 ... AND Stop Logging SoftRebootONUDevice
169
TorstenThieme1619db22020-04-03 12:01:15 +0000170*** Keywords ***
171Setup Suite
172 [Documentation] Set up the test suite
TorstenThieme87cd6202020-09-09 10:01:28 +0000173 ${LogInfo}= Catenate
174 ... \r\nPassed arguments:
TorstenThieme66c91a82020-10-19 13:37:53 +0000175 ... state2test:${state2test}, testmode:${testmode}, techprofile:${techprofile},
TorstenThieme015d5c02020-09-11 09:53:34 +0000176 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThieme87cd6202020-09-09 10:01:28 +0000177 Log ${LogInfo} console=yes
TorstenThieme1619db22020-04-03 12:01:15 +0000178 Common Test Suite Setup
TorstenThieme5a205ba2020-09-29 08:08:29 +0000179 # prepare skip message in yellow for console log
180 ${skip}= Evaluate "\\033[33mSKIP\\033[0m"
181 ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
182 ${skip_message} Catenate ${skipped} | ${skip} |
183 Set Suite Variable ${skip_message}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000184 Run Keyword If ${num_all_onus}>4 Calculate Timeout
TorstenThieme1488d772020-09-28 10:52:43 +0000185 ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000186 Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM)
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000187 ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM
188 ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM
189 ... ELSE Fail The TechProfile (${techprofile}) is not valid!
190 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
191 Set Suite Variable ${onos_ssh_connection}
TorstenThieme66c91a82020-10-19 13:37:53 +0000192 # map the passed onu state to reached and make it visible for test suite
193 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}=
194 ... Map State ${state2test}
195 Set Suite Variable ${admin_state}
196 Set Suite Variable ${oper_status}
197 Set Suite Variable ${connect_status}
198 Set Suite Variable ${onu_state_nb}
199 Set Suite Variable ${onu_state}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000200 # delete etcd MIB Template Data
201 Delete MIB Template Data
TorstenThieme1619db22020-04-03 12:01:15 +0000202
TorstenThiemeb41007d2020-06-22 12:14:12 +0000203Teardown Suite
204 [Documentation] Replaces the Suite Teardown in utils.robot.
205 ... Cleans up and checks all ONU ports disabled in ONOS.
206 ... Furthermore gives the possibility to pause the execution.
207 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
208 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
TorstenThieme87cd6202020-09-09 10:01:28 +0000209 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
TorstenThiemeb41007d2020-06-22 12:14:12 +0000210 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThiemefcafba02020-11-11 16:18:50 +0000211 Validate Onu Data In Etcd 0
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000212 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
213 Close ONOS SSH Connection ${onos_ssh_connection}
TorstenThieme87cd6202020-09-09 10:01:28 +0000214 Remove Tech Profile
TorstenThiemeb41007d2020-06-22 12:14:12 +0000215
TorstenThieme1619db22020-04-03 12:01:15 +0000216Setup Test
217 [Documentation] Pre-test Setup
218 #test for empty device list
219 Test Empty Device List
220 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700221 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +0000222 Run Keyword If ${has_dataplane} Sleep 60s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000223 # Create a list of olt ids (logical and device_id)
224 ${olt_ids} Create List
225 FOR ${I} IN RANGE 0 ${num_olts}
226 #create/preprovision device
227 ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
228 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
229 #validate olt states
230 Wait Until Keyword Succeeds ${timeout} 5s
231 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
232 Sleep 5s
233 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
234 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
235 ... of_id ${of_id} sn ${olt_serial_number}
236 Append To List ${olt_ids} ${olt}
237 END
238 Set Global Variable ${olt_ids}
TorstenThieme1619db22020-04-03 12:01:15 +0000239
240Calculate Timeout
241 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
242 ${timeout} Fetch From Left ${timeout} s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000243 ${timeout}= evaluate ${timeout}+((${num_all_onus}-4)*30)
TorstenThieme401af432020-06-11 15:53:53 +0000244 ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000245 ${timeout}= Catenate SEPARATOR= ${timeout} s
246 Set Suite Variable ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000247
248Do ONU Up To State Test
249 [Documentation] This keyword performs Up2State Test
250 ... All states up to the passed have to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000251 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000252 ${src}= Set Variable ${hosts.src[${I}]}
253 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme66c91a82020-10-19 13:37:53 +0000254 Run Keyword If ${onu_state_nb}>=1
TorstenThieme1619db22020-04-03 12:01:15 +0000255 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
256 ... Validate Device ENABLED ACTIVATING REACHABLE
257 ... ${src['onu']} onu=True onu_reason=activating-onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000258 Run Keyword If ${onu_state_nb}>=2
TorstenThieme1619db22020-04-03 12:01:15 +0000259 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
260 ... Validate Device ENABLED ACTIVATING REACHABLE
261 ... ${src['onu']} onu=True onu_reason=starting-openomci
TorstenThieme66c91a82020-10-19 13:37:53 +0000262 Run Keyword If ${onu_state_nb}>=3
TorstenThieme1619db22020-04-03 12:01:15 +0000263 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
264 ... Validate Device ENABLED ACTIVATING REACHABLE
265 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
TorstenThieme66c91a82020-10-19 13:37:53 +0000266 Run Keyword If ${onu_state_nb}>=4
TorstenThieme1619db22020-04-03 12:01:15 +0000267 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
268 ... Validate Device ENABLED ACTIVE REACHABLE
269 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
TorstenThieme66c91a82020-10-19 13:37:53 +0000270 Run Keyword If ${onu_state_nb}>=5
TorstenThieme1619db22020-04-03 12:01:15 +0000271 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
272 ... Validate Device ENABLED ACTIVE REACHABLE
273 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
TorstenThieme66c91a82020-10-19 13:37:53 +0000274 Run Keyword If ${onu_state_nb}>=6
TorstenThieme1619db22020-04-03 12:01:15 +0000275 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
276 ... Validate Device ENABLED ACTIVE REACHABLE
277 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
278 END
279
280Do ONU Single State Test
281 [Documentation] This keyword performs SingleState Test
282 ... Only the passed state has to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000283 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000284 ${src}= Set Variable ${hosts.src[${I}]}
285 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme015d5c02020-09-11 09:53:34 +0000286 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
287 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
288 ... ${src['onu']} onu=True onu_reason=${onu_state}
TorstenThieme1619db22020-04-03 12:01:15 +0000289 END
290
TorstenThieme94e4ae42020-05-18 13:01:42 +0000291Do ONU Single State Test Time
292 [Documentation] This keyword performs SingleState Test with calculate running time
293 ... Only the passed state has to be checked and the duration each single onu adapter needed
294 ... will be calculated and printed out
TorstenThieme17becfc2020-10-08 09:46:27 +0000295 #${ListfinishedONUs} Create List
296 #Set Global Variable ${ListfinishedONUs}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000297 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
298 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000299 Build ONU SN List ${list_onus}
TorstenThieme015d5c02020-09-11 09:53:34 +0000300 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000301 ... Validate ONU Devices MIB State With Duration
TorstenThieme015d5c02020-09-11 09:53:34 +0000302 ... ${onu_state} ${list_onus} ${timeStart} print2console=True
TorstenThieme401af432020-06-11 15:53:53 +0000303 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000304
TorstenThieme1619db22020-04-03 12:01:15 +0000305Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000306 [Documentation] Check that all the UNI ports show up in ONOS
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000307 Wait for Ports in ONOS ${onos_ssh_connection} ${num_all_onus} BBSM
TorstenThieme9949b172020-06-16 10:00:15 +0000308
TorstenThieme17756ea2020-11-11 14:09:47 +0000309Do Onu Etcd Data Check
310 [Documentation] Check Onu data stored in etcd
311 Validate Onu Data In Etcd
312
TorstenThieme109683b2020-09-24 12:35:41 +0000313Do Onu Flow Check
TorstenThieme52ef8392020-11-10 13:42:26 +0000314 [Documentation] This keyword iterate all OLTs and performs Do Onu Flow Checks Per OLT
315 # Check and store vlan rules
316 ${firstvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000317 FOR ${J} IN RANGE 0 ${num_olts}
318 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
319 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
320 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
321 ... ${olt_serial_number}
322 Set Global Variable ${of_id}
323 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
324 ... Get NNI Port in ONOS ${of_id}
325 Set Global Variable ${nni_port}
326 # Verify Default Meter in ONOS (valid only for ATT)
TorstenThieme52ef8392020-11-10 13:42:26 +0000327 Do Onu Subscriber Add And Flow Check Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000328 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000329 #log flows for verification
330 ${flowsresult}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s
331 log ${flowsresult}
332 #check for previous state is kept (normally omci-flows-pushed)
333 Sleep 10s
334 Run Keyword And Continue On Failure Do Current State Test All Onus ${state2test}
335 ${secondvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd nbofcookieslice=3
336 ... prevvlanrules=${firstvlanrules}
337 FOR ${J} IN RANGE 0 ${num_olts}
338 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
339 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
340 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
341 ... ${olt_serial_number}
342 Set Global Variable ${of_id}
343 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
344 ... Get NNI Port in ONOS ${of_id}
345 Set Global Variable ${nni_port}
346 # Verify Default Meter in ONOS (valid only for ATT)
347 Do Onu Subscriber Remove Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
348 END
349 #check for previous state is kept (normally omci-flows-pushed)
350 Sleep 10s
351 Run Keyword And Continue On Failure Do Current State Test All Onus ${state2test}
352 Run Keyword And Continue On Failure Validate Vlan Rules In Etcd prevvlanrules=${firstvlanrules}
353 ... setvidequal=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000354
TorstenThieme52ef8392020-11-10 13:42:26 +0000355Do Onu Subscriber Add And Flow Check Per OLT
356 [Documentation] Add Subscriber per OLT and checks all ONU flows show up in ONOS and Voltha
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000357 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
358 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme109683b2020-09-24 12:35:41 +0000359 ${src}= Set Variable ${hosts.src[${I}]}
360 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000361 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
TorstenThieme109683b2020-09-24 12:35:41 +0000362 ${onu_device_id}= Get Device ID From SN ${src['onu']}
363 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
364 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
365 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
366 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
367 ... volt-add-subscriber-access ${of_id} ${onu_port}
368 # Verify subscriber access flows are added for the ONU port
369 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
370 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
371 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
TorstenThieme109683b2020-09-24 12:35:41 +0000372 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000373
374Do Onu Subscriber Remove Per OLT
375 [Documentation] Removes per OLT subscribers in ONOS and Voltha
376 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
377 FOR ${I} IN RANGE 0 ${num_all_onus}
378 ${src}= Set Variable ${hosts.src[${I}]}
379 ${dst}= Set Variable ${hosts.dst[${I}]}
380 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
381 ${onu_device_id}= Get Device ID From SN ${src['onu']}
382 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
383 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
384 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
385 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
386 ... volt-remove-subscriber-access ${of_id} ${onu_port}
387 END
TorstenThieme109683b2020-09-24 12:35:41 +0000388
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000389Set Tech Profile
390 [Documentation] This keyword set the passed TechProfile for the test
391 [Arguments] ${TechProfile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000392 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000393 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200394 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000395 ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json
396 ${dest}= Set Variable /tmp/flexpod.json
397 ${command} Catenate
398 ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
399 Copy File To Pod ${namespace} ${podname} ${src} ${dest}
Holger Hildebrandt23147742020-11-16 10:13:21 +0000400 Exec Pod In Kube ${namespace} ${podname} ${command}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000401 ${commandget} Catenate
402 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000403 Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000404
405Remove Tech Profile
406 [Documentation] This keyword removes TechProfile
TorstenThieme015d5c02020-09-11 09:53:34 +0000407 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000408 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200409 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000410 ${command} Catenate
411 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000412 Exec Pod In Kube ${namespace} ${podname} ${command}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000413 ${commandget} Catenate
414 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000415 Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000416
417Do Check Tech Profile
418 [Documentation] This keyword checks the loaded TechProfile
419 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200420 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000421 ${commandget} Catenate
422 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000423 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000424 ${num_gem_ports}= Set Variable 1
425 ${num_gem_ports}= Set Variable If
426 ... "${techprofile}"=="default" 1
427 ... "${techprofile}"=="1T4GEM" 4
428 ... "${techprofile}"=="1T8GEM" 8
429 @{resultList} Split String ${result} separator=,
430 ${num_of_count_matches}= Get Match Count ${resultList} "num_gem_ports": ${num_gem_ports}
431 ... whitespace_insensitive=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000432 ${num_of_expected_matches}= Run Keyword If "${techprofile}"=="default" Evaluate ${num_all_onus}
433 ... ELSE Evaluate ${num_all_onus}+1
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000434 Run Keyword If ${num_of_expected_matches}!=${num_of_count_matches} Log To Console
435 ... \nTechProfile (${TechProfile}) not loaded correctly:${num_of_count_matches} of ${num_of_expected_matches}
TorstenThieme015d5c02020-09-11 09:53:34 +0000436
437Do Disable Enable Onu Test
438 [Documentation] This keyword disables/enables all onus and checks the states.
TorstenThieme1fbe8082020-10-21 13:27:59 +0000439 [Arguments] ${state2check}=${state2test} ${checkstatebeforedisable}=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000440 ... ${state2checkafterdisable}=tech-profile-config-delete-success
TorstenThieme1fbe8082020-10-21 13:27:59 +0000441 Run Keyword If ${checkstatebeforedisable} Do Current State Test All Onus ${state2check}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000442 Do Disable Onu Device
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000443 ${alternative_onu_reason}= Set Variable If '${state2checkafterdisable}'=='tech-profile-config-delete-success'
444 ... omci-flows-deleted ${EMPTY}
445 Do Current State Test All Onus ${state2checkafterdisable} alternativeonustate=${alternative_onu_reason}
TorstenThieme17becfc2020-10-08 09:46:27 +0000446 Log Ports
447 #check no port is enabled in ONOS
448 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000449 Do Enable Onu Device
TorstenThieme17becfc2020-10-08 09:46:27 +0000450 Do Current State Test All Onus ${state2check}
451 Log Ports onlyenabled=True
452 #check that all the UNI ports show up in ONOS again
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000453 Wait for Ports in ONOS ${onos_ssh_connection} ${num_all_onus} BBSM
TorstenThieme015d5c02020-09-11 09:53:34 +0000454
455Do Reconcile Onu Device
456 [Documentation] This keyword reconciles ONU device and check the state afterwards.
457 ... Following steps will be executed:
458 ... - restart openonu adaptor
459 ... - check openonu adaptor is ready again
460 ... - check previous state is kept
461 ... - ONU-Disable
462 ... - wait some seconds
463 ... - check for state omci-admin-lock
464 ... - ONU-Enable
465 ... - wait some seconds
466 ... - check for state onu-reenabled
467 ... - port check
TorstenThieme015d5c02020-09-11 09:53:34 +0000468 ${list_openonu_apps} Create List adapter-open-onu
469 ${namespace}= Set Variable voltha
470 ${adaptorname}= Set Variable open-onu
TorstenThieme015d5c02020-09-11 09:53:34 +0000471 Kill Adaptor ${namespace} ${adaptorname}
472 Sleep 5s
473 Wait For Pods Ready ${namespace} ${list_openonu_apps}
474 Do Disable Enable Onu Test
TorstenThieme66c91a82020-10-19 13:37:53 +0000475 Do Onu Port Check
TorstenThieme015d5c02020-09-11 09:53:34 +0000476
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000477Do Power Off Power On Onu Device
478 [Documentation] This keyword power off/on all onus and checks the states.
479 Do Power Off ONU Device
480 Sleep 5s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000481 #Do Current State Test All Onus stopping-openomci
482 Do Current State Test All Onus tech-profile-config-delete-success
483 ... ENABLED DISCOVERED UNREACHABLE alternativeonustate=omci-flows-deleted
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000484 Do Power On ONU Device
485 Do Current State Test All Onus ${state2test}
486
TorstenThieme1fbe8082020-10-21 13:27:59 +0000487Do Soft Reboot Onu Device
488 [Documentation] This keyword reboots softly all onus and checks the states.
489 ${namespace}= Set Variable voltha
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000490 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1fbe8082020-10-21 13:27:59 +0000491 ${src}= Set Variable ${hosts.src[${I}]}
492 ${onu_device_id}= Get Device ID From SN ${src['onu']}
TorstenThiemea0b11602020-10-30 08:39:24 +0000493 Reboot ONU ${onu_device_id} False
TorstenThieme1fbe8082020-10-21 13:27:59 +0000494 END
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000495 Run Keyword Unless ${has_dataplane} Do Current State Test All Onus tech-profile-config-delete-success
496 ... ENABLED DISCOVERED REACHABLE alternativeonustate=omci-flows-deleted
TorstenThiemea0b11602020-10-30 08:39:24 +0000497 Run Keyword Unless ${has_dataplane} Do Disable Enable Onu Test checkstatebeforedisable=False
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000498 ... state2checkafterdisable=omci-admin-lock
TorstenThiemea0b11602020-10-30 08:39:24 +0000499 Run Keyword If ${has_dataplane} Do Current State Test All Onus omci-flows-pushed
TorstenThieme1fbe8082020-10-21 13:27:59 +0000500 Do Onu Port Check
501
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000502Do Disable Onu Device
503 [Documentation] This keyword disables all onus.
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000504 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme17becfc2020-10-08 09:46:27 +0000505 ${src}= Set Variable ${hosts.src[${I}]}
506 ${onu_device_id}= Get Device ID From SN ${src['onu']}
507 Disable Device ${onu_device_id}
508 Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id}
509 END
510
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000511Do Enable Onu Device
512 [Documentation] This keyword enables all onus.
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000513 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme17becfc2020-10-08 09:46:27 +0000514 ${src}= Set Variable ${hosts.src[${I}]}
515 ${onu_device_id}= Get Device ID From SN ${src['onu']}
516 Enable Device ${onu_device_id}
517 END
518
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000519Do Power Off ONU Device
520 [Documentation] This keyword power off all onus.
521 ${namespace}= Set Variable voltha
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000522 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000523 ${src}= Set Variable ${hosts.src[${I}]}
Holger Hildebrandt23147742020-11-16 10:13:21 +0000524 ${result}= Exec Pod In Kube ${namespace} bbsim bbsimctl onu shutdown ${src['onu']}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000525 Should Contain ${result} successfully msg=Can not shutdown ${src['onu']} values=False
526 END