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 | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 120 | ... ${flow_delete_params}=&{EMPTY} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 121 | # get time of restart of openonu adapter |
| 122 | ${restart_ts}= Get Current Date |
| 123 | # restart OpenONU adapter |
| 124 | Run Keyword If ${usekill2restart} Kill And Check Onu Adaptor ${namespace} |
| 125 | ... ELSE Restart And Check Onu Adaptor ${namespace} |
| 126 | #check ready timestamp of openonu adapter, should be younger than restart timestamp |
| 127 | ${openonu_ready_ts}= Get Pod Ready Timestamp by Label ${namespace} app adapter-open-onu |
| 128 | ${restart_duration}= Subtract Date From Date ${openonu_ready_ts} ${restart_ts} |
| 129 | Should Be True ${restart_duration}>0 |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 130 | # delete the olt passed, if available (special feature) |
| 131 | ${olt_to_be_deleted_device_id}= Run Keyword IF "${olt_to_be_deleted_sn}"!="${EMPTY}" |
| 132 | ... Get OLTDeviceID From OLT List ${olt_to_be_deleted_sn} |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 133 | Run Keyword If "${olt_to_be_deleted_sn}"!="${EMPTY}" Delete Device ${olt_to_be_deleted_device_id} |
| 134 | # remove flows if params passed for it (special feature II) |
| 135 | Run Keyword If ${flow_delete_params}!=&{EMPTY} Wait Until Keyword Succeeds ${timeout} 2s |
| 136 | ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 137 | ... volt-remove-subscriber-access ${flow_delete_params['of_id']} ${flow_delete_params['onu_port']} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 138 | # wait for the reconcile to complete |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 139 | # - we check that communication to openonu-adapter is established again |
| 140 | # - we check that all ONUs leave reconcile state by validate a simple voltctl request will not responds with error |
| 141 | Wait Until Keyword Succeeds ${timeout} 1s Validate Last ONU Communication |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 142 | Wait Until Keyword Succeeds ${timeout} 1s Validate All Onus Accessible ${olt_to_be_deleted_sn} |
| 143 | # - 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] | 144 | ${list_onus} Create List |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 145 | FOR ${J} IN RANGE 0 ${num_olts} |
| 146 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 147 | Continue For Loop If "${olt_to_be_deleted_sn}"=="${olt_serial_number}" |
| 148 | Build ONU SN List ${list_onus} ${olt_serial_number} |
| 149 | END |
| 150 | Log ${list_onus} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 151 | Run Keyword And Ignore Error Wait Until Keyword Succeeds ${timeout} |
| 152 | ... 1s Check all ONU OperStatus ${list_onus} ${oper_status} |
| 153 | |
TorstenThieme | e512b1d | 2021-11-12 10:52:29 +0000 | [diff] [blame] | 154 | Validate All Onus Accessible |
| 155 | [Documentation] This keyword checks all onus accessible (again) with help of a simple voltctl request. |
| 156 | ... 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] | 157 | ... 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] | 158 | ... Will not check ONUs of passed deleted OLT (special feature) |
| 159 | [Arguments] ${deleted_olt}=${EMPTY} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 160 | ${onu_list} Create List |
| 161 | FOR ${I} IN RANGE 0 ${num_all_onus} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 162 | ${src}= Set Variable ${hosts.src[${I}]} |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 163 | ${olt_serial_number}= Set Variable ${src['olt']} |
| 164 | Continue For Loop If "${deleted_olt}"=="${olt_serial_number}" |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 165 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 166 | ${onu_id}= Get Index From List ${onu_list} ${onu_device_id} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 167 | Continue For Loop If -1 != ${onu_id} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 168 | Append To List ${onu_list} ${onu_device_id} |
| 169 | ${rc} ${output}= Get Onu Image List ${onu_device_id} |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 170 | 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] | 171 | END |
| 172 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 173 | Log Ports |
| 174 | [Documentation] This keyword logs all port data available in ONOS of first port per ONU |
| 175 | [Arguments] ${onlyenabled}=False |
| 176 | ${cmd} Set Variable If ${onlyenabled} ports -e ports |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 177 | ${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] | 178 | ${lines} = Get Lines Matching Regexp ${onu_ports} .*portName=BBSM[0-9]{8}-1 |
| 179 | Log ${lines} |
| 180 | |
| 181 | Kill Adaptor |
| 182 | [Documentation] This keyword kills the passed adaptor. |
| 183 | [Arguments] ${namespace} ${name} |
| 184 | ${cmd} Catenate |
Matteo Scandolo | 6b52412 | 2021-10-22 14:34:29 -0700 | [diff] [blame] | 185 | ... 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] | 186 | ... -- /bin/sh -c "kill 1" |
| 187 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
| 188 | Log ${output} |
| 189 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 190 | Kill And Check Onu Adaptor |
| 191 | [Documentation] This keyword kills ONU Adaptor and waits for it to come up again |
| 192 | ... Following steps will be executed: |
| 193 | ... - kill openonu adaptor |
| 194 | ... - check openonu adaptor is ready again |
| 195 | [Arguments] ${namespace} |
| 196 | ${list_openonu_apps} Create List adapter-open-onu |
| 197 | ${adaptorname}= Set Variable open-onu |
| 198 | Kill Adaptor ${namespace} ${adaptorname} |
| 199 | Sleep 5s |
| 200 | Wait For Pods Ready ${namespace} ${list_openonu_apps} |
| 201 | |
| 202 | Restart And Check Onu Adaptor |
| 203 | [Documentation] This keyword restarts ONU Adaptor and waits for it to come up again |
| 204 | ... Following steps will be executed: |
| 205 | ... - restart openonu adaptor |
| 206 | ... - check openonu adaptor is ready again |
| 207 | [Arguments] ${namespace} |
| 208 | ${list_openonu_apps} Create List adapter-open-onu |
Matteo Scandolo | 6f24ea9 | 2021-04-29 11:55:50 -0700 | [diff] [blame] | 209 | ${openonu_label_key} Set Variable app |
| 210 | ${openonu_label_value} Set Variable adapter-open-onu |
| 211 | Restart Pod By Label ${namespace} ${openonu_label_key} ${openonu_label_value} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 212 | Sleep 5s |
| 213 | Wait For Pods Ready ${namespace} ${list_openonu_apps} |
| 214 | |
| 215 | Disable Onu Device |
| 216 | [Documentation] This keyword disables all onus. |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 217 | ${onu_list} Create List |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 218 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 219 | ${src}= Set Variable ${hosts.src[${I}]} |
| 220 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 221 | ${onu_id}= Get Index From List ${onu_list} ${onu_device_id} |
| 222 | Continue For Loop If -1 != ${onu_id} |
| 223 | Append To List ${onu_list} ${onu_device_id} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 224 | Disable Device ${onu_device_id} |
| 225 | Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id} |
| 226 | END |
| 227 | |
| 228 | Enable Onu Device |
| 229 | [Documentation] This keyword enables all onus. |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 230 | ${onu_list} Create List |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 231 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 232 | ${src}= Set Variable ${hosts.src[${I}]} |
| 233 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 234 | ${onu_id}= Get Index From List ${onu_list} ${onu_device_id} |
| 235 | Continue For Loop If -1 != ${onu_id} |
| 236 | Append To List ${onu_list} ${onu_device_id} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 237 | Enable Device ${onu_device_id} |
| 238 | END |
| 239 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 240 | Verify MIB Template Data Available |
| 241 | [Documentation] This keyword verifies MIB Template Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 242 | [Arguments] ${namespace}=default |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 243 | ${podname}= Set Variable etcd |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 244 | ${commandget} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 245 | ... /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] | 246 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 247 | Should Not Be Empty ${result} No MIB Template Data stored in etcd! |
| 248 | |
| 249 | Delete MIB Template Data |
| 250 | [Documentation] This keyword deletes MIB Template Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 251 | [Arguments] ${namespace}=default |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 252 | ${podname}= Set Variable etcd |
| 253 | ${commanddel} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 254 | ... /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] | 255 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commanddel} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 256 | Sleep 3s |
| 257 | ${commandget} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 258 | ... /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] | 259 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 260 | Should Be Empty ${result} Could not delete MIB Template Data stored in etcd! |
| 261 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 262 | Set Tech Profile |
| 263 | [Documentation] This keyword sets the passed TechProfile for the test |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 264 | [Arguments] ${TechProfile} ${namespace}=default |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 265 | Log To Console \nTechProfile:${TechProfile} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 266 | ${podname}= Set Variable etcd |
Andrea Campanella | 0aa21d6 | 2021-07-22 10:44:32 +0200 | [diff] [blame] | 267 | ${label}= Set Variable app.kubernetes.io/name=${podname} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 268 | ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json |
| 269 | ${dest}= Set Variable /tmp/flexpod.json |
| 270 | ${command} Catenate |
| 271 | ... /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] | 272 | Copy File To Pod ${namespace} ${label} ${src} ${dest} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 273 | Exec Pod In Kube ${namespace} ${podname} ${command} |
| 274 | ${commandget} Catenate |
| 275 | ... /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] | 276 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 277 | Should Not Be Empty ${result} No Tech Profile stored in etcd! |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 278 | |
| 279 | Remove Tech Profile |
| 280 | [Documentation] This keyword removes TechProfile |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 281 | [Arguments] ${namespace}=default |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 282 | Log To Console \nTechProfile:${TechProfile} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 283 | ${podname}= Set Variable etcd |
| 284 | ${command} Catenate |
| 285 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64' |
| 286 | Exec Pod In Kube ${namespace} ${podname} ${command} |
| 287 | ${commandget} Catenate |
| 288 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64' |
| 289 | Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 290 | |
TorstenThieme | a7315f1 | 2021-07-23 11:56:34 +0000 | [diff] [blame] | 291 | Do Onu Subscriber Add Per OLT |
| 292 | [Documentation] Add Subscriber per OLT |
| 293 | [Arguments] ${of_id} ${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 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 301 | ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 302 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 303 | Run Keyword If ${print2console} Log \r\n[${I}] volt-add-subscriber-access ${of_id} ${onu_port}. |
| 304 | ... console=yes |
| 305 | END |
| 306 | |
| 307 | Do Onu Flow Check Per OLT |
| 308 | [Documentation] Checks all ONU flows show up in ONOS and Voltha |
| 309 | [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${print2console}=False |
| 310 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 311 | ${src}= Set Variable ${hosts.src[${I}]} |
| 312 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 313 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 314 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 315 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 316 | # Verify subscriber access flows are added for the ONU port |
| 317 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s |
| 318 | ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} |
| 319 | ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']} |
| 320 | ${logoutput} Catenate \r\n[${I}] Verify Subscriber Access Flows Added For |
| 321 | ... ONU ${of_id} ${onu_port} ${src['c_tag']} ${src['s_tag']}. |
| 322 | Run Keyword If ${print2console} Log ${logoutput} console=yes |
| 323 | END |
| 324 | |
| 325 | Do Onu Subscriber Remove Per OLT |
| 326 | [Documentation] Removes per OLT subscribers in ONOS and Voltha |
| 327 | [Arguments] ${of_id} ${olt_serial_number} ${print2console}=False |
| 328 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 329 | ${src}= Set Variable ${hosts.src[${I}]} |
| 330 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 331 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 332 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 333 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 334 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 335 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 336 | ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 337 | ... volt-remove-subscriber-access ${of_id} ${onu_port} |
| 338 | Run Keyword If ${print2console} Log \r\n[${I}] volt-remove-subscriber-access ${of_id} ${onu_port}. |
| 339 | ... console=yes |
| 340 | END |
| 341 | |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 342 | Validate Resource Instances Used Gem Ports |
| 343 | [Documentation] This keyword validates resource instances data stored in etcd. |
| 344 | ... 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] | 345 | [Arguments] ${nbofgemports} ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 346 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 347 | ${etcddata}= Get ONU Go Adapter ETCD Data namespace=${namespace} defaultkvstoreprefix=${kvstoreprefix} |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 348 | #prepare result for json convert |
| 349 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 350 | ${jsondata}= To Json ${result} |
| 351 | ${length}= Get Length ${jsondata} |
| 352 | log ${jsondata} |
| 353 | FOR ${INDEX} IN RANGE 0 ${length} |
| 354 | ${value}= Get From List ${jsondata} ${INDEX} |
| 355 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 356 | # When testing multi-tcont this may need some adjustment. |
| 357 | Exit For Loop If not ('uni_config' in $value) |
| 358 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 359 | ${resourcedata}= Get Resource Instances ETCD Data ${tp_path} namespace=${namespace} |
| 360 | ... defaultkvstoreprefix=${kvstoreprefix} |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 361 | log ${resourcedata} |
| 362 | ${decoderesult}= volthatools.Tech Profile Decode Resource Instance ${resourcedata} return_default=true |
| 363 | log ${decoderesult} |
| 364 | ${gemportids}= Get From Dictionary ${decoderesult} gemport_ids |
| 365 | ${length}= Get Length ${gemportids} |
| 366 | Should Be Equal As Integers ${nbofgemports} ${length} |
| 367 | ... msg=Number of gem ports (${length}) does not match with techprofile ${techprofile}/${nbofgemports} |
| 368 | END |
| 369 | |
| 370 | Get Resource Instances ETCD Data |
| 371 | [Documentation] This keyword delivers Resource Instances Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 372 | [Arguments] ${tppath} ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 373 | ${podname}= Set Variable etcd |
| 374 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
| 375 | ${commandget}= Catenate |
| 376 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/resource_instances/${tppath} |
| 377 | ... --print-value-only --hex' |
| 378 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 379 | log ${result} |
| 380 | [Return] ${result} |
| 381 | |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 382 | Validate Tech Profiles and Flows in ETCD Data Per Onu |
| 383 | [Documentation] This keyword validates tech profiles and flows data stored in etcd per onu. |
| 384 | ... It checks checks presence/absence of tech profiles and flows depending on must_exist. |
| 385 | ... The values/content of tech profiles and flows will be not validated! |
| 386 | [Arguments] ${onu_sn} ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha ${must_exist}=True |
| 387 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
| 388 | ${etcddata}= Get ONU Go Adapter ETCD Data namespace=${namespace} defaultkvstoreprefix=${kvstoreprefix} |
| 389 | #prepare result for json convert |
| 390 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 391 | ${jsondata}= To Json ${result} |
| 392 | ${length}= Get Length ${jsondata} |
| 393 | log ${jsondata} |
| 394 | ${matched}= Set Variable False |
| 395 | FOR ${INDEX} IN RANGE 0 ${length} |
| 396 | ${value}= Get From List ${jsondata} ${INDEX} |
| 397 | ${uni_config}= Get From Dictionary ${value} uni_config |
| 398 | ${uni_config}= Set Variable ${uni_config[0]} |
| 399 | ${sn}= Get From Dictionary ${value} serial_number |
| 400 | ${matched}= Set Variable If '${sn}'=='${onu_sn}' True False |
| 401 | Exit For Loop If ${matched} |
| 402 | END |
| 403 | Should Be True ${matched} No ETCD data found for ONU ${onu_sn} |
| 404 | Log ${uni_config} |
| 405 | ${tp_path}= Get From Dictionary ${uni_config} PersTpPathMap |
| 406 | Log ${tp_path} |
| 407 | ${flow_params}= Get From Dictionary ${uni_config} flow_params |
| 408 | Log ${flow_params} |
| 409 | # in case of ATT for ONU with removed flows there is default flow established |
| 410 | ${length}= Get Length ${flow_params} |
| 411 | ${cookieslice}= Run Keyword If ${length}>0 Run Keyword If 'cookie_slice' in ${flow_params[0]} |
| 412 | ... Get From Dictionary ${flow_params[0]} cookie_slice |
| 413 | ${setvid}= Run Keyword If ${length}>0 Run Keyword If 'set_vid' in ${flow_params[0]['vlan_rule_params']} |
| 414 | ... Get From Dictionary ${flow_params[0]['vlan_rule_params']} set_vid |
| 415 | ${cookie_slice_length}= Run Keyword If ${length}>0 Run Keyword If 'cookie_slice' in ${flow_params[0]} |
| 416 | ... Get Length ${cookieslice} |
| 417 | Run Keyword If "${workflow}"=="ATT" and not ${must_exist} Run Keywords |
| 418 | ... Should Be Equal As Numbers ${setvid} 4091 AND |
| 419 | ... Should Be Equal As Numbers ${cookie_slice_length} 1 AND |
| 420 | ... Should Not Be Empty ${tp_path} AND |
| 421 | ... Return From Keyword |
| 422 | ${tp_path_length}= Get Length ${tp_path} |
| 423 | # validate tp_path is not Empty for case must_exist, case not must_exist will be validated implicitly with FOR loop |
| 424 | Run Keyword If ${must_exist} Should Not Be Empty ${tp_path} |
| 425 | ${tp_path_keys}= Run Keyword If ${tp_path_length}==0 Create List |
| 426 | ... ELSE Get Dictionary Keys ${tp_path} |
| 427 | ${tp_path_values}= Run Keyword If ${tp_path_length}==0 Create List |
| 428 | ... ELSE Get Dictionary Values ${tp_path} |
| 429 | ${tp_path_empty}= Set Variable True |
| 430 | Log ${tp_path_values} |
| 431 | Log ${tp_path_keys} |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 432 | # In case of not empty tp_path each value will be checked depending on must_exist |
| 433 | FOR ${key} IN @{tp_path_keys} |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 434 | ${value}= Get From Dictionary ${tp_path} ${key} |
| 435 | Run Keyword If ${must_exist} Should Not Be Empty ${value} |
| 436 | ... ELSE Should Be Empty ${value} |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 437 | END |
| 438 | Run Keyword If ${must_exist} Should Not Be Empty ${flow_params} |
| 439 | ... ELSE Should Be Empty ${flow_params} |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 440 | |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 441 | Validate Onu Data In Etcd |
| 442 | [Documentation] This keyword validates openonu-go-adapter Data stored in etcd. |
| 443 | ... It checks unique of serial_number and combination of pon, onu and uni in tp_path. |
| 444 | ... Furthermore it evaluates the values of onu_id and uni_id with values read from tp_path. |
| 445 | ... Number of etcd entries has to match with the passed number. |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 446 | [Arguments] ${namespace}=default ${nbofetcddata}=${num_all_onus} ${defaultkvstoreprefix}=voltha_voltha |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 447 | ... ${without_prefix}=True ${without_pm_data}=True |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 448 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 449 | ${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] | 450 | #prepare result for json convert |
| 451 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 452 | ${jsondata}= To Json ${result} |
| 453 | ${length}= Get Length ${jsondata} |
| 454 | log ${jsondata} |
| 455 | Run Keyword And Continue On Failure Should Be Equal As Integers ${length} ${nbofetcddata} |
| 456 | ... msg=Number etcd data (${length}) does not match required (${nbofetcddata})! |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 457 | ${oltpononuuniidlist}= Create List |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 458 | ${serialnumberlist}= Create List |
| 459 | FOR ${INDEX} IN RANGE 0 ${length} |
| 460 | ${value}= Get From List ${jsondata} ${INDEX} |
Girish Gowdra | 97f8d06 | 2020-11-17 15:48:23 -0800 | [diff] [blame] | 461 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 462 | # When testing multi-tcont this may need some adjustment. |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 463 | Exit For Loop If not ('uni_config' in $value) |
Girish Gowdra | 97f8d06 | 2020-11-17 15:48:23 -0800 | [diff] [blame] | 464 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 465 | ${oltpononuuniid}= Read Pon Onu Uni String ${tp_path} |
| 466 | ${list_id}= Get Index From List ${oltpononuuniidlist} ${oltpononuuniid} |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 467 | Should Be Equal As Integers ${list_id} -1 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 468 | ... msg=Combination of Pon, Onu and Uni (${oltpononuuniid}) exist multiple in etcd data! |
| 469 | Append To List ${oltpononuuniidlist} ${oltpononuuniid} |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 470 | Validate Onu Id ${value} |
| 471 | Validate Uni Id ${value} |
| 472 | ${serial_number}= Get From Dictionary ${value} serial_number |
| 473 | ${list_id}= Get Index From List ${serialnumberlist} ${serial_number} |
| 474 | Should Be Equal As Integers ${list_id} -1 |
| 475 | ... msg=Serial number (${serial_number}) exists multiple in etcd data! |
| 476 | Append To List ${serialnumberlist} ${serial_number} |
| 477 | END |
| 478 | |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 479 | Validate Onu Data In Etcd Removed |
| 480 | [Documentation] This keyword validates openonu-go-adapter Data stored in etcd are removed. |
| 481 | ... In case of a device is passed, only this will be checked. |
| 482 | [Arguments] ${namespace}=default ${device_id}=${EMPTY} ${defaultkvstoreprefix}=voltha_voltha |
| 483 | ... ${without_pm_data}=True |
| 484 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
| 485 | ${etcddata}= Get ONU Go Adapter ETCD Data ${namespace} ${kvstoreprefix} False ${without_pm_data} |
| 486 | ... ${device_id} True |
| 487 | Log ${etcddata} |
| 488 | Should Be Empty ${etcddata} Stale Openonu Data in Etcd (KV store) ${device_id} |
| 489 | |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 490 | Validate Vlan Rules In Etcd |
| 491 | [Documentation] This keyword validates Vlan rules of openonu-go-adapter Data stored in etcd. |
| 492 | ... It checks the given number of cookie_slice, match_vid (=4096) and set_vid. |
| 493 | ... Furthermore it returns a list of all set_vid. |
| 494 | ... In case of a passed dictionary containing set_vids these will be checked for to |
| 495 | ... current set-vid depending on setvidequal (True=equal, False=not equal). |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 496 | [Arguments] ${namespace}=default ${nbofcookieslice}=1 ${reqmatchvid}=4096 ${prevvlanrules}=${NONE} |
| 497 | ... ${setvidequal}=False ${defaultkvstoreprefix}=voltha_voltha ${without_prefix}=True ${without_pm_data}=True |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 498 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 499 | ${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] | 500 | #prepare result for json convert |
| 501 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 502 | ${jsondata}= To Json ${result} |
| 503 | ${length}= Get Length ${jsondata} |
| 504 | log ${jsondata} |
| 505 | ${vlan_rules}= Create Dictionary |
| 506 | FOR ${INDEX} IN RANGE 0 ${length} |
| 507 | ${value}= Get From List ${jsondata} ${INDEX} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 508 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 509 | # When testing multi-tcont this may need some adjustment. |
| 510 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 511 | ${oltpononuuniid}= Read Pon Onu Uni String ${tp_path} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 512 | ${cookieslice}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]} cookie_slice |
| 513 | #@{cookieslicelist}= Split String ${cookieslice} , |
| 514 | ${foundcookieslices}= Get Length ${cookieslice} |
| 515 | Should Be Equal As Integers ${foundcookieslices} ${nbofcookieslice} |
| 516 | ${matchvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']} |
| 517 | ... match_vid |
| 518 | Should Be Equal As Integers ${matchvid} ${reqmatchvid} |
| 519 | ${setvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']} |
| 520 | ... set_vid |
| 521 | ${evalresult}= Evaluate 2 <= ${setvid} <= 4095 |
| 522 | Should Be True ${evalresult} msg=set_vid out of range (${setvid})! |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 523 | Set To Dictionary ${vlan_rules} ${oltpononuuniid} ${setvid} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 524 | ${oldsetvidvalid} Set Variable If ${prevvlanrules} is ${NONE} False True |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 525 | ${prevsetvid}= Set Variable If ${oldsetvidvalid} ${prevvlanrules['${oltpononuuniid}']} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 526 | Run Keyword If ${oldsetvidvalid} and ${setvidequal} |
| 527 | ... Should Be Equal As Integers ${prevsetvid} ${setvid} |
| 528 | ... ELSE IF ${oldsetvidvalid} and not ${setvidequal} |
| 529 | ... Should Not Be Equal As Integers ${prevsetvid} ${setvid} |
| 530 | END |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 531 | log Many ${vlan_rules} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 532 | [Return] ${vlan_rules} |
| 533 | |
| 534 | Get ONU Go Adapter ETCD Data |
| 535 | [Documentation] This keyword delivers openonu-go-adapter Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 536 | [Arguments] ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha ${without_prefix}=True |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 537 | ... ${without_pm_data}=True ${device_id}=${Empty} ${keys_only}=False |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 538 | ${podname}= Set Variable etcd |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 539 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
TorstenThieme | 3af1231 | 2021-03-10 16:15:24 +0000 | [diff] [blame] | 540 | ${commandget}= Catenate |
| 541 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/openonu' |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 542 | ${commandget}= Run Keyword If ${keys_only} Catenate ${commandget} --keys-only |
| 543 | ... ELSE Set Variable ${commandget} |
TorstenThieme | 3af1231 | 2021-03-10 16:15:24 +0000 | [diff] [blame] | 544 | ${commandget}= Run Keyword If ${without_prefix} Catenate ${commandget} |
| 545 | ... | grep -v service/${kvstoreprefix}/openonu |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 546 | ... ELSE Set Variable ${commandget} |
TorstenThieme | 3af1231 | 2021-03-10 16:15:24 +0000 | [diff] [blame] | 547 | ${commandget}= Run Keyword If ${without_pm_data} Catenate ${commandget} | grep -v instances_active |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 548 | ... ELSE Set Variable ${commandget} |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 549 | ${commandget}= Run Keyword If "${device_id}"!="${Empty}" Catenate ${commandget} | grep ${device_id} |
| 550 | ... ELSE Set Variable ${commandget} |
Holger Hildebrandt | 2314774 | 2020-11-16 10:13:21 +0000 | [diff] [blame] | 551 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 552 | log ${result} |
| 553 | [Return] ${result} |
| 554 | |
| 555 | Prepare ONU Go Adapter ETCD Data For Json |
| 556 | [Documentation] This keyword prepares openonu-go-adapter Data stored in etcd for converting |
| 557 | ... to json |
| 558 | [Arguments] ${etcddata} |
| 559 | #prepare result for json convert |
| 560 | ${prepresult}= Replace String ${etcddata} \n , |
| 561 | ${prepresult}= Strip String ${prepresult} mode=right characters=, |
| 562 | ${prepresult}= Set Variable [${prepresult}] |
| 563 | log ${prepresult} |
| 564 | [Return] ${prepresult} |
| 565 | |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 566 | Read Pon Onu Uni String |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 567 | [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] | 568 | ... taken from etcd data of onu go adapter |
| 569 | [Arguments] ${tp_path} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 570 | ${tppathlines}= Replace String ${tp_path} / \n |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 571 | ${olt}= Get Value Of Tp Path Element ${tppathlines} olt |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 572 | ${pon}= Get Value Of Tp Path Element ${tppathlines} pon |
| 573 | ${onu}= Get Value Of Tp Path Element ${tppathlines} onu |
| 574 | ${uni}= Get Value Of Tp Path Element ${tppathlines} uni |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 575 | ${valuesid}= Set Variable ${olt}/${pon}/${onu}/${uni} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 576 | log ${valuesid} |
| 577 | [Return] ${valuesid} |
| 578 | |
| 579 | Get Value Of Tp Path Element |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 580 | [Documentation] This keyword delivers numeric value of given tp path element. |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 581 | [Arguments] ${tp_path_lines} ${element} |
| 582 | ${value}= Get Lines Containing String ${tp_path_lines} ${element}-\{ |
| 583 | ${value}= Remove String ${value} ${element}-\{ |
| 584 | ${value}= Remove String ${value} \} |
| 585 | log ${value} |
| 586 | [Return] ${value} |
| 587 | |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 588 | Validate Onu Id |
| 589 | [Documentation] This keyword validates ONU Id of passed etcd data. |
| 590 | [Arguments] ${value} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 591 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 592 | # When testing multi-tcont this may need some adjustment. |
| 593 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 594 | ${tppathlines}= Replace String ${tp_path} / \n |
| 595 | ${onu}= Get Value Of Tp Path Element ${tppathlines} onu |
| 596 | ${onu_id}= Get From Dictionary ${value} onu_id |
| 597 | Should Be Equal As Integers ${onu} ${onu_id} |
| 598 | ... msg=Onu-Id (${onu_id}) does not match onu (${onu}) from tp_path in etcd data! |
| 599 | Should Be True ${onu_id}>=1 |
| 600 | |
| 601 | Validate Uni Id |
| 602 | [Documentation] This keyword validates UNI Id of passed etcd data. |
| 603 | [Arguments] ${value} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 604 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 605 | # When testing multi-tcont this may need some adjustment. |
| 606 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 607 | ${tppathlines}= Replace String ${tp_path} / \n |
| 608 | ${uni}= Get Value Of Tp Path Element ${tppathlines} uni |
| 609 | ${uni_id}= Get From Dictionary ${value['uni_config'][0]} uni_id |
| 610 | Should Be Equal As Integers ${uni} ${uni_id} |
| 611 | ... 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] | 612 | |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 613 | Delete ONU Go Adapter ETCD Data |
| 614 | [Documentation] This keyword deletes openonu-go-adapter Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 615 | [Arguments] ${namespace}=default ${defaultkvstoreprefix}=voltha_voltha ${validate}=False |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 616 | ${podname}= Set Variable etcd |
| 617 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
| 618 | ${commandget}= Catenate |
| 619 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/${kvstoreprefix}/openonu' |
| 620 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 621 | log ${result} |
| 622 | Run Keyword If ${validate} Wait Until Keyword Succeeds ${timeout} 1s |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 623 | ... Validate Onu Data In Etcd namespace=${namespace} nbofetcddata=0 without_pm_data=False |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 624 | [Return] ${result} |
| 625 | |
TorstenThieme | d649288 | 2021-12-16 08:10:02 +0000 | [diff] [blame] | 626 | Validate ONOS Flows per OLT |
| 627 | [Documentation] This keyword validates onos flows per olt |
| 628 | [Arguments] ${olt_sn} ${expected_flows} |
| 629 | ${olt_of_id} Validate OLT Device in ONOS ${olt_sn} |
| 630 | ${flows}= Count flows ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${olt_of_id} added |
| 631 | Log Found added ${flows} of ${expected_flows} expected flows on device ${olt_sn} |
| 632 | Should Be Equal As Integers ${expected_flows} ${flows} |
| 633 | |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 634 | Validate OLT Flows Per Onu |
| 635 | [Documentation] This keyword validates olt flows per onu |
| 636 | ... It checks checks presence/absence of olt flows depending on must_exist. |
| 637 | ... The values/content of olt flows will be not validated! |
| 638 | [Arguments] ${onu_device_id} ${must_exist} |
| 639 | ${rc} ${output}= Run and Return Rc and Output |
| 640 | ... voltctl -c ${VOLTCTL_CONFIG} device flows ${onu_device_id} -m 8MB -o json |
| 641 | Should Be Equal As Integers ${rc} 0 |
| 642 | ${jsondata}= To Json ${output} |
| 643 | Log ${jsondata} |
| 644 | # in case of ATT for ONU with removed flows there is default flow established |
| 645 | ${length}= Get Length ${jsondata} |
| 646 | ${value}= Run Keyword If ${length}>0 Get From List ${jsondata} 0 |
| 647 | ${setvid}= Run Keyword If ${length}>0 Run Keyword If 'setvlanid' in ${value} |
| 648 | ... Get From Dictionary ${value} setvlanid |
| 649 | Run Keyword If "${workflow}"=="ATT" and not ${must_exist} Run Keywords |
| 650 | ... Should Be Equal As Numbers ${setvid} 4091 AND |
| 651 | ... Should Be Equal As Numbers ${length} 1 AND |
| 652 | ... Return From Keyword |
| 653 | Run Keyword If ${must_exist} Should Not Be Empty ${jsondata} |
| 654 | ... ELSE Should Be Empty ${jsondata} |
| 655 | |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 656 | Wait for Ports in ONOS for all OLTs |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 657 | [Documentation] Waits untill a certain number of ports are enabled in all OLTs |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 658 | [Arguments] ${host} ${port} ${count} ${filter} ${max_wait_time}=10m ${determine_number}=False |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 659 | FOR ${J} IN RANGE 0 ${num_olts} |
| 660 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 661 | ${onu_count}= Set Variable ${list_olts}[${J}][onucount] |
| 662 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 663 | ... ${olt_serial_number} |
| 664 | Set Global Variable ${of_id} |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 665 | ${count2check}= Set Variable If ${count}==${num_all_onus} ${onu_count} ${count} |
| 666 | # if flag determine_number is set to True, always determine the number of real ONUs (overwrite previous value) |
| 667 | ${count2check}= Run Keyword If ${determine_number} Determine Number Of ONU ${olt_serial_number} |
| 668 | ... ELSE Set Variable ${count2check} |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 669 | 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] | 670 | END |
| 671 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 672 | Wait for all ONU Ports in ONOS Disabled |
| 673 | [Documentation] Waits untill a all ONU ports are disabled in all ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 674 | [Arguments] ${host} ${port} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 675 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 676 | ${src}= Set Variable ${hosts.src[${I}]} |
| 677 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 678 | ... ${src['olt']} |
| 679 | ${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] | 680 | 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] | 681 | ... ${onu_port} |
| 682 | END |
| 683 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 684 | Map State |
| 685 | [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values. |
| 686 | [Arguments] ${state} |
| 687 | # create state lists with corresponding return values |
| 688 | # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE (number/name) |
| 689 | ${state1} Create List ENABLED ACTIVATING REACHABLE 1 activating-onu |
| 690 | ${state2} Create List ENABLED ACTIVATING REACHABLE 2 starting-openomci |
| 691 | ${state3} Create List ENABLED ACTIVATING REACHABLE 3 discovery-mibsync-complete |
| 692 | ${state4} Create List ENABLED ACTIVE REACHABLE 4 initial-mib-downloaded |
| 693 | ${state5} Create List ENABLED ACTIVE REACHABLE 5 tech-profile-config-download-success |
| 694 | ${state6} Create List ENABLED ACTIVE REACHABLE 6 omci-flows-pushed |
| 695 | ${state7} Create List DISABLED UNKNOWN REACHABLE 7 omci-admin-lock |
| 696 | ${state8} Create List ENABLED ACTIVE REACHABLE 8 onu-reenabled |
| 697 | ${state9} Create List ENABLED DISCOVERED UNREACHABLE 9 stopping-openomci |
| 698 | ${state10} Create List ENABLED DISCOVERED REACHABLE 10 rebooting |
| 699 | ${state11} Create List ENABLED DISCOVERED REACHABLE 11 omci-flows-deleted |
| 700 | ${state12} Create List DISABLED UNKNOWN REACHABLE 12 tech-profile-config-delete-success |
| 701 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Set Variable If |
| 702 | ... '${state}'=='1' or '${state}'=='activating-onu' ${state1} |
| 703 | ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2} |
| 704 | ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3} |
| 705 | ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4} |
| 706 | ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5} |
| 707 | ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6} |
| 708 | ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7} |
| 709 | ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8} |
| 710 | ... '${state}'=='9' or '${state}'=='stopping-openomci' ${state9} |
| 711 | ... '${state}'=='10' or '${state}'=='rebooting' ${state10} |
| 712 | ... '${state}'=='11' or '${state}'=='omci-flows-deleted' ${state11} |
| 713 | ... '${state}'=='12' or '${state}'=='tech-profile-config-delete-success' ${state12} |
| 714 | [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state} |