blob: 73cef1f8b89630001bf9d2c406214392cdb10090 [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
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000140Power Off Power On Onu Device
141 [Documentation] Power off and Power on of all ONU Devices and check state
142 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
143 [Tags] onutest
144 [Setup] Start Logging PowerOffPowerOnONUDevice
145 Run Keyword If ${state2test}>=5 Do Power Off Power On Onu Device
146 ... ELSE Pass Execution ${skip_message} skipped
147 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
148 ... AND Stop Logging PowerOffPowerOnONUDevice
149
TorstenThieme1619db22020-04-03 12:01:15 +0000150*** Keywords ***
151Setup Suite
152 [Documentation] Set up the test suite
TorstenThieme87cd6202020-09-09 10:01:28 +0000153 ${LogInfo}= Catenate
154 ... \r\nPassed arguments:
155 ... state2test:${state2test}, testmode:${testmode}, profiletest:${profiletest}, techprofile:${techprofile},
156 ... porttest:${porttest}, flowtest:${flowtest}, reconciletest:${reconciletest},
TorstenThiemee3841a02020-09-23 08:20:43 +0000157 ... disableenabletest:${disableenabletest},
TorstenThieme015d5c02020-09-11 09:53:34 +0000158 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThieme87cd6202020-09-09 10:01:28 +0000159 Log ${LogInfo} console=yes
TorstenThieme1619db22020-04-03 12:01:15 +0000160 Common Test Suite Setup
TorstenThieme5a205ba2020-09-29 08:08:29 +0000161 # prepare skip message in yellow for console log
162 ${skip}= Evaluate "\\033[33mSKIP\\033[0m"
163 ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
164 ${skip_message} Catenate ${skipped} | ${skip} |
165 Set Suite Variable ${skip_message}
TorstenThieme1619db22020-04-03 12:01:15 +0000166 Run Keyword If ${num_onus}>4 Calculate Timeout
TorstenThieme1488d772020-09-28 10:52:43 +0000167 ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000168 Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM)
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000169 ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM
170 ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM
171 ... ELSE Fail The TechProfile (${techprofile}) is not valid!
172 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
173 Set Suite Variable ${onos_ssh_connection}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000174 # delete etcd MIB Template Data
175 Delete MIB Template Data
TorstenThieme1619db22020-04-03 12:01:15 +0000176
TorstenThiemeb41007d2020-06-22 12:14:12 +0000177Teardown Suite
178 [Documentation] Replaces the Suite Teardown in utils.robot.
179 ... Cleans up and checks all ONU ports disabled in ONOS.
180 ... Furthermore gives the possibility to pause the execution.
181 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
182 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
TorstenThieme87cd6202020-09-09 10:01:28 +0000183 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
TorstenThiemeb41007d2020-06-22 12:14:12 +0000184 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000185 # Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM
186 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
187 Close ONOS SSH Connection ${onos_ssh_connection}
TorstenThieme87cd6202020-09-09 10:01:28 +0000188 Remove Tech Profile
TorstenThiemeb41007d2020-06-22 12:14:12 +0000189
TorstenThieme1619db22020-04-03 12:01:15 +0000190Setup Test
191 [Documentation] Pre-test Setup
192 #test for empty device list
193 Test Empty Device List
194 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700195 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +0000196 Run Keyword If ${has_dataplane} Sleep 60s
197 #create/preprovision device
198 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
199 Set Suite Variable ${olt_device_id}
200 #validate olt states
201 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
202 ... ${olt_device_id}
203 Sleep 5s
204
205Calculate Timeout
206 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
207 ${timeout} Fetch From Left ${timeout} s
208 ${timeout}= evaluate ${timeout}+((${num_onus}-4)*30)
TorstenThieme401af432020-06-11 15:53:53 +0000209 ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000210 ${timeout}= Catenate SEPARATOR= ${timeout} s
211 Set Suite Variable ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000212
213Do ONU Up To State Test
214 [Documentation] This keyword performs Up2State Test
215 ... All states up to the passed have to be checked
216 FOR ${I} IN RANGE 0 ${num_onus}
217 ${src}= Set Variable ${hosts.src[${I}]}
218 ${dst}= Set Variable ${hosts.dst[${I}]}
219 Run Keyword If ${state2test}>=1
220 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
221 ... Validate Device ENABLED ACTIVATING REACHABLE
222 ... ${src['onu']} onu=True onu_reason=activating-onu
223 Run Keyword If ${state2test}>=2
224 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
225 ... Validate Device ENABLED ACTIVATING REACHABLE
226 ... ${src['onu']} onu=True onu_reason=starting-openomci
227 Run Keyword If ${state2test}>=3
228 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
229 ... Validate Device ENABLED ACTIVATING REACHABLE
230 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
231 Run Keyword If ${state2test}>=4
232 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
233 ... Validate Device ENABLED ACTIVE REACHABLE
234 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
235 Run Keyword If ${state2test}>=5
236 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
237 ... Validate Device ENABLED ACTIVE REACHABLE
238 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
239 Run Keyword If ${state2test}>=6
240 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
241 ... Validate Device ENABLED ACTIVE REACHABLE
242 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
243 END
244
245Do ONU Single State Test
246 [Documentation] This keyword performs SingleState Test
247 ... Only the passed state has to be checked
248 FOR ${I} IN RANGE 0 ${num_onus}
249 ${src}= Set Variable ${hosts.src[${I}]}
250 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme015d5c02020-09-11 09:53:34 +0000251 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state2test}
252 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
253 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
254 ... ${src['onu']} onu=True onu_reason=${onu_state}
TorstenThieme1619db22020-04-03 12:01:15 +0000255 END
256
TorstenThieme94e4ae42020-05-18 13:01:42 +0000257Do ONU Single State Test Time
258 [Documentation] This keyword performs SingleState Test with calculate running time
259 ... Only the passed state has to be checked and the duration each single onu adapter needed
260 ... will be calculated and printed out
TorstenThieme17becfc2020-10-08 09:46:27 +0000261 #${ListfinishedONUs} Create List
262 #Set Global Variable ${ListfinishedONUs}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000263 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
264 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000265 Build ONU SN List ${list_onus}
TorstenThieme015d5c02020-09-11 09:53:34 +0000266 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state2test}
267 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000268 ... Validate ONU Devices MIB State With Duration
TorstenThieme015d5c02020-09-11 09:53:34 +0000269 ... ${onu_state} ${list_onus} ${timeStart} print2console=True
TorstenThieme401af432020-06-11 15:53:53 +0000270 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000271
TorstenThieme1619db22020-04-03 12:01:15 +0000272Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000273 [Documentation] Check that all the UNI ports show up in ONOS
TorstenThieme17becfc2020-10-08 09:46:27 +0000274 Wait for Ports in ONOS ${onos_ssh_connection} ${num_onus} BBSM
TorstenThieme9949b172020-06-16 10:00:15 +0000275
TorstenThieme109683b2020-09-24 12:35:41 +0000276Do Onu Flow Check
277 [Documentation] Check that all ONU flows show up in ONOS and Voltha
278 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
279 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
280 ... Get NNI Port in ONOS ${of_id}
281 FOR ${I} IN RANGE 0 ${num_onus}
282 ${src}= Set Variable ${hosts.src[${I}]}
283 ${dst}= Set Variable ${hosts.dst[${I}]}
284 ${onu_device_id}= Get Device ID From SN ${src['onu']}
285 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
286 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
287 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
288 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
289 ... volt-add-subscriber-access ${of_id} ${onu_port}
290 # Verify subscriber access flows are added for the ONU port
291 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
292 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
293 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
294 #check for previous state is kept (normally omci-flows-pushed)
295 Do Current State Test ${state2test} ${src['onu']}
296 END
297
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000298Set Tech Profile
299 [Documentation] This keyword set the passed TechProfile for the test
300 [Arguments] ${TechProfile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000301 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000302 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200303 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000304 ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json
305 ${dest}= Set Variable /tmp/flexpod.json
306 ${command} Catenate
307 ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
308 Copy File To Pod ${namespace} ${podname} ${src} ${dest}
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
314Remove Tech Profile
315 [Documentation] This keyword removes TechProfile
TorstenThieme015d5c02020-09-11 09:53:34 +0000316 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000317 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200318 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000319 ${command} Catenate
320 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
321 Exec Pod ${namespace} ${podname} ${command}
322 ${commandget} Catenate
323 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
324 Exec Pod ${namespace} ${podname} ${commandget}
325
326Do Check Tech Profile
327 [Documentation] This keyword checks the loaded TechProfile
328 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200329 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000330 ${commandget} Catenate
331 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
332 ${result}= Exec Pod ${namespace} ${podname} ${commandget}
333 ${num_gem_ports}= Set Variable 1
334 ${num_gem_ports}= Set Variable If
335 ... "${techprofile}"=="default" 1
336 ... "${techprofile}"=="1T4GEM" 4
337 ... "${techprofile}"=="1T8GEM" 8
338 @{resultList} Split String ${result} separator=,
339 ${num_of_count_matches}= Get Match Count ${resultList} "num_gem_ports": ${num_gem_ports}
340 ... whitespace_insensitive=True
341 ${num_of_expected_matches}= Run Keyword If "${techprofile}"=="default" Evaluate ${num_onus}
342 ... ELSE Evaluate ${num_onus}+1
343 Run Keyword If ${num_of_expected_matches}!=${num_of_count_matches} Log To Console
344 ... \nTechProfile (${TechProfile}) not loaded correctly:${num_of_count_matches} of ${num_of_expected_matches}
TorstenThieme015d5c02020-09-11 09:53:34 +0000345
346Do Disable Enable Onu Test
347 [Documentation] This keyword disables/enables all onus and checks the states.
TorstenThieme17becfc2020-10-08 09:46:27 +0000348 [Arguments] ${state2check}=${state2test}
349 Do Current State Test All Onus ${state2check}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000350 Do Disable Onu Device
TorstenThieme17becfc2020-10-08 09:46:27 +0000351 Do Current State Test All Onus omci-admin-lock
352 Log Ports
353 #check no port is enabled in ONOS
354 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000355 Do Enable Onu Device
TorstenThieme17becfc2020-10-08 09:46:27 +0000356 Do Current State Test All Onus ${state2check}
357 Log Ports onlyenabled=True
358 #check that all the UNI ports show up in ONOS again
359 Wait for Ports in ONOS ${onos_ssh_connection} ${num_onus} BBSM
TorstenThieme015d5c02020-09-11 09:53:34 +0000360
361Do Reconcile Onu Device
362 [Documentation] This keyword reconciles ONU device and check the state afterwards.
363 ... Following steps will be executed:
364 ... - restart openonu adaptor
365 ... - check openonu adaptor is ready again
366 ... - check previous state is kept
367 ... - ONU-Disable
368 ... - wait some seconds
369 ... - check for state omci-admin-lock
370 ... - ONU-Enable
371 ... - wait some seconds
372 ... - check for state onu-reenabled
373 ... - port check
TorstenThieme015d5c02020-09-11 09:53:34 +0000374 ${list_openonu_apps} Create List adapter-open-onu
375 ${namespace}= Set Variable voltha
376 ${adaptorname}= Set Variable open-onu
TorstenThieme015d5c02020-09-11 09:53:34 +0000377 Kill Adaptor ${namespace} ${adaptorname}
378 Sleep 5s
379 Wait For Pods Ready ${namespace} ${list_openonu_apps}
380 Do Disable Enable Onu Test
381 Run Keyword If ${porttest} Do Onu Port Check
382
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000383Do Power Off Power On Onu Device
384 [Documentation] This keyword power off/on all onus and checks the states.
385 Do Power Off ONU Device
386 Sleep 5s
387 Do Current State Test All Onus stopping-openomci
388 Do Power On ONU Device
389 Do Current State Test All Onus ${state2test}
390
391Do Disable Onu Device
392 [Documentation] This keyword disables all onus.
TorstenThieme17becfc2020-10-08 09:46:27 +0000393 FOR ${I} IN RANGE 0 ${num_onus}
394 ${src}= Set Variable ${hosts.src[${I}]}
395 ${onu_device_id}= Get Device ID From SN ${src['onu']}
396 Disable Device ${onu_device_id}
397 Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id}
398 END
399
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000400Do Enable Onu Device
401 [Documentation] This keyword enables all onus.
TorstenThieme17becfc2020-10-08 09:46:27 +0000402 FOR ${I} IN RANGE 0 ${num_onus}
403 ${src}= Set Variable ${hosts.src[${I}]}
404 ${onu_device_id}= Get Device ID From SN ${src['onu']}
405 Enable Device ${onu_device_id}
406 END
407
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000408Do Power Off ONU Device
409 [Documentation] This keyword power off all onus.
410 ${namespace}= Set Variable voltha
411 FOR ${I} IN RANGE 0 ${num_onus}
412 ${src}= Set Variable ${hosts.src[${I}]}
413 ${result}= Exec Pod ${namespace} bbsim bbsimctl onu shutdown ${src['onu']}
414 Should Contain ${result} successfully msg=Can not shutdown ${src['onu']} values=False
415 END
416
417Do Power On ONU Device
418 [Documentation] This keyword power on all onus.
419 ${namespace}= Set Variable voltha
420 FOR ${I} IN RANGE 0 ${num_onus}
421 ${src}= Set Variable ${hosts.src[${I}]}
422 ${result}= Exec Pod ${namespace} bbsim bbsimctl onu poweron ${src['onu']}
423 Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
424 END
425
TorstenThieme015d5c02020-09-11 09:53:34 +0000426Do Current State Test
427 [Documentation] This keyword checks the passed state of the given onu.
428 [Arguments] ${state} ${onu}
429 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state}
430 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
431 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
432 ... ${onu} onu=True onu_reason=${onu_state}
433
TorstenThieme17becfc2020-10-08 09:46:27 +0000434Do Current State Test All Onus
435 [Documentation] This keyword checks the passed state of all onus.
436 ... Hint: ${timeStart} will be not evaluated here!
437 [Arguments] ${state}
438 ${list_onus} Create List
439 Build ONU SN List ${list_onus}
440 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state}
TorstenThieme17becfc2020-10-08 09:46:27 +0000441 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
442 ... Validate ONU Devices With Duration
443 ... ${admin_state} ${oper_status} ${connect_status}
444 ... ${onu_state} ${list_onus} ${timeStart}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000445
TorstenThieme17becfc2020-10-08 09:46:27 +0000446Log Ports
447 [Documentation] This keyword logs all port data available in ONOS of first port per ONU
448 [Arguments] ${onlyenabled}=False
449 ${cmd} Set Variable If ${onlyenabled} ports -e ports
450 ${onu_ports}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} ${cmd}
451 ${lines} = Get Lines Matching Regexp ${onu_ports} .*portName=BBSM[0-9]{8}-1
452 Log ${lines}
453
TorstenThieme015d5c02020-09-11 09:53:34 +0000454Kill Adaptor
455 [Documentation] This keyword kills the passed adaptor.
456 [Arguments] ${namespace} ${name}
457 ${cmd} Catenate
458 ... kubectl exec -it -n voltha $(kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}')
459 ... -- /bin/sh -c "kill 1"
460 ${rc} ${output}= Run and Return Rc and Output ${cmd}
461 Log ${output}
462
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000463Delete MIB Template Data
464 [Documentation] This keyword deletes MIB Template Data stored in etcd
465 ${namespace}= Set Variable default
466 ${podname}= Set Variable etcd
467 ${commanddel} Catenate
468 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/omci_mibs/go_templates/'
469 ${result}= Exec Pod ${namespace} ${podname} ${commanddel}
470 Sleep 3s
471 ${commandget} Catenate
472 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
473 ${result}= Exec Pod ${namespace} ${podname} ${commandget}
474 Should Be Empty ${result} Could not delete MIB Template Data stored in etcd!
475
TorstenThieme015d5c02020-09-11 09:53:34 +0000476Map State
477 [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values.
478 [Arguments] ${state}
479 # create state lists with corresponding return values
480 # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE
481 ${state1} Create List ENABLED ACTIVATING REACHABLE activating-onu
482 ${state2} Create List ENABLED ACTIVATING REACHABLE starting-openomci
483 ${state3} Create List ENABLED ACTIVATING REACHABLE discovery-mibsync-complete
484 ${state4} Create List ENABLED ACTIVE REACHABLE initial-mib-downloaded
485 ${state5} Create List ENABLED ACTIVE REACHABLE tech-profile-config-download-success
486 ${state6} Create List ENABLED ACTIVE REACHABLE omci-flows-pushed
TorstenThieme17becfc2020-10-08 09:46:27 +0000487 ${state7} Create List DISABLED UNKNOWN REACHABLE omci-admin-lock
TorstenThieme015d5c02020-09-11 09:53:34 +0000488 ${state8} Create List ENABLED ACTIVE REACHABLE onu-reenabled
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000489 ${state9} Create List ENABLED DISCOVERED UNREACHABLE stopping-openomci
TorstenThieme015d5c02020-09-11 09:53:34 +0000490 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Set Variable If
491 ... '${state}'=='1' or '${state}'=='activating-onu' ${state1}
492 ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2}
493 ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3}
494 ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4}
495 ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5}
496 ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6}
497 ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7}
498 ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000499 ... '${state}'=='9' or '${state}'=='stopping-openomci' ${state9}
TorstenThieme015d5c02020-09-11 09:53:34 +0000500 [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state}