blob: e7748847afdbe63917abe601bb6a0dd73d216835 [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
19
20*** Variables ***
21${POD_NAME} flex-ocp-cord
22${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
23${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
24#${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
25${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
26${HELM_CHARTS_DIR} ~/helm-charts
27${VOLTHA_POD_NUM} 8
28${NAMESPACE} voltha
29# For below variable value, using deployment name as using grep for
30# parsing radius pod name, we can also use full radius pod name
31${RESTART_POD_NAME} radius
TorstenThieme94e4ae42020-05-18 13:01:42 +000032${timeout} 180s
TorstenThieme1619db22020-04-03 12:01:15 +000033${of_id} 0
34${logical_id} 0
35${has_dataplane} True
36${external_libs} True
37${teardown_device} True
38${scripts} ../../scripts
39# Per-test logging on failure is turned off by default; set this variable to enable
40${container_log_dir} ${None}
TorstenThiemee0e5bba2020-08-05 11:20:13 +000041# state to test variable, can be passed via the command line too, valid values: 1-6
42# 1 -> activating-onu
43# 2 -> starting-openomci
44# 3 -> discovery-mibsync-complete
45# 4 -> initial-mib-downloaded
46# 5 -> tech-profile-config-download-success
47# 6 -> omci-flows-pushed
TorstenThieme87cd6202020-09-09 10:01:28 +000048# example: -v state2test:5
TorstenThieme1619db22020-04-03 12:01:15 +000049${state2test} 6
TorstenThiemee0e5bba2020-08-05 11:20:13 +000050# test mode variable, can be passed via the command line too, valid values: SingleState, Up2State, SingleStateTime
TorstenThieme87cd6202020-09-09 10:01:28 +000051# example: -v testmode:SingleStateTime
TorstenThieme1619db22020-04-03 12:01:15 +000052${testmode} SingleState
TorstenThiemee0e5bba2020-08-05 11:20:13 +000053# flag for execute Tech Profile check, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000054# example: -v profiletest:False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000055${profiletest} True
TorstenThieme87cd6202020-09-09 10:01:28 +000056# used tech profile, can be passed via the command line too, valid values: default (=1T1GEM), 1T4GEM, 1T8GEM
57# example: -v techprofile:1T4GEM
TorstenThiemee0e5bba2020-08-05 11:20:13 +000058${techprofile} default
59# flag for execute port test, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000060# example: -v porttest:False
TorstenThieme1619db22020-04-03 12:01:15 +000061${porttest} True
TorstenThieme87cd6202020-09-09 10:01:28 +000062# flag for execute flow test, can be passed via the command line too
TorstenThieme109683b2020-09-24 12:35:41 +000063# example: -v flowtest:True
64${flowtest} False
TorstenThiemee3841a02020-09-23 08:20:43 +000065# flag for execute disable/enable onu device test, can be passed via the command line too
66# example: -v disableenabletest:True
67${disableenabletest} False
TorstenThieme87cd6202020-09-09 10:01:28 +000068# flag for execute reconcile onu device test, can be passed via the command line too
69# example: -v reconciletest:True
70${reconciletest} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000071# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000072# example: -v debugmode:True
TorstenThieme401af432020-06-11 15:53:53 +000073${debugmode} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000074# logging flag to enable Collect Logs, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000075# example: -v logging:True
TorstenThieme5e324e42020-07-27 09:36:16 +000076${logging} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000077# if True execution will be paused before clean up
TorstenThieme87cd6202020-09-09 10:01:28 +000078# example: -v pausebeforecleanup:True
TorstenThiemeb41007d2020-06-22 12:14:12 +000079${pausebeforecleanup} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000080${data_dir} ../data
81
TorstenThieme1619db22020-04-03 12:01:15 +000082
83*** Test Cases ***
84ONU State Test
85 [Documentation] Validates the ONU Go adapter states
TorstenThieme401af432020-06-11 15:53:53 +000086 [Tags] statetest onutest
TorstenThieme1619db22020-04-03 12:01:15 +000087 [Setup] Run Keywords Start Logging ONUStateTest
88 ... AND Setup Test
89 Run Keyword If ${has_dataplane} Clean Up Linux
90 Enable Device ${olt_device_id}
TorstenThieme94e4ae42020-05-18 13:01:42 +000091 ${timeStart} = Get Current Date
92 Set Global Variable ${timeStart}
TorstenThieme1619db22020-04-03 12:01:15 +000093 Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test
94 ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test
TorstenThieme94e4ae42020-05-18 13:01:42 +000095 ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time
TorstenThieme1619db22020-04-03 12:01:15 +000096 ... ELSE Fail The testmode (${testmode}) is not valid!
TorstenThieme5e324e42020-07-27 09:36:16 +000097 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme1619db22020-04-03 12:01:15 +000098 ... AND Stop Logging ONUStateTest
99
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000100Check Loaded Tech Profile
101 [Documentation] Validates the loaded Tech Profile
102 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
103 ... Check will be executed only the reached ONU state is 5 (tech-profile-config-download-success) or higher
104 [Tags] onutest
105 [Setup] Start Logging ONUCheckTechProfile
106 Run Keyword If ${state2test}>=5 and ${profiletest} Do Check Tech Profile
107 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
108 ... AND Stop Logging ONUCheckTechProfile
109
TorstenThieme401af432020-06-11 15:53:53 +0000110Onu Port Check
TorstenThieme87cd6202020-09-09 10:01:28 +0000111 [Documentation] Validates that all the UNI ports show up in ONOS
TorstenThieme00958682020-06-19 11:29:31 +0000112 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme401af432020-06-11 15:53:53 +0000113 [Tags] onutest
114 [Setup] Start Logging ONUPortTest
115 Run Keyword If ${porttest} Do Onu Port Check
TorstenThieme5e324e42020-07-27 09:36:16 +0000116 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme401af432020-06-11 15:53:53 +0000117 ... AND Stop Logging ONUPortTest
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!
122 [Tags] onutest
123 [Setup] Start Logging ONUFlowTest
124 Run Keyword If ${state2test}>=6 and ${flowtest} Do Onu Flow Check
125 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
126 ... AND Stop Logging ONUFlowTest
127
TorstenThiemee3841a02020-09-23 08:20:43 +0000128Disable Enable Onu Device
129 [Documentation] Disables/enables ONU Device and check states
130 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
131 [Tags] onutest
132 [Setup] Start Logging DisableEnableONUDevice
133 Run Keyword If ${state2test}>=5 and ${disableenabletest} Do Disable Enable Onu Test
134 [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!
140 [Tags] onutest
141 [Setup] Start Logging ReconcileONUDevice
142 Run Keyword If ${state2test}>=5 and ${reconciletest} Do Reconcile Onu Device
143 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
144 ... AND Stop Logging ReconcileONUDevice
145
TorstenThieme1619db22020-04-03 12:01:15 +0000146*** Keywords ***
147Setup Suite
148 [Documentation] Set up the test suite
TorstenThieme87cd6202020-09-09 10:01:28 +0000149 ${LogInfo}= Catenate
150 ... \r\nPassed arguments:
151 ... state2test:${state2test}, testmode:${testmode}, profiletest:${profiletest}, techprofile:${techprofile},
152 ... porttest:${porttest}, flowtest:${flowtest}, reconciletest:${reconciletest},
TorstenThiemee3841a02020-09-23 08:20:43 +0000153 ... disableenabletest:${disableenabletest},
TorstenThieme015d5c02020-09-11 09:53:34 +0000154 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThieme87cd6202020-09-09 10:01:28 +0000155 Log ${LogInfo} console=yes
TorstenThieme1619db22020-04-03 12:01:15 +0000156 Common Test Suite Setup
157 Run Keyword If ${num_onus}>4 Calculate Timeout
TorstenThieme1488d772020-09-28 10:52:43 +0000158 ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000159 Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM)
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000160 ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM
161 ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM
162 ... ELSE Fail The TechProfile (${techprofile}) is not valid!
163 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
164 Set Suite Variable ${onos_ssh_connection}
TorstenThieme1619db22020-04-03 12:01:15 +0000165
TorstenThiemeb41007d2020-06-22 12:14:12 +0000166Teardown Suite
167 [Documentation] Replaces the Suite Teardown in utils.robot.
168 ... Cleans up and checks all ONU ports disabled in ONOS.
169 ... Furthermore gives the possibility to pause the execution.
170 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
171 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
TorstenThieme87cd6202020-09-09 10:01:28 +0000172 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
TorstenThiemeb41007d2020-06-22 12:14:12 +0000173 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000174 # Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM
175 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
176 Close ONOS SSH Connection ${onos_ssh_connection}
TorstenThieme87cd6202020-09-09 10:01:28 +0000177 Remove Tech Profile
TorstenThiemeb41007d2020-06-22 12:14:12 +0000178
TorstenThieme1619db22020-04-03 12:01:15 +0000179Setup Test
180 [Documentation] Pre-test Setup
181 #test for empty device list
182 Test Empty Device List
183 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700184 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +0000185 Run Keyword If ${has_dataplane} Sleep 60s
186 #create/preprovision device
187 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
188 Set Suite Variable ${olt_device_id}
189 #validate olt states
190 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
191 ... ${olt_device_id}
192 Sleep 5s
193
194Calculate Timeout
195 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
196 ${timeout} Fetch From Left ${timeout} s
197 ${timeout}= evaluate ${timeout}+((${num_onus}-4)*30)
TorstenThieme401af432020-06-11 15:53:53 +0000198 ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000199 ${timeout}= Catenate SEPARATOR= ${timeout} s
200 Set Suite Variable ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000201
202Do ONU Up To State Test
203 [Documentation] This keyword performs Up2State Test
204 ... All states up to the passed have to be checked
205 FOR ${I} IN RANGE 0 ${num_onus}
206 ${src}= Set Variable ${hosts.src[${I}]}
207 ${dst}= Set Variable ${hosts.dst[${I}]}
208 Run Keyword If ${state2test}>=1
209 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
210 ... Validate Device ENABLED ACTIVATING REACHABLE
211 ... ${src['onu']} onu=True onu_reason=activating-onu
212 Run Keyword If ${state2test}>=2
213 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
214 ... Validate Device ENABLED ACTIVATING REACHABLE
215 ... ${src['onu']} onu=True onu_reason=starting-openomci
216 Run Keyword If ${state2test}>=3
217 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
218 ... Validate Device ENABLED ACTIVATING REACHABLE
219 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
220 Run Keyword If ${state2test}>=4
221 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
222 ... Validate Device ENABLED ACTIVE REACHABLE
223 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
224 Run Keyword If ${state2test}>=5
225 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
226 ... Validate Device ENABLED ACTIVE REACHABLE
227 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
228 Run Keyword If ${state2test}>=6
229 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
230 ... Validate Device ENABLED ACTIVE REACHABLE
231 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
232 END
233
234Do ONU Single State Test
235 [Documentation] This keyword performs SingleState Test
236 ... Only the passed state has to be checked
237 FOR ${I} IN RANGE 0 ${num_onus}
238 ${src}= Set Variable ${hosts.src[${I}]}
239 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme015d5c02020-09-11 09:53:34 +0000240 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state2test}
241 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
242 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
243 ... ${src['onu']} onu=True onu_reason=${onu_state}
TorstenThieme1619db22020-04-03 12:01:15 +0000244 END
245
TorstenThieme94e4ae42020-05-18 13:01:42 +0000246Do ONU Single State Test Time
247 [Documentation] This keyword performs SingleState Test with calculate running time
248 ... Only the passed state has to be checked and the duration each single onu adapter needed
249 ... will be calculated and printed out
250 ${ListfinishedONUs} Create List
251 Set Global Variable ${ListfinishedONUs}
252 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
253 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000254 Build ONU SN List ${list_onus}
TorstenThieme015d5c02020-09-11 09:53:34 +0000255 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state2test}
256 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000257 ... Validate ONU Devices MIB State With Duration
TorstenThieme015d5c02020-09-11 09:53:34 +0000258 ... ${onu_state} ${list_onus} ${timeStart} print2console=True
TorstenThieme401af432020-06-11 15:53:53 +0000259 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000260
TorstenThieme1619db22020-04-03 12:01:15 +0000261Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000262 [Documentation] Check that all the UNI ports show up in ONOS
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000263 Wait for Ports in ONOS ${onos_ssh_connection} ${num_onus} BBSM
TorstenThieme9949b172020-06-16 10:00:15 +0000264
TorstenThieme109683b2020-09-24 12:35:41 +0000265Do Onu Flow Check
266 [Documentation] Check that all ONU flows show up in ONOS and Voltha
267 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
268 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
269 ... Get NNI Port in ONOS ${of_id}
270 FOR ${I} IN RANGE 0 ${num_onus}
271 ${src}= Set Variable ${hosts.src[${I}]}
272 ${dst}= Set Variable ${hosts.dst[${I}]}
273 ${onu_device_id}= Get Device ID From SN ${src['onu']}
274 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
275 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
276 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
277 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
278 ... volt-add-subscriber-access ${of_id} ${onu_port}
279 # Verify subscriber access flows are added for the ONU port
280 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
281 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
282 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
283 #check for previous state is kept (normally omci-flows-pushed)
284 Do Current State Test ${state2test} ${src['onu']}
285 END
286
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000287Set Tech Profile
288 [Documentation] This keyword set the passed TechProfile for the test
289 [Arguments] ${TechProfile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000290 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000291 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200292 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000293 ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json
294 ${dest}= Set Variable /tmp/flexpod.json
295 ${command} Catenate
296 ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
297 Copy File To Pod ${namespace} ${podname} ${src} ${dest}
298 Exec Pod ${namespace} ${podname} ${command}
299 ${commandget} Catenate
300 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
301 Exec Pod ${namespace} ${podname} ${commandget}
302
303Remove Tech Profile
304 [Documentation] This keyword removes TechProfile
TorstenThieme015d5c02020-09-11 09:53:34 +0000305 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000306 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200307 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000308 ${command} Catenate
309 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
310 Exec Pod ${namespace} ${podname} ${command}
311 ${commandget} Catenate
312 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
313 Exec Pod ${namespace} ${podname} ${commandget}
314
315Do Check Tech Profile
316 [Documentation] This keyword checks the loaded TechProfile
317 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200318 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000319 ${commandget} Catenate
320 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
321 ${result}= Exec Pod ${namespace} ${podname} ${commandget}
322 ${num_gem_ports}= Set Variable 1
323 ${num_gem_ports}= Set Variable If
324 ... "${techprofile}"=="default" 1
325 ... "${techprofile}"=="1T4GEM" 4
326 ... "${techprofile}"=="1T8GEM" 8
327 @{resultList} Split String ${result} separator=,
328 ${num_of_count_matches}= Get Match Count ${resultList} "num_gem_ports": ${num_gem_ports}
329 ... whitespace_insensitive=True
330 ${num_of_expected_matches}= Run Keyword If "${techprofile}"=="default" Evaluate ${num_onus}
331 ... ELSE Evaluate ${num_onus}+1
332 Run Keyword If ${num_of_expected_matches}!=${num_of_count_matches} Log To Console
333 ... \nTechProfile (${TechProfile}) not loaded correctly:${num_of_count_matches} of ${num_of_expected_matches}
TorstenThieme015d5c02020-09-11 09:53:34 +0000334
335Do Disable Enable Onu Test
336 [Documentation] This keyword disables/enables all onus and checks the states.
337 FOR ${I} IN RANGE 0 ${num_onus}
338 ${src}= Set Variable ${hosts.src[${I}]}
339 ${onu_device_id}= Get Device ID From SN ${src['onu']}
340 #check for previous state is kept (normally omci-flows-pushed)
341 Do Current State Test ${state2test} ${src['onu']}
342 Disable Device ${onu_device_id}
343 Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id}
344 #check state for omci-admin-lock
345 Do Current State Test omci-admin-lock ${src['onu']}
346 Enable Device ${onu_device_id}
347 #check state for onu-reenabled
348 Do Current State Test onu-reenabled ${src['onu']}
349 #check for previous state is reached again (normally omci-flows-pushed)
350 Do Current State Test ${state2test} ${src['onu']}
351 END
352
353Do Reconcile Onu Device
354 [Documentation] This keyword reconciles ONU device and check the state afterwards.
355 ... Following steps will be executed:
356 ... - restart openonu adaptor
357 ... - check openonu adaptor is ready again
358 ... - check previous state is kept
359 ... - ONU-Disable
360 ... - wait some seconds
361 ... - check for state omci-admin-lock
362 ... - ONU-Enable
363 ... - wait some seconds
364 ... - check for state onu-reenabled
365 ... - port check
366 # set open-onu app name
367 ${list_openonu_apps} Create List adapter-open-onu
368 ${namespace}= Set Variable voltha
369 ${adaptorname}= Set Variable open-onu
370 # restart openonu adapter
371 # Restart Pod ${namespace} ${adaptorname}
372 # use kill command instaed of libraries restart keyword (requested by Holger)
373 Kill Adaptor ${namespace} ${adaptorname}
374 Sleep 5s
375 Wait For Pods Ready ${namespace} ${list_openonu_apps}
376 Do Disable Enable Onu Test
377 Run Keyword If ${porttest} Do Onu Port Check
378
379Do Current State Test
380 [Documentation] This keyword checks the passed state of the given onu.
381 [Arguments] ${state} ${onu}
382 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state}
383 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
384 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
385 ... ${onu} onu=True onu_reason=${onu_state}
386
387Kill Adaptor
388 [Documentation] This keyword kills the passed adaptor.
389 [Arguments] ${namespace} ${name}
390 ${cmd} Catenate
391 ... kubectl exec -it -n voltha $(kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}')
392 ... -- /bin/sh -c "kill 1"
393 ${rc} ${output}= Run and Return Rc and Output ${cmd}
394 Log ${output}
395
396Map State
397 [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values.
398 [Arguments] ${state}
399 # create state lists with corresponding return values
400 # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE
401 ${state1} Create List ENABLED ACTIVATING REACHABLE activating-onu
402 ${state2} Create List ENABLED ACTIVATING REACHABLE starting-openomci
403 ${state3} Create List ENABLED ACTIVATING REACHABLE discovery-mibsync-complete
404 ${state4} Create List ENABLED ACTIVE REACHABLE initial-mib-downloaded
405 ${state5} Create List ENABLED ACTIVE REACHABLE tech-profile-config-download-success
406 ${state6} Create List ENABLED ACTIVE REACHABLE omci-flows-pushed
407 ${state7} Create List DISABLED UNKNOWN UNREACHABLE omci-admin-lock
408 ${state8} Create List ENABLED ACTIVE REACHABLE onu-reenabled
409 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Set Variable If
410 ... '${state}'=='1' or '${state}'=='activating-onu' ${state1}
411 ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2}
412 ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3}
413 ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4}
414 ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5}
415 ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6}
416 ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7}
417 ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8}
418 [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state}