TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 1 | # Copyright 2020 - present Open Networking Foundation |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 2 | # |
| 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. |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 14 | |
| 15 | *** Settings *** |
| 16 | Documentation Library for various openonu-go-adpter utilities |
| 17 | |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 18 | *** Variables *** |
| 19 | ${defaultstackname} minimal |
| 20 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 21 | *** Keywords *** |
| 22 | Do Power On ONU Device |
| 23 | [Documentation] This keyword power on all onus. |
| 24 | ${namespace}= Set Variable voltha |
| 25 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 26 | ${src}= Set Variable ${hosts.src[${I}]} |
Holger Hildebrandt | 2314774 | 2020-11-16 10:13:21 +0000 | [diff] [blame] | 27 | ${result}= Exec Pod In Kube ${namespace} bbsim bbsimctl onu poweron ${src['onu']} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 28 | Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False |
| 29 | END |
| 30 | |
| 31 | Do Current State Test |
| 32 | [Documentation] This keyword checks the passed state of the given onu. |
| 33 | [Arguments] ${state} ${onu} ${reqadminstate}=${EMPTY} ${reqoperstatus}=${EMPTY} |
| 34 | ... ${reqconnectstatus}=${EMPTY} |
| 35 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State ${state} |
| 36 | ${admin_state}= Set Variable If '${reqadminstate}'!='${EMPTY}' ${reqadminstate} ${admin_state} |
| 37 | ${oper_status}= Set Variable If '${reqoperstatus}'!='${EMPTY}' ${reqoperstatus} ${oper_status} |
| 38 | ${connect_status}= Set Variable If '${reqconnectstatus}'!='${EMPTY}' ${reqconnectstatus} |
| 39 | ... ${connect_status} |
| 40 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 41 | ... Validate Device ${admin_state} ${oper_status} ${connect_status} |
| 42 | ... ${onu} onu=True onu_reason=${onu_state} |
| 43 | |
| 44 | Do Current State Test All Onus |
| 45 | [Documentation] This keyword checks the passed state of all onus. |
| 46 | ... Hint: ${timeStart} will be not evaluated here! |
| 47 | [Arguments] ${state} ${reqadminstate}=${EMPTY} ${reqoperstatus}=${EMPTY} ${reqconnectstatus}=${EMPTY} |
| 48 | ... ${alternativeonustate}=${EMPTY} |
| 49 | ${list_onus} Create List |
| 50 | Build ONU SN List ${list_onus} |
| 51 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State ${state} |
| 52 | ${admin_state}= Set Variable If '${reqadminstate}'!='${EMPTY}' ${reqadminstate} ${admin_state} |
| 53 | ${oper_status}= Set Variable If '${reqoperstatus}'!='${EMPTY}' ${reqoperstatus} ${oper_status} |
| 54 | ${connect_status}= Set Variable If '${reqconnectstatus}'!='${EMPTY}' ${reqconnectstatus} |
| 55 | ... ${connect_status} |
| 56 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 57 | ... Validate ONU Devices With Duration |
| 58 | ... ${admin_state} ${oper_status} ${connect_status} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 59 | ... ${onu_state} ${list_onus} ${timeStart} alternate_reason=${alternativeonustate} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 60 | |
| 61 | Do Current Reason Test All Onus |
| 62 | [Documentation] This keyword checks the passed state of all onus. |
| 63 | ... Hint: ${timeStart} will be not evaluated here! |
| 64 | [Arguments] ${state} |
| 65 | ${list_onus} Create List |
| 66 | Build ONU SN List ${list_onus} |
| 67 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State ${state} |
| 68 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 69 | ... Validate ONU Devices MIB State With Duration |
| 70 | ... ${onu_state} ${list_onus} ${timeStart} |
| 71 | |
| 72 | Log Ports |
| 73 | [Documentation] This keyword logs all port data available in ONOS of first port per ONU |
| 74 | [Arguments] ${onlyenabled}=False |
| 75 | ${cmd} Set Variable If ${onlyenabled} ports -e ports |
| 76 | ${onu_ports}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} ${cmd} |
| 77 | ${lines} = Get Lines Matching Regexp ${onu_ports} .*portName=BBSM[0-9]{8}-1 |
| 78 | Log ${lines} |
| 79 | |
| 80 | Kill Adaptor |
| 81 | [Documentation] This keyword kills the passed adaptor. |
| 82 | [Arguments] ${namespace} ${name} |
| 83 | ${cmd} Catenate |
| 84 | ... kubectl exec -it -n voltha $(kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}') |
| 85 | ... -- /bin/sh -c "kill 1" |
| 86 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
| 87 | Log ${output} |
| 88 | |
| 89 | Verify MIB Template Data Available |
| 90 | [Documentation] This keyword verifies MIB Template Data stored in etcd |
| 91 | ${namespace}= Set Variable default |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 92 | ${podname}= Set Variable etcd |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 93 | ${commandget} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 94 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/' |
Holger Hildebrandt | 2314774 | 2020-11-16 10:13:21 +0000 | [diff] [blame] | 95 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 96 | Should Not Be Empty ${result} No MIB Template Data stored in etcd! |
| 97 | |
| 98 | Delete MIB Template Data |
| 99 | [Documentation] This keyword deletes MIB Template Data stored in etcd |
| 100 | ${namespace}= Set Variable default |
| 101 | ${podname}= Set Variable etcd |
| 102 | ${commanddel} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 103 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/omci_mibs/go_templates/' |
Holger Hildebrandt | 2314774 | 2020-11-16 10:13:21 +0000 | [diff] [blame] | 104 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commanddel} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 105 | Sleep 3s |
| 106 | ${commandget} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 107 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/' |
Holger Hildebrandt | 2314774 | 2020-11-16 10:13:21 +0000 | [diff] [blame] | 108 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 109 | Should Be Empty ${result} Could not delete MIB Template Data stored in etcd! |
| 110 | |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 111 | Validate Onu Data In Etcd |
| 112 | [Documentation] This keyword validates openonu-go-adapter Data stored in etcd. |
| 113 | ... It checks unique of serial_number and combination of pon, onu and uni in tp_path. |
| 114 | ... Furthermore it evaluates the values of onu_id and uni_id with values read from tp_path. |
| 115 | ... Number of etcd entries has to match with the passed number. |
| 116 | [Arguments] ${nbofetcddata}=${num_all_onus} |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 117 | ${stackname}= Get Stack Name |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 118 | ${etcddata}= Get ONU Go Adapter ETCD Data |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 119 | ${etcddata}= Remove Lines Containing String ${etcddata} service/${stackname}/openonu \n |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 120 | #prepare result for json convert |
| 121 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 122 | ${jsondata}= To Json ${result} |
| 123 | ${length}= Get Length ${jsondata} |
| 124 | log ${jsondata} |
| 125 | Run Keyword And Continue On Failure Should Be Equal As Integers ${length} ${nbofetcddata} |
| 126 | ... msg=Number etcd data (${length}) does not match required (${nbofetcddata})! |
| 127 | ${pononuuniidlist}= Create List |
| 128 | ${serialnumberlist}= Create List |
| 129 | FOR ${INDEX} IN RANGE 0 ${length} |
| 130 | ${value}= Get From List ${jsondata} ${INDEX} |
Girish Gowdra | 97f8d06 | 2020-11-17 15:48:23 -0800 | [diff] [blame] | 131 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 132 | # When testing multi-tcont this may need some adjustment. |
| 133 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 134 | ${pononuuniid}= Read Pon Onu Uni String ${tp_path} |
| 135 | ${list_id}= Get Index From List ${pononuuniidlist} ${pononuuniid} |
| 136 | Should Be Equal As Integers ${list_id} -1 |
| 137 | ... msg=Combination of Pon, Onu and Uni (${pononuuniid}) exist multiple in etcd data! |
| 138 | Append To List ${pononuuniidlist} ${pononuuniid} |
| 139 | Validate Onu Id ${value} |
| 140 | Validate Uni Id ${value} |
| 141 | ${serial_number}= Get From Dictionary ${value} serial_number |
| 142 | ${list_id}= Get Index From List ${serialnumberlist} ${serial_number} |
| 143 | Should Be Equal As Integers ${list_id} -1 |
| 144 | ... msg=Serial number (${serial_number}) exists multiple in etcd data! |
| 145 | Append To List ${serialnumberlist} ${serial_number} |
| 146 | END |
| 147 | |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 148 | Validate Vlan Rules In Etcd |
| 149 | [Documentation] This keyword validates Vlan rules of openonu-go-adapter Data stored in etcd. |
| 150 | ... It checks the given number of cookie_slice, match_vid (=4096) and set_vid. |
| 151 | ... Furthermore it returns a list of all set_vid. |
| 152 | ... In case of a passed dictionary containing set_vids these will be checked for to |
| 153 | ... current set-vid depending on setvidequal (True=equal, False=not equal). |
| 154 | [Arguments] ${nbofcookieslice}=1 ${reqmatchvid}=4096 ${prevvlanrules}=${NONE} ${setvidequal}=False |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 155 | ${stackname}= Get Stack Name |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 156 | ${etcddata}= Get ONU Go Adapter ETCD Data |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 157 | ${etcddata}= Remove Lines Containing String ${etcddata} service/${stackname}/openonu \n |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 158 | #prepare result for json convert |
| 159 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 160 | ${jsondata}= To Json ${result} |
| 161 | ${length}= Get Length ${jsondata} |
| 162 | log ${jsondata} |
| 163 | ${vlan_rules}= Create Dictionary |
| 164 | FOR ${INDEX} IN RANGE 0 ${length} |
| 165 | ${value}= Get From List ${jsondata} ${INDEX} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 166 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 167 | # When testing multi-tcont this may need some adjustment. |
| 168 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 169 | ${pononuuniid}= Read Pon Onu Uni String ${tp_path} |
| 170 | ${cookieslice}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]} cookie_slice |
| 171 | #@{cookieslicelist}= Split String ${cookieslice} , |
| 172 | ${foundcookieslices}= Get Length ${cookieslice} |
| 173 | Should Be Equal As Integers ${foundcookieslices} ${nbofcookieslice} |
| 174 | ${matchvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']} |
| 175 | ... match_vid |
| 176 | Should Be Equal As Integers ${matchvid} ${reqmatchvid} |
| 177 | ${setvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']} |
| 178 | ... set_vid |
| 179 | ${evalresult}= Evaluate 2 <= ${setvid} <= 4095 |
| 180 | Should Be True ${evalresult} msg=set_vid out of range (${setvid})! |
| 181 | Set To Dictionary ${vlan_rules} ${pononuuniid} ${setvid} |
| 182 | ${oldsetvidvalid} Set Variable If ${prevvlanrules} is ${NONE} False True |
| 183 | ${prevsetvid}= Set Variable If ${oldsetvidvalid} ${prevvlanrules['${pononuuniid}']} |
| 184 | Run Keyword If ${oldsetvidvalid} and ${setvidequal} |
| 185 | ... Should Be Equal As Integers ${prevsetvid} ${setvid} |
| 186 | ... ELSE IF ${oldsetvidvalid} and not ${setvidequal} |
| 187 | ... Should Not Be Equal As Integers ${prevsetvid} ${setvid} |
| 188 | END |
| 189 | log Many ${vlan_rules} |
| 190 | [Return] ${vlan_rules} |
| 191 | |
| 192 | Get ONU Go Adapter ETCD Data |
| 193 | [Documentation] This keyword delivers openonu-go-adapter Data stored in etcd |
| 194 | ${namespace}= Set Variable default |
| 195 | ${podname}= Set Variable etcd |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 196 | ${stackname}= Get Stack Name |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 197 | ${commandget} Catenate |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 198 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix --prefix service/${stackname}/openonu' |
Holger Hildebrandt | 2314774 | 2020-11-16 10:13:21 +0000 | [diff] [blame] | 199 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 200 | log ${result} |
| 201 | [Return] ${result} |
| 202 | |
| 203 | Prepare ONU Go Adapter ETCD Data For Json |
| 204 | [Documentation] This keyword prepares openonu-go-adapter Data stored in etcd for converting |
| 205 | ... to json |
| 206 | [Arguments] ${etcddata} |
| 207 | #prepare result for json convert |
| 208 | ${prepresult}= Replace String ${etcddata} \n , |
| 209 | ${prepresult}= Strip String ${prepresult} mode=right characters=, |
| 210 | ${prepresult}= Set Variable [${prepresult}] |
| 211 | log ${prepresult} |
| 212 | [Return] ${prepresult} |
| 213 | |
| 214 | Remove Lines Containing String |
| 215 | [Documentation] This keyword deletes all lines from given string containing passed remove string |
| 216 | [Arguments] ${string} ${toremove} ${appendtoremoveline} |
| 217 | ${lines}= Get Lines Containing String ${string} ${toremove} |
| 218 | ${length}= Get Line Count ${lines} |
| 219 | ${firstline}= Set Variable False |
| 220 | FOR ${INDEX} IN RANGE 0 ${length} |
| 221 | ${String2remove} Get Line ${lines} ${INDEX} |
| 222 | ${String2remove} Set Variable ${String2remove}${appendtoremoveline} |
| 223 | ${string}= Remove String ${string} ${String2remove} |
| 224 | END |
| 225 | log ${string} |
| 226 | [Return] ${string} |
| 227 | |
| 228 | Read Pon Onu Uni String |
| 229 | [Documentation] This keyword builds a thre digit string using Pon, Onu and Uni value of given tp-path taken |
| 230 | ... taken from etcd data of onu go adapter |
| 231 | [Arguments] ${tp_path} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 232 | ${tppathlines}= Replace String ${tp_path} / \n |
| 233 | ${pon}= Get Value Of Tp Path Element ${tppathlines} pon |
| 234 | ${onu}= Get Value Of Tp Path Element ${tppathlines} onu |
| 235 | ${uni}= Get Value Of Tp Path Element ${tppathlines} uni |
| 236 | ${valuesid}= Set Variable ${pon}/${onu}/${uni} |
| 237 | log ${valuesid} |
| 238 | [Return] ${valuesid} |
| 239 | |
| 240 | Get Value Of Tp Path Element |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 241 | [Documentation] This keyword delivers numeric value of given tp path element. |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 242 | [Arguments] ${tp_path_lines} ${element} |
| 243 | ${value}= Get Lines Containing String ${tp_path_lines} ${element}-\{ |
| 244 | ${value}= Remove String ${value} ${element}-\{ |
| 245 | ${value}= Remove String ${value} \} |
| 246 | log ${value} |
| 247 | [Return] ${value} |
| 248 | |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 249 | Validate Onu Id |
| 250 | [Documentation] This keyword validates ONU Id of passed etcd data. |
| 251 | [Arguments] ${value} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 252 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 253 | # When testing multi-tcont this may need some adjustment. |
| 254 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 255 | ${tppathlines}= Replace String ${tp_path} / \n |
| 256 | ${onu}= Get Value Of Tp Path Element ${tppathlines} onu |
| 257 | ${onu_id}= Get From Dictionary ${value} onu_id |
| 258 | Should Be Equal As Integers ${onu} ${onu_id} |
| 259 | ... msg=Onu-Id (${onu_id}) does not match onu (${onu}) from tp_path in etcd data! |
| 260 | Should Be True ${onu_id}>=1 |
| 261 | |
| 262 | Validate Uni Id |
| 263 | [Documentation] This keyword validates UNI Id of passed etcd data. |
| 264 | [Arguments] ${value} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 265 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 266 | # When testing multi-tcont this may need some adjustment. |
| 267 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 268 | ${tppathlines}= Replace String ${tp_path} / \n |
| 269 | ${uni}= Get Value Of Tp Path Element ${tppathlines} uni |
| 270 | ${uni_id}= Get From Dictionary ${value['uni_config'][0]} uni_id |
| 271 | Should Be Equal As Integers ${uni} ${uni_id} |
| 272 | ... msg=Uni-Id (${uni_id}) does not match onu (${uni}) from tp_path in etcd data! |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 273 | |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 274 | Get Stack Name |
| 275 | [Documentation] This keyword delivers the stack name read from environment variable NAME if present. |
| 276 | ${env_name}= Get Environment Variable NAME default=${defaultstackname} |
| 277 | # while Get Environment Variable does not work correctly, a manual correction follows |
| 278 | ${env_name}= Set Variable If "${env_name}"=="${EMPTY}" ${defaultstackname} ${env_name} |
| 279 | [Return] ${env_name} |
| 280 | |
| 281 | Wait for Ports in ONOS for all OLTs |
| 282 | [Documentation] Waits untill a certain number of ports are enabled in all ONOS |
| 283 | [Arguments] ${onos_ssh_connection} ${count} ${filter} ${max_wait_time}=10m |
| 284 | FOR ${J} IN RANGE 0 ${num_olts} |
| 285 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 286 | ${onu_count}= Set Variable ${list_olts}[${J}][onucount] |
| 287 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 288 | ... ${olt_serial_number} |
| 289 | Set Global Variable ${of_id} |
| 290 | Wait for Ports in ONOS ${onos_ssh_connection} ${count} ${of_id} BBSM ${max_wait_time} |
| 291 | END |
| 292 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 293 | Map State |
| 294 | [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values. |
| 295 | [Arguments] ${state} |
| 296 | # create state lists with corresponding return values |
| 297 | # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE (number/name) |
| 298 | ${state1} Create List ENABLED ACTIVATING REACHABLE 1 activating-onu |
| 299 | ${state2} Create List ENABLED ACTIVATING REACHABLE 2 starting-openomci |
| 300 | ${state3} Create List ENABLED ACTIVATING REACHABLE 3 discovery-mibsync-complete |
| 301 | ${state4} Create List ENABLED ACTIVE REACHABLE 4 initial-mib-downloaded |
| 302 | ${state5} Create List ENABLED ACTIVE REACHABLE 5 tech-profile-config-download-success |
| 303 | ${state6} Create List ENABLED ACTIVE REACHABLE 6 omci-flows-pushed |
| 304 | ${state7} Create List DISABLED UNKNOWN REACHABLE 7 omci-admin-lock |
| 305 | ${state8} Create List ENABLED ACTIVE REACHABLE 8 onu-reenabled |
| 306 | ${state9} Create List ENABLED DISCOVERED UNREACHABLE 9 stopping-openomci |
| 307 | ${state10} Create List ENABLED DISCOVERED REACHABLE 10 rebooting |
| 308 | ${state11} Create List ENABLED DISCOVERED REACHABLE 11 omci-flows-deleted |
| 309 | ${state12} Create List DISABLED UNKNOWN REACHABLE 12 tech-profile-config-delete-success |
| 310 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Set Variable If |
| 311 | ... '${state}'=='1' or '${state}'=='activating-onu' ${state1} |
| 312 | ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2} |
| 313 | ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3} |
| 314 | ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4} |
| 315 | ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5} |
| 316 | ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6} |
| 317 | ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7} |
| 318 | ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8} |
| 319 | ... '${state}'=='9' or '${state}'=='stopping-openomci' ${state9} |
| 320 | ... '${state}'=='10' or '${state}'=='rebooting' ${state10} |
| 321 | ... '${state}'=='11' or '${state}'=='omci-flows-deleted' ${state11} |
| 322 | ... '${state}'=='12' or '${state}'=='tech-profile-config-delete-success' ${state12} |
| 323 | [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state} |