blob: a5bd4ec70776817f01e030a51f96d18856f5ee33 [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 ***
TorstenThieme94e4ae42020-05-18 13:01:42 +000021${timeout} 180s
TorstenThieme1619db22020-04-03 12:01:15 +000022${of_id} 0
23${logical_id} 0
24${has_dataplane} True
25${external_libs} True
26${teardown_device} True
27${scripts} ../../scripts
28# Per-test logging on failure is turned off by default; set this variable to enable
29${container_log_dir} ${None}
TorstenThiemee0e5bba2020-08-05 11:20:13 +000030# state to test variable, can be passed via the command line too, valid values: 1-6
31# 1 -> activating-onu
32# 2 -> starting-openomci
33# 3 -> discovery-mibsync-complete
34# 4 -> initial-mib-downloaded
35# 5 -> tech-profile-config-download-success
36# 6 -> omci-flows-pushed
TorstenThieme87cd6202020-09-09 10:01:28 +000037# example: -v state2test:5
TorstenThieme1619db22020-04-03 12:01:15 +000038${state2test} 6
TorstenThiemee0e5bba2020-08-05 11:20:13 +000039# test mode variable, can be passed via the command line too, valid values: SingleState, Up2State, SingleStateTime
TorstenThieme87cd6202020-09-09 10:01:28 +000040# example: -v testmode:SingleStateTime
TorstenThieme1619db22020-04-03 12:01:15 +000041${testmode} SingleState
TorstenThiemee0e5bba2020-08-05 11:20:13 +000042# flag for execute Tech Profile check, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000043# example: -v profiletest:False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000044${profiletest} True
TorstenThieme87cd6202020-09-09 10:01:28 +000045# used tech profile, can be passed via the command line too, valid values: default (=1T1GEM), 1T4GEM, 1T8GEM
46# example: -v techprofile:1T4GEM
TorstenThiemee0e5bba2020-08-05 11:20:13 +000047${techprofile} default
48# flag for execute port test, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000049# example: -v porttest:False
TorstenThieme1619db22020-04-03 12:01:15 +000050${porttest} True
TorstenThieme87cd6202020-09-09 10:01:28 +000051# flag for execute flow test, can be passed via the command line too
TorstenThieme109683b2020-09-24 12:35:41 +000052# example: -v flowtest:True
53${flowtest} False
TorstenThiemee3841a02020-09-23 08:20:43 +000054# flag for execute disable/enable onu device test, can be passed via the command line too
55# example: -v disableenabletest:True
TorstenThieme17becfc2020-10-08 09:46:27 +000056${disableenabletest} True
TorstenThieme87cd6202020-09-09 10:01:28 +000057# flag for execute reconcile onu device test, can be passed via the command line too
58# example: -v reconciletest:True
TorstenThieme17becfc2020-10-08 09:46:27 +000059${reconciletest} True
TorstenThiemee0e5bba2020-08-05 11:20:13 +000060# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000061# example: -v debugmode:True
TorstenThieme401af432020-06-11 15:53:53 +000062${debugmode} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000063# logging flag to enable Collect Logs, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000064# example: -v logging:True
TorstenThieme5e324e42020-07-27 09:36:16 +000065${logging} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000066# if True execution will be paused before clean up
TorstenThieme87cd6202020-09-09 10:01:28 +000067# example: -v pausebeforecleanup:True
TorstenThiemeb41007d2020-06-22 12:14:12 +000068${pausebeforecleanup} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000069${data_dir} ../data
70
TorstenThieme1619db22020-04-03 12:01:15 +000071
72*** Test Cases ***
73ONU State Test
74 [Documentation] Validates the ONU Go adapter states
TorstenThieme401af432020-06-11 15:53:53 +000075 [Tags] statetest onutest
TorstenThieme1619db22020-04-03 12:01:15 +000076 [Setup] Run Keywords Start Logging ONUStateTest
77 ... AND Setup Test
78 Run Keyword If ${has_dataplane} Clean Up Linux
79 Enable Device ${olt_device_id}
TorstenThieme94e4ae42020-05-18 13:01:42 +000080 ${timeStart} = Get Current Date
81 Set Global Variable ${timeStart}
TorstenThieme1619db22020-04-03 12:01:15 +000082 Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test
83 ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test
TorstenThieme94e4ae42020-05-18 13:01:42 +000084 ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time
TorstenThieme1619db22020-04-03 12:01:15 +000085 ... ELSE Fail The testmode (${testmode}) is not valid!
TorstenThieme5e324e42020-07-27 09:36:16 +000086 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme1619db22020-04-03 12:01:15 +000087 ... AND Stop Logging ONUStateTest
88
TorstenThiemee0e5bba2020-08-05 11:20:13 +000089Check Loaded Tech Profile
90 [Documentation] Validates the loaded Tech Profile
91 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
92 ... Check will be executed only the reached ONU state is 5 (tech-profile-config-download-success) or higher
93 [Tags] onutest
94 [Setup] Start Logging ONUCheckTechProfile
95 Run Keyword If ${state2test}>=5 and ${profiletest} Do Check Tech Profile
TorstenThieme5a205ba2020-09-29 08:08:29 +000096 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee0e5bba2020-08-05 11:20:13 +000097 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
98 ... AND Stop Logging ONUCheckTechProfile
99
TorstenThieme401af432020-06-11 15:53:53 +0000100Onu Port Check
TorstenThieme87cd6202020-09-09 10:01:28 +0000101 [Documentation] Validates that all the UNI ports show up in ONOS
TorstenThieme00958682020-06-19 11:29:31 +0000102 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme401af432020-06-11 15:53:53 +0000103 [Tags] onutest
104 [Setup] Start Logging ONUPortTest
105 Run Keyword If ${porttest} Do Onu Port Check
TorstenThieme5a205ba2020-09-29 08:08:29 +0000106 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme5e324e42020-07-27 09:36:16 +0000107 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme401af432020-06-11 15:53:53 +0000108 ... AND Stop Logging ONUPortTest
109
TorstenThieme109683b2020-09-24 12:35:41 +0000110Onu Flow Check
111 [Documentation] Validates the onu flows in ONOS and Voltha
112 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
113 [Tags] onutest
114 [Setup] Start Logging ONUFlowTest
115 Run Keyword If ${state2test}>=6 and ${flowtest} Do Onu Flow Check
TorstenThieme5a205ba2020-09-29 08:08:29 +0000116 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme109683b2020-09-24 12:35:41 +0000117 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
118 ... AND Stop Logging ONUFlowTest
119
TorstenThiemee3841a02020-09-23 08:20:43 +0000120Disable Enable Onu Device
121 [Documentation] Disables/enables ONU Device and check states
122 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
123 [Tags] onutest
124 [Setup] Start Logging DisableEnableONUDevice
125 Run Keyword If ${state2test}>=5 and ${disableenabletest} Do Disable Enable Onu Test
TorstenThieme5a205ba2020-09-29 08:08:29 +0000126 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee3841a02020-09-23 08:20:43 +0000127 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
128 ... AND Stop Logging DisableEnableONUDevice
129
TorstenThieme015d5c02020-09-11 09:53:34 +0000130Reconcile Onu Device
131 [Documentation] Reconciles ONU Device and check state
132 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
133 [Tags] onutest
134 [Setup] Start Logging ReconcileONUDevice
135 Run Keyword If ${state2test}>=5 and ${reconciletest} Do Reconcile Onu Device
TorstenThieme5a205ba2020-09-29 08:08:29 +0000136 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme015d5c02020-09-11 09:53:34 +0000137 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
138 ... AND Stop Logging ReconcileONUDevice
139
TorstenThieme1619db22020-04-03 12:01:15 +0000140*** Keywords ***
141Setup Suite
142 [Documentation] Set up the test suite
TorstenThieme87cd6202020-09-09 10:01:28 +0000143 ${LogInfo}= Catenate
144 ... \r\nPassed arguments:
145 ... state2test:${state2test}, testmode:${testmode}, profiletest:${profiletest}, techprofile:${techprofile},
146 ... porttest:${porttest}, flowtest:${flowtest}, reconciletest:${reconciletest},
TorstenThiemee3841a02020-09-23 08:20:43 +0000147 ... disableenabletest:${disableenabletest},
TorstenThieme015d5c02020-09-11 09:53:34 +0000148 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThieme87cd6202020-09-09 10:01:28 +0000149 Log ${LogInfo} console=yes
TorstenThieme1619db22020-04-03 12:01:15 +0000150 Common Test Suite Setup
TorstenThieme5a205ba2020-09-29 08:08:29 +0000151 # prepare skip message in yellow for console log
152 ${skip}= Evaluate "\\033[33mSKIP\\033[0m"
153 ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
154 ${skip_message} Catenate ${skipped} | ${skip} |
155 Set Suite Variable ${skip_message}
TorstenThieme1619db22020-04-03 12:01:15 +0000156 Run Keyword If ${num_onus}>4 Calculate Timeout
TorstenThieme1488d772020-09-28 10:52:43 +0000157 ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000158 Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM)
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000159 ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM
160 ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM
161 ... ELSE Fail The TechProfile (${techprofile}) is not valid!
162 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
163 Set Suite Variable ${onos_ssh_connection}
TorstenThieme1619db22020-04-03 12:01:15 +0000164
TorstenThiemeb41007d2020-06-22 12:14:12 +0000165Teardown Suite
166 [Documentation] Replaces the Suite Teardown in utils.robot.
167 ... Cleans up and checks all ONU ports disabled in ONOS.
168 ... Furthermore gives the possibility to pause the execution.
169 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
170 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
TorstenThieme87cd6202020-09-09 10:01:28 +0000171 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
TorstenThiemeb41007d2020-06-22 12:14:12 +0000172 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000173 # Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM
174 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
175 Close ONOS SSH Connection ${onos_ssh_connection}
TorstenThieme87cd6202020-09-09 10:01:28 +0000176 Remove Tech Profile
TorstenThiemeb41007d2020-06-22 12:14:12 +0000177
TorstenThieme1619db22020-04-03 12:01:15 +0000178Setup Test
179 [Documentation] Pre-test Setup
180 #test for empty device list
181 Test Empty Device List
182 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700183 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +0000184 Run Keyword If ${has_dataplane} Sleep 60s
185 #create/preprovision device
186 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
187 Set Suite Variable ${olt_device_id}
188 #validate olt states
189 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
190 ... ${olt_device_id}
191 Sleep 5s
192
193Calculate Timeout
194 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
195 ${timeout} Fetch From Left ${timeout} s
196 ${timeout}= evaluate ${timeout}+((${num_onus}-4)*30)
TorstenThieme401af432020-06-11 15:53:53 +0000197 ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000198 ${timeout}= Catenate SEPARATOR= ${timeout} s
199 Set Suite Variable ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000200
201Do ONU Up To State Test
202 [Documentation] This keyword performs Up2State Test
203 ... All states up to the passed have to be checked
204 FOR ${I} IN RANGE 0 ${num_onus}
205 ${src}= Set Variable ${hosts.src[${I}]}
206 ${dst}= Set Variable ${hosts.dst[${I}]}
207 Run Keyword If ${state2test}>=1
208 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
209 ... Validate Device ENABLED ACTIVATING REACHABLE
210 ... ${src['onu']} onu=True onu_reason=activating-onu
211 Run Keyword If ${state2test}>=2
212 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
213 ... Validate Device ENABLED ACTIVATING REACHABLE
214 ... ${src['onu']} onu=True onu_reason=starting-openomci
215 Run Keyword If ${state2test}>=3
216 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
217 ... Validate Device ENABLED ACTIVATING REACHABLE
218 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
219 Run Keyword If ${state2test}>=4
220 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
221 ... Validate Device ENABLED ACTIVE REACHABLE
222 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
223 Run Keyword If ${state2test}>=5
224 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
225 ... Validate Device ENABLED ACTIVE REACHABLE
226 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
227 Run Keyword If ${state2test}>=6
228 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
229 ... Validate Device ENABLED ACTIVE REACHABLE
230 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
231 END
232
233Do ONU Single State Test
234 [Documentation] This keyword performs SingleState Test
235 ... Only the passed state has to be checked
236 FOR ${I} IN RANGE 0 ${num_onus}
237 ${src}= Set Variable ${hosts.src[${I}]}
238 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme015d5c02020-09-11 09:53:34 +0000239 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state2test}
240 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
241 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
242 ... ${src['onu']} onu=True onu_reason=${onu_state}
TorstenThieme1619db22020-04-03 12:01:15 +0000243 END
244
TorstenThieme94e4ae42020-05-18 13:01:42 +0000245Do ONU Single State Test Time
246 [Documentation] This keyword performs SingleState Test with calculate running time
247 ... Only the passed state has to be checked and the duration each single onu adapter needed
248 ... will be calculated and printed out
TorstenThieme17becfc2020-10-08 09:46:27 +0000249 #${ListfinishedONUs} Create List
250 #Set Global Variable ${ListfinishedONUs}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000251 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
252 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000253 Build ONU SN List ${list_onus}
TorstenThieme015d5c02020-09-11 09:53:34 +0000254 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state2test}
255 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000256 ... Validate ONU Devices MIB State With Duration
TorstenThieme015d5c02020-09-11 09:53:34 +0000257 ... ${onu_state} ${list_onus} ${timeStart} print2console=True
TorstenThieme401af432020-06-11 15:53:53 +0000258 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000259
TorstenThieme1619db22020-04-03 12:01:15 +0000260Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000261 [Documentation] Check that all the UNI ports show up in ONOS
TorstenThieme17becfc2020-10-08 09:46:27 +0000262 Wait for Ports in ONOS ${onos_ssh_connection} ${num_onus} BBSM
TorstenThieme9949b172020-06-16 10:00:15 +0000263
TorstenThieme109683b2020-09-24 12:35:41 +0000264Do Onu Flow Check
265 [Documentation] Check that all ONU flows show up in ONOS and Voltha
266 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
267 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
268 ... Get NNI Port in ONOS ${of_id}
269 FOR ${I} IN RANGE 0 ${num_onus}
270 ${src}= Set Variable ${hosts.src[${I}]}
271 ${dst}= Set Variable ${hosts.dst[${I}]}
272 ${onu_device_id}= Get Device ID From SN ${src['onu']}
273 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
274 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
275 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
276 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
277 ... volt-add-subscriber-access ${of_id} ${onu_port}
278 # Verify subscriber access flows are added for the ONU port
279 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
280 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
281 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
282 #check for previous state is kept (normally omci-flows-pushed)
283 Do Current State Test ${state2test} ${src['onu']}
284 END
285
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000286Set Tech Profile
287 [Documentation] This keyword set the passed TechProfile for the test
288 [Arguments] ${TechProfile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000289 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000290 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200291 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000292 ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json
293 ${dest}= Set Variable /tmp/flexpod.json
294 ${command} Catenate
295 ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
296 Copy File To Pod ${namespace} ${podname} ${src} ${dest}
297 Exec Pod ${namespace} ${podname} ${command}
298 ${commandget} Catenate
299 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
300 Exec Pod ${namespace} ${podname} ${commandget}
301
302Remove Tech Profile
303 [Documentation] This keyword removes TechProfile
TorstenThieme015d5c02020-09-11 09:53:34 +0000304 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000305 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200306 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000307 ${command} Catenate
308 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
309 Exec Pod ${namespace} ${podname} ${command}
310 ${commandget} Catenate
311 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
312 Exec Pod ${namespace} ${podname} ${commandget}
313
314Do Check Tech Profile
315 [Documentation] This keyword checks the loaded TechProfile
316 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200317 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000318 ${commandget} Catenate
319 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
320 ${result}= Exec Pod ${namespace} ${podname} ${commandget}
321 ${num_gem_ports}= Set Variable 1
322 ${num_gem_ports}= Set Variable If
323 ... "${techprofile}"=="default" 1
324 ... "${techprofile}"=="1T4GEM" 4
325 ... "${techprofile}"=="1T8GEM" 8
326 @{resultList} Split String ${result} separator=,
327 ${num_of_count_matches}= Get Match Count ${resultList} "num_gem_ports": ${num_gem_ports}
328 ... whitespace_insensitive=True
329 ${num_of_expected_matches}= Run Keyword If "${techprofile}"=="default" Evaluate ${num_onus}
330 ... ELSE Evaluate ${num_onus}+1
331 Run Keyword If ${num_of_expected_matches}!=${num_of_count_matches} Log To Console
332 ... \nTechProfile (${TechProfile}) not loaded correctly:${num_of_count_matches} of ${num_of_expected_matches}
TorstenThieme015d5c02020-09-11 09:53:34 +0000333
334Do Disable Enable Onu Test
335 [Documentation] This keyword disables/enables all onus and checks the states.
TorstenThieme17becfc2020-10-08 09:46:27 +0000336 [Arguments] ${state2check}=${state2test}
337 Do Current State Test All Onus ${state2check}
338 Do Disable Onu ${state2check}
339 Do Current State Test All Onus omci-admin-lock
340 Log Ports
341 #check no port is enabled in ONOS
342 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
343 Do Enable Onu tech-profile-config-download-success
344 Do Current State Test All Onus ${state2check}
345 Log Ports onlyenabled=True
346 #check that all the UNI ports show up in ONOS again
347 Wait for Ports in ONOS ${onos_ssh_connection} ${num_onus} BBSM
TorstenThieme015d5c02020-09-11 09:53:34 +0000348
349Do Reconcile Onu Device
350 [Documentation] This keyword reconciles ONU device and check the state afterwards.
351 ... Following steps will be executed:
352 ... - restart openonu adaptor
353 ... - check openonu adaptor is ready again
354 ... - check previous state is kept
355 ... - ONU-Disable
356 ... - wait some seconds
357 ... - check for state omci-admin-lock
358 ... - ONU-Enable
359 ... - wait some seconds
360 ... - check for state onu-reenabled
361 ... - port check
TorstenThieme015d5c02020-09-11 09:53:34 +0000362 ${list_openonu_apps} Create List adapter-open-onu
363 ${namespace}= Set Variable voltha
364 ${adaptorname}= Set Variable open-onu
TorstenThieme015d5c02020-09-11 09:53:34 +0000365 Kill Adaptor ${namespace} ${adaptorname}
366 Sleep 5s
367 Wait For Pods Ready ${namespace} ${list_openonu_apps}
368 Do Disable Enable Onu Test
369 Run Keyword If ${porttest} Do Onu Port Check
370
TorstenThieme17becfc2020-10-08 09:46:27 +0000371Do Disable Onu
372 [Documentation] This keyword disables all onus and checks the states.
373 [Arguments] ${state2check}
374 FOR ${I} IN RANGE 0 ${num_onus}
375 ${src}= Set Variable ${hosts.src[${I}]}
376 ${onu_device_id}= Get Device ID From SN ${src['onu']}
377 Disable Device ${onu_device_id}
378 Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id}
379 END
380
381Do Enable Onu
382 [Documentation] This keyword enables all onus and checks the states.
383 [Arguments] ${state2check}
384 FOR ${I} IN RANGE 0 ${num_onus}
385 ${src}= Set Variable ${hosts.src[${I}]}
386 ${onu_device_id}= Get Device ID From SN ${src['onu']}
387 Enable Device ${onu_device_id}
388 END
389
TorstenThieme015d5c02020-09-11 09:53:34 +0000390Do Current State Test
391 [Documentation] This keyword checks the passed state of the given onu.
392 [Arguments] ${state} ${onu}
393 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state}
394 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
395 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
396 ... ${onu} onu=True onu_reason=${onu_state}
397
TorstenThieme17becfc2020-10-08 09:46:27 +0000398Do Current State Test All Onus
399 [Documentation] This keyword checks the passed state of all onus.
400 ... Hint: ${timeStart} will be not evaluated here!
401 [Arguments] ${state}
402 ${list_onus} Create List
403 Build ONU SN List ${list_onus}
404 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state}
405 #Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
406 #... Validate ONU Devices MIB State With Duration
407 #... ${onu_state} ${list_onus} ${timeStart}
408 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
409 ... Validate ONU Devices With Duration
410 ... ${admin_state} ${oper_status} ${connect_status}
411 ... ${onu_state} ${list_onus} ${timeStart}
412Log Ports
413 [Documentation] This keyword logs all port data available in ONOS of first port per ONU
414 [Arguments] ${onlyenabled}=False
415 ${cmd} Set Variable If ${onlyenabled} ports -e ports
416 ${onu_ports}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} ${cmd}
417 ${lines} = Get Lines Matching Regexp ${onu_ports} .*portName=BBSM[0-9]{8}-1
418 Log ${lines}
419
TorstenThieme015d5c02020-09-11 09:53:34 +0000420Kill Adaptor
421 [Documentation] This keyword kills the passed adaptor.
422 [Arguments] ${namespace} ${name}
423 ${cmd} Catenate
424 ... kubectl exec -it -n voltha $(kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}')
425 ... -- /bin/sh -c "kill 1"
426 ${rc} ${output}= Run and Return Rc and Output ${cmd}
427 Log ${output}
428
429Map State
430 [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values.
431 [Arguments] ${state}
432 # create state lists with corresponding return values
433 # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE
434 ${state1} Create List ENABLED ACTIVATING REACHABLE activating-onu
435 ${state2} Create List ENABLED ACTIVATING REACHABLE starting-openomci
436 ${state3} Create List ENABLED ACTIVATING REACHABLE discovery-mibsync-complete
437 ${state4} Create List ENABLED ACTIVE REACHABLE initial-mib-downloaded
438 ${state5} Create List ENABLED ACTIVE REACHABLE tech-profile-config-download-success
439 ${state6} Create List ENABLED ACTIVE REACHABLE omci-flows-pushed
TorstenThieme17becfc2020-10-08 09:46:27 +0000440 ${state7} Create List DISABLED UNKNOWN REACHABLE omci-admin-lock
TorstenThieme015d5c02020-09-11 09:53:34 +0000441 ${state8} Create List ENABLED ACTIVE REACHABLE onu-reenabled
442 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Set Variable If
443 ... '${state}'=='1' or '${state}'=='activating-onu' ${state1}
444 ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2}
445 ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3}
446 ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4}
447 ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5}
448 ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6}
449 ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7}
450 ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8}
451 [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state}