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 | |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 117 | Reconcile Onu Adapter |
| 118 | [Documentation] Restarts the openonu adapter and waits for reconciling is finished and expected oper-state is reached |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 119 | [Arguments] ${namespace} ${usekill2restart} ${oper_status} ${olt_to_be_deleted_sn}=${EMPTY} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 120 | # 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 |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 129 | # 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 Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 133 | # wait for the reconcile to complete |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 134 | # - 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 |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 137 | 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) |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 139 | ${list_onus} Create List |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 140 | 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} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 146 | Run Keyword And Ignore Error Wait Until Keyword Succeeds ${timeout} |
| 147 | ... 1s Check all ONU OperStatus ${list_onus} ${oper_status} |
| 148 | |
TorstenThieme | e512b1d | 2021-11-12 10:52:29 +0000 | [diff] [blame] | 149 | Validate 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. |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 152 | ... As get request Onu image list is used, any other get command could be used for this check. |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 153 | ... Will not check ONUs of passed deleted OLT (special feature) |
| 154 | [Arguments] ${deleted_olt}=${EMPTY} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 155 | ${onu_list} Create List |
| 156 | FOR ${I} IN RANGE 0 ${num_all_onus} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 157 | ${src}= Set Variable ${hosts.src[${I}]} |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 158 | ${olt_serial_number}= Set Variable ${src['olt']} |
| 159 | Continue For Loop If "${deleted_olt}"=="${olt_serial_number}" |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 160 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 161 | ${onu_id}= Get Index From List ${onu_list} ${onu_device_id} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 162 | Continue For Loop If -1 != ${onu_id} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 163 | Append To List ${onu_list} ${onu_device_id} |
| 164 | ${rc} ${output}= Get Onu Image List ${onu_device_id} |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 165 | Should Be True ${rc}==0 Onu ${src['onu']} (${onu_device_id}) still not accessible. |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 166 | END |
| 167 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 168 | Log 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 |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 172 | ${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] | 173 | ${lines} = Get Lines Matching Regexp ${onu_ports} .*portName=BBSM[0-9]{8}-1 |
| 174 | Log ${lines} |
| 175 | |
| 176 | Kill Adaptor |
| 177 | [Documentation] This keyword kills the passed adaptor. |
| 178 | [Arguments] ${namespace} ${name} |
| 179 | ${cmd} Catenate |
Matteo Scandolo | 6b52412 | 2021-10-22 14:34:29 -0700 | [diff] [blame] | 180 | ... kubectl exec -it -n ${namespace} $(kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}') |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 181 | ... -- /bin/sh -c "kill 1" |
| 182 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
| 183 | Log ${output} |
| 184 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 185 | Kill 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 | |
| 197 | Restart 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 Scandolo | 6f24ea9 | 2021-04-29 11:55:50 -0700 | [diff] [blame] | 204 | ${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} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 207 | Sleep 5s |
| 208 | Wait For Pods Ready ${namespace} ${list_openonu_apps} |
| 209 | |
| 210 | Disable Onu Device |
| 211 | [Documentation] This keyword disables all onus. |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 212 | ${onu_list} Create List |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 213 | 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']} |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 216 | ${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} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 219 | Disable Device ${onu_device_id} |
| 220 | Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id} |
| 221 | END |
| 222 | |
| 223 | Enable Onu Device |
| 224 | [Documentation] This keyword enables all onus. |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 225 | ${onu_list} Create List |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 226 | 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']} |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 229 | ${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} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 232 | Enable Device ${onu_device_id} |
| 233 | END |
| 234 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 235 | Verify MIB Template Data Available |
| 236 | [Documentation] This keyword verifies MIB Template Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 237 | [Arguments] ${namespace}=default |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 238 | ${podname}= Set Variable etcd |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 239 | ${commandget} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 240 | ... /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] | 241 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 242 | Should Not Be Empty ${result} No MIB Template Data stored in etcd! |
| 243 | |
| 244 | Delete MIB Template Data |
| 245 | [Documentation] This keyword deletes MIB Template Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 246 | [Arguments] ${namespace}=default |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 247 | ${podname}= Set Variable etcd |
| 248 | ${commanddel} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 249 | ... /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] | 250 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commanddel} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 251 | Sleep 3s |
| 252 | ${commandget} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 253 | ... /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] | 254 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 255 | Should Be Empty ${result} Could not delete MIB Template Data stored in etcd! |
| 256 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 257 | Set Tech Profile |
| 258 | [Documentation] This keyword sets the passed TechProfile for the test |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 259 | [Arguments] ${TechProfile} ${namespace}=default |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 260 | Log To Console \nTechProfile:${TechProfile} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 261 | ${podname}= Set Variable etcd |
Andrea Campanella | 0aa21d6 | 2021-07-22 10:44:32 +0200 | [diff] [blame] | 262 | ${label}= Set Variable app.kubernetes.io/name=${podname} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 263 | ${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 Campanella | 0aa21d6 | 2021-07-22 10:44:32 +0200 | [diff] [blame] | 267 | Copy File To Pod ${namespace} ${label} ${src} ${dest} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 268 | 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 Campanella | 0aa21d6 | 2021-07-22 10:44:32 +0200 | [diff] [blame] | 271 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 272 | Should Not Be Empty ${result} No Tech Profile stored in etcd! |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 273 | |
| 274 | Remove Tech Profile |
| 275 | [Documentation] This keyword removes TechProfile |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 276 | [Arguments] ${namespace}=default |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 277 | Log To Console \nTechProfile:${TechProfile} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 278 | ${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 | |
TorstenThieme | a7315f1 | 2021-07-23 11:56:34 +0000 | [diff] [blame] | 286 | Do 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 | |
| 302 | Do 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 | |
| 320 | Do 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 | |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 337 | Validate 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 Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 340 | [Arguments] ${nbofgemports} ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 341 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 342 | ${etcddata}= Get ONU Go Adapter ETCD Data namespace=${namespace} defaultkvstoreprefix=${kvstoreprefix} |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 343 | #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 Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 354 | ${resourcedata}= Get Resource Instances ETCD Data ${tp_path} namespace=${namespace} |
| 355 | ... defaultkvstoreprefix=${kvstoreprefix} |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 356 | 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 | |
| 365 | Get Resource Instances ETCD Data |
| 366 | [Documentation] This keyword delivers Resource Instances Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 367 | [Arguments] ${tppath} ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 368 | ${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 | |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 378 | Validate 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 Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 383 | [Arguments] ${namespace}=default ${nbofetcddata}=${num_all_onus} ${defaultkvstoreprefix}=voltha_voltha |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 384 | ... ${without_prefix}=True ${without_pm_data}=True |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 385 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 386 | ${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] | 387 | #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})! |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 394 | ${oltpononuuniidlist}= Create List |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 395 | ${serialnumberlist}= Create List |
| 396 | FOR ${INDEX} IN RANGE 0 ${length} |
| 397 | ${value}= Get From List ${jsondata} ${INDEX} |
Girish Gowdra | 97f8d06 | 2020-11-17 15:48:23 -0800 | [diff] [blame] | 398 | # 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. |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 400 | Exit For Loop If not ('uni_config' in $value) |
Girish Gowdra | 97f8d06 | 2020-11-17 15:48:23 -0800 | [diff] [blame] | 401 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 402 | ${oltpononuuniid}= Read Pon Onu Uni String ${tp_path} |
| 403 | ${list_id}= Get Index From List ${oltpononuuniidlist} ${oltpononuuniid} |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 404 | Should Be Equal As Integers ${list_id} -1 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 405 | ... msg=Combination of Pon, Onu and Uni (${oltpononuuniid}) exist multiple in etcd data! |
| 406 | Append To List ${oltpononuuniidlist} ${oltpononuuniid} |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 407 | 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 | |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 416 | Validate 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 | |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 427 | Validate 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 Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 433 | [Arguments] ${namespace}=default ${nbofcookieslice}=1 ${reqmatchvid}=4096 ${prevvlanrules}=${NONE} |
| 434 | ... ${setvidequal}=False ${defaultkvstoreprefix}=voltha_voltha ${without_prefix}=True ${without_pm_data}=True |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 435 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 436 | ${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] | 437 | #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 Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 445 | # 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 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 448 | ${oltpononuuniid}= Read Pon Onu Uni String ${tp_path} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 449 | ${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})! |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 460 | Set To Dictionary ${vlan_rules} ${oltpononuuniid} ${setvid} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 461 | ${oldsetvidvalid} Set Variable If ${prevvlanrules} is ${NONE} False True |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 462 | ${prevsetvid}= Set Variable If ${oldsetvidvalid} ${prevvlanrules['${oltpononuuniid}']} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 463 | 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 |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 468 | log Many ${vlan_rules} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 469 | [Return] ${vlan_rules} |
| 470 | |
| 471 | Get ONU Go Adapter ETCD Data |
| 472 | [Documentation] This keyword delivers openonu-go-adapter Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 473 | [Arguments] ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha ${without_prefix}=True |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 474 | ... ${without_pm_data}=True ${device_id}=${Empty} ${keys_only}=False |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 475 | ${podname}= Set Variable etcd |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 476 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
TorstenThieme | 3af1231 | 2021-03-10 16:15:24 +0000 | [diff] [blame] | 477 | ${commandget}= Catenate |
| 478 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/openonu' |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 479 | ${commandget}= Run Keyword If ${keys_only} Catenate ${commandget} --keys-only |
| 480 | ... ELSE Set Variable ${commandget} |
TorstenThieme | 3af1231 | 2021-03-10 16:15:24 +0000 | [diff] [blame] | 481 | ${commandget}= Run Keyword If ${without_prefix} Catenate ${commandget} |
| 482 | ... | grep -v service/${kvstoreprefix}/openonu |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 483 | ... ELSE Set Variable ${commandget} |
TorstenThieme | 3af1231 | 2021-03-10 16:15:24 +0000 | [diff] [blame] | 484 | ${commandget}= Run Keyword If ${without_pm_data} Catenate ${commandget} | grep -v instances_active |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 485 | ... ELSE Set Variable ${commandget} |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 486 | ${commandget}= Run Keyword If "${device_id}"!="${Empty}" Catenate ${commandget} | grep ${device_id} |
| 487 | ... ELSE Set Variable ${commandget} |
Holger Hildebrandt | 2314774 | 2020-11-16 10:13:21 +0000 | [diff] [blame] | 488 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 489 | log ${result} |
| 490 | [Return] ${result} |
| 491 | |
| 492 | Prepare 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 | |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 503 | Read Pon Onu Uni String |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 504 | [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] | 505 | ... taken from etcd data of onu go adapter |
| 506 | [Arguments] ${tp_path} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 507 | ${tppathlines}= Replace String ${tp_path} / \n |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 508 | ${olt}= Get Value Of Tp Path Element ${tppathlines} olt |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 509 | ${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 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 512 | ${valuesid}= Set Variable ${olt}/${pon}/${onu}/${uni} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 513 | log ${valuesid} |
| 514 | [Return] ${valuesid} |
| 515 | |
| 516 | Get Value Of Tp Path Element |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 517 | [Documentation] This keyword delivers numeric value of given tp path element. |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 518 | [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 | |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 525 | Validate Onu Id |
| 526 | [Documentation] This keyword validates ONU Id of passed etcd data. |
| 527 | [Arguments] ${value} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 528 | # 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 |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 531 | ${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 | |
| 538 | Validate Uni Id |
| 539 | [Documentation] This keyword validates UNI Id of passed etcd data. |
| 540 | [Arguments] ${value} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 541 | # 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 |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 544 | ${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! |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 549 | |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 550 | Delete ONU Go Adapter ETCD Data |
| 551 | [Documentation] This keyword deletes openonu-go-adapter Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 552 | [Arguments] ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha ${validate}=False |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 553 | ${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 Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 560 | ... Validate Onu Data In Etcd namespace=${namespace} nbofetcddata=0 without_pm_data=False |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 561 | [Return] ${result} |
| 562 | |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 563 | Wait for Ports in ONOS for all OLTs |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 564 | [Documentation] Waits untill a certain number of ports are enabled in all OLTs |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 565 | [Arguments] ${host} ${port} ${count} ${filter} ${max_wait_time}=10m ${determine_number}=False |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 566 | 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} |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 572 | ${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} |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 576 | 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] | 577 | END |
| 578 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 579 | Wait for all ONU Ports in ONOS Disabled |
| 580 | [Documentation] Waits untill a all ONU ports are disabled in all ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 581 | [Arguments] ${host} ${port} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 582 | 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} |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 587 | 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] | 588 | ... ${onu_port} |
| 589 | END |
| 590 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 591 | Map 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} |