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 |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 17 | Library grpc_robot.VolthaTools WITH NAME volthatools |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 18 | |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 19 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 20 | *** Keywords *** |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 21 | Calculate 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 | |
TorstenThieme | 3494ceb | 2021-07-19 09:47:24 +0000 | [diff] [blame] | 31 | Get 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 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 46 | Power On ONU Device |
| 47 | [Documentation] This keyword turns on the power for all onus. |
| 48 | [Arguments] ${namespace} |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 49 | 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 | |
| 56 | Power On ONU Device per OLT |
| 57 | [Documentation] This keyword turns on the power for all onus. |
| 58 | [Arguments] ${namespace} ${olt_serial_number} ${bbsim_pod} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 59 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 60 | ${src}= Set Variable ${hosts.src[${I}]} |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 61 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 62 | Power On ONU ${namespace} ${bbsim_pod} ${src['onu']} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 63 | END |
| 64 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 65 | Power Off ONU Device |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 66 | [Documentation] This keyword turns off the power for all onus per olt. |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 67 | [Arguments] ${namespace} |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 68 | 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 | |
| 75 | Power 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} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 78 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 79 | ${src}= Set Variable ${hosts.src[${I}]} |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 80 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 81 | Power Off ONU ${namespace} ${bbsim_pod} ${src['onu']} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 82 | END |
| 83 | |
| 84 | Current State Test |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 85 | [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 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 97 | Current State Test All Onus |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 98 | [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} |
TorstenThieme | 53450ff | 2021-05-11 09:44:33 +0000 | [diff] [blame] | 101 | ... ${alternativeonustate}=${EMPTY} ${timeout}=${timeout} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 102 | ${timeStart}= Get Current Date |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 103 | ${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} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 113 | ... ${onu_state} ${list_onus} ${timeStart} alternate_reason=${alternativeonustate} |
TorstenThieme | 53450ff | 2021-05-11 09:44:33 +0000 | [diff] [blame] | 114 | # 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 |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 116 | |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 117 | Wait for ONU Adapter Reconcile |
| 118 | [Documentation] After the OpenONU adapter is restarted waits for all the ONUs to go through the reconciling process |
| 119 | ... till they reach the expect OpenStatus |
| 120 | [Arguments] ${oper_status} |
| 121 | # wait for the reconcile to complete |
| 122 | # - we check that the first ONU state is set to reconciling. All of the ONUs will be set to reconciling |
| 123 | # very quickly at that point |
| 124 | # we need the Ignore Error to support he kafka case, in which the reconcile happens meanwhile we're waiting for |
| 125 | # the adapter to restart |
| 126 | Run Keyword And Ignore Error Wait Until Keyword Succeeds ${timeout} |
| 127 | ... 100ms Check ONU OperStatus ${hosts.src[0]['onu']} RECONCILING |
| 128 | # - then we wait that all ONU move to the next state |
| 129 | ${onu_list} Create List |
| 130 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 131 | ${onu_sn}= Set Variable ${hosts.src[${I}]['onu']} |
| 132 | # skip the check if we have already performed it for this ONU |
| 133 | ${onu_id}= Get Index From List ${onu_list} ${onu_sn} |
| 134 | Continue For Loop If -1 != ${onu_id} |
| 135 | Append To List ${onu_list} ${onu_sn} |
| 136 | Wait Until Keyword Succeeds ${timeout} 100ms Check ONU OperStatus ${onu_sn} ${oper_status} |
| 137 | END |
| 138 | |
| 139 | Check ONU OperStatus |
| 140 | [Documentation] Checks that all ONUs OperStatus is ACTIVE |
| 141 | [Arguments] ${sn} ${oper_status} |
| 142 | ${List_ONU_Serial} Create List |
| 143 | Build ONU SN List ${List_ONU_Serial} |
| 144 | ${cmd}= Catenate voltctl -c ${VOLTCTL_CONFIG} device list -m 8MB -f Type=brcm_openomci_onu |
| 145 | ... --format "{{.SerialNumber}}\t{{.AdminState}}\t{{.OperStatus}}\t{{.ConnectStatus}}\t{{.Reason}}" |
| 146 | ... | grep -v SERIALNUMBER | grep ${sn} |
| 147 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
| 148 | Should Be Equal As Integers ${rc} 0 |
| 149 | Log ${output} |
| 150 | |
| 151 | @{words}= Split String ${output} \t |
| 152 | ${sn}= Set Variable ${words[0]} |
| 153 | ${opstatus}= Set Variable ${words[2]} |
| 154 | Log OperStatus is ${opstatus} for device ${sn} |
| 155 | Should Be True '${opstatus}' == '${oper_status}' OperStatus ${oper_status} not matched on ONU ${sn} |
| 156 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 157 | Log Ports |
| 158 | [Documentation] This keyword logs all port data available in ONOS of first port per ONU |
| 159 | [Arguments] ${onlyenabled}=False |
| 160 | ${cmd} Set Variable If ${onlyenabled} ports -e ports |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 161 | ${onu_ports}= Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${cmd} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 162 | ${lines} = Get Lines Matching Regexp ${onu_ports} .*portName=BBSM[0-9]{8}-1 |
| 163 | Log ${lines} |
| 164 | |
| 165 | Kill Adaptor |
| 166 | [Documentation] This keyword kills the passed adaptor. |
| 167 | [Arguments] ${namespace} ${name} |
| 168 | ${cmd} Catenate |
| 169 | ... kubectl exec -it -n voltha $(kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}') |
| 170 | ... -- /bin/sh -c "kill 1" |
| 171 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
| 172 | Log ${output} |
| 173 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 174 | Kill And Check Onu Adaptor |
| 175 | [Documentation] This keyword kills ONU Adaptor and waits for it to come up again |
| 176 | ... Following steps will be executed: |
| 177 | ... - kill openonu adaptor |
| 178 | ... - check openonu adaptor is ready again |
| 179 | [Arguments] ${namespace} |
| 180 | ${list_openonu_apps} Create List adapter-open-onu |
| 181 | ${adaptorname}= Set Variable open-onu |
| 182 | Kill Adaptor ${namespace} ${adaptorname} |
| 183 | Sleep 5s |
| 184 | Wait For Pods Ready ${namespace} ${list_openonu_apps} |
| 185 | |
| 186 | Restart And Check Onu Adaptor |
| 187 | [Documentation] This keyword restarts ONU Adaptor and waits for it to come up again |
| 188 | ... Following steps will be executed: |
| 189 | ... - restart openonu adaptor |
| 190 | ... - check openonu adaptor is ready again |
| 191 | [Arguments] ${namespace} |
| 192 | ${list_openonu_apps} Create List adapter-open-onu |
Matteo Scandolo | 6f24ea9 | 2021-04-29 11:55:50 -0700 | [diff] [blame] | 193 | ${openonu_label_key} Set Variable app |
| 194 | ${openonu_label_value} Set Variable adapter-open-onu |
| 195 | Restart Pod By Label ${namespace} ${openonu_label_key} ${openonu_label_value} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 196 | Sleep 5s |
| 197 | Wait For Pods Ready ${namespace} ${list_openonu_apps} |
| 198 | |
| 199 | Disable Onu Device |
| 200 | [Documentation] This keyword disables all onus. |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 201 | ${onu_list} Create List |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 202 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 203 | ${src}= Set Variable ${hosts.src[${I}]} |
| 204 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 205 | ${onu_id}= Get Index From List ${onu_list} ${onu_device_id} |
| 206 | Continue For Loop If -1 != ${onu_id} |
| 207 | Append To List ${onu_list} ${onu_device_id} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 208 | Disable Device ${onu_device_id} |
| 209 | Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id} |
| 210 | END |
| 211 | |
| 212 | Enable Onu Device |
| 213 | [Documentation] This keyword enables all onus. |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 214 | ${onu_list} Create List |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 215 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 216 | ${src}= Set Variable ${hosts.src[${I}]} |
| 217 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 218 | ${onu_id}= Get Index From List ${onu_list} ${onu_device_id} |
| 219 | Continue For Loop If -1 != ${onu_id} |
| 220 | Append To List ${onu_list} ${onu_device_id} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 221 | Enable Device ${onu_device_id} |
| 222 | END |
| 223 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 224 | Verify MIB Template Data Available |
| 225 | [Documentation] This keyword verifies MIB Template Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 226 | [Arguments] ${namespace}=default |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 227 | ${podname}= Set Variable etcd |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 228 | ${commandget} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 229 | ... /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] | 230 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 231 | Should Not Be Empty ${result} No MIB Template Data stored in etcd! |
| 232 | |
| 233 | Delete MIB Template Data |
| 234 | [Documentation] This keyword deletes MIB Template Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 235 | [Arguments] ${namespace}=default |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 236 | ${podname}= Set Variable etcd |
| 237 | ${commanddel} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 238 | ... /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] | 239 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commanddel} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 240 | Sleep 3s |
| 241 | ${commandget} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 242 | ... /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] | 243 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 244 | Should Be Empty ${result} Could not delete MIB Template Data stored in etcd! |
| 245 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 246 | Set Tech Profile |
| 247 | [Documentation] This keyword sets the passed TechProfile for the test |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 248 | [Arguments] ${TechProfile} ${namespace}=default |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 249 | Log To Console \nTechProfile:${TechProfile} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 250 | ${podname}= Set Variable etcd |
Andrea Campanella | 0aa21d6 | 2021-07-22 10:44:32 +0200 | [diff] [blame] | 251 | ${label}= Set Variable app.kubernetes.io/name=${podname} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 252 | ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json |
| 253 | ${dest}= Set Variable /tmp/flexpod.json |
| 254 | ${command} Catenate |
| 255 | ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64' |
Andrea Campanella | 0aa21d6 | 2021-07-22 10:44:32 +0200 | [diff] [blame] | 256 | Copy File To Pod ${namespace} ${label} ${src} ${dest} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 257 | Exec Pod In Kube ${namespace} ${podname} ${command} |
| 258 | ${commandget} Catenate |
| 259 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64' |
Andrea Campanella | 0aa21d6 | 2021-07-22 10:44:32 +0200 | [diff] [blame] | 260 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 261 | Should Not Be Empty ${result} No Tech Profile stored in etcd! |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 262 | |
| 263 | Remove Tech Profile |
| 264 | [Documentation] This keyword removes TechProfile |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 265 | [Arguments] ${namespace}=default |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 266 | Log To Console \nTechProfile:${TechProfile} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 267 | ${podname}= Set Variable etcd |
| 268 | ${command} Catenate |
| 269 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64' |
| 270 | Exec Pod In Kube ${namespace} ${podname} ${command} |
| 271 | ${commandget} Catenate |
| 272 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64' |
| 273 | Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 274 | |
TorstenThieme | a7315f1 | 2021-07-23 11:56:34 +0000 | [diff] [blame] | 275 | Do Onu Subscriber Add Per OLT |
| 276 | [Documentation] Add Subscriber per OLT |
| 277 | [Arguments] ${of_id} ${olt_serial_number} ${print2console}=False |
| 278 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 279 | ${src}= Set Variable ${hosts.src[${I}]} |
| 280 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 281 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 282 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 283 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 284 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 285 | ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 286 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 287 | Run Keyword If ${print2console} Log \r\n[${I}] volt-add-subscriber-access ${of_id} ${onu_port}. |
| 288 | ... console=yes |
| 289 | END |
| 290 | |
| 291 | Do Onu Flow Check Per OLT |
| 292 | [Documentation] Checks all ONU flows show up in ONOS and Voltha |
| 293 | [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${print2console}=False |
| 294 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 295 | ${src}= Set Variable ${hosts.src[${I}]} |
| 296 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 297 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 298 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 299 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 300 | # Verify subscriber access flows are added for the ONU port |
| 301 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s |
| 302 | ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} |
| 303 | ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']} |
| 304 | ${logoutput} Catenate \r\n[${I}] Verify Subscriber Access Flows Added For |
| 305 | ... ONU ${of_id} ${onu_port} ${src['c_tag']} ${src['s_tag']}. |
| 306 | Run Keyword If ${print2console} Log ${logoutput} console=yes |
| 307 | END |
| 308 | |
| 309 | Do Onu Subscriber Remove Per OLT |
| 310 | [Documentation] Removes per OLT subscribers in ONOS and Voltha |
| 311 | [Arguments] ${of_id} ${olt_serial_number} ${print2console}=False |
| 312 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 313 | ${src}= Set Variable ${hosts.src[${I}]} |
| 314 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 315 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 316 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 317 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 318 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 319 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 320 | ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 321 | ... volt-remove-subscriber-access ${of_id} ${onu_port} |
| 322 | Run Keyword If ${print2console} Log \r\n[${I}] volt-remove-subscriber-access ${of_id} ${onu_port}. |
| 323 | ... console=yes |
| 324 | END |
| 325 | |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 326 | Validate Resource Instances Used Gem Ports |
| 327 | [Documentation] This keyword validates resource instances data stored in etcd. |
| 328 | ... It checks checks the number of gemport-ids which has matched with used Tech Profile |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 329 | [Arguments] ${nbofgemports} ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 330 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 331 | ${etcddata}= Get ONU Go Adapter ETCD Data namespace=${namespace} defaultkvstoreprefix=${kvstoreprefix} |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 332 | #prepare result for json convert |
| 333 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 334 | ${jsondata}= To Json ${result} |
| 335 | ${length}= Get Length ${jsondata} |
| 336 | log ${jsondata} |
| 337 | FOR ${INDEX} IN RANGE 0 ${length} |
| 338 | ${value}= Get From List ${jsondata} ${INDEX} |
| 339 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 340 | # When testing multi-tcont this may need some adjustment. |
| 341 | Exit For Loop If not ('uni_config' in $value) |
| 342 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 343 | ${resourcedata}= Get Resource Instances ETCD Data ${tp_path} namespace=${namespace} |
| 344 | ... defaultkvstoreprefix=${kvstoreprefix} |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 345 | log ${resourcedata} |
| 346 | ${decoderesult}= volthatools.Tech Profile Decode Resource Instance ${resourcedata} return_default=true |
| 347 | log ${decoderesult} |
| 348 | ${gemportids}= Get From Dictionary ${decoderesult} gemport_ids |
| 349 | ${length}= Get Length ${gemportids} |
| 350 | Should Be Equal As Integers ${nbofgemports} ${length} |
| 351 | ... msg=Number of gem ports (${length}) does not match with techprofile ${techprofile}/${nbofgemports} |
| 352 | END |
| 353 | |
| 354 | Get Resource Instances ETCD Data |
| 355 | [Documentation] This keyword delivers Resource Instances Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 356 | [Arguments] ${tppath} ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 357 | ${podname}= Set Variable etcd |
| 358 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
| 359 | ${commandget}= Catenate |
| 360 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/resource_instances/${tppath} |
| 361 | ... --print-value-only --hex' |
| 362 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 363 | log ${result} |
| 364 | [Return] ${result} |
| 365 | |
| 366 | |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 367 | Validate Onu Data In Etcd |
| 368 | [Documentation] This keyword validates openonu-go-adapter Data stored in etcd. |
| 369 | ... It checks unique of serial_number and combination of pon, onu and uni in tp_path. |
| 370 | ... Furthermore it evaluates the values of onu_id and uni_id with values read from tp_path. |
| 371 | ... Number of etcd entries has to match with the passed number. |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 372 | [Arguments] ${namespace}=default ${nbofetcddata}=${num_all_onus} ${defaultkvstoreprefix}=voltha_voltha |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 373 | ... ${without_prefix}=True ${without_pm_data}=True |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 374 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 375 | ${etcddata}= Get ONU Go Adapter ETCD Data ${namespace} ${kvstoreprefix} ${without_prefix} ${without_pm_data} |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 376 | #prepare result for json convert |
| 377 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 378 | ${jsondata}= To Json ${result} |
| 379 | ${length}= Get Length ${jsondata} |
| 380 | log ${jsondata} |
| 381 | Run Keyword And Continue On Failure Should Be Equal As Integers ${length} ${nbofetcddata} |
| 382 | ... msg=Number etcd data (${length}) does not match required (${nbofetcddata})! |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 383 | ${oltpononuuniidlist}= Create List |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 384 | ${serialnumberlist}= Create List |
| 385 | FOR ${INDEX} IN RANGE 0 ${length} |
| 386 | ${value}= Get From List ${jsondata} ${INDEX} |
Girish Gowdra | 97f8d06 | 2020-11-17 15:48:23 -0800 | [diff] [blame] | 387 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 388 | # When testing multi-tcont this may need some adjustment. |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 389 | Exit For Loop If not ('uni_config' in $value) |
Girish Gowdra | 97f8d06 | 2020-11-17 15:48:23 -0800 | [diff] [blame] | 390 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 391 | ${oltpononuuniid}= Read Pon Onu Uni String ${tp_path} |
| 392 | ${list_id}= Get Index From List ${oltpononuuniidlist} ${oltpononuuniid} |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 393 | Should Be Equal As Integers ${list_id} -1 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 394 | ... msg=Combination of Pon, Onu and Uni (${oltpononuuniid}) exist multiple in etcd data! |
| 395 | Append To List ${oltpononuuniidlist} ${oltpononuuniid} |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 396 | Validate Onu Id ${value} |
| 397 | Validate Uni Id ${value} |
| 398 | ${serial_number}= Get From Dictionary ${value} serial_number |
| 399 | ${list_id}= Get Index From List ${serialnumberlist} ${serial_number} |
| 400 | Should Be Equal As Integers ${list_id} -1 |
| 401 | ... msg=Serial number (${serial_number}) exists multiple in etcd data! |
| 402 | Append To List ${serialnumberlist} ${serial_number} |
| 403 | END |
| 404 | |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 405 | Validate Vlan Rules In Etcd |
| 406 | [Documentation] This keyword validates Vlan rules of openonu-go-adapter Data stored in etcd. |
| 407 | ... It checks the given number of cookie_slice, match_vid (=4096) and set_vid. |
| 408 | ... Furthermore it returns a list of all set_vid. |
| 409 | ... In case of a passed dictionary containing set_vids these will be checked for to |
| 410 | ... current set-vid depending on setvidequal (True=equal, False=not equal). |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 411 | [Arguments] ${namespace}=default ${nbofcookieslice}=1 ${reqmatchvid}=4096 ${prevvlanrules}=${NONE} |
| 412 | ... ${setvidequal}=False ${defaultkvstoreprefix}=voltha_voltha ${without_prefix}=True ${without_pm_data}=True |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 413 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 414 | ${etcddata}= Get ONU Go Adapter ETCD Data ${namespace} ${kvstoreprefix} ${without_prefix} ${without_pm_data} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 415 | #prepare result for json convert |
| 416 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 417 | ${jsondata}= To Json ${result} |
| 418 | ${length}= Get Length ${jsondata} |
| 419 | log ${jsondata} |
| 420 | ${vlan_rules}= Create Dictionary |
| 421 | FOR ${INDEX} IN RANGE 0 ${length} |
| 422 | ${value}= Get From List ${jsondata} ${INDEX} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 423 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 424 | # When testing multi-tcont this may need some adjustment. |
| 425 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 426 | ${oltpononuuniid}= Read Pon Onu Uni String ${tp_path} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 427 | ${cookieslice}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]} cookie_slice |
| 428 | #@{cookieslicelist}= Split String ${cookieslice} , |
| 429 | ${foundcookieslices}= Get Length ${cookieslice} |
| 430 | Should Be Equal As Integers ${foundcookieslices} ${nbofcookieslice} |
| 431 | ${matchvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']} |
| 432 | ... match_vid |
| 433 | Should Be Equal As Integers ${matchvid} ${reqmatchvid} |
| 434 | ${setvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']} |
| 435 | ... set_vid |
| 436 | ${evalresult}= Evaluate 2 <= ${setvid} <= 4095 |
| 437 | Should Be True ${evalresult} msg=set_vid out of range (${setvid})! |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 438 | Set To Dictionary ${vlan_rules} ${oltpononuuniid} ${setvid} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 439 | ${oldsetvidvalid} Set Variable If ${prevvlanrules} is ${NONE} False True |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 440 | ${prevsetvid}= Set Variable If ${oldsetvidvalid} ${prevvlanrules['${oltpononuuniid}']} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 441 | Run Keyword If ${oldsetvidvalid} and ${setvidequal} |
| 442 | ... Should Be Equal As Integers ${prevsetvid} ${setvid} |
| 443 | ... ELSE IF ${oldsetvidvalid} and not ${setvidequal} |
| 444 | ... Should Not Be Equal As Integers ${prevsetvid} ${setvid} |
| 445 | END |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 446 | log Many ${vlan_rules} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 447 | [Return] ${vlan_rules} |
| 448 | |
| 449 | Get ONU Go Adapter ETCD Data |
| 450 | [Documentation] This keyword delivers openonu-go-adapter Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 451 | [Arguments] ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha ${without_prefix}=True |
| 452 | ... ${without_pm_data}=True |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 453 | ${podname}= Set Variable etcd |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 454 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
TorstenThieme | 3af1231 | 2021-03-10 16:15:24 +0000 | [diff] [blame] | 455 | ${commandget}= Catenate |
| 456 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/openonu' |
| 457 | ${commandget}= Run Keyword If ${without_prefix} Catenate ${commandget} |
| 458 | ... | grep -v service/${kvstoreprefix}/openonu |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 459 | ... ELSE Set Variable ${commandget} |
TorstenThieme | 3af1231 | 2021-03-10 16:15:24 +0000 | [diff] [blame] | 460 | ${commandget}= Run Keyword If ${without_pm_data} Catenate ${commandget} | grep -v instances_active |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 461 | ... ELSE Set Variable ${commandget} |
Holger Hildebrandt | 2314774 | 2020-11-16 10:13:21 +0000 | [diff] [blame] | 462 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 463 | log ${result} |
| 464 | [Return] ${result} |
| 465 | |
| 466 | Prepare ONU Go Adapter ETCD Data For Json |
| 467 | [Documentation] This keyword prepares openonu-go-adapter Data stored in etcd for converting |
| 468 | ... to json |
| 469 | [Arguments] ${etcddata} |
| 470 | #prepare result for json convert |
| 471 | ${prepresult}= Replace String ${etcddata} \n , |
| 472 | ${prepresult}= Strip String ${prepresult} mode=right characters=, |
| 473 | ${prepresult}= Set Variable [${prepresult}] |
| 474 | log ${prepresult} |
| 475 | [Return] ${prepresult} |
| 476 | |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 477 | Read Pon Onu Uni String |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 478 | [Documentation] This keyword builds a four digit string using Olt, Pon, Onu and Uni value of given tp-path taken |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 479 | ... taken from etcd data of onu go adapter |
| 480 | [Arguments] ${tp_path} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 481 | ${tppathlines}= Replace String ${tp_path} / \n |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 482 | ${olt}= Get Value Of Tp Path Element ${tppathlines} olt |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 483 | ${pon}= Get Value Of Tp Path Element ${tppathlines} pon |
| 484 | ${onu}= Get Value Of Tp Path Element ${tppathlines} onu |
| 485 | ${uni}= Get Value Of Tp Path Element ${tppathlines} uni |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 486 | ${valuesid}= Set Variable ${olt}/${pon}/${onu}/${uni} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 487 | log ${valuesid} |
| 488 | [Return] ${valuesid} |
| 489 | |
| 490 | Get Value Of Tp Path Element |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 491 | [Documentation] This keyword delivers numeric value of given tp path element. |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 492 | [Arguments] ${tp_path_lines} ${element} |
| 493 | ${value}= Get Lines Containing String ${tp_path_lines} ${element}-\{ |
| 494 | ${value}= Remove String ${value} ${element}-\{ |
| 495 | ${value}= Remove String ${value} \} |
| 496 | log ${value} |
| 497 | [Return] ${value} |
| 498 | |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 499 | Validate Onu Id |
| 500 | [Documentation] This keyword validates ONU Id of passed etcd data. |
| 501 | [Arguments] ${value} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 502 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 503 | # When testing multi-tcont this may need some adjustment. |
| 504 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 505 | ${tppathlines}= Replace String ${tp_path} / \n |
| 506 | ${onu}= Get Value Of Tp Path Element ${tppathlines} onu |
| 507 | ${onu_id}= Get From Dictionary ${value} onu_id |
| 508 | Should Be Equal As Integers ${onu} ${onu_id} |
| 509 | ... msg=Onu-Id (${onu_id}) does not match onu (${onu}) from tp_path in etcd data! |
| 510 | Should Be True ${onu_id}>=1 |
| 511 | |
| 512 | Validate Uni Id |
| 513 | [Documentation] This keyword validates UNI Id of passed etcd data. |
| 514 | [Arguments] ${value} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 515 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 516 | # When testing multi-tcont this may need some adjustment. |
| 517 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 518 | ${tppathlines}= Replace String ${tp_path} / \n |
| 519 | ${uni}= Get Value Of Tp Path Element ${tppathlines} uni |
| 520 | ${uni_id}= Get From Dictionary ${value['uni_config'][0]} uni_id |
| 521 | Should Be Equal As Integers ${uni} ${uni_id} |
| 522 | ... 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] | 523 | |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 524 | Delete ONU Go Adapter ETCD Data |
| 525 | [Documentation] This keyword deletes openonu-go-adapter Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 526 | [Arguments] ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha ${validate}=False |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 527 | ${podname}= Set Variable etcd |
| 528 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
| 529 | ${commandget}= Catenate |
| 530 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/${kvstoreprefix}/openonu' |
| 531 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 532 | log ${result} |
| 533 | Run Keyword If ${validate} Wait Until Keyword Succeeds ${timeout} 1s |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 534 | ... Validate Onu Data In Etcd namespace=${namespace} nbofetcddata=0 without_pm_data=False |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 535 | [Return] ${result} |
| 536 | |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 537 | Wait for Ports in ONOS for all OLTs |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 538 | [Documentation] Waits untill a certain number of ports are enabled in all OLTs |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 539 | [Arguments] ${host} ${port} ${count} ${filter} ${max_wait_time}=10m ${determine_number}=False |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 540 | FOR ${J} IN RANGE 0 ${num_olts} |
| 541 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 542 | ${onu_count}= Set Variable ${list_olts}[${J}][onucount] |
| 543 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 544 | ... ${olt_serial_number} |
| 545 | Set Global Variable ${of_id} |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 546 | ${count2check}= Set Variable If ${count}==${num_all_onus} ${onu_count} ${count} |
| 547 | # if flag determine_number is set to True, always determine the number of real ONUs (overwrite previous value) |
| 548 | ${count2check}= Run Keyword If ${determine_number} Determine Number Of ONU ${olt_serial_number} |
| 549 | ... ELSE Set Variable ${count2check} |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 550 | Wait for Ports in ONOS ${host} ${port} ${count2check} ${of_id} BBSM ${max_wait_time} |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 551 | END |
| 552 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 553 | Wait for all ONU Ports in ONOS Disabled |
| 554 | [Documentation] Waits untill a all ONU ports are disabled in all ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 555 | [Arguments] ${host} ${port} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 556 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 557 | ${src}= Set Variable ${hosts.src[${I}]} |
| 558 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 559 | ... ${src['olt']} |
| 560 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} ${of_id} |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 561 | Wait Until Keyword Succeeds ${timeout} 2s Assert ONU Port Is Disabled ${host} ${port} ${of_id} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 562 | ... ${onu_port} |
| 563 | END |
| 564 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 565 | Map State |
| 566 | [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values. |
| 567 | [Arguments] ${state} |
| 568 | # create state lists with corresponding return values |
| 569 | # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE (number/name) |
| 570 | ${state1} Create List ENABLED ACTIVATING REACHABLE 1 activating-onu |
| 571 | ${state2} Create List ENABLED ACTIVATING REACHABLE 2 starting-openomci |
| 572 | ${state3} Create List ENABLED ACTIVATING REACHABLE 3 discovery-mibsync-complete |
| 573 | ${state4} Create List ENABLED ACTIVE REACHABLE 4 initial-mib-downloaded |
| 574 | ${state5} Create List ENABLED ACTIVE REACHABLE 5 tech-profile-config-download-success |
| 575 | ${state6} Create List ENABLED ACTIVE REACHABLE 6 omci-flows-pushed |
| 576 | ${state7} Create List DISABLED UNKNOWN REACHABLE 7 omci-admin-lock |
| 577 | ${state8} Create List ENABLED ACTIVE REACHABLE 8 onu-reenabled |
| 578 | ${state9} Create List ENABLED DISCOVERED UNREACHABLE 9 stopping-openomci |
| 579 | ${state10} Create List ENABLED DISCOVERED REACHABLE 10 rebooting |
| 580 | ${state11} Create List ENABLED DISCOVERED REACHABLE 11 omci-flows-deleted |
| 581 | ${state12} Create List DISABLED UNKNOWN REACHABLE 12 tech-profile-config-delete-success |
| 582 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Set Variable If |
| 583 | ... '${state}'=='1' or '${state}'=='activating-onu' ${state1} |
| 584 | ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2} |
| 585 | ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3} |
| 586 | ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4} |
| 587 | ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5} |
| 588 | ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6} |
| 589 | ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7} |
| 590 | ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8} |
| 591 | ... '${state}'=='9' or '${state}'=='stopping-openomci' ${state9} |
| 592 | ... '${state}'=='10' or '${state}'=='rebooting' ${state10} |
| 593 | ... '${state}'=='11' or '${state}'=='omci-flows-deleted' ${state11} |
| 594 | ... '${state}'=='12' or '${state}'=='tech-profile-config-delete-success' ${state12} |
| 595 | [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state} |