blob: ee16b80bf1429a4f6d7ab40364eb434936021961 [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
TorstenThieme109683b2020-09-24 12:35:41 +0000105Onu Flow Check
106 [Documentation] Validates the onu flows in ONOS and Voltha
107 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000108 [Tags] functionalOnuGo FlowTestOnuGo notreadyOnuGo
TorstenThieme109683b2020-09-24 12:35:41 +0000109 [Setup] Start Logging ONUFlowTest
TorstenThieme66c91a82020-10-19 13:37:53 +0000110 Run Keyword If '${onu_state}'=='omci-flows-pushed' Do Onu Flow Check
TorstenThieme5a205ba2020-09-29 08:08:29 +0000111 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme109683b2020-09-24 12:35:41 +0000112 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
113 ... AND Stop Logging ONUFlowTest
114
TorstenThiemee3841a02020-09-23 08:20:43 +0000115Disable Enable Onu Device
116 [Documentation] Disables/enables ONU Device and check states
117 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000118 [Tags] functionalOnuGo DisableEnableOnuGo
TorstenThiemee3841a02020-09-23 08:20:43 +0000119 [Setup] Start Logging DisableEnableONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000120 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
121 ... Do Disable Enable Onu Test
TorstenThieme5a205ba2020-09-29 08:08:29 +0000122 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee3841a02020-09-23 08:20:43 +0000123 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
124 ... AND Stop Logging DisableEnableONUDevice
125
TorstenThieme015d5c02020-09-11 09:53:34 +0000126Reconcile Onu Device
127 [Documentation] Reconciles ONU Device and check state
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 ReconcileOnuGo
TorstenThieme015d5c02020-09-11 09:53:34 +0000130 [Setup] Start Logging ReconcileONUDevice
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 Reconcile Onu Device
TorstenThieme5a205ba2020-09-29 08:08:29 +0000133 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme015d5c02020-09-11 09:53:34 +0000134 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
135 ... AND Stop Logging ReconcileONUDevice
136
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000137Power Off Power On Onu Device
138 [Documentation] Power off and Power on of all ONU Devices 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 PowerOffPowerOnOnuGo
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000141 [Setup] Start Logging PowerOffPowerOnONUDevice
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 Power Off Power On Onu Device
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000144 ... ELSE Pass Execution ${skip_message} skipped
145 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
146 ... AND Stop Logging PowerOffPowerOnONUDevice
147
TorstenThieme1fbe8082020-10-21 13:27:59 +0000148Soft Reboot Onu Device
149 [Documentation] Reboots softly all ONU Devices and check state
150 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
151 [Tags] functionalOnuGo SoftRebootOnuGo
152 [Setup] Start Logging SoftRebootONUDevice
153 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
154 ... Do Soft Reboot Onu Device
155 ... ELSE Pass Execution ${skip_message} skipped
156 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
157 ... AND Stop Logging SoftRebootONUDevice
158
TorstenThieme1619db22020-04-03 12:01:15 +0000159*** Keywords ***
160Setup Suite
161 [Documentation] Set up the test suite
TorstenThieme87cd6202020-09-09 10:01:28 +0000162 ${LogInfo}= Catenate
163 ... \r\nPassed arguments:
TorstenThieme66c91a82020-10-19 13:37:53 +0000164 ... state2test:${state2test}, testmode:${testmode}, techprofile:${techprofile},
TorstenThieme015d5c02020-09-11 09:53:34 +0000165 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThieme87cd6202020-09-09 10:01:28 +0000166 Log ${LogInfo} console=yes
TorstenThieme1619db22020-04-03 12:01:15 +0000167 Common Test Suite Setup
TorstenThieme5a205ba2020-09-29 08:08:29 +0000168 # prepare skip message in yellow for console log
169 ${skip}= Evaluate "\\033[33mSKIP\\033[0m"
170 ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
171 ${skip_message} Catenate ${skipped} | ${skip} |
172 Set Suite Variable ${skip_message}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000173 Run Keyword If ${num_all_onus}>4 Calculate Timeout
TorstenThieme1488d772020-09-28 10:52:43 +0000174 ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000175 Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM)
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000176 ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM
177 ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM
178 ... ELSE Fail The TechProfile (${techprofile}) is not valid!
179 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
180 Set Suite Variable ${onos_ssh_connection}
TorstenThieme66c91a82020-10-19 13:37:53 +0000181 # map the passed onu state to reached and make it visible for test suite
182 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}=
183 ... Map State ${state2test}
184 Set Suite Variable ${admin_state}
185 Set Suite Variable ${oper_status}
186 Set Suite Variable ${connect_status}
187 Set Suite Variable ${onu_state_nb}
188 Set Suite Variable ${onu_state}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000189 # delete etcd MIB Template Data
190 Delete MIB Template Data
TorstenThieme1619db22020-04-03 12:01:15 +0000191
TorstenThiemeb41007d2020-06-22 12:14:12 +0000192Teardown Suite
193 [Documentation] Replaces the Suite Teardown in utils.robot.
194 ... Cleans up and checks all ONU ports disabled in ONOS.
195 ... Furthermore gives the possibility to pause the execution.
196 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
197 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
TorstenThieme87cd6202020-09-09 10:01:28 +0000198 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
TorstenThiemeb41007d2020-06-22 12:14:12 +0000199 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000200 # Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM
201 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
202 Close ONOS SSH Connection ${onos_ssh_connection}
TorstenThieme87cd6202020-09-09 10:01:28 +0000203 Remove Tech Profile
TorstenThiemeb41007d2020-06-22 12:14:12 +0000204
TorstenThieme1619db22020-04-03 12:01:15 +0000205Setup Test
206 [Documentation] Pre-test Setup
207 #test for empty device list
208 Test Empty Device List
209 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700210 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +0000211 Run Keyword If ${has_dataplane} Sleep 60s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000212 # Create a list of olt ids (logical and device_id)
213 ${olt_ids} Create List
214 FOR ${I} IN RANGE 0 ${num_olts}
215 #create/preprovision device
216 ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
217 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
218 #validate olt states
219 Wait Until Keyword Succeeds ${timeout} 5s
220 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
221 Sleep 5s
222 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
223 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
224 ... of_id ${of_id} sn ${olt_serial_number}
225 Append To List ${olt_ids} ${olt}
226 END
227 Set Global Variable ${olt_ids}
TorstenThieme1619db22020-04-03 12:01:15 +0000228
229Calculate Timeout
230 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
231 ${timeout} Fetch From Left ${timeout} s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000232 ${timeout}= evaluate ${timeout}+((${num_all_onus}-4)*30)
TorstenThieme401af432020-06-11 15:53:53 +0000233 ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000234 ${timeout}= Catenate SEPARATOR= ${timeout} s
235 Set Suite Variable ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000236
237Do ONU Up To State Test
238 [Documentation] This keyword performs Up2State Test
239 ... All states up to the passed have to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000240 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000241 ${src}= Set Variable ${hosts.src[${I}]}
242 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme66c91a82020-10-19 13:37:53 +0000243 Run Keyword If ${onu_state_nb}>=1
TorstenThieme1619db22020-04-03 12:01:15 +0000244 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
245 ... Validate Device ENABLED ACTIVATING REACHABLE
246 ... ${src['onu']} onu=True onu_reason=activating-onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000247 Run Keyword If ${onu_state_nb}>=2
TorstenThieme1619db22020-04-03 12:01:15 +0000248 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
249 ... Validate Device ENABLED ACTIVATING REACHABLE
250 ... ${src['onu']} onu=True onu_reason=starting-openomci
TorstenThieme66c91a82020-10-19 13:37:53 +0000251 Run Keyword If ${onu_state_nb}>=3
TorstenThieme1619db22020-04-03 12:01:15 +0000252 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
253 ... Validate Device ENABLED ACTIVATING REACHABLE
254 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
TorstenThieme66c91a82020-10-19 13:37:53 +0000255 Run Keyword If ${onu_state_nb}>=4
TorstenThieme1619db22020-04-03 12:01:15 +0000256 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
257 ... Validate Device ENABLED ACTIVE REACHABLE
258 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
TorstenThieme66c91a82020-10-19 13:37:53 +0000259 Run Keyword If ${onu_state_nb}>=5
TorstenThieme1619db22020-04-03 12:01:15 +0000260 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
261 ... Validate Device ENABLED ACTIVE REACHABLE
262 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
TorstenThieme66c91a82020-10-19 13:37:53 +0000263 Run Keyword If ${onu_state_nb}>=6
TorstenThieme1619db22020-04-03 12:01:15 +0000264 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
265 ... Validate Device ENABLED ACTIVE REACHABLE
266 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
267 END
268
269Do ONU Single State Test
270 [Documentation] This keyword performs SingleState Test
271 ... Only the passed state has to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000272 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000273 ${src}= Set Variable ${hosts.src[${I}]}
274 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme015d5c02020-09-11 09:53:34 +0000275 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
276 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
277 ... ${src['onu']} onu=True onu_reason=${onu_state}
TorstenThieme1619db22020-04-03 12:01:15 +0000278 END
279
TorstenThieme94e4ae42020-05-18 13:01:42 +0000280Do ONU Single State Test Time
281 [Documentation] This keyword performs SingleState Test with calculate running time
282 ... Only the passed state has to be checked and the duration each single onu adapter needed
283 ... will be calculated and printed out
TorstenThieme17becfc2020-10-08 09:46:27 +0000284 #${ListfinishedONUs} Create List
285 #Set Global Variable ${ListfinishedONUs}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000286 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
287 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000288 Build ONU SN List ${list_onus}
TorstenThieme015d5c02020-09-11 09:53:34 +0000289 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000290 ... Validate ONU Devices MIB State With Duration
TorstenThieme015d5c02020-09-11 09:53:34 +0000291 ... ${onu_state} ${list_onus} ${timeStart} print2console=True
TorstenThieme401af432020-06-11 15:53:53 +0000292 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000293
TorstenThieme1619db22020-04-03 12:01:15 +0000294Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000295 [Documentation] Check that all the UNI ports show up in ONOS
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000296 Wait for Ports in ONOS ${onos_ssh_connection} ${num_all_onus} BBSM
TorstenThieme9949b172020-06-16 10:00:15 +0000297
TorstenThieme109683b2020-09-24 12:35:41 +0000298Do Onu Flow Check
TorstenThieme52ef8392020-11-10 13:42:26 +0000299 [Documentation] This keyword iterate all OLTs and performs Do Onu Flow Checks Per OLT
300 # Check and store vlan rules
301 ${firstvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000302 FOR ${J} IN RANGE 0 ${num_olts}
303 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
304 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
305 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
306 ... ${olt_serial_number}
307 Set Global Variable ${of_id}
308 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
309 ... Get NNI Port in ONOS ${of_id}
310 Set Global Variable ${nni_port}
311 # Verify Default Meter in ONOS (valid only for ATT)
TorstenThieme52ef8392020-11-10 13:42:26 +0000312 Do Onu Subscriber Add And Flow Check Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000313 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000314 #log flows for verification
315 ${flowsresult}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s
316 log ${flowsresult}
317 #check for previous state is kept (normally omci-flows-pushed)
318 Sleep 10s
319 Run Keyword And Continue On Failure Do Current State Test All Onus ${state2test}
320 ${secondvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd nbofcookieslice=3
321 ... prevvlanrules=${firstvlanrules}
322 FOR ${J} IN RANGE 0 ${num_olts}
323 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
324 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
325 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
326 ... ${olt_serial_number}
327 Set Global Variable ${of_id}
328 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
329 ... Get NNI Port in ONOS ${of_id}
330 Set Global Variable ${nni_port}
331 # Verify Default Meter in ONOS (valid only for ATT)
332 Do Onu Subscriber Remove Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
333 END
334 #check for previous state is kept (normally omci-flows-pushed)
335 Sleep 10s
336 Run Keyword And Continue On Failure Do Current State Test All Onus ${state2test}
337 Run Keyword And Continue On Failure Validate Vlan Rules In Etcd prevvlanrules=${firstvlanrules}
338 ... setvidequal=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000339
TorstenThieme52ef8392020-11-10 13:42:26 +0000340Do Onu Subscriber Add And Flow Check Per OLT
341 [Documentation] Add Subscriber per OLT and checks all ONU flows show up in ONOS and Voltha
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000342 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
343 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme109683b2020-09-24 12:35:41 +0000344 ${src}= Set Variable ${hosts.src[${I}]}
345 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000346 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
TorstenThieme109683b2020-09-24 12:35:41 +0000347 ${onu_device_id}= Get Device ID From SN ${src['onu']}
348 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
349 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
350 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
351 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
352 ... volt-add-subscriber-access ${of_id} ${onu_port}
353 # Verify subscriber access flows are added for the ONU port
354 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
355 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
356 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
TorstenThieme109683b2020-09-24 12:35:41 +0000357 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000358
359Do Onu Subscriber Remove Per OLT
360 [Documentation] Removes per OLT subscribers in ONOS and Voltha
361 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
362 FOR ${I} IN RANGE 0 ${num_all_onus}
363 ${src}= Set Variable ${hosts.src[${I}]}
364 ${dst}= Set Variable ${hosts.dst[${I}]}
365 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
366 ${onu_device_id}= Get Device ID From SN ${src['onu']}
367 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
368 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
369 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
370 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
371 ... volt-remove-subscriber-access ${of_id} ${onu_port}
372 END
TorstenThieme109683b2020-09-24 12:35:41 +0000373
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000374Set Tech Profile
375 [Documentation] This keyword set the passed TechProfile for the test
376 [Arguments] ${TechProfile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000377 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000378 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200379 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000380 ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json
381 ${dest}= Set Variable /tmp/flexpod.json
382 ${command} Catenate
383 ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
384 Copy File To Pod ${namespace} ${podname} ${src} ${dest}
385 Exec Pod ${namespace} ${podname} ${command}
386 ${commandget} Catenate
387 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
388 Exec Pod ${namespace} ${podname} ${commandget}
389
390Remove Tech Profile
391 [Documentation] This keyword removes TechProfile
TorstenThieme015d5c02020-09-11 09:53:34 +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 ${command} Catenate
396 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
397 Exec Pod ${namespace} ${podname} ${command}
398 ${commandget} Catenate
399 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
400 Exec Pod ${namespace} ${podname} ${commandget}
401
402Do Check Tech Profile
403 [Documentation] This keyword checks the loaded TechProfile
404 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200405 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000406 ${commandget} Catenate
407 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
408 ${result}= Exec Pod ${namespace} ${podname} ${commandget}
409 ${num_gem_ports}= Set Variable 1
410 ${num_gem_ports}= Set Variable If
411 ... "${techprofile}"=="default" 1
412 ... "${techprofile}"=="1T4GEM" 4
413 ... "${techprofile}"=="1T8GEM" 8
414 @{resultList} Split String ${result} separator=,
415 ${num_of_count_matches}= Get Match Count ${resultList} "num_gem_ports": ${num_gem_ports}
416 ... whitespace_insensitive=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000417 ${num_of_expected_matches}= Run Keyword If "${techprofile}"=="default" Evaluate ${num_all_onus}
418 ... ELSE Evaluate ${num_all_onus}+1
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000419 Run Keyword If ${num_of_expected_matches}!=${num_of_count_matches} Log To Console
420 ... \nTechProfile (${TechProfile}) not loaded correctly:${num_of_count_matches} of ${num_of_expected_matches}
TorstenThieme015d5c02020-09-11 09:53:34 +0000421
422Do Disable Enable Onu Test
423 [Documentation] This keyword disables/enables all onus and checks the states.
TorstenThieme1fbe8082020-10-21 13:27:59 +0000424 [Arguments] ${state2check}=${state2test} ${checkstatebeforedisable}=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000425 ... ${state2checkafterdisable}=tech-profile-config-delete-success
TorstenThieme1fbe8082020-10-21 13:27:59 +0000426 Run Keyword If ${checkstatebeforedisable} Do Current State Test All Onus ${state2check}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000427 Do Disable Onu Device
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000428 ${alternative_onu_reason}= Set Variable If '${state2checkafterdisable}'=='tech-profile-config-delete-success'
429 ... omci-flows-deleted ${EMPTY}
430 Do Current State Test All Onus ${state2checkafterdisable} alternativeonustate=${alternative_onu_reason}
TorstenThieme17becfc2020-10-08 09:46:27 +0000431 Log Ports
432 #check no port is enabled in ONOS
433 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000434 Do Enable Onu Device
TorstenThieme17becfc2020-10-08 09:46:27 +0000435 Do Current State Test All Onus ${state2check}
436 Log Ports onlyenabled=True
437 #check that all the UNI ports show up in ONOS again
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000438 Wait for Ports in ONOS ${onos_ssh_connection} ${num_all_onus} BBSM
TorstenThieme015d5c02020-09-11 09:53:34 +0000439
440Do Reconcile Onu Device
441 [Documentation] This keyword reconciles ONU device and check the state afterwards.
442 ... Following steps will be executed:
443 ... - restart openonu adaptor
444 ... - check openonu adaptor is ready again
445 ... - check previous state is kept
446 ... - ONU-Disable
447 ... - wait some seconds
448 ... - check for state omci-admin-lock
449 ... - ONU-Enable
450 ... - wait some seconds
451 ... - check for state onu-reenabled
452 ... - port check
TorstenThieme015d5c02020-09-11 09:53:34 +0000453 ${list_openonu_apps} Create List adapter-open-onu
454 ${namespace}= Set Variable voltha
455 ${adaptorname}= Set Variable open-onu
TorstenThieme015d5c02020-09-11 09:53:34 +0000456 Kill Adaptor ${namespace} ${adaptorname}
457 Sleep 5s
458 Wait For Pods Ready ${namespace} ${list_openonu_apps}
459 Do Disable Enable Onu Test
TorstenThieme66c91a82020-10-19 13:37:53 +0000460 Do Onu Port Check
TorstenThieme015d5c02020-09-11 09:53:34 +0000461
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000462Do Power Off Power On Onu Device
463 [Documentation] This keyword power off/on all onus and checks the states.
464 Do Power Off ONU Device
465 Sleep 5s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000466 #Do Current State Test All Onus stopping-openomci
467 Do Current State Test All Onus tech-profile-config-delete-success
468 ... ENABLED DISCOVERED UNREACHABLE alternativeonustate=omci-flows-deleted
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000469 Do Power On ONU Device
470 Do Current State Test All Onus ${state2test}
471
TorstenThieme1fbe8082020-10-21 13:27:59 +0000472Do Soft Reboot Onu Device
473 [Documentation] This keyword reboots softly all onus and checks the states.
474 ${namespace}= Set Variable voltha
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000475 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1fbe8082020-10-21 13:27:59 +0000476 ${src}= Set Variable ${hosts.src[${I}]}
477 ${onu_device_id}= Get Device ID From SN ${src['onu']}
TorstenThiemea0b11602020-10-30 08:39:24 +0000478 Reboot ONU ${onu_device_id} False
TorstenThieme1fbe8082020-10-21 13:27:59 +0000479 END
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000480 Run Keyword Unless ${has_dataplane} Do Current State Test All Onus tech-profile-config-delete-success
481 ... ENABLED DISCOVERED REACHABLE alternativeonustate=omci-flows-deleted
TorstenThiemea0b11602020-10-30 08:39:24 +0000482 Run Keyword Unless ${has_dataplane} Do Disable Enable Onu Test checkstatebeforedisable=False
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000483 ... state2checkafterdisable=omci-admin-lock
TorstenThiemea0b11602020-10-30 08:39:24 +0000484 Run Keyword If ${has_dataplane} Do Current State Test All Onus omci-flows-pushed
TorstenThieme1fbe8082020-10-21 13:27:59 +0000485 Do Onu Port Check
486
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000487Do Disable Onu Device
488 [Documentation] This keyword disables all onus.
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000489 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme17becfc2020-10-08 09:46:27 +0000490 ${src}= Set Variable ${hosts.src[${I}]}
491 ${onu_device_id}= Get Device ID From SN ${src['onu']}
492 Disable Device ${onu_device_id}
493 Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id}
494 END
495
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000496Do Enable Onu Device
497 [Documentation] This keyword enables all onus.
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000498 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme17becfc2020-10-08 09:46:27 +0000499 ${src}= Set Variable ${hosts.src[${I}]}
500 ${onu_device_id}= Get Device ID From SN ${src['onu']}
501 Enable Device ${onu_device_id}
502 END
503
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000504Do Power Off ONU Device
505 [Documentation] This keyword power off all onus.
506 ${namespace}= Set Variable voltha
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000507 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000508 ${src}= Set Variable ${hosts.src[${I}]}
509 ${result}= Exec Pod ${namespace} bbsim bbsimctl onu shutdown ${src['onu']}
510 Should Contain ${result} successfully msg=Can not shutdown ${src['onu']} values=False
511 END