blob: 10c859dabed3771bd7de0823ca609f43a3f39d28 [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
Matteo Scandolo786aba42020-12-07 10:00:03 -080099 FOR ${I} IN RANGE 0 ${num_olts}
100 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
101 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
102 ... Do Onu Port Check ${olt_serial_number}
103 ... ELSE Pass Execution ${skip_message} skipped
104 END
TorstenThieme5e324e42020-07-27 09:36:16 +0000105 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme401af432020-06-11 15:53:53 +0000106 ... AND Stop Logging ONUPortTest
107
TorstenThieme17756ea2020-11-11 14:09:47 +0000108Onu Etcd Data Check
109 [Documentation] Validates ONU data stored in ETCD
110 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
111 [Tags] functionalOnuGo EtcdDataOnuGo
112 [Setup] Start Logging ONUEtcdDataTest
113 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
114 ... Do Onu Etcd Data Check
115 ... ELSE Pass Execution ${skip_message} skipped
116 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
117 ... AND Stop Logging ONUEtcdDataTest
118
TorstenThieme109683b2020-09-24 12:35:41 +0000119Onu Flow Check
120 [Documentation] Validates the onu flows in ONOS and Voltha
121 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
mpagenkoc2e7ba52020-11-12 13:50:57 +0000122 [Tags] functionalOnuGo FlowTestOnuGo
TorstenThieme109683b2020-09-24 12:35:41 +0000123 [Setup] Start Logging ONUFlowTest
TorstenThieme66c91a82020-10-19 13:37:53 +0000124 Run Keyword If '${onu_state}'=='omci-flows-pushed' Do Onu Flow Check
TorstenThieme5a205ba2020-09-29 08:08:29 +0000125 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme109683b2020-09-24 12:35:41 +0000126 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
127 ... AND Stop Logging ONUFlowTest
128
TorstenThiemee3841a02020-09-23 08:20:43 +0000129Disable Enable Onu Device
130 [Documentation] Disables/enables ONU Device and check states
131 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000132 [Tags] functionalOnuGo DisableEnableOnuGo
TorstenThiemee3841a02020-09-23 08:20:43 +0000133 [Setup] Start Logging DisableEnableONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000134 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
135 ... Do Disable Enable Onu Test
TorstenThieme5a205ba2020-09-29 08:08:29 +0000136 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee3841a02020-09-23 08:20:43 +0000137 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
138 ... AND Stop Logging DisableEnableONUDevice
139
TorstenThieme015d5c02020-09-11 09:53:34 +0000140Reconcile Onu Device
141 [Documentation] Reconciles ONU Device and check state
142 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000143 [Tags] functionalOnuGo ReconcileOnuGo
TorstenThieme015d5c02020-09-11 09:53:34 +0000144 [Setup] Start Logging ReconcileONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000145 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
146 ... Do Reconcile Onu Device
TorstenThieme5a205ba2020-09-29 08:08:29 +0000147 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme015d5c02020-09-11 09:53:34 +0000148 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
149 ... AND Stop Logging ReconcileONUDevice
150
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000151Power Off Power On Onu Device
152 [Documentation] Power off and Power on of all ONU Devices and check state
153 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000154 [Tags] functionalOnuGo PowerOffPowerOnOnuGo
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000155 [Setup] Start Logging PowerOffPowerOnONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000156 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
157 ... Do Power Off Power On Onu Device
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000158 ... ELSE Pass Execution ${skip_message} skipped
159 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
160 ... AND Stop Logging PowerOffPowerOnONUDevice
161
TorstenThieme1fbe8082020-10-21 13:27:59 +0000162Soft Reboot Onu Device
163 [Documentation] Reboots softly all ONU Devices and check state
164 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
165 [Tags] functionalOnuGo SoftRebootOnuGo
166 [Setup] Start Logging SoftRebootONUDevice
167 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
168 ... Do Soft Reboot Onu Device
169 ... ELSE Pass Execution ${skip_message} skipped
170 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
171 ... AND Stop Logging SoftRebootONUDevice
172
TorstenThieme1619db22020-04-03 12:01:15 +0000173*** Keywords ***
174Setup Suite
175 [Documentation] Set up the test suite
TorstenThieme87cd6202020-09-09 10:01:28 +0000176 ${LogInfo}= Catenate
177 ... \r\nPassed arguments:
TorstenThieme66c91a82020-10-19 13:37:53 +0000178 ... state2test:${state2test}, testmode:${testmode}, techprofile:${techprofile},
TorstenThieme015d5c02020-09-11 09:53:34 +0000179 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThieme87cd6202020-09-09 10:01:28 +0000180 Log ${LogInfo} console=yes
TorstenThieme1619db22020-04-03 12:01:15 +0000181 Common Test Suite Setup
TorstenThieme5a205ba2020-09-29 08:08:29 +0000182 # prepare skip message in yellow for console log
183 ${skip}= Evaluate "\\033[33mSKIP\\033[0m"
184 ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
185 ${skip_message} Catenate ${skipped} | ${skip} |
186 Set Suite Variable ${skip_message}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000187 Run Keyword If ${num_all_onus}>4 Calculate Timeout
TorstenThieme1488d772020-09-28 10:52:43 +0000188 ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000189 Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM)
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000190 ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM
191 ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM
192 ... ELSE Fail The TechProfile (${techprofile}) is not valid!
193 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
194 Set Suite Variable ${onos_ssh_connection}
TorstenThieme66c91a82020-10-19 13:37:53 +0000195 # map the passed onu state to reached and make it visible for test suite
196 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}=
197 ... Map State ${state2test}
198 Set Suite Variable ${admin_state}
199 Set Suite Variable ${oper_status}
200 Set Suite Variable ${connect_status}
201 Set Suite Variable ${onu_state_nb}
202 Set Suite Variable ${onu_state}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000203 # delete etcd MIB Template Data
204 Delete MIB Template Data
TorstenThieme1619db22020-04-03 12:01:15 +0000205
TorstenThiemeb41007d2020-06-22 12:14:12 +0000206Teardown Suite
207 [Documentation] Replaces the Suite Teardown in utils.robot.
208 ... Cleans up and checks all ONU ports disabled in ONOS.
209 ... Furthermore gives the possibility to pause the execution.
210 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
211 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
TorstenThieme87cd6202020-09-09 10:01:28 +0000212 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
TorstenThiemeb41007d2020-06-22 12:14:12 +0000213 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThiemefcafba02020-11-11 16:18:50 +0000214 Validate Onu Data In Etcd 0
Matteo Scandolo786aba42020-12-07 10:00:03 -0800215 FOR ${I} IN RANGE 0 ${num_olts}
216 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
217 Wait for Ports in ONOS ${onos_ssh_connection} 0 ${olt_serial_number} BBSM
218 END
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000219 Close ONOS SSH Connection ${onos_ssh_connection}
TorstenThieme87cd6202020-09-09 10:01:28 +0000220 Remove Tech Profile
TorstenThiemeb41007d2020-06-22 12:14:12 +0000221
TorstenThieme1619db22020-04-03 12:01:15 +0000222Setup Test
223 [Documentation] Pre-test Setup
224 #test for empty device list
225 Test Empty Device List
226 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700227 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +0000228 Run Keyword If ${has_dataplane} Sleep 60s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000229 # Create a list of olt ids (logical and device_id)
230 ${olt_ids} Create List
231 FOR ${I} IN RANGE 0 ${num_olts}
232 #create/preprovision device
233 ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
234 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
235 #validate olt states
236 Wait Until Keyword Succeeds ${timeout} 5s
237 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
238 Sleep 5s
239 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
240 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
241 ... of_id ${of_id} sn ${olt_serial_number}
242 Append To List ${olt_ids} ${olt}
243 END
244 Set Global Variable ${olt_ids}
TorstenThieme1619db22020-04-03 12:01:15 +0000245
246Calculate Timeout
247 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
248 ${timeout} Fetch From Left ${timeout} s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000249 ${timeout}= evaluate ${timeout}+((${num_all_onus}-4)*30)
TorstenThieme401af432020-06-11 15:53:53 +0000250 ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000251 ${timeout}= Catenate SEPARATOR= ${timeout} s
252 Set Suite Variable ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000253
254Do ONU Up To State Test
255 [Documentation] This keyword performs Up2State Test
256 ... All states up to the passed have to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000257 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000258 ${src}= Set Variable ${hosts.src[${I}]}
259 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme66c91a82020-10-19 13:37:53 +0000260 Run Keyword If ${onu_state_nb}>=1
TorstenThieme1619db22020-04-03 12:01:15 +0000261 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
262 ... Validate Device ENABLED ACTIVATING REACHABLE
263 ... ${src['onu']} onu=True onu_reason=activating-onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000264 Run Keyword If ${onu_state_nb}>=2
TorstenThieme1619db22020-04-03 12:01:15 +0000265 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
266 ... Validate Device ENABLED ACTIVATING REACHABLE
267 ... ${src['onu']} onu=True onu_reason=starting-openomci
TorstenThieme66c91a82020-10-19 13:37:53 +0000268 Run Keyword If ${onu_state_nb}>=3
TorstenThieme1619db22020-04-03 12:01:15 +0000269 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
270 ... Validate Device ENABLED ACTIVATING REACHABLE
271 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
TorstenThieme66c91a82020-10-19 13:37:53 +0000272 Run Keyword If ${onu_state_nb}>=4
TorstenThieme1619db22020-04-03 12:01:15 +0000273 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
274 ... Validate Device ENABLED ACTIVE REACHABLE
275 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
TorstenThieme66c91a82020-10-19 13:37:53 +0000276 Run Keyword If ${onu_state_nb}>=5
TorstenThieme1619db22020-04-03 12:01:15 +0000277 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
278 ... Validate Device ENABLED ACTIVE REACHABLE
279 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
TorstenThieme66c91a82020-10-19 13:37:53 +0000280 Run Keyword If ${onu_state_nb}>=6
TorstenThieme1619db22020-04-03 12:01:15 +0000281 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
282 ... Validate Device ENABLED ACTIVE REACHABLE
283 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
284 END
285
286Do ONU Single State Test
287 [Documentation] This keyword performs SingleState Test
288 ... Only the passed state has to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000289 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000290 ${src}= Set Variable ${hosts.src[${I}]}
291 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme015d5c02020-09-11 09:53:34 +0000292 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
293 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
294 ... ${src['onu']} onu=True onu_reason=${onu_state}
TorstenThieme1619db22020-04-03 12:01:15 +0000295 END
296
TorstenThieme94e4ae42020-05-18 13:01:42 +0000297Do ONU Single State Test Time
298 [Documentation] This keyword performs SingleState Test with calculate running time
299 ... Only the passed state has to be checked and the duration each single onu adapter needed
300 ... will be calculated and printed out
TorstenThieme17becfc2020-10-08 09:46:27 +0000301 #${ListfinishedONUs} Create List
302 #Set Global Variable ${ListfinishedONUs}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000303 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
304 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000305 Build ONU SN List ${list_onus}
TorstenThieme015d5c02020-09-11 09:53:34 +0000306 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000307 ... Validate ONU Devices MIB State With Duration
TorstenThieme015d5c02020-09-11 09:53:34 +0000308 ... ${onu_state} ${list_onus} ${timeStart} print2console=True
TorstenThieme401af432020-06-11 15:53:53 +0000309 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000310
TorstenThieme1619db22020-04-03 12:01:15 +0000311Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000312 [Documentation] Check that all the UNI ports show up in ONOS
Matteo Scandolo786aba42020-12-07 10:00:03 -0800313 [Arguments] ${olt_serial_number}
314 Wait for Ports in ONOS ${onos_ssh_connection} ${num_all_onus} ${olt_serial_number} BBSM
TorstenThieme9949b172020-06-16 10:00:15 +0000315
TorstenThieme17756ea2020-11-11 14:09:47 +0000316Do Onu Etcd Data Check
317 [Documentation] Check Onu data stored in etcd
318 Validate Onu Data In Etcd
319
TorstenThieme109683b2020-09-24 12:35:41 +0000320Do Onu Flow Check
TorstenThieme52ef8392020-11-10 13:42:26 +0000321 [Documentation] This keyword iterate all OLTs and performs Do Onu Flow Checks Per OLT
322 # Check and store vlan rules
323 ${firstvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000324 FOR ${J} IN RANGE 0 ${num_olts}
325 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
326 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
327 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
328 ... ${olt_serial_number}
329 Set Global Variable ${of_id}
330 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
331 ... Get NNI Port in ONOS ${of_id}
332 Set Global Variable ${nni_port}
333 # Verify Default Meter in ONOS (valid only for ATT)
TorstenThieme52ef8392020-11-10 13:42:26 +0000334 Do Onu Subscriber Add And Flow Check Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000335 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000336 #log flows for verification
337 ${flowsresult}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s
338 log ${flowsresult}
339 #check for previous state is kept (normally omci-flows-pushed)
340 Sleep 10s
341 Run Keyword And Continue On Failure Do Current State Test All Onus ${state2test}
342 ${secondvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd nbofcookieslice=3
343 ... prevvlanrules=${firstvlanrules}
344 FOR ${J} IN RANGE 0 ${num_olts}
345 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
346 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
347 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
348 ... ${olt_serial_number}
349 Set Global Variable ${of_id}
350 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
351 ... Get NNI Port in ONOS ${of_id}
352 Set Global Variable ${nni_port}
353 # Verify Default Meter in ONOS (valid only for ATT)
354 Do Onu Subscriber Remove Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
355 END
356 #check for previous state is kept (normally omci-flows-pushed)
357 Sleep 10s
358 Run Keyword And Continue On Failure Do Current State Test All Onus ${state2test}
359 Run Keyword And Continue On Failure Validate Vlan Rules In Etcd prevvlanrules=${firstvlanrules}
360 ... setvidequal=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000361
TorstenThieme52ef8392020-11-10 13:42:26 +0000362Do Onu Subscriber Add And Flow Check Per OLT
363 [Documentation] Add Subscriber per OLT and checks all ONU flows show up in ONOS and Voltha
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000364 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
365 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme109683b2020-09-24 12:35:41 +0000366 ${src}= Set Variable ${hosts.src[${I}]}
367 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000368 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
TorstenThieme109683b2020-09-24 12:35:41 +0000369 ${onu_device_id}= Get Device ID From SN ${src['onu']}
370 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
371 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
372 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
373 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
374 ... volt-add-subscriber-access ${of_id} ${onu_port}
375 # Verify subscriber access flows are added for the ONU port
376 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
377 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
378 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
TorstenThieme109683b2020-09-24 12:35:41 +0000379 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000380
381Do Onu Subscriber Remove Per OLT
382 [Documentation] Removes per OLT subscribers in ONOS and Voltha
383 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
384 FOR ${I} IN RANGE 0 ${num_all_onus}
385 ${src}= Set Variable ${hosts.src[${I}]}
386 ${dst}= Set Variable ${hosts.dst[${I}]}
387 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
388 ${onu_device_id}= Get Device ID From SN ${src['onu']}
389 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
390 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
391 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
392 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
393 ... volt-remove-subscriber-access ${of_id} ${onu_port}
394 END
TorstenThieme109683b2020-09-24 12:35:41 +0000395
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000396Set Tech Profile
397 [Documentation] This keyword set the passed TechProfile for the test
398 [Arguments] ${TechProfile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000399 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000400 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200401 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000402 ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json
403 ${dest}= Set Variable /tmp/flexpod.json
404 ${command} Catenate
405 ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
406 Copy File To Pod ${namespace} ${podname} ${src} ${dest}
Holger Hildebrandt23147742020-11-16 10:13:21 +0000407 Exec Pod In Kube ${namespace} ${podname} ${command}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000408 ${commandget} Catenate
409 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000410 Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000411
412Remove Tech Profile
413 [Documentation] This keyword removes TechProfile
TorstenThieme015d5c02020-09-11 09:53:34 +0000414 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000415 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200416 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000417 ${command} Catenate
418 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000419 Exec Pod In Kube ${namespace} ${podname} ${command}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000420 ${commandget} Catenate
421 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000422 Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000423
424Do Check Tech Profile
425 [Documentation] This keyword checks the loaded TechProfile
426 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200427 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000428 ${commandget} Catenate
429 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000430 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000431 ${num_gem_ports}= Set Variable 1
432 ${num_gem_ports}= Set Variable If
433 ... "${techprofile}"=="default" 1
434 ... "${techprofile}"=="1T4GEM" 4
435 ... "${techprofile}"=="1T8GEM" 8
436 @{resultList} Split String ${result} separator=,
437 ${num_of_count_matches}= Get Match Count ${resultList} "num_gem_ports": ${num_gem_ports}
438 ... whitespace_insensitive=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000439 ${num_of_expected_matches}= Run Keyword If "${techprofile}"=="default" Evaluate ${num_all_onus}
440 ... ELSE Evaluate ${num_all_onus}+1
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000441 Run Keyword If ${num_of_expected_matches}!=${num_of_count_matches} Log To Console
442 ... \nTechProfile (${TechProfile}) not loaded correctly:${num_of_count_matches} of ${num_of_expected_matches}
TorstenThieme015d5c02020-09-11 09:53:34 +0000443
444Do Disable Enable Onu Test
445 [Documentation] This keyword disables/enables all onus and checks the states.
TorstenThieme1fbe8082020-10-21 13:27:59 +0000446 [Arguments] ${state2check}=${state2test} ${checkstatebeforedisable}=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000447 ... ${state2checkafterdisable}=tech-profile-config-delete-success
TorstenThieme1fbe8082020-10-21 13:27:59 +0000448 Run Keyword If ${checkstatebeforedisable} Do Current State Test All Onus ${state2check}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000449 Do Disable Onu Device
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000450 ${alternative_onu_reason}= Set Variable If '${state2checkafterdisable}'=='tech-profile-config-delete-success'
451 ... omci-flows-deleted ${EMPTY}
452 Do Current State Test All Onus ${state2checkafterdisable} alternativeonustate=${alternative_onu_reason}
TorstenThieme17becfc2020-10-08 09:46:27 +0000453 Log Ports
454 #check no port is enabled in ONOS
Matteo Scandolo786aba42020-12-07 10:00:03 -0800455 FOR ${I} IN RANGE 0 ${num_olts}
456 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
457 Wait for Ports in ONOS ${onos_ssh_connection} 0 ${olt_serial_number} BBSM
458 END
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000459 Do Enable Onu Device
TorstenThieme17becfc2020-10-08 09:46:27 +0000460 Do Current State Test All Onus ${state2check}
461 Log Ports onlyenabled=True
462 #check that all the UNI ports show up in ONOS again
Matteo Scandolo786aba42020-12-07 10:00:03 -0800463 FOR ${I} IN RANGE 0 ${num_olts}
464 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
465 Wait for Ports in ONOS ${onos_ssh_connection} ${num_all_onus} ${olt_serial_number} BBSM
466 END
TorstenThieme015d5c02020-09-11 09:53:34 +0000467
468Do Reconcile Onu Device
469 [Documentation] This keyword reconciles ONU device and check the state afterwards.
470 ... Following steps will be executed:
471 ... - restart openonu adaptor
472 ... - check openonu adaptor is ready again
473 ... - check previous state is kept
474 ... - ONU-Disable
475 ... - wait some seconds
476 ... - check for state omci-admin-lock
477 ... - ONU-Enable
478 ... - wait some seconds
479 ... - check for state onu-reenabled
480 ... - port check
TorstenThieme015d5c02020-09-11 09:53:34 +0000481 ${list_openonu_apps} Create List adapter-open-onu
482 ${namespace}= Set Variable voltha
483 ${adaptorname}= Set Variable open-onu
TorstenThieme015d5c02020-09-11 09:53:34 +0000484 Kill Adaptor ${namespace} ${adaptorname}
485 Sleep 5s
486 Wait For Pods Ready ${namespace} ${list_openonu_apps}
487 Do Disable Enable Onu Test
Matteo Scandolo786aba42020-12-07 10:00:03 -0800488 FOR ${I} IN RANGE 0 ${num_olts}
489 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
490 Do Onu Port Check ${olt_serial_number}
491 END
TorstenThieme015d5c02020-09-11 09:53:34 +0000492
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000493Do Power Off Power On Onu Device
494 [Documentation] This keyword power off/on all onus and checks the states.
495 Do Power Off ONU Device
496 Sleep 5s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000497 #Do Current State Test All Onus stopping-openomci
498 Do Current State Test All Onus tech-profile-config-delete-success
499 ... ENABLED DISCOVERED UNREACHABLE alternativeonustate=omci-flows-deleted
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000500 Do Power On ONU Device
501 Do Current State Test All Onus ${state2test}
502
TorstenThieme1fbe8082020-10-21 13:27:59 +0000503Do Soft Reboot Onu Device
504 [Documentation] This keyword reboots softly all onus and checks the states.
505 ${namespace}= Set Variable voltha
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000506 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1fbe8082020-10-21 13:27:59 +0000507 ${src}= Set Variable ${hosts.src[${I}]}
508 ${onu_device_id}= Get Device ID From SN ${src['onu']}
TorstenThiemea0b11602020-10-30 08:39:24 +0000509 Reboot ONU ${onu_device_id} False
TorstenThieme1fbe8082020-10-21 13:27:59 +0000510 END
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000511 Run Keyword Unless ${has_dataplane} Do Current State Test All Onus tech-profile-config-delete-success
512 ... ENABLED DISCOVERED REACHABLE alternativeonustate=omci-flows-deleted
TorstenThiemea0b11602020-10-30 08:39:24 +0000513 Run Keyword Unless ${has_dataplane} Do Disable Enable Onu Test checkstatebeforedisable=False
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000514 ... state2checkafterdisable=omci-admin-lock
TorstenThiemea0b11602020-10-30 08:39:24 +0000515 Run Keyword If ${has_dataplane} Do Current State Test All Onus omci-flows-pushed
Matteo Scandolo786aba42020-12-07 10:00:03 -0800516 FOR ${I} IN RANGE 0 ${num_olts}
517 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
518 Do Onu Port Check ${olt_serial_number}
519 END
TorstenThieme1fbe8082020-10-21 13:27:59 +0000520
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000521Do Disable Onu Device
522 [Documentation] This keyword disables all onus.
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000523 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme17becfc2020-10-08 09:46:27 +0000524 ${src}= Set Variable ${hosts.src[${I}]}
525 ${onu_device_id}= Get Device ID From SN ${src['onu']}
526 Disable Device ${onu_device_id}
527 Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id}
528 END
529
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000530Do Enable Onu Device
531 [Documentation] This keyword enables all onus.
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000532 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme17becfc2020-10-08 09:46:27 +0000533 ${src}= Set Variable ${hosts.src[${I}]}
534 ${onu_device_id}= Get Device ID From SN ${src['onu']}
535 Enable Device ${onu_device_id}
536 END
537
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000538Do Power Off ONU Device
539 [Documentation] This keyword power off all onus.
540 ${namespace}= Set Variable voltha
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000541 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000542 ${src}= Set Variable ${hosts.src[${I}]}
Holger Hildebrandt23147742020-11-16 10:13:21 +0000543 ${result}= Exec Pod In Kube ${namespace} bbsim bbsimctl onu shutdown ${src['onu']}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000544 Should Contain ${result} successfully msg=Can not shutdown ${src['onu']} values=False
545 END