blob: 83af8539019dbbdd91837233c976cfbd6d8d93f0 [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
TorstenThieme7c397d72021-07-14 11:51:09 +000017Library grpc_robot.VolthaTools WITH NAME volthatools
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000018
TorstenThiemed4f48962020-12-08 12:17:19 +000019
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000020*** Keywords ***
TorstenThieme440b7c02020-12-18 15:42:57 +000021Calculate Timeout
22 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
23 [Arguments] ${basetimeout}=60s
24 ${new_timeout} Fetch From Left ${basetimeout} s
25 ${new_timeout}= evaluate ${new_timeout}+((${num_all_onus}-4)*10)
26 ${new_timeout}= Set Variable If (not ${debugmode}) and (${new_timeout}>300)
27 ... 300 ${new_timeout}
28 ${new_timeout}= Catenate SEPARATOR= ${new_timeout} s
29 [Return] ${new_timeout}
30
TorstenThieme3494ceb2021-07-19 09:47:24 +000031Get Logical Id of OLT
32 [Documentation] Fills the logical id of OLT(s) if missing
33 FOR ${I} IN RANGE 0 ${num_olts}
34 # exit loop if logical id already known
35 Exit For Loop IF "${olt_ids}[${I}][logical_id]" != "${EMPTY}"
36 #read current device values
37 ${olt}= Get From List ${olt_ids} ${I}
38 ${olt_serial_number}= Get From Dictionary ${olt} sn
39 # read logical id and store it
40 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
41 Set To Dictionary ${olt} logical_id ${logical_id}
42 Set List Value ${olt_ids} ${I} ${olt}
43 END
44 Set Global Variable ${olt_ids}
45
TorstenThieme440b7c02020-12-18 15:42:57 +000046Power On ONU Device
47 [Documentation] This keyword turns on the power for all onus.
48 [Arguments] ${namespace}
TorstenThiemefe7099e2021-01-29 08:41:04 +000049 FOR ${J} IN RANGE 0 ${num_olts}
50 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
51 ${bbsim}= Catenate SEPARATOR= bbsim ${J}
52 ${bbsim_pod}= Get Pod Name By Label ${namespace} release ${bbsim}
53 Power On ONU Device per OLT ${namespace} ${olt_serial_number} ${bbsim_pod}
54 END
55
56Power On ONU Device per OLT
57 [Documentation] This keyword turns on the power for all onus.
58 [Arguments] ${namespace} ${olt_serial_number} ${bbsim_pod}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000059 FOR ${I} IN RANGE 0 ${num_all_onus}
60 ${src}= Set Variable ${hosts.src[${I}]}
TorstenThiemefe7099e2021-01-29 08:41:04 +000061 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
62 Power On ONU ${namespace} ${bbsim_pod} ${src['onu']}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000063 END
64
TorstenThieme440b7c02020-12-18 15:42:57 +000065Power Off ONU Device
TorstenThiemefe7099e2021-01-29 08:41:04 +000066 [Documentation] This keyword turns off the power for all onus per olt.
TorstenThieme440b7c02020-12-18 15:42:57 +000067 [Arguments] ${namespace}
TorstenThiemefe7099e2021-01-29 08:41:04 +000068 FOR ${J} IN RANGE 0 ${num_olts}
69 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
70 ${bbsim}= Catenate SEPARATOR= bbsim ${J}
71 ${bbsim_pod}= Get Pod Name By Label ${namespace} release ${bbsim}
72 Power Off ONU Device per OLT ${namespace} ${olt_serial_number} ${bbsim_pod}
73 END
74
75Power Off ONU Device per OLT
76 [Documentation] This keyword turns off the power for all onus per olt.
77 [Arguments] ${namespace} ${olt_serial_number} ${bbsim_pod}
TorstenThieme440b7c02020-12-18 15:42:57 +000078 FOR ${I} IN RANGE 0 ${num_all_onus}
79 ${src}= Set Variable ${hosts.src[${I}]}
TorstenThiemefe7099e2021-01-29 08:41:04 +000080 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
81 Power Off ONU ${namespace} ${bbsim_pod} ${src['onu']}
TorstenThieme440b7c02020-12-18 15:42:57 +000082 END
83
84Current State Test
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000085 [Documentation] This keyword checks the passed state of the given onu.
86 [Arguments] ${state} ${onu} ${reqadminstate}=${EMPTY} ${reqoperstatus}=${EMPTY}
87 ... ${reqconnectstatus}=${EMPTY}
88 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State ${state}
89 ${admin_state}= Set Variable If '${reqadminstate}'!='${EMPTY}' ${reqadminstate} ${admin_state}
90 ${oper_status}= Set Variable If '${reqoperstatus}'!='${EMPTY}' ${reqoperstatus} ${oper_status}
91 ${connect_status}= Set Variable If '${reqconnectstatus}'!='${EMPTY}' ${reqconnectstatus}
92 ... ${connect_status}
93 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
94 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
95 ... ${onu} onu=True onu_reason=${onu_state}
96
TorstenThieme440b7c02020-12-18 15:42:57 +000097Current State Test All Onus
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000098 [Documentation] This keyword checks the passed state of all onus.
99 ... Hint: ${timeStart} will be not evaluated here!
100 [Arguments] ${state} ${reqadminstate}=${EMPTY} ${reqoperstatus}=${EMPTY} ${reqconnectstatus}=${EMPTY}
TorstenThieme53450ff2021-05-11 09:44:33 +0000101 ... ${alternativeonustate}=${EMPTY} ${timeout}=${timeout}
TorstenThieme440b7c02020-12-18 15:42:57 +0000102 ${timeStart}= Get Current Date
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000103 ${list_onus} Create List
104 Build ONU SN List ${list_onus}
105 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State ${state}
106 ${admin_state}= Set Variable If '${reqadminstate}'!='${EMPTY}' ${reqadminstate} ${admin_state}
107 ${oper_status}= Set Variable If '${reqoperstatus}'!='${EMPTY}' ${reqoperstatus} ${oper_status}
108 ${connect_status}= Set Variable If '${reqconnectstatus}'!='${EMPTY}' ${reqconnectstatus}
109 ... ${connect_status}
110 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
111 ... Validate ONU Devices With Duration
112 ... ${admin_state} ${oper_status} ${connect_status}
TorstenThieme52ef8392020-11-10 13:42:26 +0000113 ... ${onu_state} ${list_onus} ${timeStart} alternate_reason=${alternativeonustate}
TorstenThieme53450ff2021-05-11 09:44:33 +0000114 # teardown is used as 'return' for result of Validate ONU Devices With Duration (used for ONUNegativeStateTests)
115 [Teardown] Run Keyword If "${KEYWORD STATUS}"=="FAIL" Set Suite Variable ${StateTestAllONUs} False
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000116
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000117Reconcile Onu Adapter
118 [Documentation] Restarts the openonu adapter and waits for reconciling is finished and expected oper-state is reached
TorstenThieme712b2962021-11-17 14:16:15 +0000119 [Arguments] ${namespace} ${usekill2restart} ${oper_status} ${olt_to_be_deleted_sn}=${EMPTY}
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000120 # get time of restart of openonu adapter
121 ${restart_ts}= Get Current Date
122 # restart OpenONU adapter
123 Run Keyword If ${usekill2restart} Kill And Check Onu Adaptor ${namespace}
124 ... ELSE Restart And Check Onu Adaptor ${namespace}
125 #check ready timestamp of openonu adapter, should be younger than restart timestamp
126 ${openonu_ready_ts}= Get Pod Ready Timestamp by Label ${namespace} app adapter-open-onu
127 ${restart_duration}= Subtract Date From Date ${openonu_ready_ts} ${restart_ts}
128 Should Be True ${restart_duration}>0
TorstenThieme712b2962021-11-17 14:16:15 +0000129 # delete the olt passed, if available (special feature)
130 ${olt_to_be_deleted_device_id}= Run Keyword IF "${olt_to_be_deleted_sn}"!="${EMPTY}"
131 ... Get OLTDeviceID From OLT List ${olt_to_be_deleted_sn}
132 Run Keyword IF "${olt_to_be_deleted_sn}"!="${EMPTY}" Delete Device ${olt_to_be_deleted_device_id}
Matteo Scandolo741d4fd2021-09-23 17:08:34 -0700133 # wait for the reconcile to complete
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000134 # - we check that communication to openonu-adapter is established again
135 # - we check that all ONUs leave reconcile state by validate a simple voltctl request will not responds with error
136 Wait Until Keyword Succeeds ${timeout} 1s Validate Last ONU Communication
TorstenThieme712b2962021-11-17 14:16:15 +0000137 Wait Until Keyword Succeeds ${timeout} 1s Validate All Onus Accessible ${olt_to_be_deleted_sn}
138 # - then we wait that all ONU move to the next state, except ONU belonging to deleted OLT (special feature)
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000139 ${list_onus} Create List
TorstenThieme712b2962021-11-17 14:16:15 +0000140 FOR ${J} IN RANGE 0 ${num_olts}
141 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
142 Continue For Loop If "${olt_to_be_deleted_sn}"=="${olt_serial_number}"
143 Build ONU SN List ${list_onus} ${olt_serial_number}
144 END
145 Log ${list_onus}
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000146 Run Keyword And Ignore Error Wait Until Keyword Succeeds ${timeout}
147 ... 1s Check all ONU OperStatus ${list_onus} ${oper_status}
148
TorstenThiemee512b1d2021-11-12 10:52:29 +0000149Validate All Onus Accessible
150 [Documentation] This keyword checks all onus accessible (again) with help of a simple voltctl request.
151 ... As long we've got an rc!=0 keyword will fail -> onu is not accessible.
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000152 ... As get request Onu image list is used, any other get command could be used for this check.
TorstenThieme712b2962021-11-17 14:16:15 +0000153 ... Will not check ONUs of passed deleted OLT (special feature)
154 [Arguments] ${deleted_olt}=${EMPTY}
Matteo Scandolo741d4fd2021-09-23 17:08:34 -0700155 ${onu_list} Create List
156 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000157 ${src}= Set Variable ${hosts.src[${I}]}
TorstenThieme712b2962021-11-17 14:16:15 +0000158 ${olt_serial_number}= Set Variable ${src['olt']}
159 Continue For Loop If "${deleted_olt}"=="${olt_serial_number}"
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000160 ${onu_device_id}= Get Device ID From SN ${src['onu']}
161 ${onu_id}= Get Index From List ${onu_list} ${onu_device_id}
Matteo Scandolo741d4fd2021-09-23 17:08:34 -0700162 Continue For Loop If -1 != ${onu_id}
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000163 Append To List ${onu_list} ${onu_device_id}
164 ${rc} ${output}= Get Onu Image List ${onu_device_id}
TorstenThieme712b2962021-11-17 14:16:15 +0000165 Should Be True ${rc}==0 Onu ${src['onu']} (${onu_device_id}) still not accessible.
Matteo Scandolo741d4fd2021-09-23 17:08:34 -0700166 END
167
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000168Log Ports
169 [Documentation] This keyword logs all port data available in ONOS of first port per ONU
170 [Arguments] ${onlyenabled}=False
171 ${cmd} Set Variable If ${onlyenabled} ports -e ports
TorstenThieme731a7592021-07-01 14:26:54 +0000172 ${onu_ports}= Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${cmd}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000173 ${lines} = Get Lines Matching Regexp ${onu_ports} .*portName=BBSM[0-9]{8}-1
174 Log ${lines}
175
176Kill Adaptor
177 [Documentation] This keyword kills the passed adaptor.
178 [Arguments] ${namespace} ${name}
179 ${cmd} Catenate
Matteo Scandolo6b524122021-10-22 14:34:29 -0700180 ... kubectl exec -it -n ${namespace} $(kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}')
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000181 ... -- /bin/sh -c "kill 1"
182 ${rc} ${output}= Run and Return Rc and Output ${cmd}
183 Log ${output}
184
TorstenThieme440b7c02020-12-18 15:42:57 +0000185Kill And Check Onu Adaptor
186 [Documentation] This keyword kills ONU Adaptor and waits for it to come up again
187 ... Following steps will be executed:
188 ... - kill openonu adaptor
189 ... - check openonu adaptor is ready again
190 [Arguments] ${namespace}
191 ${list_openonu_apps} Create List adapter-open-onu
192 ${adaptorname}= Set Variable open-onu
193 Kill Adaptor ${namespace} ${adaptorname}
194 Sleep 5s
195 Wait For Pods Ready ${namespace} ${list_openonu_apps}
196
197Restart And Check Onu Adaptor
198 [Documentation] This keyword restarts ONU Adaptor and waits for it to come up again
199 ... Following steps will be executed:
200 ... - restart openonu adaptor
201 ... - check openonu adaptor is ready again
202 [Arguments] ${namespace}
203 ${list_openonu_apps} Create List adapter-open-onu
Matteo Scandolo6f24ea92021-04-29 11:55:50 -0700204 ${openonu_label_key} Set Variable app
205 ${openonu_label_value} Set Variable adapter-open-onu
206 Restart Pod By Label ${namespace} ${openonu_label_key} ${openonu_label_value}
TorstenThieme440b7c02020-12-18 15:42:57 +0000207 Sleep 5s
208 Wait For Pods Ready ${namespace} ${list_openonu_apps}
209
210Disable Onu Device
211 [Documentation] This keyword disables all onus.
TorstenThieme70bc5262021-01-19 12:12:55 +0000212 ${onu_list} Create List
TorstenThieme440b7c02020-12-18 15:42:57 +0000213 FOR ${I} IN RANGE 0 ${num_all_onus}
214 ${src}= Set Variable ${hosts.src[${I}]}
215 ${onu_device_id}= Get Device ID From SN ${src['onu']}
TorstenThieme70bc5262021-01-19 12:12:55 +0000216 ${onu_id}= Get Index From List ${onu_list} ${onu_device_id}
217 Continue For Loop If -1 != ${onu_id}
218 Append To List ${onu_list} ${onu_device_id}
TorstenThieme440b7c02020-12-18 15:42:57 +0000219 Disable Device ${onu_device_id}
220 Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id}
221 END
222
223Enable Onu Device
224 [Documentation] This keyword enables all onus.
TorstenThieme70bc5262021-01-19 12:12:55 +0000225 ${onu_list} Create List
TorstenThieme440b7c02020-12-18 15:42:57 +0000226 FOR ${I} IN RANGE 0 ${num_all_onus}
227 ${src}= Set Variable ${hosts.src[${I}]}
228 ${onu_device_id}= Get Device ID From SN ${src['onu']}
TorstenThieme70bc5262021-01-19 12:12:55 +0000229 ${onu_id}= Get Index From List ${onu_list} ${onu_device_id}
230 Continue For Loop If -1 != ${onu_id}
231 Append To List ${onu_list} ${onu_device_id}
TorstenThieme440b7c02020-12-18 15:42:57 +0000232 Enable Device ${onu_device_id}
233 END
234
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000235Verify MIB Template Data Available
236 [Documentation] This keyword verifies MIB Template Data stored in etcd
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000237 [Arguments] ${namespace}=default
TorstenThiemed4f48962020-12-08 12:17:19 +0000238 ${podname}= Set Variable etcd
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000239 ${commandget} Catenate
Matteo Scandolo341b9372020-12-09 14:15:06 -0800240 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000241 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000242 Should Not Be Empty ${result} No MIB Template Data stored in etcd!
243
244Delete MIB Template Data
245 [Documentation] This keyword deletes MIB Template Data stored in etcd
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000246 [Arguments] ${namespace}=default
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000247 ${podname}= Set Variable etcd
248 ${commanddel} Catenate
Matteo Scandolo341b9372020-12-09 14:15:06 -0800249 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/omci_mibs/go_templates/'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000250 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commanddel}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000251 Sleep 3s
252 ${commandget} Catenate
Matteo Scandolo341b9372020-12-09 14:15:06 -0800253 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000254 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000255 Should Be Empty ${result} Could not delete MIB Template Data stored in etcd!
256
TorstenThieme440b7c02020-12-18 15:42:57 +0000257Set Tech Profile
258 [Documentation] This keyword sets the passed TechProfile for the test
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000259 [Arguments] ${TechProfile} ${namespace}=default
TorstenThieme440b7c02020-12-18 15:42:57 +0000260 Log To Console \nTechProfile:${TechProfile}
TorstenThieme440b7c02020-12-18 15:42:57 +0000261 ${podname}= Set Variable etcd
Andrea Campanella0aa21d62021-07-22 10:44:32 +0200262 ${label}= Set Variable app.kubernetes.io/name=${podname}
TorstenThieme440b7c02020-12-18 15:42:57 +0000263 ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json
264 ${dest}= Set Variable /tmp/flexpod.json
265 ${command} Catenate
266 ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
Andrea Campanella0aa21d62021-07-22 10:44:32 +0200267 Copy File To Pod ${namespace} ${label} ${src} ${dest}
TorstenThieme440b7c02020-12-18 15:42:57 +0000268 Exec Pod In Kube ${namespace} ${podname} ${command}
269 ${commandget} Catenate
270 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
Andrea Campanella0aa21d62021-07-22 10:44:32 +0200271 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
272 Should Not Be Empty ${result} No Tech Profile stored in etcd!
TorstenThieme440b7c02020-12-18 15:42:57 +0000273
274Remove Tech Profile
275 [Documentation] This keyword removes TechProfile
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000276 [Arguments] ${namespace}=default
TorstenThieme440b7c02020-12-18 15:42:57 +0000277 Log To Console \nTechProfile:${TechProfile}
TorstenThieme440b7c02020-12-18 15:42:57 +0000278 ${podname}= Set Variable etcd
279 ${command} Catenate
280 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
281 Exec Pod In Kube ${namespace} ${podname} ${command}
282 ${commandget} Catenate
283 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
284 Exec Pod In Kube ${namespace} ${podname} ${commandget}
285
TorstenThiemea7315f12021-07-23 11:56:34 +0000286Do Onu Subscriber Add Per OLT
287 [Documentation] Add Subscriber per OLT
288 [Arguments] ${of_id} ${olt_serial_number} ${print2console}=False
289 FOR ${I} IN RANGE 0 ${num_all_onus}
290 ${src}= Set Variable ${hosts.src[${I}]}
291 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
292 ${onu_device_id}= Get Device ID From SN ${src['onu']}
293 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
294 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
295 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
296 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
297 ... volt-add-subscriber-access ${of_id} ${onu_port}
298 Run Keyword If ${print2console} Log \r\n[${I}] volt-add-subscriber-access ${of_id} ${onu_port}.
299 ... console=yes
300 END
301
302Do Onu Flow Check Per OLT
303 [Documentation] Checks all ONU flows show up in ONOS and Voltha
304 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${print2console}=False
305 FOR ${I} IN RANGE 0 ${num_all_onus}
306 ${src}= Set Variable ${hosts.src[${I}]}
307 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
308 ${onu_device_id}= Get Device ID From SN ${src['onu']}
309 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
310 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
311 # Verify subscriber access flows are added for the ONU port
312 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
313 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
314 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
315 ${logoutput} Catenate \r\n[${I}] Verify Subscriber Access Flows Added For
316 ... ONU ${of_id} ${onu_port} ${src['c_tag']} ${src['s_tag']}.
317 Run Keyword If ${print2console} Log ${logoutput} console=yes
318 END
319
320Do Onu Subscriber Remove Per OLT
321 [Documentation] Removes per OLT subscribers in ONOS and Voltha
322 [Arguments] ${of_id} ${olt_serial_number} ${print2console}=False
323 FOR ${I} IN RANGE 0 ${num_all_onus}
324 ${src}= Set Variable ${hosts.src[${I}]}
325 ${dst}= Set Variable ${hosts.dst[${I}]}
326 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
327 ${onu_device_id}= Get Device ID From SN ${src['onu']}
328 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
329 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
330 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
331 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
332 ... volt-remove-subscriber-access ${of_id} ${onu_port}
333 Run Keyword If ${print2console} Log \r\n[${I}] volt-remove-subscriber-access ${of_id} ${onu_port}.
334 ... console=yes
335 END
336
TorstenThieme7c397d72021-07-14 11:51:09 +0000337Validate Resource Instances Used Gem Ports
338 [Documentation] This keyword validates resource instances data stored in etcd.
339 ... It checks checks the number of gemport-ids which has matched with used Tech Profile
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000340 [Arguments] ${nbofgemports} ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha
TorstenThieme7c397d72021-07-14 11:51:09 +0000341 ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix}
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000342 ${etcddata}= Get ONU Go Adapter ETCD Data namespace=${namespace} defaultkvstoreprefix=${kvstoreprefix}
TorstenThieme7c397d72021-07-14 11:51:09 +0000343 #prepare result for json convert
344 ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata}
345 ${jsondata}= To Json ${result}
346 ${length}= Get Length ${jsondata}
347 log ${jsondata}
348 FOR ${INDEX} IN RANGE 0 ${length}
349 ${value}= Get From List ${jsondata} ${INDEX}
350 # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow.
351 # When testing multi-tcont this may need some adjustment.
352 Exit For Loop If not ('uni_config' in $value)
353 ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000354 ${resourcedata}= Get Resource Instances ETCD Data ${tp_path} namespace=${namespace}
355 ... defaultkvstoreprefix=${kvstoreprefix}
TorstenThieme7c397d72021-07-14 11:51:09 +0000356 log ${resourcedata}
357 ${decoderesult}= volthatools.Tech Profile Decode Resource Instance ${resourcedata} return_default=true
358 log ${decoderesult}
359 ${gemportids}= Get From Dictionary ${decoderesult} gemport_ids
360 ${length}= Get Length ${gemportids}
361 Should Be Equal As Integers ${nbofgemports} ${length}
362 ... msg=Number of gem ports (${length}) does not match with techprofile ${techprofile}/${nbofgemports}
363 END
364
365Get Resource Instances ETCD Data
366 [Documentation] This keyword delivers Resource Instances Data stored in etcd
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000367 [Arguments] ${tppath} ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha
TorstenThieme7c397d72021-07-14 11:51:09 +0000368 ${podname}= Set Variable etcd
369 ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix}
370 ${commandget}= Catenate
371 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/resource_instances/${tppath}
372 ... --print-value-only --hex'
373 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
374 log ${result}
375 [Return] ${result}
376
377
TorstenThieme17756ea2020-11-11 14:09:47 +0000378Validate Onu Data In Etcd
379 [Documentation] This keyword validates openonu-go-adapter Data stored in etcd.
380 ... It checks unique of serial_number and combination of pon, onu and uni in tp_path.
381 ... Furthermore it evaluates the values of onu_id and uni_id with values read from tp_path.
382 ... Number of etcd entries has to match with the passed number.
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000383 [Arguments] ${namespace}=default ${nbofetcddata}=${num_all_onus} ${defaultkvstoreprefix}=voltha_voltha
TorstenThiemefa29a892021-03-11 14:11:29 +0000384 ... ${without_prefix}=True ${without_pm_data}=True
TorstenThieme3385cdc2021-02-04 13:50:50 +0000385 ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix}
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000386 ${etcddata}= Get ONU Go Adapter ETCD Data ${namespace} ${kvstoreprefix} ${without_prefix} ${without_pm_data}
TorstenThieme17756ea2020-11-11 14:09:47 +0000387 #prepare result for json convert
388 ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata}
389 ${jsondata}= To Json ${result}
390 ${length}= Get Length ${jsondata}
391 log ${jsondata}
392 Run Keyword And Continue On Failure Should Be Equal As Integers ${length} ${nbofetcddata}
393 ... msg=Number etcd data (${length}) does not match required (${nbofetcddata})!
TorstenThiemefe7099e2021-01-29 08:41:04 +0000394 ${oltpononuuniidlist}= Create List
TorstenThieme17756ea2020-11-11 14:09:47 +0000395 ${serialnumberlist}= Create List
396 FOR ${INDEX} IN RANGE 0 ${length}
397 ${value}= Get From List ${jsondata} ${INDEX}
Girish Gowdra97f8d062020-11-17 15:48:23 -0800398 # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow.
399 # When testing multi-tcont this may need some adjustment.
TorstenThieme45071602021-03-16 12:14:37 +0000400 Exit For Loop If not ('uni_config' in $value)
Girish Gowdra97f8d062020-11-17 15:48:23 -0800401 ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64
TorstenThiemefe7099e2021-01-29 08:41:04 +0000402 ${oltpononuuniid}= Read Pon Onu Uni String ${tp_path}
403 ${list_id}= Get Index From List ${oltpononuuniidlist} ${oltpononuuniid}
TorstenThieme17756ea2020-11-11 14:09:47 +0000404 Should Be Equal As Integers ${list_id} -1
TorstenThiemefe7099e2021-01-29 08:41:04 +0000405 ... msg=Combination of Pon, Onu and Uni (${oltpononuuniid}) exist multiple in etcd data!
406 Append To List ${oltpononuuniidlist} ${oltpononuuniid}
TorstenThieme17756ea2020-11-11 14:09:47 +0000407 Validate Onu Id ${value}
408 Validate Uni Id ${value}
409 ${serial_number}= Get From Dictionary ${value} serial_number
410 ${list_id}= Get Index From List ${serialnumberlist} ${serial_number}
411 Should Be Equal As Integers ${list_id} -1
412 ... msg=Serial number (${serial_number}) exists multiple in etcd data!
413 Append To List ${serialnumberlist} ${serial_number}
414 END
415
TorstenThieme712b2962021-11-17 14:16:15 +0000416Validate Onu Data In Etcd Removed
417 [Documentation] This keyword validates openonu-go-adapter Data stored in etcd are removed.
418 ... In case of a device is passed, only this will be checked.
419 [Arguments] ${namespace}=default ${device_id}=${EMPTY} ${defaultkvstoreprefix}=voltha_voltha
420 ... ${without_pm_data}=True
421 ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix}
422 ${etcddata}= Get ONU Go Adapter ETCD Data ${namespace} ${kvstoreprefix} False ${without_pm_data}
423 ... ${device_id} True
424 Log ${etcddata}
425 Should Be Empty ${etcddata} Stale Openonu Data in Etcd (KV store) ${device_id}
426
TorstenThieme52ef8392020-11-10 13:42:26 +0000427Validate Vlan Rules In Etcd
428 [Documentation] This keyword validates Vlan rules of openonu-go-adapter Data stored in etcd.
429 ... It checks the given number of cookie_slice, match_vid (=4096) and set_vid.
430 ... Furthermore it returns a list of all set_vid.
431 ... In case of a passed dictionary containing set_vids these will be checked for to
432 ... current set-vid depending on setvidequal (True=equal, False=not equal).
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000433 [Arguments] ${namespace}=default ${nbofcookieslice}=1 ${reqmatchvid}=4096 ${prevvlanrules}=${NONE}
434 ... ${setvidequal}=False ${defaultkvstoreprefix}=voltha_voltha ${without_prefix}=True ${without_pm_data}=True
TorstenThieme3385cdc2021-02-04 13:50:50 +0000435 ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix}
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000436 ${etcddata}= Get ONU Go Adapter ETCD Data ${namespace} ${kvstoreprefix} ${without_prefix} ${without_pm_data}
TorstenThieme52ef8392020-11-10 13:42:26 +0000437 #prepare result for json convert
438 ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata}
439 ${jsondata}= To Json ${result}
440 ${length}= Get Length ${jsondata}
441 log ${jsondata}
442 ${vlan_rules}= Create Dictionary
443 FOR ${INDEX} IN RANGE 0 ${length}
444 ${value}= Get From List ${jsondata} ${INDEX}
Girish Gowdra295c1692020-11-19 10:51:53 -0800445 # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow.
446 # When testing multi-tcont this may need some adjustment.
447 ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64
TorstenThiemefe7099e2021-01-29 08:41:04 +0000448 ${oltpononuuniid}= Read Pon Onu Uni String ${tp_path}
TorstenThieme52ef8392020-11-10 13:42:26 +0000449 ${cookieslice}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]} cookie_slice
450 #@{cookieslicelist}= Split String ${cookieslice} ,
451 ${foundcookieslices}= Get Length ${cookieslice}
452 Should Be Equal As Integers ${foundcookieslices} ${nbofcookieslice}
453 ${matchvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']}
454 ... match_vid
455 Should Be Equal As Integers ${matchvid} ${reqmatchvid}
456 ${setvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']}
457 ... set_vid
458 ${evalresult}= Evaluate 2 <= ${setvid} <= 4095
459 Should Be True ${evalresult} msg=set_vid out of range (${setvid})!
TorstenThiemefe7099e2021-01-29 08:41:04 +0000460 Set To Dictionary ${vlan_rules} ${oltpononuuniid} ${setvid}
TorstenThieme52ef8392020-11-10 13:42:26 +0000461 ${oldsetvidvalid} Set Variable If ${prevvlanrules} is ${NONE} False True
TorstenThiemefe7099e2021-01-29 08:41:04 +0000462 ${prevsetvid}= Set Variable If ${oldsetvidvalid} ${prevvlanrules['${oltpononuuniid}']}
TorstenThieme52ef8392020-11-10 13:42:26 +0000463 Run Keyword If ${oldsetvidvalid} and ${setvidequal}
464 ... Should Be Equal As Integers ${prevsetvid} ${setvid}
465 ... ELSE IF ${oldsetvidvalid} and not ${setvidequal}
466 ... Should Not Be Equal As Integers ${prevsetvid} ${setvid}
467 END
TorstenThieme440b7c02020-12-18 15:42:57 +0000468 log Many ${vlan_rules}
TorstenThieme52ef8392020-11-10 13:42:26 +0000469 [Return] ${vlan_rules}
470
471Get ONU Go Adapter ETCD Data
472 [Documentation] This keyword delivers openonu-go-adapter Data stored in etcd
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000473 [Arguments] ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha ${without_prefix}=True
TorstenThieme712b2962021-11-17 14:16:15 +0000474 ... ${without_pm_data}=True ${device_id}=${Empty} ${keys_only}=False
TorstenThieme52ef8392020-11-10 13:42:26 +0000475 ${podname}= Set Variable etcd
TorstenThieme3385cdc2021-02-04 13:50:50 +0000476 ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix}
TorstenThieme3af12312021-03-10 16:15:24 +0000477 ${commandget}= Catenate
478 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/openonu'
TorstenThieme712b2962021-11-17 14:16:15 +0000479 ${commandget}= Run Keyword If ${keys_only} Catenate ${commandget} --keys-only
480 ... ELSE Set Variable ${commandget}
TorstenThieme3af12312021-03-10 16:15:24 +0000481 ${commandget}= Run Keyword If ${without_prefix} Catenate ${commandget}
482 ... | grep -v service/${kvstoreprefix}/openonu
TorstenThiemefa29a892021-03-11 14:11:29 +0000483 ... ELSE Set Variable ${commandget}
TorstenThieme3af12312021-03-10 16:15:24 +0000484 ${commandget}= Run Keyword If ${without_pm_data} Catenate ${commandget} | grep -v instances_active
TorstenThiemefa29a892021-03-11 14:11:29 +0000485 ... ELSE Set Variable ${commandget}
TorstenThieme712b2962021-11-17 14:16:15 +0000486 ${commandget}= Run Keyword If "${device_id}"!="${Empty}" Catenate ${commandget} | grep ${device_id}
487 ... ELSE Set Variable ${commandget}
Holger Hildebrandt23147742020-11-16 10:13:21 +0000488 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThieme52ef8392020-11-10 13:42:26 +0000489 log ${result}
490 [Return] ${result}
491
492Prepare ONU Go Adapter ETCD Data For Json
493 [Documentation] This keyword prepares openonu-go-adapter Data stored in etcd for converting
494 ... to json
495 [Arguments] ${etcddata}
496 #prepare result for json convert
497 ${prepresult}= Replace String ${etcddata} \n ,
498 ${prepresult}= Strip String ${prepresult} mode=right characters=,
499 ${prepresult}= Set Variable [${prepresult}]
500 log ${prepresult}
501 [Return] ${prepresult}
502
TorstenThieme52ef8392020-11-10 13:42:26 +0000503Read Pon Onu Uni String
TorstenThiemefe7099e2021-01-29 08:41:04 +0000504 [Documentation] This keyword builds a four digit string using Olt, Pon, Onu and Uni value of given tp-path taken
TorstenThieme52ef8392020-11-10 13:42:26 +0000505 ... taken from etcd data of onu go adapter
506 [Arguments] ${tp_path}
TorstenThieme52ef8392020-11-10 13:42:26 +0000507 ${tppathlines}= Replace String ${tp_path} / \n
TorstenThiemefe7099e2021-01-29 08:41:04 +0000508 ${olt}= Get Value Of Tp Path Element ${tppathlines} olt
TorstenThieme52ef8392020-11-10 13:42:26 +0000509 ${pon}= Get Value Of Tp Path Element ${tppathlines} pon
510 ${onu}= Get Value Of Tp Path Element ${tppathlines} onu
511 ${uni}= Get Value Of Tp Path Element ${tppathlines} uni
TorstenThiemefe7099e2021-01-29 08:41:04 +0000512 ${valuesid}= Set Variable ${olt}/${pon}/${onu}/${uni}
TorstenThieme52ef8392020-11-10 13:42:26 +0000513 log ${valuesid}
514 [Return] ${valuesid}
515
516Get Value Of Tp Path Element
TorstenThieme17756ea2020-11-11 14:09:47 +0000517 [Documentation] This keyword delivers numeric value of given tp path element.
TorstenThieme52ef8392020-11-10 13:42:26 +0000518 [Arguments] ${tp_path_lines} ${element}
519 ${value}= Get Lines Containing String ${tp_path_lines} ${element}-\{
520 ${value}= Remove String ${value} ${element}-\{
521 ${value}= Remove String ${value} \}
522 log ${value}
523 [Return] ${value}
524
TorstenThieme17756ea2020-11-11 14:09:47 +0000525Validate Onu Id
526 [Documentation] This keyword validates ONU Id of passed etcd data.
527 [Arguments] ${value}
Girish Gowdra295c1692020-11-19 10:51:53 -0800528 # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow.
529 # When testing multi-tcont this may need some adjustment.
530 ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64
TorstenThieme17756ea2020-11-11 14:09:47 +0000531 ${tppathlines}= Replace String ${tp_path} / \n
532 ${onu}= Get Value Of Tp Path Element ${tppathlines} onu
533 ${onu_id}= Get From Dictionary ${value} onu_id
534 Should Be Equal As Integers ${onu} ${onu_id}
535 ... msg=Onu-Id (${onu_id}) does not match onu (${onu}) from tp_path in etcd data!
536 Should Be True ${onu_id}>=1
537
538Validate Uni Id
539 [Documentation] This keyword validates UNI Id of passed etcd data.
540 [Arguments] ${value}
Girish Gowdra295c1692020-11-19 10:51:53 -0800541 # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow.
542 # When testing multi-tcont this may need some adjustment.
543 ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64
TorstenThieme17756ea2020-11-11 14:09:47 +0000544 ${tppathlines}= Replace String ${tp_path} / \n
545 ${uni}= Get Value Of Tp Path Element ${tppathlines} uni
546 ${uni_id}= Get From Dictionary ${value['uni_config'][0]} uni_id
547 Should Be Equal As Integers ${uni} ${uni_id}
548 ... msg=Uni-Id (${uni_id}) does not match onu (${uni}) from tp_path in etcd data!
TorstenThieme52ef8392020-11-10 13:42:26 +0000549
TorstenThieme45071602021-03-16 12:14:37 +0000550Delete ONU Go Adapter ETCD Data
551 [Documentation] This keyword deletes openonu-go-adapter Data stored in etcd
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000552 [Arguments] ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha ${validate}=False
TorstenThieme45071602021-03-16 12:14:37 +0000553 ${podname}= Set Variable etcd
554 ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix}
555 ${commandget}= Catenate
556 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/${kvstoreprefix}/openonu'
557 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
558 log ${result}
559 Run Keyword If ${validate} Wait Until Keyword Succeeds ${timeout} 1s
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000560 ... Validate Onu Data In Etcd namespace=${namespace} nbofetcddata=0 without_pm_data=False
TorstenThieme45071602021-03-16 12:14:37 +0000561 [Return] ${result}
562
TorstenThiemed4f48962020-12-08 12:17:19 +0000563Wait for Ports in ONOS for all OLTs
TorstenThieme440b7c02020-12-18 15:42:57 +0000564 [Documentation] Waits untill a certain number of ports are enabled in all OLTs
TorstenThieme731a7592021-07-01 14:26:54 +0000565 [Arguments] ${host} ${port} ${count} ${filter} ${max_wait_time}=10m ${determine_number}=False
TorstenThiemed4f48962020-12-08 12:17:19 +0000566 FOR ${J} IN RANGE 0 ${num_olts}
567 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
568 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
569 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
570 ... ${olt_serial_number}
571 Set Global Variable ${of_id}
TorstenThiemeff9c9142021-04-08 07:21:34 +0000572 ${count2check}= Set Variable If ${count}==${num_all_onus} ${onu_count} ${count}
573 # if flag determine_number is set to True, always determine the number of real ONUs (overwrite previous value)
574 ${count2check}= Run Keyword If ${determine_number} Determine Number Of ONU ${olt_serial_number}
575 ... ELSE Set Variable ${count2check}
TorstenThieme731a7592021-07-01 14:26:54 +0000576 Wait for Ports in ONOS ${host} ${port} ${count2check} ${of_id} BBSM ${max_wait_time}
TorstenThiemed4f48962020-12-08 12:17:19 +0000577 END
578
TorstenThieme440b7c02020-12-18 15:42:57 +0000579Wait for all ONU Ports in ONOS Disabled
580 [Documentation] Waits untill a all ONU ports are disabled in all ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000581 [Arguments] ${host} ${port}
TorstenThieme440b7c02020-12-18 15:42:57 +0000582 FOR ${I} IN RANGE 0 ${num_all_onus}
583 ${src}= Set Variable ${hosts.src[${I}]}
584 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
585 ... ${src['olt']}
586 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} ${of_id}
TorstenThieme731a7592021-07-01 14:26:54 +0000587 Wait Until Keyword Succeeds ${timeout} 2s Assert ONU Port Is Disabled ${host} ${port} ${of_id}
TorstenThieme440b7c02020-12-18 15:42:57 +0000588 ... ${onu_port}
589 END
590
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000591Map State
592 [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values.
593 [Arguments] ${state}
594 # create state lists with corresponding return values
595 # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE (number/name)
596 ${state1} Create List ENABLED ACTIVATING REACHABLE 1 activating-onu
597 ${state2} Create List ENABLED ACTIVATING REACHABLE 2 starting-openomci
598 ${state3} Create List ENABLED ACTIVATING REACHABLE 3 discovery-mibsync-complete
599 ${state4} Create List ENABLED ACTIVE REACHABLE 4 initial-mib-downloaded
600 ${state5} Create List ENABLED ACTIVE REACHABLE 5 tech-profile-config-download-success
601 ${state6} Create List ENABLED ACTIVE REACHABLE 6 omci-flows-pushed
602 ${state7} Create List DISABLED UNKNOWN REACHABLE 7 omci-admin-lock
603 ${state8} Create List ENABLED ACTIVE REACHABLE 8 onu-reenabled
604 ${state9} Create List ENABLED DISCOVERED UNREACHABLE 9 stopping-openomci
605 ${state10} Create List ENABLED DISCOVERED REACHABLE 10 rebooting
606 ${state11} Create List ENABLED DISCOVERED REACHABLE 11 omci-flows-deleted
607 ${state12} Create List DISABLED UNKNOWN REACHABLE 12 tech-profile-config-delete-success
608 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Set Variable If
609 ... '${state}'=='1' or '${state}'=='activating-onu' ${state1}
610 ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2}
611 ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3}
612 ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4}
613 ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5}
614 ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6}
615 ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7}
616 ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8}
617 ... '${state}'=='9' or '${state}'=='stopping-openomci' ${state9}
618 ... '${state}'=='10' or '${state}'=='rebooting' ${state10}
619 ... '${state}'=='11' or '${state}'=='omci-flows-deleted' ${state11}
620 ... '${state}'=='12' or '${state}'=='tech-profile-config-delete-success' ${state12}
621 [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}