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 | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 18 | Resource ./bbsim.robot |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 19 | |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 20 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 21 | *** Keywords *** |
TorstenThieme | 373adfe | 2021-12-16 13:03:04 +0000 | [diff] [blame] | 22 | Printout ONU Serial Number and Device Id |
| 23 | [Documentation] Printouts the ONU serial number and corresponding device id. |
| 24 | [Arguments] ${onu_sn}=${EMPTY} ${print2console}=False |
| 25 | ${output}= Set Variable \r\n |
| 26 | ${onu_sn_list} Create List |
| 27 | Run Keyword If "${onu_sn}"=="${EMPTY}" Build ONU SN List ${onu_sn_list} |
| 28 | ... ELSE Append To List ${onu_sn_list} ${onu_sn} |
| 29 | FOR ${sn} IN @{onu_sn_list} |
| 30 | ${device_id}= Get Device ID From SN ${sn} |
| 31 | ${output}= Catenate ${output} ONU Serial Number: ${sn} ONU Device ID: ${device_id}\r\n |
| 32 | END |
| 33 | Log ${output} |
| 34 | Run Keyword If ${print2console} Log ${output} console=yes |
| 35 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 36 | Calculate Timeout |
| 37 | [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus |
| 38 | [Arguments] ${basetimeout}=60s |
| 39 | ${new_timeout} Fetch From Left ${basetimeout} s |
| 40 | ${new_timeout}= evaluate ${new_timeout}+((${num_all_onus}-4)*10) |
| 41 | ${new_timeout}= Set Variable If (not ${debugmode}) and (${new_timeout}>300) |
| 42 | ... 300 ${new_timeout} |
| 43 | ${new_timeout}= Catenate SEPARATOR= ${new_timeout} s |
| 44 | [Return] ${new_timeout} |
| 45 | |
TorstenThieme | 3494ceb | 2021-07-19 09:47:24 +0000 | [diff] [blame] | 46 | Get Logical Id of OLT |
| 47 | [Documentation] Fills the logical id of OLT(s) if missing |
| 48 | FOR ${I} IN RANGE 0 ${num_olts} |
| 49 | # exit loop if logical id already known |
| 50 | Exit For Loop IF "${olt_ids}[${I}][logical_id]" != "${EMPTY}" |
| 51 | #read current device values |
| 52 | ${olt}= Get From List ${olt_ids} ${I} |
| 53 | ${olt_serial_number}= Get From Dictionary ${olt} sn |
| 54 | # read logical id and store it |
| 55 | ${logical_id}= Get Logical Device ID From SN ${olt_serial_number} |
| 56 | Set To Dictionary ${olt} logical_id ${logical_id} |
| 57 | Set List Value ${olt_ids} ${I} ${olt} |
| 58 | END |
| 59 | Set Global Variable ${olt_ids} |
| 60 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 61 | Power On ONU Device |
| 62 | [Documentation] This keyword turns on the power for all onus. |
| 63 | [Arguments] ${namespace} |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 64 | FOR ${J} IN RANGE 0 ${num_olts} |
| 65 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 66 | ${bbsim}= Catenate SEPARATOR= bbsim ${J} |
| 67 | ${bbsim_pod}= Get Pod Name By Label ${namespace} release ${bbsim} |
| 68 | Power On ONU Device per OLT ${namespace} ${olt_serial_number} ${bbsim_pod} |
| 69 | END |
| 70 | |
| 71 | Power On ONU Device per OLT |
| 72 | [Documentation] This keyword turns on the power for all onus. |
| 73 | [Arguments] ${namespace} ${olt_serial_number} ${bbsim_pod} |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 74 | @{onu_list}= Create List |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 75 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 76 | ${src}= Set Variable ${hosts.src[${I}]} |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 77 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 78 | ${sn}= Set Variable ${src['onu']} |
| 79 | # make sure all actions are done only once per onu |
| 80 | ${onu_id}= Get Index From List ${onu_list} ${sn} |
| 81 | Continue For Loop If -1 != ${onu_id} |
| 82 | Append To List ${onu_list} ${sn} |
| 83 | Power On ONU ${namespace} ${bbsim_pod} ${sn} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 84 | END |
| 85 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 86 | Power Off ONU Device |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 87 | [Documentation] This keyword turns off the power for all onus per olt. |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 88 | [Arguments] ${namespace} |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 89 | FOR ${J} IN RANGE 0 ${num_olts} |
| 90 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 91 | ${bbsim}= Catenate SEPARATOR= bbsim ${J} |
| 92 | ${bbsim_pod}= Get Pod Name By Label ${namespace} release ${bbsim} |
| 93 | Power Off ONU Device per OLT ${namespace} ${olt_serial_number} ${bbsim_pod} |
| 94 | END |
| 95 | |
| 96 | Power Off ONU Device per OLT |
| 97 | [Documentation] This keyword turns off the power for all onus per olt. |
| 98 | [Arguments] ${namespace} ${olt_serial_number} ${bbsim_pod} |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 99 | @{onu_list}= Create List |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 100 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 101 | ${src}= Set Variable ${hosts.src[${I}]} |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 102 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 103 | ${sn}= Set Variable ${src['onu']} |
| 104 | # make sure all actions are done only once per onu |
| 105 | ${onu_id}= Get Index From List ${onu_list} ${sn} |
| 106 | Continue For Loop If -1 != ${onu_id} |
| 107 | Append To List ${onu_list} ${sn} |
| 108 | Power Off ONU ${namespace} ${bbsim_pod} ${sn} |
| 109 | END |
| 110 | |
| 111 | Set Wrong MDS Counter All ONUs |
| 112 | [Documentation] This keyword sets wrong MDS counter for all onus. |
| 113 | [Arguments] ${namespace} |
| 114 | FOR ${J} IN RANGE 0 ${num_olts} |
| 115 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 116 | ${bbsim}= Catenate SEPARATOR= bbsim ${J} |
| 117 | ${bbsim_pod}= Get Pod Name By Label ${namespace} release ${bbsim} |
| 118 | Set Wrong MDS Counter per OLT ${namespace} ${olt_serial_number} ${bbsim_pod} |
| 119 | END |
| 120 | |
| 121 | Set Wrong MDS Counter per OLT |
| 122 | [Documentation] This keyword sets wrong MDS counter for all onus per olt. |
| 123 | [Arguments] ${namespace} ${olt_serial_number} ${bbsim_pod} |
| 124 | @{onu_list}= Create List |
| 125 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 126 | ${src}= Set Variable ${hosts.src[${I}]} |
| 127 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 128 | ${sn}= Set Variable ${src['onu']} |
| 129 | # make sure all actions are done only once per onu |
| 130 | ${onu_id}= Get Index From List ${onu_list} ${sn} |
| 131 | Continue For Loop If -1 != ${onu_id} |
| 132 | Append To List ${onu_list} ${sn} |
| 133 | Set Wrong MDS Counter ONU ${namespace} ${bbsim_pod} ${sn} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 134 | END |
| 135 | |
| 136 | Current State Test |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 137 | [Documentation] This keyword checks the passed state of the given onu. |
| 138 | [Arguments] ${state} ${onu} ${reqadminstate}=${EMPTY} ${reqoperstatus}=${EMPTY} |
| 139 | ... ${reqconnectstatus}=${EMPTY} |
| 140 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State ${state} |
| 141 | ${admin_state}= Set Variable If '${reqadminstate}'!='${EMPTY}' ${reqadminstate} ${admin_state} |
| 142 | ${oper_status}= Set Variable If '${reqoperstatus}'!='${EMPTY}' ${reqoperstatus} ${oper_status} |
| 143 | ${connect_status}= Set Variable If '${reqconnectstatus}'!='${EMPTY}' ${reqconnectstatus} |
| 144 | ... ${connect_status} |
| 145 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 146 | ... Validate Device ${admin_state} ${oper_status} ${connect_status} |
| 147 | ... ${onu} onu=True onu_reason=${onu_state} |
| 148 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 149 | Current State Test All Onus |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 150 | [Documentation] This keyword checks the passed state of all onus. |
| 151 | ... Hint: ${timeStart} will be not evaluated here! |
| 152 | [Arguments] ${state} ${reqadminstate}=${EMPTY} ${reqoperstatus}=${EMPTY} ${reqconnectstatus}=${EMPTY} |
TorstenThieme | 53450ff | 2021-05-11 09:44:33 +0000 | [diff] [blame] | 153 | ... ${alternativeonustate}=${EMPTY} ${timeout}=${timeout} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 154 | ${timeStart}= Get Current Date |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 155 | ${list_onus} Create List |
| 156 | Build ONU SN List ${list_onus} |
| 157 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State ${state} |
| 158 | ${admin_state}= Set Variable If '${reqadminstate}'!='${EMPTY}' ${reqadminstate} ${admin_state} |
| 159 | ${oper_status}= Set Variable If '${reqoperstatus}'!='${EMPTY}' ${reqoperstatus} ${oper_status} |
| 160 | ${connect_status}= Set Variable If '${reqconnectstatus}'!='${EMPTY}' ${reqconnectstatus} |
| 161 | ... ${connect_status} |
| 162 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 163 | ... Validate ONU Devices With Duration |
| 164 | ... ${admin_state} ${oper_status} ${connect_status} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 165 | ... ${onu_state} ${list_onus} ${timeStart} alternate_reason=${alternativeonustate} |
TorstenThieme | 53450ff | 2021-05-11 09:44:33 +0000 | [diff] [blame] | 166 | # teardown is used as 'return' for result of Validate ONU Devices With Duration (used for ONUNegativeStateTests) |
| 167 | [Teardown] Run Keyword If "${KEYWORD STATUS}"=="FAIL" Set Suite Variable ${StateTestAllONUs} False |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 168 | |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 169 | Reconcile Onu Adapter |
| 170 | [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] | 171 | [Arguments] ${namespace} ${usekill2restart} ${oper_status} ${olt_to_be_deleted_sn}=${EMPTY} |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 172 | ... ${flow_delete_params}=&{EMPTY} ${wrong_MDS_counter}=False |
TorstenThieme | 7e9f125 | 2022-01-05 13:43:59 +0000 | [diff] [blame] | 173 | # get last ready timestamp of openonu adapter |
| 174 | ${previous_ready_ts}= Get Pod Ready Timestamp by Label ${namespace} app adapter-open-onu |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 175 | # restart OpenONU adapter |
| 176 | Run Keyword If ${usekill2restart} Kill And Check Onu Adaptor ${namespace} |
| 177 | ... ELSE Restart And Check Onu Adaptor ${namespace} |
TorstenThieme | 7e9f125 | 2022-01-05 13:43:59 +0000 | [diff] [blame] | 178 | #check ready timestamp of openonu adapter, should be younger than the previous ready timestamp |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 179 | ${openonu_ready_ts}= Get Pod Ready Timestamp by Label ${namespace} app adapter-open-onu |
TorstenThieme | 7e9f125 | 2022-01-05 13:43:59 +0000 | [diff] [blame] | 180 | ${restart_duration}= Subtract Date From Date ${openonu_ready_ts} ${previous_ready_ts} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 181 | Should Be True ${restart_duration}>0 |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 182 | # delete the olt passed, if available (special feature) |
| 183 | ${olt_to_be_deleted_device_id}= Run Keyword IF "${olt_to_be_deleted_sn}"!="${EMPTY}" |
| 184 | ... Get OLTDeviceID From OLT List ${olt_to_be_deleted_sn} |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 185 | Run Keyword If "${olt_to_be_deleted_sn}"!="${EMPTY}" Delete Device ${olt_to_be_deleted_device_id} |
| 186 | # remove flows if params passed for it (special feature II) |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 187 | Run Keyword If ${flow_delete_params}!=&{EMPTY} Remove Flows Conditional ${flow_delete_params['unitag']} |
| 188 | ... ${flow_delete_params['onu_sn']} ${flow_delete_params['of_id']} ${flow_delete_params['onu_port']} |
| 189 | # Set wrong MDS counter (for all ONUs) if required (special feature III) |
| 190 | Run Keyword If ${wrong_MDS_counter} Set Wrong MDS Counter All ONUs ${namespace} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 191 | # wait for the reconcile to complete |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 192 | # - we check that communication to openonu-adapter is established again |
| 193 | # - we check that all ONUs leave reconcile state by validate a simple voltctl request will not responds with error |
| 194 | Wait Until Keyword Succeeds ${timeout} 1s Validate Last ONU Communication |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 195 | Wait Until Keyword Succeeds ${timeout} 1s Validate All Onus Accessible ${olt_to_be_deleted_sn} |
| 196 | # - 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] | 197 | ${list_onus} Create List |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 198 | FOR ${J} IN RANGE 0 ${num_olts} |
| 199 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 200 | Continue For Loop If "${olt_to_be_deleted_sn}"=="${olt_serial_number}" |
| 201 | Build ONU SN List ${list_onus} ${olt_serial_number} |
| 202 | END |
| 203 | Log ${list_onus} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 204 | Run Keyword And Ignore Error Wait Until Keyword Succeeds ${timeout} |
| 205 | ... 1s Check all ONU OperStatus ${list_onus} ${oper_status} |
| 206 | |
TorstenThieme | e512b1d | 2021-11-12 10:52:29 +0000 | [diff] [blame] | 207 | Validate All Onus Accessible |
| 208 | [Documentation] This keyword checks all onus accessible (again) with help of a simple voltctl request. |
| 209 | ... 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] | 210 | ... 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] | 211 | ... Will not check ONUs of passed deleted OLT (special feature) |
| 212 | [Arguments] ${deleted_olt}=${EMPTY} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 213 | ${onu_list} Create List |
| 214 | FOR ${I} IN RANGE 0 ${num_all_onus} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 215 | ${src}= Set Variable ${hosts.src[${I}]} |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 216 | ${olt_serial_number}= Set Variable ${src['olt']} |
| 217 | Continue For Loop If "${deleted_olt}"=="${olt_serial_number}" |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 218 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 219 | ${onu_id}= Get Index From List ${onu_list} ${onu_device_id} |
Matteo Scandolo | 741d4fd | 2021-09-23 17:08:34 -0700 | [diff] [blame] | 220 | Continue For Loop If -1 != ${onu_id} |
TorstenThieme | 96fe9ee | 2021-10-21 10:24:08 +0000 | [diff] [blame] | 221 | Append To List ${onu_list} ${onu_device_id} |
| 222 | ${rc} ${output}= Get Onu Image List ${onu_device_id} |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 223 | 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] | 224 | END |
| 225 | |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 226 | Remove Flows Conditional |
| 227 | [Documentation] This keyword removes the flows (subscriber) conditional depending on unitag. |
| 228 | ... In case of unitagsub==False (normal case) single subscriber remove will be executed. |
| 229 | ... In case of multi uni each uni id will be deleted. |
| 230 | [Arguments] ${unitagsub} ${onu_sn} ${of_id} ${onu_port} |
| 231 | # first handle 'normal' case without uni ports |
| 232 | Run Keyword If ${unitagsub}==False Wait Until Keyword Succeeds ${timeout} 2s |
| 233 | ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 234 | ... volt-remove-subscriber-access ${of_id} ${onu_port} |
| 235 | Return From Keyword If ${unitagsub}==False |
| 236 | # handle multi uni case |
| 237 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 238 | ${src}= Set Variable ${hosts.src[${I}]} |
| 239 | Continue For Loop If "${onu_sn}"!="${src['onu']}" |
| 240 | ${add_sub_cmd}= Catenate volt-remove-subscriber-unitag --tpId ${src['tp_id']} --sTag ${src['s_tag']} |
| 241 | ... --cTag ${src['c_tag']} ${src['onu']}-${src['uni_id']} |
| 242 | Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection |
| 243 | ... ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${add_sub_cmd} |
| 244 | END |
| 245 | |
TorstenThieme | 700ccbf | 2022-02-11 10:24:05 +0000 | [diff] [blame] | 246 | Remove Flows all ONUs |
| 247 | [Documentation] Remove all Flows from all onus |
TorstenThieme | 22491b7 | 2022-03-31 13:12:27 +0000 | [diff] [blame] | 248 | @{onu_list}= Create List |
TorstenThieme | 700ccbf | 2022-02-11 10:24:05 +0000 | [diff] [blame] | 249 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 250 | # Collect data for remove flow(s) |
| 251 | ${src}= Set Variable ${hosts.src[${I}]} |
TorstenThieme | 22491b7 | 2022-03-31 13:12:27 +0000 | [diff] [blame] | 252 | # skip if we have already handled this ONU |
| 253 | ${onu_sn}= Set Variable ${src['onu']} |
| 254 | ${onu_id}= Get Index From List ${onu_list} ${onu_sn} |
| 255 | Continue For Loop If -1 != ${onu_id} |
| 256 | Append To List ${onu_list} ${onu_sn} |
TorstenThieme | 700ccbf | 2022-02-11 10:24:05 +0000 | [diff] [blame] | 257 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']} |
TorstenThieme | 22491b7 | 2022-03-31 13:12:27 +0000 | [diff] [blame] | 258 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${onu_sn} |
TorstenThieme | 700ccbf | 2022-02-11 10:24:05 +0000 | [diff] [blame] | 259 | ... ${of_id} ${src['uni_id']} |
TorstenThieme | 700ccbf | 2022-02-11 10:24:05 +0000 | [diff] [blame] | 260 | # Remove Flows |
| 261 | Remove Flows Conditional ${unitag_sub} ${onu_sn} ${of_id} ${onu_port} |
| 262 | END |
| 263 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 264 | Log Ports |
| 265 | [Documentation] This keyword logs all port data available in ONOS of first port per ONU |
| 266 | [Arguments] ${onlyenabled}=False |
| 267 | ${cmd} Set Variable If ${onlyenabled} ports -e ports |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 268 | ${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] | 269 | ${lines} = Get Lines Matching Regexp ${onu_ports} .*portName=BBSM[0-9]{8}-1 |
| 270 | Log ${lines} |
| 271 | |
| 272 | Kill Adaptor |
| 273 | [Documentation] This keyword kills the passed adaptor. |
| 274 | [Arguments] ${namespace} ${name} |
| 275 | ${cmd} Catenate |
Matteo Scandolo | 6b52412 | 2021-10-22 14:34:29 -0700 | [diff] [blame] | 276 | ... 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] | 277 | ... -- /bin/sh -c "kill 1" |
| 278 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
| 279 | Log ${output} |
| 280 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 281 | Kill And Check Onu Adaptor |
| 282 | [Documentation] This keyword kills ONU Adaptor and waits for it to come up again |
| 283 | ... Following steps will be executed: |
| 284 | ... - kill openonu adaptor |
| 285 | ... - check openonu adaptor is ready again |
| 286 | [Arguments] ${namespace} |
| 287 | ${list_openonu_apps} Create List adapter-open-onu |
| 288 | ${adaptorname}= Set Variable open-onu |
| 289 | Kill Adaptor ${namespace} ${adaptorname} |
| 290 | Sleep 5s |
| 291 | Wait For Pods Ready ${namespace} ${list_openonu_apps} |
| 292 | |
| 293 | Restart And Check Onu Adaptor |
| 294 | [Documentation] This keyword restarts ONU Adaptor and waits for it to come up again |
| 295 | ... Following steps will be executed: |
| 296 | ... - restart openonu adaptor |
| 297 | ... - check openonu adaptor is ready again |
| 298 | [Arguments] ${namespace} |
| 299 | ${list_openonu_apps} Create List adapter-open-onu |
Matteo Scandolo | 6f24ea9 | 2021-04-29 11:55:50 -0700 | [diff] [blame] | 300 | ${openonu_label_key} Set Variable app |
| 301 | ${openonu_label_value} Set Variable adapter-open-onu |
| 302 | Restart Pod By Label ${namespace} ${openonu_label_key} ${openonu_label_value} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 303 | Sleep 5s |
| 304 | Wait For Pods Ready ${namespace} ${list_openonu_apps} |
| 305 | |
| 306 | Disable Onu Device |
| 307 | [Documentation] This keyword disables all onus. |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 308 | ${onu_list} Create List |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 309 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 310 | ${src}= Set Variable ${hosts.src[${I}]} |
| 311 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 312 | ${onu_id}= Get Index From List ${onu_list} ${onu_device_id} |
| 313 | Continue For Loop If -1 != ${onu_id} |
| 314 | Append To List ${onu_list} ${onu_device_id} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 315 | Disable Device ${onu_device_id} |
| 316 | Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id} |
| 317 | END |
| 318 | |
| 319 | Enable Onu Device |
| 320 | [Documentation] This keyword enables all onus. |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 321 | ${onu_list} Create List |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 322 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 323 | ${src}= Set Variable ${hosts.src[${I}]} |
| 324 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
TorstenThieme | 70bc526 | 2021-01-19 12:12:55 +0000 | [diff] [blame] | 325 | ${onu_id}= Get Index From List ${onu_list} ${onu_device_id} |
| 326 | Continue For Loop If -1 != ${onu_id} |
| 327 | Append To List ${onu_list} ${onu_device_id} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 328 | Enable Device ${onu_device_id} |
| 329 | END |
| 330 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 331 | Verify MIB Template Data Available |
| 332 | [Documentation] This keyword verifies MIB Template Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 333 | [Arguments] ${namespace}=default |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 334 | ${podname}= Set Variable etcd |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 335 | ${commandget} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 336 | ... /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] | 337 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 338 | Should Not Be Empty ${result} No MIB Template Data stored in etcd! |
| 339 | |
| 340 | Delete MIB Template Data |
| 341 | [Documentation] This keyword deletes MIB Template Data stored in etcd |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 342 | [Arguments] ${namespace}=default |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 343 | ${podname}= Set Variable etcd |
| 344 | ${commanddel} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 345 | ... /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] | 346 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commanddel} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 347 | Sleep 3s |
| 348 | ${commandget} Catenate |
Matteo Scandolo | 341b937 | 2020-12-09 14:15:06 -0800 | [diff] [blame] | 349 | ... /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] | 350 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 351 | Should Be Empty ${result} Could not delete MIB Template Data stored in etcd! |
| 352 | |
TorstenThieme | 2d8327b | 2022-03-15 08:42:27 +0000 | [diff] [blame] | 353 | Get ONU MIB Template Data |
| 354 | [Documentation] This keyword delivers MIB Template Data stored in etcd |
| 355 | [Arguments] ${namespace}=default ${without_prefix}=True |
| 356 | ${podname}= Set Variable etcd |
| 357 | ${commandget} Catenate |
| 358 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/' |
| 359 | ${commandget}= Run Keyword If ${without_prefix} Catenate ${commandget} |
| 360 | ... | grep -v service/voltha/omci_mibs/go_templates/ |
| 361 | ... ELSE Set Variable ${commandget} |
| 362 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 363 | log ${result} |
| 364 | [Return] ${result} |
| 365 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 366 | Set Tech Profile |
| 367 | [Documentation] This keyword sets the passed TechProfile for the test |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 368 | [Arguments] ${TechProfile} ${namespace}=default ${tp_id}=64 |
| 369 | Log To Console \nSet TechProfile:${TechProfile} tp_id:${tp_id} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 370 | ${podname}= Set Variable etcd |
Andrea Campanella | 0aa21d6 | 2021-07-22 10:44:32 +0200 | [diff] [blame] | 371 | ${label}= Set Variable app.kubernetes.io/name=${podname} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 372 | ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json |
| 373 | ${dest}= Set Variable /tmp/flexpod.json |
| 374 | ${command} Catenate |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 375 | ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/${tp_id}' |
Andrea Campanella | 0aa21d6 | 2021-07-22 10:44:32 +0200 | [diff] [blame] | 376 | Copy File To Pod ${namespace} ${label} ${src} ${dest} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 377 | Exec Pod In Kube ${namespace} ${podname} ${command} |
| 378 | ${commandget} Catenate |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 379 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/${tp_id}' |
Andrea Campanella | 0aa21d6 | 2021-07-22 10:44:32 +0200 | [diff] [blame] | 380 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 381 | Should Not Be Empty ${result} No Tech Profile stored in etcd! |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 382 | |
| 383 | Remove Tech Profile |
| 384 | [Documentation] This keyword removes TechProfile |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 385 | [Arguments] ${namespace}=default ${tp_id}=64 |
| 386 | Run Keyword If "${TechProfile}"!="${EMPTY}" Log To Console \nRemove TechProfile:${TechProfile} tp_id:${tp_id} |
| 387 | ... ELSE Log To Console \nRemove Tech Profile template at tp_id:${tp_id} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 388 | ${podname}= Set Variable etcd |
| 389 | ${command} Catenate |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 390 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/${tp_id}' |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 391 | Exec Pod In Kube ${namespace} ${podname} ${command} |
| 392 | ${commandget} Catenate |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 393 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/${tp_id}' |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 394 | Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 395 | |
TorstenThieme | a7315f1 | 2021-07-23 11:56:34 +0000 | [diff] [blame] | 396 | Do Onu Subscriber Add Per OLT |
| 397 | [Documentation] Add Subscriber per OLT |
| 398 | [Arguments] ${of_id} ${olt_serial_number} ${print2console}=False |
TorstenThieme | 029d5f0 | 2022-05-03 09:25:01 +0000 | [diff] [blame] | 399 | ${onu_list} Create List |
TorstenThieme | a7315f1 | 2021-07-23 11:56:34 +0000 | [diff] [blame] | 400 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 401 | ${src}= Set Variable ${hosts.src[${I}]} |
| 402 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 403 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 404 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 405 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
TorstenThieme | 029d5f0 | 2022-05-03 09:25:01 +0000 | [diff] [blame] | 406 | ${of_id_onu_port}= Catenate SEPARATOR=- ${of_id} ${onu_port} |
| 407 | ${pair_id}= Get Index From List ${onu_list} ${of_id_onu_port} |
TorstenThieme | d9cc06e | 2022-11-09 12:12:46 +0000 | [diff] [blame] | 408 | Continue For Loop If -1 != ${pair_id} and ${unitag_sub} == False |
TorstenThieme | 029d5f0 | 2022-05-03 09:25:01 +0000 | [diff] [blame] | 409 | Append To List ${onu_list} ${of_id_onu_port} |
TorstenThieme | d9cc06e | 2022-11-09 12:12:46 +0000 | [diff] [blame] | 410 | # Add subscriber |
| 411 | ${add_sub_cmd}= Run Keyword If ${unitag_sub} |
| 412 | ... Catenate volt-add-subscriber-unitag --tpId ${src['tp_id']} --sTag ${src['s_tag']} |
| 413 | ... --cTag ${src['c_tag']} ${src['onu']}-${src['uni_id']} |
| 414 | ... ELSE |
| 415 | ... Set Variable volt-add-subscriber-access ${of_id} ${onu_port} |
TorstenThieme | a7315f1 | 2021-07-23 11:56:34 +0000 | [diff] [blame] | 416 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
TorstenThieme | d9cc06e | 2022-11-09 12:12:46 +0000 | [diff] [blame] | 417 | ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${add_sub_cmd} |
TorstenThieme | a7315f1 | 2021-07-23 11:56:34 +0000 | [diff] [blame] | 418 | Run Keyword If ${print2console} Log \r\n[${I}] volt-add-subscriber-access ${of_id} ${onu_port}. |
| 419 | ... console=yes |
| 420 | END |
| 421 | |
| 422 | Do Onu Flow Check Per OLT |
| 423 | [Documentation] Checks all ONU flows show up in ONOS and Voltha |
| 424 | [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${print2console}=False |
| 425 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 426 | ${src}= Set Variable ${hosts.src[${I}]} |
| 427 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 428 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 429 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 430 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 431 | # Verify subscriber access flows are added for the ONU port |
| 432 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s |
| 433 | ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} |
| 434 | ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']} |
| 435 | ${logoutput} Catenate \r\n[${I}] Verify Subscriber Access Flows Added For |
| 436 | ... ONU ${of_id} ${onu_port} ${src['c_tag']} ${src['s_tag']}. |
| 437 | Run Keyword If ${print2console} Log ${logoutput} console=yes |
| 438 | END |
| 439 | |
| 440 | Do Onu Subscriber Remove Per OLT |
| 441 | [Documentation] Removes per OLT subscribers in ONOS and Voltha |
| 442 | [Arguments] ${of_id} ${olt_serial_number} ${print2console}=False |
TorstenThieme | 029d5f0 | 2022-05-03 09:25:01 +0000 | [diff] [blame] | 443 | ${onu_list} Create List |
TorstenThieme | a7315f1 | 2021-07-23 11:56:34 +0000 | [diff] [blame] | 444 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 445 | ${src}= Set Variable ${hosts.src[${I}]} |
| 446 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 447 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 448 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 449 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 450 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
TorstenThieme | 029d5f0 | 2022-05-03 09:25:01 +0000 | [diff] [blame] | 451 | ${of_id_onu_port}= Catenate SEPARATOR=- ${of_id} ${onu_port} |
| 452 | ${pair_id}= Get Index From List ${onu_list} ${of_id_onu_port} |
| 453 | Continue For Loop If -1 != ${pair_id} |
| 454 | Append To List ${onu_list} ${of_id_onu_port} |
TorstenThieme | a7315f1 | 2021-07-23 11:56:34 +0000 | [diff] [blame] | 455 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 456 | ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 457 | ... volt-remove-subscriber-access ${of_id} ${onu_port} |
| 458 | Run Keyword If ${print2console} Log \r\n[${I}] volt-remove-subscriber-access ${of_id} ${onu_port}. |
| 459 | ... console=yes |
| 460 | END |
| 461 | |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 462 | Validate Resource Instances Used Gem Ports |
| 463 | [Documentation] This keyword validates resource instances data stored in etcd. |
| 464 | ... It checks checks the number of gemport-ids which has matched with used Tech Profile |
Andrea Campanella | 388cd87 | 2022-02-10 09:11:39 +0100 | [diff] [blame] | 465 | [Arguments] ${nbofgemports} ${namespace}=default ${defaultkvstoreprefix}=voltha/voltha_voltha |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 466 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 467 | ${etcddata}= Get ONU Go Adapter ETCD Data namespace=${namespace} defaultkvstoreprefix=${kvstoreprefix} |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 468 | #prepare result for json convert |
| 469 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 470 | ${jsondata}= To Json ${result} |
| 471 | ${length}= Get Length ${jsondata} |
| 472 | log ${jsondata} |
| 473 | FOR ${INDEX} IN RANGE 0 ${length} |
| 474 | ${value}= Get From List ${jsondata} ${INDEX} |
| 475 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 476 | # When testing multi-tcont this may need some adjustment. |
| 477 | Exit For Loop If not ('uni_config' in $value) |
| 478 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 479 | ${resourcedata}= Get Resource Instances ETCD Data ${tp_path} namespace=${namespace} |
| 480 | ... defaultkvstoreprefix=${kvstoreprefix} |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 481 | log ${resourcedata} |
| 482 | ${decoderesult}= volthatools.Tech Profile Decode Resource Instance ${resourcedata} return_default=true |
| 483 | log ${decoderesult} |
| 484 | ${gemportids}= Get From Dictionary ${decoderesult} gemport_ids |
| 485 | ${length}= Get Length ${gemportids} |
| 486 | Should Be Equal As Integers ${nbofgemports} ${length} |
TorstenThieme | d9cc06e | 2022-11-09 12:12:46 +0000 | [diff] [blame] | 487 | ... msg=Number of gem ports (${length}) does not match with techprofile ${nbofgemports} |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 488 | END |
| 489 | |
| 490 | Get Resource Instances ETCD Data |
| 491 | [Documentation] This keyword delivers Resource Instances Data stored in etcd |
Andrea Campanella | 388cd87 | 2022-02-10 09:11:39 +0100 | [diff] [blame] | 492 | [Arguments] ${tppath} ${namespace}=default ${defaultkvstoreprefix}=voltha/voltha_voltha |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 493 | ${podname}= Set Variable etcd |
| 494 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
| 495 | ${commandget}= Catenate |
| 496 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/resource_instances/${tppath} |
| 497 | ... --print-value-only --hex' |
| 498 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 499 | log ${result} |
| 500 | [Return] ${result} |
| 501 | |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 502 | Validate Tech Profiles and Flows in ETCD Data Per Onu |
| 503 | [Documentation] This keyword validates tech profiles and flows data stored in etcd per onu. |
| 504 | ... It checks checks presence/absence of tech profiles and flows depending on must_exist. |
| 505 | ... The values/content of tech profiles and flows will be not validated! |
Andrea Campanella | 388cd87 | 2022-02-10 09:11:39 +0100 | [diff] [blame] | 506 | [Arguments] ${onu_sn} ${namespace}=default ${defaultkvstoreprefix}=voltha/voltha_voltha ${must_exist}=True |
TorstenThieme | 569ef45 | 2022-02-07 14:00:26 +0000 | [diff] [blame] | 507 | ... ${check_tcont_map_empty}=False ${check_default_flow_att}=True |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 508 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
| 509 | ${etcddata}= Get ONU Go Adapter ETCD Data namespace=${namespace} defaultkvstoreprefix=${kvstoreprefix} |
| 510 | #prepare result for json convert |
| 511 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 512 | ${jsondata}= To Json ${result} |
| 513 | ${length}= Get Length ${jsondata} |
| 514 | log ${jsondata} |
| 515 | ${matched}= Set Variable False |
| 516 | FOR ${INDEX} IN RANGE 0 ${length} |
| 517 | ${value}= Get From List ${jsondata} ${INDEX} |
| 518 | ${uni_config}= Get From Dictionary ${value} uni_config |
| 519 | ${uni_config}= Set Variable ${uni_config[0]} |
| 520 | ${sn}= Get From Dictionary ${value} serial_number |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 521 | ${tcont_map}= Get From Dictionary ${value} tcont_map |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 522 | ${matched}= Set Variable If '${sn}'=='${onu_sn}' True False |
| 523 | Exit For Loop If ${matched} |
| 524 | END |
| 525 | Should Be True ${matched} No ETCD data found for ONU ${onu_sn} |
| 526 | Log ${uni_config} |
| 527 | ${tp_path}= Get From Dictionary ${uni_config} PersTpPathMap |
| 528 | Log ${tp_path} |
| 529 | ${flow_params}= Get From Dictionary ${uni_config} flow_params |
| 530 | Log ${flow_params} |
| 531 | # in case of ATT for ONU with removed flows there is default flow established |
| 532 | ${length}= Get Length ${flow_params} |
| 533 | ${cookieslice}= Run Keyword If ${length}>0 Run Keyword If 'cookie_slice' in ${flow_params[0]} |
| 534 | ... Get From Dictionary ${flow_params[0]} cookie_slice |
| 535 | ${setvid}= Run Keyword If ${length}>0 Run Keyword If 'set_vid' in ${flow_params[0]['vlan_rule_params']} |
| 536 | ... Get From Dictionary ${flow_params[0]['vlan_rule_params']} set_vid |
| 537 | ${cookie_slice_length}= Run Keyword If ${length}>0 Run Keyword If 'cookie_slice' in ${flow_params[0]} |
| 538 | ... Get Length ${cookieslice} |
TorstenThieme | 569ef45 | 2022-02-07 14:00:26 +0000 | [diff] [blame] | 539 | Run Keyword If "${workflow}"=="ATT" and not ${must_exist} and ${check_default_flow_att} Run Keywords |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 540 | ... Should Be Equal As Numbers ${setvid} 4091 AND |
| 541 | ... Should Be Equal As Numbers ${cookie_slice_length} 1 AND |
| 542 | ... Should Not Be Empty ${tp_path} AND |
| 543 | ... Return From Keyword |
| 544 | ${tp_path_length}= Get Length ${tp_path} |
| 545 | # validate tp_path is not Empty for case must_exist, case not must_exist will be validated implicitly with FOR loop |
| 546 | Run Keyword If ${must_exist} Should Not Be Empty ${tp_path} |
| 547 | ${tp_path_keys}= Run Keyword If ${tp_path_length}==0 Create List |
| 548 | ... ELSE Get Dictionary Keys ${tp_path} |
| 549 | ${tp_path_values}= Run Keyword If ${tp_path_length}==0 Create List |
| 550 | ... ELSE Get Dictionary Values ${tp_path} |
| 551 | ${tp_path_empty}= Set Variable True |
| 552 | Log ${tp_path_values} |
| 553 | Log ${tp_path_keys} |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 554 | # In case of not empty tp_path each value will be checked depending on must_exist |
| 555 | FOR ${key} IN @{tp_path_keys} |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 556 | ${value}= Get From Dictionary ${tp_path} ${key} |
| 557 | Run Keyword If ${must_exist} Should Not Be Empty ${value} |
| 558 | ... ELSE Should Be Empty ${value} |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 559 | END |
| 560 | Run Keyword If ${must_exist} Should Not Be Empty ${flow_params} |
| 561 | ... ELSE Should Be Empty ${flow_params} |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 562 | Run Keyword If ${check_tcont_map_empty} Log ${tcont_map} |
| 563 | Run Keyword If ${check_tcont_map_empty} Should Be Empty ${tcont_map} |
TorstenThieme | 7c397d7 | 2021-07-14 11:51:09 +0000 | [diff] [blame] | 564 | |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 565 | Validate Onu Data In Etcd |
| 566 | [Documentation] This keyword validates openonu-go-adapter Data stored in etcd. |
| 567 | ... It checks unique of serial_number and combination of pon, onu and uni in tp_path. |
| 568 | ... Furthermore it evaluates the values of onu_id and uni_id with values read from tp_path. |
| 569 | ... Number of etcd entries has to match with the passed number. |
Andrea Campanella | 388cd87 | 2022-02-10 09:11:39 +0100 | [diff] [blame] | 570 | [Arguments] ${namespace}=default ${nbofetcddata}=${num_all_onus} ${defaultkvstoreprefix}=voltha/voltha_voltha |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 571 | ... ${without_prefix}=True ${without_pm_data}=True |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 572 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 573 | ${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] | 574 | #prepare result for json convert |
| 575 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 576 | ${jsondata}= To Json ${result} |
| 577 | ${length}= Get Length ${jsondata} |
| 578 | log ${jsondata} |
| 579 | Run Keyword And Continue On Failure Should Be Equal As Integers ${length} ${nbofetcddata} |
| 580 | ... msg=Number etcd data (${length}) does not match required (${nbofetcddata})! |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 581 | ${oltpononuuniidlist}= Create List |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 582 | ${serialnumberlist}= Create List |
| 583 | FOR ${INDEX} IN RANGE 0 ${length} |
| 584 | ${value}= Get From List ${jsondata} ${INDEX} |
Girish Gowdra | 97f8d06 | 2020-11-17 15:48:23 -0800 | [diff] [blame] | 585 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 586 | # When testing multi-tcont this may need some adjustment. |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 587 | Exit For Loop If not ('uni_config' in $value) |
Girish Gowdra | 97f8d06 | 2020-11-17 15:48:23 -0800 | [diff] [blame] | 588 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 589 | ${oltpononuuniid}= Read Pon Onu Uni String ${tp_path} |
| 590 | ${list_id}= Get Index From List ${oltpononuuniidlist} ${oltpononuuniid} |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 591 | Should Be Equal As Integers ${list_id} -1 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 592 | ... msg=Combination of Pon, Onu and Uni (${oltpononuuniid}) exist multiple in etcd data! |
| 593 | Append To List ${oltpononuuniidlist} ${oltpononuuniid} |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 594 | Validate Onu Id ${value} |
| 595 | Validate Uni Id ${value} |
| 596 | ${serial_number}= Get From Dictionary ${value} serial_number |
| 597 | ${list_id}= Get Index From List ${serialnumberlist} ${serial_number} |
| 598 | Should Be Equal As Integers ${list_id} -1 |
| 599 | ... msg=Serial number (${serial_number}) exists multiple in etcd data! |
| 600 | Append To List ${serialnumberlist} ${serial_number} |
| 601 | END |
| 602 | |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 603 | Validate Onu Data In Etcd Removed |
| 604 | [Documentation] This keyword validates openonu-go-adapter Data stored in etcd are removed. |
| 605 | ... In case of a device is passed, only this will be checked. |
Andrea Campanella | 388cd87 | 2022-02-10 09:11:39 +0100 | [diff] [blame] | 606 | [Arguments] ${namespace}=default ${device_id}=${EMPTY} ${defaultkvstoreprefix}=voltha/voltha_voltha |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 607 | ... ${without_pm_data}=True |
| 608 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
| 609 | ${etcddata}= Get ONU Go Adapter ETCD Data ${namespace} ${kvstoreprefix} False ${without_pm_data} |
| 610 | ... ${device_id} True |
| 611 | Log ${etcddata} |
| 612 | Should Be Empty ${etcddata} Stale Openonu Data in Etcd (KV store) ${device_id} |
| 613 | |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 614 | Validate Vlan Rules In Etcd |
| 615 | [Documentation] This keyword validates Vlan rules of openonu-go-adapter Data stored in etcd. |
| 616 | ... It checks the given number of cookie_slice, match_vid (=4096) and set_vid. |
| 617 | ... Furthermore it returns a list of all set_vid. |
| 618 | ... In case of a passed dictionary containing set_vids these will be checked for to |
| 619 | ... current set-vid depending on setvidequal (True=equal, False=not equal). |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 620 | [Arguments] ${namespace}=default ${nbofcookieslice}=1 ${reqmatchvid}=4096 ${prevvlanrules}=${NONE} |
Andrea Campanella | 388cd87 | 2022-02-10 09:11:39 +0100 | [diff] [blame] | 621 | ... ${setvidequal}=False ${defaultkvstoreprefix}=voltha/voltha_voltha |
| 622 | ... ${without_prefix}=True ${without_pm_data}=True |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 623 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 624 | ${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] | 625 | #prepare result for json convert |
| 626 | ${result}= Prepare ONU Go Adapter ETCD Data For Json ${etcddata} |
| 627 | ${jsondata}= To Json ${result} |
| 628 | ${length}= Get Length ${jsondata} |
| 629 | log ${jsondata} |
| 630 | ${vlan_rules}= Create Dictionary |
| 631 | FOR ${INDEX} IN RANGE 0 ${length} |
| 632 | ${value}= Get From List ${jsondata} ${INDEX} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 633 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 634 | # When testing multi-tcont this may need some adjustment. |
| 635 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 636 | ${oltpononuuniid}= Read Pon Onu Uni String ${tp_path} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 637 | ${cookieslice}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]} cookie_slice |
| 638 | #@{cookieslicelist}= Split String ${cookieslice} , |
| 639 | ${foundcookieslices}= Get Length ${cookieslice} |
| 640 | Should Be Equal As Integers ${foundcookieslices} ${nbofcookieslice} |
| 641 | ${matchvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']} |
| 642 | ... match_vid |
| 643 | Should Be Equal As Integers ${matchvid} ${reqmatchvid} |
| 644 | ${setvid}= Get From Dictionary ${value['uni_config'][0]['flow_params'][0]['vlan_rule_params']} |
| 645 | ... set_vid |
| 646 | ${evalresult}= Evaluate 2 <= ${setvid} <= 4095 |
| 647 | Should Be True ${evalresult} msg=set_vid out of range (${setvid})! |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 648 | Set To Dictionary ${vlan_rules} ${oltpononuuniid} ${setvid} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 649 | ${oldsetvidvalid} Set Variable If ${prevvlanrules} is ${NONE} False True |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 650 | ${prevsetvid}= Set Variable If ${oldsetvidvalid} ${prevvlanrules['${oltpononuuniid}']} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 651 | Run Keyword If ${oldsetvidvalid} and ${setvidequal} |
| 652 | ... Should Be Equal As Integers ${prevsetvid} ${setvid} |
| 653 | ... ELSE IF ${oldsetvidvalid} and not ${setvidequal} |
| 654 | ... Should Not Be Equal As Integers ${prevsetvid} ${setvid} |
| 655 | END |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 656 | log Many ${vlan_rules} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 657 | [Return] ${vlan_rules} |
| 658 | |
| 659 | Get ONU Go Adapter ETCD Data |
| 660 | [Documentation] This keyword delivers openonu-go-adapter Data stored in etcd |
Andrea Campanella | 388cd87 | 2022-02-10 09:11:39 +0100 | [diff] [blame] | 661 | [Arguments] ${namespace}=default ${defaultkvstoreprefix}=voltha/voltha_voltha ${without_prefix}=True |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 662 | ... ${without_pm_data}=True ${device_id}=${Empty} ${keys_only}=False |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 663 | ${podname}= Set Variable etcd |
TorstenThieme | 3385cdc | 2021-02-04 13:50:50 +0000 | [diff] [blame] | 664 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
TorstenThieme | 3af1231 | 2021-03-10 16:15:24 +0000 | [diff] [blame] | 665 | ${commandget}= Catenate |
| 666 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/openonu' |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 667 | ${commandget}= Run Keyword If ${keys_only} Catenate ${commandget} --keys-only |
| 668 | ... ELSE Set Variable ${commandget} |
TorstenThieme | 3af1231 | 2021-03-10 16:15:24 +0000 | [diff] [blame] | 669 | ${commandget}= Run Keyword If ${without_prefix} Catenate ${commandget} |
| 670 | ... | grep -v service/${kvstoreprefix}/openonu |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 671 | ... ELSE Set Variable ${commandget} |
TorstenThieme | 3af1231 | 2021-03-10 16:15:24 +0000 | [diff] [blame] | 672 | ${commandget}= Run Keyword If ${without_pm_data} Catenate ${commandget} | grep -v instances_active |
TorstenThieme | fa29a89 | 2021-03-11 14:11:29 +0000 | [diff] [blame] | 673 | ... ELSE Set Variable ${commandget} |
TorstenThieme | 712b296 | 2021-11-17 14:16:15 +0000 | [diff] [blame] | 674 | ${commandget}= Run Keyword If "${device_id}"!="${Empty}" Catenate ${commandget} | grep ${device_id} |
| 675 | ... ELSE Set Variable ${commandget} |
Holger Hildebrandt | 2314774 | 2020-11-16 10:13:21 +0000 | [diff] [blame] | 676 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 677 | log ${result} |
| 678 | [Return] ${result} |
| 679 | |
| 680 | Prepare ONU Go Adapter ETCD Data For Json |
| 681 | [Documentation] This keyword prepares openonu-go-adapter Data stored in etcd for converting |
| 682 | ... to json |
| 683 | [Arguments] ${etcddata} |
| 684 | #prepare result for json convert |
| 685 | ${prepresult}= Replace String ${etcddata} \n , |
| 686 | ${prepresult}= Strip String ${prepresult} mode=right characters=, |
| 687 | ${prepresult}= Set Variable [${prepresult}] |
| 688 | log ${prepresult} |
| 689 | [Return] ${prepresult} |
| 690 | |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 691 | Read Pon Onu Uni String |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 692 | [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] | 693 | ... taken from etcd data of onu go adapter |
| 694 | [Arguments] ${tp_path} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 695 | ${tppathlines}= Replace String ${tp_path} / \n |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 696 | ${olt}= Get Value Of Tp Path Element ${tppathlines} olt |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 697 | ${pon}= Get Value Of Tp Path Element ${tppathlines} pon |
| 698 | ${onu}= Get Value Of Tp Path Element ${tppathlines} onu |
| 699 | ${uni}= Get Value Of Tp Path Element ${tppathlines} uni |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 700 | ${valuesid}= Set Variable ${olt}/${pon}/${onu}/${uni} |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 701 | log ${valuesid} |
| 702 | [Return] ${valuesid} |
| 703 | |
| 704 | Get Value Of Tp Path Element |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 705 | [Documentation] This keyword delivers numeric value of given tp path element. |
TorstenThieme | 52ef839 | 2020-11-10 13:42:26 +0000 | [diff] [blame] | 706 | [Arguments] ${tp_path_lines} ${element} |
| 707 | ${value}= Get Lines Containing String ${tp_path_lines} ${element}-\{ |
| 708 | ${value}= Remove String ${value} ${element}-\{ |
| 709 | ${value}= Remove String ${value} \} |
| 710 | log ${value} |
| 711 | [Return] ${value} |
| 712 | |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 713 | Validate Onu Id |
| 714 | [Documentation] This keyword validates ONU Id of passed etcd data. |
| 715 | [Arguments] ${value} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 716 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 717 | # When testing multi-tcont this may need some adjustment. |
| 718 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 719 | ${tppathlines}= Replace String ${tp_path} / \n |
| 720 | ${onu}= Get Value Of Tp Path Element ${tppathlines} onu |
| 721 | ${onu_id}= Get From Dictionary ${value} onu_id |
| 722 | Should Be Equal As Integers ${onu} ${onu_id} |
| 723 | ... msg=Onu-Id (${onu_id}) does not match onu (${onu}) from tp_path in etcd data! |
| 724 | Should Be True ${onu_id}>=1 |
| 725 | |
| 726 | Validate Uni Id |
| 727 | [Documentation] This keyword validates UNI Id of passed etcd data. |
| 728 | [Arguments] ${value} |
Girish Gowdra | 295c169 | 2020-11-19 10:51:53 -0800 | [diff] [blame] | 729 | # TODO: The TP ID is hardcoded to 64 below. It is fine when testing single-tcont workflow. |
| 730 | # When testing multi-tcont this may need some adjustment. |
| 731 | ${tp_path}= Get From Dictionary ${value['uni_config'][0]['PersTpPathMap']} 64 |
TorstenThieme | 17756ea | 2020-11-11 14:09:47 +0000 | [diff] [blame] | 732 | ${tppathlines}= Replace String ${tp_path} / \n |
| 733 | ${uni}= Get Value Of Tp Path Element ${tppathlines} uni |
| 734 | ${uni_id}= Get From Dictionary ${value['uni_config'][0]} uni_id |
| 735 | Should Be Equal As Integers ${uni} ${uni_id} |
| 736 | ... 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] | 737 | |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 738 | Delete ONU Go Adapter ETCD Data |
| 739 | [Documentation] This keyword deletes openonu-go-adapter Data stored in etcd |
Andrea Campanella | 388cd87 | 2022-02-10 09:11:39 +0100 | [diff] [blame] | 740 | [Arguments] ${namespace}=default ${defaultkvstoreprefix}=voltha/voltha_voltha ${validate}=False |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 741 | ${podname}= Set Variable etcd |
| 742 | ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix} |
| 743 | ${commandget}= Catenate |
| 744 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/${kvstoreprefix}/openonu' |
| 745 | ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget} |
| 746 | log ${result} |
| 747 | Run Keyword If ${validate} Wait Until Keyword Succeeds ${timeout} 1s |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 748 | ... Validate Onu Data In Etcd namespace=${namespace} nbofetcddata=0 without_pm_data=False |
TorstenThieme | 4507160 | 2021-03-16 12:14:37 +0000 | [diff] [blame] | 749 | [Return] ${result} |
| 750 | |
TorstenThieme | d649288 | 2021-12-16 08:10:02 +0000 | [diff] [blame] | 751 | Validate ONOS Flows per OLT |
| 752 | [Documentation] This keyword validates onos flows per olt |
| 753 | [Arguments] ${olt_sn} ${expected_flows} |
| 754 | ${olt_of_id} Validate OLT Device in ONOS ${olt_sn} |
| 755 | ${flows}= Count flows ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${olt_of_id} added |
| 756 | Log Found added ${flows} of ${expected_flows} expected flows on device ${olt_sn} |
| 757 | Should Be Equal As Integers ${expected_flows} ${flows} |
| 758 | |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 759 | Validate OLT Flows Per Onu |
| 760 | [Documentation] This keyword validates olt flows per onu |
| 761 | ... It checks checks presence/absence of olt flows depending on must_exist. |
| 762 | ... The values/content of olt flows will be not validated! |
| 763 | [Arguments] ${onu_device_id} ${must_exist} |
| 764 | ${rc} ${output}= Run and Return Rc and Output |
Andrea Campanella | 28989d1 | 2022-01-11 09:49:21 +0100 | [diff] [blame] | 765 | ... voltctl -c ${VOLTCTL_CONFIG} device flows ${onu_device_id} -m 32MB -o json |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 766 | Should Be Equal As Integers ${rc} 0 |
| 767 | ${jsondata}= To Json ${output} |
| 768 | Log ${jsondata} |
| 769 | # in case of ATT for ONU with removed flows there is default flow established |
| 770 | ${length}= Get Length ${jsondata} |
| 771 | ${value}= Run Keyword If ${length}>0 Get From List ${jsondata} 0 |
| 772 | ${setvid}= Run Keyword If ${length}>0 Run Keyword If 'setvlanid' in ${value} |
| 773 | ... Get From Dictionary ${value} setvlanid |
| 774 | Run Keyword If "${workflow}"=="ATT" and not ${must_exist} Run Keywords |
| 775 | ... Should Be Equal As Numbers ${setvid} 4091 AND |
| 776 | ... Should Be Equal As Numbers ${length} 1 AND |
| 777 | ... Return From Keyword |
| 778 | Run Keyword If ${must_exist} Should Not Be Empty ${jsondata} |
| 779 | ... ELSE Should Be Empty ${jsondata} |
| 780 | |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 781 | Wait for Ports in ONOS for all OLTs |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 782 | [Documentation] Waits untill a certain number of ports are enabled in all OLTs |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 783 | [Arguments] ${host} ${port} ${count} ${filter} ${max_wait_time}=10m ${determine_number}=False |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 784 | FOR ${J} IN RANGE 0 ${num_olts} |
| 785 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 786 | ${onu_count}= Set Variable ${list_olts}[${J}][onucount] |
| 787 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 788 | ... ${olt_serial_number} |
| 789 | Set Global Variable ${of_id} |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 790 | ${count2check}= Set Variable If ${count}==${num_all_onus} ${onu_count} ${count} |
| 791 | # if flag determine_number is set to True, always determine the number of real ONUs (overwrite previous value) |
| 792 | ${count2check}= Run Keyword If ${determine_number} Determine Number Of ONU ${olt_serial_number} |
| 793 | ... ELSE Set Variable ${count2check} |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 794 | 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] | 795 | END |
| 796 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 797 | Wait for all ONU Ports in ONOS Disabled |
| 798 | [Documentation] Waits untill a all ONU ports are disabled in all ONOS |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 799 | [Arguments] ${host} ${port} ${unitag}=False |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 800 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 801 | ${src}= Set Variable ${hosts.src[${I}]} |
| 802 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 803 | ... ${src['olt']} |
TorstenThieme | 00fe826 | 2022-01-19 10:43:07 +0000 | [diff] [blame] | 804 | ${onu_uni_id}= Set Variable If ${unitag} ${src['uni_id']} 1 |
| 805 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 806 | ... ${onu_uni_id} |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 807 | 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] | 808 | ... ${onu_port} |
| 809 | END |
| 810 | |
TorstenThieme | d9cc06e | 2022-11-09 12:12:46 +0000 | [diff] [blame] | 811 | Validate Events All ONUs |
| 812 | [Documentation] Validates kafka events for all ONUs |
| 813 | [Arguments] ${list_onu_device_id} ${expected_event} |
| 814 | ${Kafka_Records}= kafka.Records Get voltha.events |
| 815 | ${RecordsLength}= Get Length ${Kafka_Records} |
| 816 | FOR ${Index} IN RANGE 0 ${RecordsLength} |
| 817 | ${metric}= Set Variable ${Kafka_Records[${Index}]} |
| 818 | ${message}= Get From Dictionary ${metric} message |
| 819 | ${event}= volthatools.Events Decode Event ${message} return_default=true |
| 820 | Continue For Loop If not 'device_event' in ${event} |
| 821 | ${event_name}= Get From Dictionary ${event['device_event']} device_event_name |
| 822 | Continue For Loop If "${event_name}" != "${expected_event}" |
| 823 | ${resource_id}= Get From Dictionary ${event['device_event']} resource_id |
| 824 | Remove Values From List ${list_onu_device_id} ${resource_id} |
| 825 | END |
| 826 | Should Be Empty ${list_onu_device_id} Missing "${expected_event}" for ONUs ${list_onu_device_id}! |
| 827 | |
TorstenThieme | fd7e7ba | 2020-11-06 13:57:57 +0000 | [diff] [blame] | 828 | Map State |
| 829 | [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values. |
| 830 | [Arguments] ${state} |
| 831 | # create state lists with corresponding return values |
| 832 | # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE (number/name) |
| 833 | ${state1} Create List ENABLED ACTIVATING REACHABLE 1 activating-onu |
| 834 | ${state2} Create List ENABLED ACTIVATING REACHABLE 2 starting-openomci |
| 835 | ${state3} Create List ENABLED ACTIVATING REACHABLE 3 discovery-mibsync-complete |
| 836 | ${state4} Create List ENABLED ACTIVE REACHABLE 4 initial-mib-downloaded |
| 837 | ${state5} Create List ENABLED ACTIVE REACHABLE 5 tech-profile-config-download-success |
| 838 | ${state6} Create List ENABLED ACTIVE REACHABLE 6 omci-flows-pushed |
| 839 | ${state7} Create List DISABLED UNKNOWN REACHABLE 7 omci-admin-lock |
| 840 | ${state8} Create List ENABLED ACTIVE REACHABLE 8 onu-reenabled |
| 841 | ${state9} Create List ENABLED DISCOVERED UNREACHABLE 9 stopping-openomci |
| 842 | ${state10} Create List ENABLED DISCOVERED REACHABLE 10 rebooting |
| 843 | ${state11} Create List ENABLED DISCOVERED REACHABLE 11 omci-flows-deleted |
| 844 | ${state12} Create List DISABLED UNKNOWN REACHABLE 12 tech-profile-config-delete-success |
| 845 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Set Variable If |
| 846 | ... '${state}'=='1' or '${state}'=='activating-onu' ${state1} |
| 847 | ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2} |
| 848 | ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3} |
| 849 | ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4} |
| 850 | ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5} |
| 851 | ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6} |
| 852 | ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7} |
| 853 | ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8} |
| 854 | ... '${state}'=='9' or '${state}'=='stopping-openomci' ${state9} |
| 855 | ... '${state}'=='10' or '${state}'=='rebooting' ${state10} |
| 856 | ... '${state}'=='11' or '${state}'=='omci-flows-deleted' ${state11} |
| 857 | ... '${state}'=='12' or '${state}'=='tech-profile-config-delete-success' ${state12} |
| 858 | [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state} |