blob: 41f598e38472eb4bf86d8d61577021a5cee2c720 [file] [log] [blame]
TorstenThiemed4f48962020-12-08 12:17:19 +00001# Copyright 2020 - present Open Networking Foundation
TorstenThiemefd7e7ba2020-11-06 13:57:57 +00002#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000014
15*** Settings ***
16Documentation Library for various openonu-go-adpter utilities
17
TorstenThiemed4f48962020-12-08 12:17:19 +000018*** Variables ***
19${defaultstackname} minimal
20
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000021*** Keywords ***
TorstenThieme440b7c02020-12-18 15:42:57 +000022Calculate Timeout
23 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
24 [Arguments] ${basetimeout}=60s
25 ${new_timeout} Fetch From Left ${basetimeout} s
26 ${new_timeout}= evaluate ${new_timeout}+((${num_all_onus}-4)*10)
27 ${new_timeout}= Set Variable If (not ${debugmode}) and (${new_timeout}>300)
28 ... 300 ${new_timeout}
29 ${new_timeout}= Catenate SEPARATOR= ${new_timeout} s
30 [Return] ${new_timeout}
31
32Power On ONU Device
33 [Documentation] This keyword turns on the power for all onus.
34 [Arguments] ${namespace}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000035 FOR ${I} IN RANGE 0 ${num_all_onus}
36 ${src}= Set Variable ${hosts.src[${I}]}
Holger Hildebrandt23147742020-11-16 10:13:21 +000037 ${result}= Exec Pod In Kube ${namespace} bbsim bbsimctl onu poweron ${src['onu']}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000038 Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
39 END
40
TorstenThieme440b7c02020-12-18 15:42:57 +000041Power Off ONU Device
42 [Documentation] This keyword turns off the power for all onus.
43 [Arguments] ${namespace}
44 FOR ${I} IN RANGE 0 ${num_all_onus}
45 ${src}= Set Variable ${hosts.src[${I}]}
46 ${result}= Exec Pod In Kube ${namespace} bbsim bbsimctl onu shutdown ${src['onu']}
47 Should Contain ${result} successfully msg=Can not shutdown ${src['onu']} values=False
48 END
49
50Current State Test
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000051 [Documentation] This keyword checks the passed state of the given onu.
52 [Arguments] ${state} ${onu} ${reqadminstate}=${EMPTY} ${reqoperstatus}=${EMPTY}
53 ... ${reqconnectstatus}=${EMPTY}
54 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State ${state}
55 ${admin_state}= Set Variable If '${reqadminstate}'!='${EMPTY}' ${reqadminstate} ${admin_state}
56 ${oper_status}= Set Variable If '${reqoperstatus}'!='${EMPTY}' ${reqoperstatus} ${oper_status}
57 ${connect_status}= Set Variable If '${reqconnectstatus}'!='${EMPTY}' ${reqconnectstatus}
58 ... ${connect_status}
59 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
60 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
61 ... ${onu} onu=True onu_reason=${onu_state}
62
TorstenThieme440b7c02020-12-18 15:42:57 +000063Current State Test All Onus
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000064 [Documentation] This keyword checks the passed state of all onus.
65 ... Hint: ${timeStart} will be not evaluated here!
66 [Arguments] ${state} ${reqadminstate}=${EMPTY} ${reqoperstatus}=${EMPTY} ${reqconnectstatus}=${EMPTY}
67 ... ${alternativeonustate}=${EMPTY}
TorstenThieme440b7c02020-12-18 15:42:57 +000068 ${timeStart}= Get Current Date
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000069 ${list_onus} Create List
70 Build ONU SN List ${list_onus}
71 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State ${state}
72 ${admin_state}= Set Variable If '${reqadminstate}'!='${EMPTY}' ${reqadminstate} ${admin_state}
73 ${oper_status}= Set Variable If '${reqoperstatus}'!='${EMPTY}' ${reqoperstatus} ${oper_status}
74 ${connect_status}= Set Variable If '${reqconnectstatus}'!='${EMPTY}' ${reqconnectstatus}
75 ... ${connect_status}
76 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
77 ... Validate ONU Devices With Duration
78 ... ${admin_state} ${oper_status} ${connect_status}
TorstenThieme52ef8392020-11-10 13:42:26 +000079 ... ${onu_state} ${list_onus} ${timeStart} alternate_reason=${alternativeonustate}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000080
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000081Log Ports
82 [Documentation] This keyword logs all port data available in ONOS of first port per ONU
83 [Arguments] ${onlyenabled}=False
84 ${cmd} Set Variable If ${onlyenabled} ports -e ports
85 ${onu_ports}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} ${cmd}
86 ${lines} = Get Lines Matching Regexp ${onu_ports} .*portName=BBSM[0-9]{8}-1
87 Log ${lines}
88
89Kill Adaptor
90 [Documentation] This keyword kills the passed adaptor.
91 [Arguments] ${namespace} ${name}
92 ${cmd} Catenate
93 ... kubectl exec -it -n voltha $(kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}')
94 ... -- /bin/sh -c "kill 1"
95 ${rc} ${output}= Run and Return Rc and Output ${cmd}
96 Log ${output}
97
TorstenThieme440b7c02020-12-18 15:42:57 +000098Kill And Check Onu Adaptor
99 [Documentation] This keyword kills ONU Adaptor and waits for it to come up again
100 ... Following steps will be executed:
101 ... - kill openonu adaptor
102 ... - check openonu adaptor is ready again
103 [Arguments] ${namespace}
104 ${list_openonu_apps} Create List adapter-open-onu
105 ${adaptorname}= Set Variable open-onu
106 Kill Adaptor ${namespace} ${adaptorname}
107 Sleep 5s
108 Wait For Pods Ready ${namespace} ${list_openonu_apps}
109
110Restart And Check Onu Adaptor
111 [Documentation] This keyword restarts ONU Adaptor and waits for it to come up again
112 ... Following steps will be executed:
113 ... - restart openonu adaptor
114 ... - check openonu adaptor is ready again
115 [Arguments] ${namespace}
116 ${list_openonu_apps} Create List adapter-open-onu
117 ${adaptorname}= Set Variable open-onu
118 Restart Pod ${namespace} ${adaptorname}
119 Sleep 5s
120 Wait For Pods Ready ${namespace} ${list_openonu_apps}
121
122Disable Onu Device
123 [Documentation] This keyword disables all onus.
124 FOR ${I} IN RANGE 0 ${num_all_onus}
125 ${src}= Set Variable ${hosts.src[${I}]}
126 ${onu_device_id}= Get Device ID From SN ${src['onu']}
127 Disable Device ${onu_device_id}
128 Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id}
129 END
130
131Enable Onu Device
132 [Documentation] This keyword enables all onus.
133 FOR ${I} IN RANGE 0 ${num_all_onus}
134 ${src}= Set Variable ${hosts.src[${I}]}
135 ${onu_device_id}= Get Device ID From SN ${src['onu']}
136 Enable Device ${onu_device_id}
137 END
138
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000139Verify MIB Template Data Available
140 [Documentation] This keyword verifies MIB Template Data stored in etcd
141 ${namespace}= Set Variable default
TorstenThiemed4f48962020-12-08 12:17:19 +0000142 ${podname}= Set Variable etcd
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000143 ${commandget} Catenate
Matteo Scandolo341b9372020-12-09 14:15:06 -0800144 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000145 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000146 Should Not Be Empty ${result} No MIB Template Data stored in etcd!
147
148Delete MIB Template Data
149 [Documentation] This keyword deletes MIB Template Data stored in etcd
150 ${namespace}= Set Variable default
151 ${podname}= Set Variable etcd
152 ${commanddel} Catenate
Matteo Scandolo341b9372020-12-09 14:15:06 -0800153 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/omci_mibs/go_templates/'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000154 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commanddel}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000155 Sleep 3s
156 ${commandget} Catenate
Matteo Scandolo341b9372020-12-09 14:15:06 -0800157 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000158 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000159 Should Be Empty ${result} Could not delete MIB Template Data stored in etcd!
160
TorstenThieme440b7c02020-12-18 15:42:57 +0000161Set Tech Profile
162 [Documentation] This keyword sets the passed TechProfile for the test
163 [Arguments] ${TechProfile}
164 Log To Console \nTechProfile:${TechProfile}
165 ${namespace}= Set Variable default
166 ${podname}= Set Variable etcd
167 ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json
168 ${dest}= Set Variable /tmp/flexpod.json
169 ${command} Catenate
170 ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
171 Copy File To Pod ${namespace} ${podname} ${src} ${dest}
172 Exec Pod In Kube ${namespace} ${podname} ${command}
173 ${commandget} Catenate
174 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
175 Exec Pod In Kube ${namespace} ${podname} ${commandget}
176
177Remove Tech Profile
178 [Documentation] This keyword removes TechProfile
179 Log To Console \nTechProfile:${TechProfile}
180 ${namespace}= Set Variable default
181 ${podname}= Set Variable etcd
182 ${command} Catenate
183 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
184 Exec Pod In Kube ${namespace} ${podname} ${command}
185 ${commandget} Catenate
186 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
187 Exec Pod In Kube ${namespace} ${podname} ${commandget}
188
TorstenThieme17756ea2020-11-11 14:09:47 +0000189Validate Onu Data In Etcd
190 [Documentation] This keyword validates openonu-go-adapter Data stored in etcd.
191 ... It checks unique of serial_number and combination of pon, onu and uni in tp_path.
192 ... Furthermore it evaluates the values of onu_id and uni_id with values read from tp_path.
193 ... Number of etcd entries has to match with the passed number.
194 [Arguments] ${nbofetcddata}=${num_all_onus}
TorstenThiemed4f48962020-12-08 12:17:19 +0000195 ${stackname}= Get Stack Name
TorstenThieme17756ea2020-11-11 14:09:47 +0000196 ${etcddata}= Get ONU Go Adapter ETCD Data
TorstenThiemed4f48962020-12-08 12:17:19 +0000197 ${etcddata}= Remove Lines Containing String ${etcddata} service/${stackname}/openonu \n
TorstenThieme17756ea2020-11-11 14:09:47 +0000198 #prepare result for json convert
199 ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata}
200 ${jsondata}= To Json ${result}
201 ${length}= Get Length ${jsondata}
202 log ${jsondata}
203 Run Keyword And Continue On Failure Should Be Equal As Integers ${length} ${nbofetcddata}
204 ... msg=Number etcd data (${length}) does not match required (${nbofetcddata})!
205 ${pononuuniidlist}= Create List
206 ${serialnumberlist}= Create List
207 FOR ${INDEX} IN RANGE 0 ${length}
208 ${value}= Get From List ${jsondata} ${INDEX}
Girish Gowdra97f8d062020-11-17 15:48:23 -0800209 # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow.
210 # When testing multi-tcont this may need some adjustment.
211 ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64
TorstenThieme17756ea2020-11-11 14:09:47 +0000212 ${pononuuniid}= Read Pon Onu Uni String ${tp_path}
213 ${list_id}= Get Index From List ${pononuuniidlist} ${pononuuniid}
214 Should Be Equal As Integers ${list_id} -1
215 ... msg=Combination of Pon, Onu and Uni (${pononuuniid}) exist multiple in etcd data!
216 Append To List ${pononuuniidlist} ${pononuuniid}
217 Validate Onu Id ${value}
218 Validate Uni Id ${value}
219 ${serial_number}= Get From Dictionary ${value} serial_number
220 ${list_id}= Get Index From List ${serialnumberlist} ${serial_number}
221 Should Be Equal As Integers ${list_id} -1
222 ... msg=Serial number (${serial_number}) exists multiple in etcd data!
223 Append To List ${serialnumberlist} ${serial_number}
224 END
225
TorstenThieme52ef8392020-11-10 13:42:26 +0000226Validate Vlan Rules In Etcd
227 [Documentation] This keyword validates Vlan rules of openonu-go-adapter Data stored in etcd.
228 ... It checks the given number of cookie_slice, match_vid (=4096) and set_vid.
229 ... Furthermore it returns a list of all set_vid.
230 ... In case of a passed dictionary containing set_vids these will be checked for to
231 ... current set-vid depending on setvidequal (True=equal, False=not equal).
232 [Arguments] ${nbofcookieslice}=1 ${reqmatchvid}=4096 ${prevvlanrules}=${NONE} ${setvidequal}=False
TorstenThiemed4f48962020-12-08 12:17:19 +0000233 ${stackname}= Get Stack Name
TorstenThieme52ef8392020-11-10 13:42:26 +0000234 ${etcddata}= Get ONU Go Adapter ETCD Data
TorstenThiemed4f48962020-12-08 12:17:19 +0000235 ${etcddata}= Remove Lines Containing String ${etcddata} service/${stackname}/openonu \n
TorstenThieme52ef8392020-11-10 13:42:26 +0000236 #prepare result for json convert
237 ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata}
238 ${jsondata}= To Json ${result}
239 ${length}= Get Length ${jsondata}
240 log ${jsondata}
241 ${vlan_rules}= Create Dictionary
242 FOR ${INDEX} IN RANGE 0 ${length}
243 ${value}= Get From List ${jsondata} ${INDEX}
Girish Gowdra295c1692020-11-19 10:51:53 -0800244 # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow.
245 # When testing multi-tcont this may need some adjustment.
246 ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64
TorstenThieme52ef8392020-11-10 13:42:26 +0000247 ${pononuuniid}= Read Pon Onu Uni String ${tp_path}
248 ${cookieslice}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]} cookie_slice
249 #@{cookieslicelist}= Split String ${cookieslice} ,
250 ${foundcookieslices}= Get Length ${cookieslice}
251 Should Be Equal As Integers ${foundcookieslices} ${nbofcookieslice}
252 ${matchvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']}
253 ... match_vid
254 Should Be Equal As Integers ${matchvid} ${reqmatchvid}
255 ${setvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']}
256 ... set_vid
257 ${evalresult}= Evaluate 2 <= ${setvid} <= 4095
258 Should Be True ${evalresult} msg=set_vid out of range (${setvid})!
259 Set To Dictionary ${vlan_rules} ${pononuuniid} ${setvid}
260 ${oldsetvidvalid} Set Variable If ${prevvlanrules} is ${NONE} False True
261 ${prevsetvid}= Set Variable If ${oldsetvidvalid} ${prevvlanrules['${pononuuniid}']}
262 Run Keyword If ${oldsetvidvalid} and ${setvidequal}
263 ... Should Be Equal As Integers ${prevsetvid} ${setvid}
264 ... ELSE IF ${oldsetvidvalid} and not ${setvidequal}
265 ... Should Not Be Equal As Integers ${prevsetvid} ${setvid}
266 END
TorstenThieme440b7c02020-12-18 15:42:57 +0000267 log Many ${vlan_rules}
TorstenThieme52ef8392020-11-10 13:42:26 +0000268 [Return] ${vlan_rules}
269
270Get ONU Go Adapter ETCD Data
271 [Documentation] This keyword delivers openonu-go-adapter Data stored in etcd
272 ${namespace}= Set Variable default
273 ${podname}= Set Variable etcd
TorstenThiemed4f48962020-12-08 12:17:19 +0000274 ${stackname}= Get Stack Name
TorstenThieme52ef8392020-11-10 13:42:26 +0000275 ${commandget} Catenate
TorstenThiemed4f48962020-12-08 12:17:19 +0000276 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix --prefix service/${stackname}/openonu'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000277 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThieme52ef8392020-11-10 13:42:26 +0000278 log ${result}
279 [Return] ${result}
280
281Prepare ONU Go Adapter ETCD Data For Json
282 [Documentation] This keyword prepares openonu-go-adapter Data stored in etcd for converting
283 ... to json
284 [Arguments] ${etcddata}
285 #prepare result for json convert
286 ${prepresult}= Replace String ${etcddata} \n ,
287 ${prepresult}= Strip String ${prepresult} mode=right characters=,
288 ${prepresult}= Set Variable [${prepresult}]
289 log ${prepresult}
290 [Return] ${prepresult}
291
292Remove Lines Containing String
293 [Documentation] This keyword deletes all lines from given string containing passed remove string
294 [Arguments] ${string} ${toremove} ${appendtoremoveline}
295 ${lines}= Get Lines Containing String ${string} ${toremove}
296 ${length}= Get Line Count ${lines}
297 ${firstline}= Set Variable False
298 FOR ${INDEX} IN RANGE 0 ${length}
299 ${String2remove} Get Line ${lines} ${INDEX}
300 ${String2remove} Set Variable ${String2remove}${appendtoremoveline}
301 ${string}= Remove String ${string} ${String2remove}
302 END
303 log ${string}
304 [Return] ${string}
305
306Read Pon Onu Uni String
307 [Documentation] This keyword builds a thre digit string using Pon, Onu and Uni value of given tp-path taken
308 ... taken from etcd data of onu go adapter
309 [Arguments] ${tp_path}
TorstenThieme52ef8392020-11-10 13:42:26 +0000310 ${tppathlines}= Replace String ${tp_path} / \n
311 ${pon}= Get Value Of Tp Path Element ${tppathlines} pon
312 ${onu}= Get Value Of Tp Path Element ${tppathlines} onu
313 ${uni}= Get Value Of Tp Path Element ${tppathlines} uni
314 ${valuesid}= Set Variable ${pon}/${onu}/${uni}
315 log ${valuesid}
316 [Return] ${valuesid}
317
318Get Value Of Tp Path Element
TorstenThieme17756ea2020-11-11 14:09:47 +0000319 [Documentation] This keyword delivers numeric value of given tp path element.
TorstenThieme52ef8392020-11-10 13:42:26 +0000320 [Arguments] ${tp_path_lines} ${element}
321 ${value}= Get Lines Containing String ${tp_path_lines} ${element}-\{
322 ${value}= Remove String ${value} ${element}-\{
323 ${value}= Remove String ${value} \}
324 log ${value}
325 [Return] ${value}
326
TorstenThieme17756ea2020-11-11 14:09:47 +0000327Validate Onu Id
328 [Documentation] This keyword validates ONU Id of passed etcd data.
329 [Arguments] ${value}
Girish Gowdra295c1692020-11-19 10:51:53 -0800330 # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow.
331 # When testing multi-tcont this may need some adjustment.
332 ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64
TorstenThieme17756ea2020-11-11 14:09:47 +0000333 ${tppathlines}= Replace String ${tp_path} / \n
334 ${onu}= Get Value Of Tp Path Element ${tppathlines} onu
335 ${onu_id}= Get From Dictionary ${value} onu_id
336 Should Be Equal As Integers ${onu} ${onu_id}
337 ... msg=Onu-Id (${onu_id}) does not match onu (${onu}) from tp_path in etcd data!
338 Should Be True ${onu_id}>=1
339
340Validate Uni Id
341 [Documentation] This keyword validates UNI Id of passed etcd data.
342 [Arguments] ${value}
Girish Gowdra295c1692020-11-19 10:51:53 -0800343 # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow.
344 # When testing multi-tcont this may need some adjustment.
345 ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64
TorstenThieme17756ea2020-11-11 14:09:47 +0000346 ${tppathlines}= Replace String ${tp_path} / \n
347 ${uni}= Get Value Of Tp Path Element ${tppathlines} uni
348 ${uni_id}= Get From Dictionary ${value['uni_config'][0]} uni_id
349 Should Be Equal As Integers ${uni} ${uni_id}
350 ... msg=Uni-Id (${uni_id}) does not match onu (${uni}) from tp_path in etcd data!
TorstenThieme52ef8392020-11-10 13:42:26 +0000351
TorstenThiemed4f48962020-12-08 12:17:19 +0000352Get Stack Name
353 [Documentation] This keyword delivers the stack name read from environment variable NAME if present.
354 ${env_name}= Get Environment Variable NAME default=${defaultstackname}
355 # while Get Environment Variable does not work correctly, a manual correction follows
356 ${env_name}= Set Variable If "${env_name}"=="${EMPTY}" ${defaultstackname} ${env_name}
357 [Return] ${env_name}
358
359Wait for Ports in ONOS for all OLTs
TorstenThieme440b7c02020-12-18 15:42:57 +0000360 [Documentation] Waits untill a certain number of ports are enabled in all OLTs
TorstenThiemed4f48962020-12-08 12:17:19 +0000361 [Arguments] ${onos_ssh_connection} ${count} ${filter} ${max_wait_time}=10m
362 FOR ${J} IN RANGE 0 ${num_olts}
363 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
364 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
365 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
366 ... ${olt_serial_number}
367 Set Global Variable ${of_id}
368 Wait for Ports in ONOS ${onos_ssh_connection} ${count} ${of_id} BBSM ${max_wait_time}
369 END
370
TorstenThieme440b7c02020-12-18 15:42:57 +0000371Wait for all ONU Ports in ONOS Disabled
372 [Documentation] Waits untill a all ONU ports are disabled in all ONOS
373 [Arguments] ${onos_ssh_connection}
374 FOR ${I} IN RANGE 0 ${num_all_onus}
375 ${src}= Set Variable ${hosts.src[${I}]}
376 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
377 ... ${src['olt']}
378 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} ${of_id}
379 Wait Until Keyword Succeeds ${timeout} 2s Assert ONU Port Is Disabled ${onos_ssh_connection} ${of_id}
380 ... ${onu_port}
381 END
382
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000383Map State
384 [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values.
385 [Arguments] ${state}
386 # create state lists with corresponding return values
387 # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE (number/name)
388 ${state1} Create List ENABLED ACTIVATING REACHABLE 1 activating-onu
389 ${state2} Create List ENABLED ACTIVATING REACHABLE 2 starting-openomci
390 ${state3} Create List ENABLED ACTIVATING REACHABLE 3 discovery-mibsync-complete
391 ${state4} Create List ENABLED ACTIVE REACHABLE 4 initial-mib-downloaded
392 ${state5} Create List ENABLED ACTIVE REACHABLE 5 tech-profile-config-download-success
393 ${state6} Create List ENABLED ACTIVE REACHABLE 6 omci-flows-pushed
394 ${state7} Create List DISABLED UNKNOWN REACHABLE 7 omci-admin-lock
395 ${state8} Create List ENABLED ACTIVE REACHABLE 8 onu-reenabled
396 ${state9} Create List ENABLED DISCOVERED UNREACHABLE 9 stopping-openomci
397 ${state10} Create List ENABLED DISCOVERED REACHABLE 10 rebooting
398 ${state11} Create List ENABLED DISCOVERED REACHABLE 11 omci-flows-deleted
399 ${state12} Create List DISABLED UNKNOWN REACHABLE 12 tech-profile-config-delete-success
400 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Set Variable If
401 ... '${state}'=='1' or '${state}'=='activating-onu' ${state1}
402 ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2}
403 ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3}
404 ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4}
405 ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5}
406 ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6}
407 ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7}
408 ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8}
409 ... '${state}'=='9' or '${state}'=='stopping-openomci' ${state9}
410 ... '${state}'=='10' or '${state}'=='rebooting' ${state10}
411 ... '${state}'=='11' or '${state}'=='omci-flows-deleted' ${state11}
412 ... '${state}'=='12' or '${state}'=='tech-profile-config-delete-success' ${state12}
413 [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}