Joey Armstrong | 888f1ee | 2023-01-11 17:14:30 -0500 | [diff] [blame] | 1 | # Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Andrea Speranza | 8b6f46f | 2022-08-23 14:22:15 +0200 | [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. |
| 14 | # common functions |
| 15 | |
| 16 | *** Settings *** |
| 17 | Documentation Library for various utilities |
| 18 | Library SSHLibrary |
| 19 | Library String |
| 20 | Library DateTime |
| 21 | Library Process |
| 22 | Library Collections |
| 23 | Library RequestsLibrary |
| 24 | Library OperatingSystem |
| 25 | Library XML |
| 26 | Resource ./k8s.robot |
| 27 | |
| 28 | *** Variables *** |
| 29 | |
| 30 | *** Keywords *** |
| 31 | |
| 32 | Get BBF Device Aggregation |
| 33 | [Documentation] Extract, running an except script, the XML that |
| 34 | ... represent all the Network viewed by the BBF-Adapter and |
| 35 | ... copy it to the ${XMLDestPath}. |
| 36 | [Arguments] ${namespace} ${XMLDestPath} ${pathToScript} |
| 37 | |
| 38 | #Remove the previus XML (extract by previus tests) |
| 39 | ${rc} ${exec_pod_name}= Run and Return Rc and Output |
| 40 | ... rm ${XMLDestPath} |
| 41 | #Retrive the Name of the BBF-Adapter Pod |
| 42 | ${rc} ${exec_pod_name}= Run and Return Rc and Output |
| 43 | ... kubectl get pods -n ${namespace} -l app=bbf-adapter --no-headers | awk 'NR==1{print $1}' |
| 44 | #Execute the script that access with SSH to the BBF-Adapter Pod |
| 45 | #Run the netopeer2-cli, set up it, and ask to the device-aggregation XML |
| 46 | ${rc} ${output}= Run and Return Rc and Output |
| 47 | ... expect ${pathToScript}/bbf_device_aggregation.exp ${exec_pod_name} |
| 48 | Log ${output} |
| 49 | #Verify if there are some error of connectivity with the Adapter Pod |
| 50 | ${expect}= Get Length ${output} |
| 51 | Run Keyword If ${expect} <= 100 |
| 52 | ... Fail Impossible to Reach the BBF-Adapter Pod (port-forward/key-exchange?) |
| 53 | #Copy From the Pod to the ${XMLDestPath} the XML file |
| 54 | Copy File From Pod ${namespace} app=bbf-adapter home/voltha/output.xml ${XMLDestPath} |
| 55 | |
| 56 | OLT XML update From BBF |
| 57 | [Documentation] Extract, running an except script, the XML that |
| 58 | ... represent all the Network viewed by the BBF-Adapter and |
| 59 | ... copy it to the ${XMLDestPath}. |
| 60 | [Arguments] ${dirXML} ${pathToScript} |
| 61 | Get BBF Device Aggregation ${NAMESPACE} ${dirXML} ${pathToScript} |
| 62 | ${oltes_bbf}= Get Olts From XML ${dirXML} |
| 63 | Set Global Variable ${oltes_bbf} |
| 64 | |
| 65 | ONU XML update From BBF |
| 66 | [Documentation] Extract, running an except script, the XML that |
| 67 | ... represent all the Network viewed by the BBF-Adapter and |
| 68 | ... copy it to the ${XMLDestPath}. |
| 69 | [Arguments] ${dirXML} ${pathToScript} |
| 70 | Get BBF Device Aggregation ${NAMESPACE} ${dirXML} ${pathToScript} |
| 71 | ${onus_bbf}= Get Onus From XML ${dirXML} |
| 72 | Set Global Variable ${onus_bbf} |
| 73 | |
| 74 | ALL DEVICES XML update From BBF |
| 75 | [Documentation] Extract, running an except script, the XML that |
| 76 | ... represent all the Network viewed by the BBF-Adapter and |
| 77 | ... copy it to the ${XMLDestPath}. |
| 78 | [Arguments] ${dirXML} ${pathToScript} |
| 79 | Get BBF Device Aggregation ${NAMESPACE} ${dirXML} ${pathToScript} |
| 80 | ${all_devices_bbf}= Get All Devices ${dirXML} |
| 81 | Set Global Variable ${all_devices_bbf} |
| 82 | |
| 83 | Get Devices By Type |
| 84 | [Documentation] Extract ALL the Devices viewed by the BBF-Adapter |
| 85 | ... that there are the type defined: OLT(bbf-dvct:olt), ONU(bbf-dvct:onu) |
| 86 | ... ${XML} is the path to XML file OR the XML itself. |
| 87 | ... Return a List of Defined Devices information |
| 88 | [Arguments] ${XML} ${typeAsk} |
| 89 | #Take the XML file o the XML itself |
| 90 | Log ${XML} |
| 91 | ${root}= Parse XML ${XML} |
| 92 | #Define a list of all the OLTs |
| 93 | @{bbf_olts_xml}= Create List |
| 94 | #Navigate in the XML to enter in the Devices and get all Devices in XML |
| 95 | @{device} = Get Elements ${root} devices/device |
| 96 | ${number_of_devices}= Get Length ${device} |
| 97 | #Run on all the devices |
| 98 | FOR ${I} IN RANGE 0 ${number_of_devices} |
| 99 | #Verify the correct Type of device that is declared |
| 100 | ${type}= Get Element Text ${device}[${I}] type |
| 101 | Continue For Loop If "${type}" != "${typeAsk}" |
| 102 | #Append the device with che correct type in the list |
| 103 | Append To List ${bbf_olts_xml} ${device}[${I}] |
| 104 | END |
| 105 | Log ${bbf_olts_xml} |
| 106 | [Return] ${bbf_olts_xml} |
| 107 | |
| 108 | Get Olts From XML |
| 109 | [Documentation] Extract ALL the OLTs viewed by the BBF-Adapter |
| 110 | ... ${XML} is the path to XML file OR the XML itself. |
| 111 | ... Return a List of OLTs information. |
| 112 | [Arguments] ${XML} |
| 113 | #Get from the XML all OLT |
| 114 | ${bbf_olts}= Get Devices By Type ${XML} bbf-dvct:olt |
| 115 | #Create a List of OLTs |
| 116 | @{bbf_olts_Info}= Create List |
| 117 | ${number_of_olts}= Get Length ${bbf_olts} |
| 118 | FOR ${I} IN RANGE 0 ${number_of_olts} |
| 119 | #Enter in the component where there are the information of the OLT |
| 120 | ${component}= Get Element ${bbf_olts}[${I}] data/hardware/component |
| 121 | #Get from the XML the data |
| 122 | ${name}= Get Element Text ${component} name |
| 123 | ${hardware_rev}= Get Element Text ${component} hardware-rev |
| 124 | ${firmware_rev}= Get Element Text ${component} firmware-rev |
| 125 | ${serial_number}= Get Element Text ${component} serial-num |
| 126 | ${mfg_name}= Get Element Text ${component} mfg-name |
| 127 | ${model_name}= Get Element Text ${component} model-name |
| 128 | ${admin_state}= Get Element Text ${component} state/admin-state |
| 129 | ${oper_state}= Get Element Text ${component} state/oper-state |
| 130 | |
| 131 | #Define a Dictionary that containe all the information about the OLT |
| 132 | #Need to modify when there are add in the XML the connect-state |
| 133 | ${bbf_olt} Create Dictionary |
| 134 | ... name ${name} |
| 135 | ... hardware_rev ${hardware_rev} |
| 136 | ... firmware_rev ${firmware_rev} |
| 137 | ... serial-num ${serial_number} |
| 138 | ... mfg-name ${mfg_name} |
| 139 | ... model-name ${model_name} |
| 140 | ... admin-state ${admin_state} |
| 141 | ... oper-state ${oper_state} |
| 142 | ... connect-state unknown |
| 143 | |
| 144 | Append To List ${bbf_olts_Info} ${bbf_olt} |
| 145 | END |
| 146 | Log ${bbf_olts_Info} |
| 147 | [Return] ${bbf_olts_Info} |
| 148 | |
| 149 | Get Onus From XML |
| 150 | [Documentation] Extract ALL the ONUs viewed by the BBF-Adapter |
| 151 | ... Return a List of ONUs information. |
| 152 | [Arguments] ${XML} |
| 153 | #Get all the devices of the specific type |
| 154 | ${bbf_onus}= Get Devices By Type ${XML} bbf-dvct:onu |
| 155 | #Create a list that will contain all the information of the ONUs |
| 156 | @{bbf_onus_Info}= Create List |
| 157 | #Run on the XML compose be ONUs information |
| 158 | ${number_of_onus}= Get Length ${bbf_onus} |
| 159 | FOR ${I} IN RANGE 0 ${number_of_onus} |
| 160 | #Enter in the component where there are the information of the ONU |
| 161 | ${component}= Get Element ${bbf_onus}[${I}] data/hardware/component |
| 162 | #Get from the XML the data |
| 163 | ${name}= Get Element Text ${component} name |
| 164 | ${parent}= Get Element Text ${component} parent |
| 165 | ${parent_rel_pos}= Get Element Text ${component} parent-rel-pos |
| 166 | ${hardware_rev}= Get Element Text ${component} hardware-rev |
| 167 | ${firmware_rev}= Get Element Text ${component} firmware-rev |
| 168 | ${serial_number}= Get Element Text ${component} serial-num |
| 169 | ${mfg_name}= Get Element Text ${component} mfg-name |
| 170 | ${model_name}= Get Element Text ${component} model-name |
| 171 | ${admin_state}= Get Element Text ${component} state/admin-state |
| 172 | ${oper_state}= Get Element Text ${component} state/oper-state |
| 173 | #Enter in the interfaces part |
| 174 | ${interfaces}= Get Element ${bbf_onus}[${I}] data/interfaces |
| 175 | #Retrive all the information about all the interface of the consider ONU |
| 176 | @{onu_interfaces}= Get Interfaces From Onu XML Interfaces ${interfaces} |
| 177 | |
| 178 | #Define a Dictionary that containe all the information about the OLT |
| 179 | #Need to modify when there are add in the XML the connect-state |
| 180 | #Need to modify when there are add in the XML the Onu-Reason |
| 181 | ${bbf_onu} Create Dictionary |
| 182 | ... name ${name} |
| 183 | ... parent-id ${parent} |
| 184 | ... parent-rel-pos ${parent_rel_pos} |
| 185 | ... hardware_rev ${hardware_rev} |
| 186 | ... firmware_rev ${firmware_rev} |
| 187 | ... serial-num ${serial_number} |
| 188 | ... mfg-name ${mfg_name} |
| 189 | ... model-name ${model_name} |
| 190 | ... admin-state ${admin_state} |
| 191 | ... oper-state ${oper_state} |
| 192 | ... connect-state unknown |
| 193 | ... onu-reason omci-flows-pushed |
| 194 | ... interfaces ${onu_interfaces} |
| 195 | |
| 196 | Append To List ${bbf_onus_Info} ${bbf_onu} |
| 197 | END |
| 198 | Log ${bbf_onus_Info} |
| 199 | [Return] ${bbf_onus_Info} |
| 200 | |
| 201 | Get Interfaces From Onu XML Interfaces |
| 202 | [Documentation] Extract ALL the Interfaces of a ONU viewed by the BBF-Adapter |
| 203 | ... Return a List of ONU Interfaces information |
| 204 | [Arguments] ${interfaces_bbf} |
| 205 | #Intereate on the Interfaces |
| 206 | @{interface}= Get Elements ${interfaces_bbf} interface |
| 207 | #Create a list of interface for each ONU |
| 208 | @{interfaces_Info}= Create List |
| 209 | ${number_of_interfaces}= Get Length ${interface} |
| 210 | FOR ${I} IN RANGE 0 ${number_of_interfaces} |
| 211 | #Get from the XML information about the interface |
| 212 | ${name}= Get Element Text ${interface}[${I}] name |
| 213 | ${type}= Get Element Text ${interface}[${I}] type |
| 214 | ${oper_status}= Get Element Text ${interface}[${I}] oper-status |
| 215 | #Define a Dictionary that contain all the information of single interface |
| 216 | ${onu_interface} Create Dictionary |
| 217 | ... name ${name} |
| 218 | ... type ${type} |
| 219 | ... oper_status ${oper_status} |
| 220 | #Appen interface |
| 221 | Append To List ${interfaces_Info} ${onu_interface} |
| 222 | END |
| 223 | Log ${interfaces_Info} |
| 224 | [Return] ${interfaces_Info} |
| 225 | |
| 226 | Get All Devices |
| 227 | [Documentation] Extract all the Device (OLTs and ONUS) in a unique List of Devices |
| 228 | [Arguments] ${XML} |
| 229 | ${onus_bbf}= Get Onus From XML ${XML} |
| 230 | ${olts_bbf}= Get Olts From XML ${XML} |
| 231 | ${all_devices_bbf}= Combine Lists ${onus_bbf} ${olts_bbf} |
| 232 | [Return] ${all_devices_bbf} |
| 233 | |
| 234 | Admin State Translation From IETF to VOLTHA |
| 235 | [Documentation] Allow to translate the IETF of a Admin-State to VOLTHA |
| 236 | [Arguments] ${ietf_admin_state} |
| 237 | #Remeber that exist in VOLTHA also Admini State with: Downloading_Image |
| 238 | #PREPROVISIONED is consider inside the DISABLED state |
| 239 | ${voltha_admin_state}= Run Keyword IF "${ietf_admin_state}"=="locked" |
| 240 | ... Set Variable DISABLED |
| 241 | ... ELSE |
| 242 | ... Run Keyword IF "${ietf_admin_state}"=="unlocked" |
| 243 | ... Set Variable ENABLED |
| 244 | ... ELSE |
| 245 | ... Set Variable UNKNOWN |
| 246 | Log ${voltha_admin_state} |
| 247 | [Return] ${voltha_admin_state} |
| 248 | |
| 249 | Create Device in BBF |
| 250 | [Arguments] ${device_id} |
| 251 | [Documentation] PlaceHolder Method to future Create Device from the BBF Adapter |
| 252 | Should Be True True |
| 253 | |
| 254 | Delete Device in BBF |
| 255 | [Arguments] ${device_id} |
| 256 | [Documentation] PlaceHolder Method to future Delete Device from the BBF Adapter |
| 257 | Should Be True True |
| 258 | |
| 259 | Enable Device in BBF |
| 260 | [Arguments] ${device_id} |
| 261 | [Documentation] PlaceHolder Method to future Enable Device from the BBF Adapter |
| 262 | Should Be True True |
| 263 | |
| 264 | Disable Device in BBF |
| 265 | [Arguments] ${device_id} |
| 266 | [Documentation] PlaceHolder Method to future Disable Device from the BBF Adapter |
| 267 | Should Be True True |
| 268 | |
| 269 | Admin State Translation From VOLTHA to IETF |
| 270 | [Documentation] Allow to translate the VOLTHA of a Admin-State to IETF Standard |
| 271 | [Arguments] ${voltha_admin_state} |
| 272 | #Remeber that exist in VOLTHA also Admini State with: Downloading_Image |
| 273 | ${ietf_admin_state}= Run Keyword IF "${voltha_admin_state}"=="DISABLED" |
| 274 | ... Set Variable locked |
| 275 | ... ELSE |
| 276 | ... Run Keyword IF "${voltha_admin_state}"=="PREPROVISIONED" |
| 277 | ... Set Variable locked |
| 278 | ... ELSE |
| 279 | ... Run Keyword IF "${voltha_admin_state}"=="ENABLED" |
| 280 | ... Set Variable unlocked |
| 281 | ... ELSE |
| 282 | ... Set Variable unknown |
| 283 | [Return] ${ietf_admin_state} |
| 284 | |
| 285 | Oper State Translation From IETF to VOLTHA |
| 286 | [Documentation] Allow to translate the IETF of a Oper-State to VOLTHA |
| 287 | [Arguments] ${ietf_oper_state} |
| 288 | #Remeber that exist in VOLTHA also Admini State with: Discovered and Activating and Failed |
| 289 | ${voltha_oper_state}= Run Keyword IF "${ietf_oper_state}"=="disable" |
| 290 | ... Set Variable RECONCILING_FAILED |
| 291 | ... ELSE |
| 292 | ... Run Keyword IF "${ietf_oper_state}"=="enabled" |
| 293 | ... Set Variable ACTIVE |
| 294 | ... ELSE |
| 295 | ... Run Keyword IF "${ietf_oper_state}"=="testing" |
| 296 | ... Set Variable TESTING |
| 297 | ... ELSE |
| 298 | ... Set Variable UNKNOWN |
| 299 | Log ${voltha_oper_state} |
| 300 | [Return] ${voltha_oper_state} |
| 301 | |
| 302 | Oper State Translation From VOLTHA to IETF |
| 303 | [Documentation] Allow to translate the VOLTHA of a Oper-State to IETF Standard |
| 304 | [Arguments] ${voltha_oper_state} |
| 305 | #Remeber that exist in VOLTHA also Admini State with: Discovered and Activating and Failed |
| 306 | ${ietf_oper_state}= Run Keyword IF "${voltha_oper_state}"=="RECONCILING_FAILED" |
| 307 | ... Set Variable disable |
| 308 | ... ELSE |
| 309 | ... Run Keyword IF "${voltha_oper_state}"=="ACTIVE" |
| 310 | ... Set Variable enabled |
| 311 | ... ELSE |
| 312 | ... Run Keyword IF "${voltha_oper_state}"=="TESTING" |
| 313 | ... Set Variable testing |
| 314 | ... ELSE |
| 315 | ... Set Variable unknown |
| 316 | Log ${ietf_oper_state} |
| 317 | [Return] ${ietf_oper_state} |
| 318 | |
| 319 | Connect State Translation From IETF to VOLTHA |
| 320 | [Documentation] Allow to translate the IETF of a Connect-State to VOLTHA |
| 321 | [Arguments] ${bbf_connect_state} |
| 322 | #Only REACHABLE because we don't know the IETF status |
| 323 | ${voltha_connect_state}= Set Variable REACHABLE |
| 324 | [Return] ${voltha_connect_state} |
| 325 | |
| 326 | Connect State Translation From VOLTHA to IETF |
| 327 | [Documentation] Allow to translate the VOLTHA of a Connect-State to IETF Standard |
| 328 | [Arguments] ${voltha_connect_state} |
| 329 | ${bbf_connect_state}= Set Variable unknown |
| 330 | [Return] ${bbf_connect_state} |
| 331 | |
| 332 | Validate Onu in BBF |
| 333 | [Documentation] Validate an ONU in BBF and its states |
| 334 | [Arguments] ${admin_state_voltha} ${oper_status_voltha} ${connect_status_voltha} |
| 335 | ... ${onu_serial_number} ${onu_reasons} |
| 336 | #Translate some states from VOLTHA to IETF to verify it in the BBF |
| 337 | ${admin_state}= Admin State Translation From VOLTHA to IETF ${admin_state_voltha} |
| 338 | ${oper_status}= Oper State Translation From VOLTHA to IETF ${oper_status_voltha} |
| 339 | #${connect_status_voltha}= Connect State Translation From VOLTHA to IETF ${connect_status_voltha} |
| 340 | #Define passed to understand if there are or not the consider ONU |
| 341 | ${passed}= Set Variable False |
| 342 | ${number_of_onus}= Get Length ${onus_bbf} |
| 343 | FOR ${I} IN RANGE 0 ${number_of_onus} |
| 344 | Continue For Loop If "${onu_serial_number}"!="${onus_bbf}[${I}][serial-num]" |
| 345 | #The ONU is in the BBF |
| 346 | ${passed}= Set Variable True |
| 347 | #Get all the information of the ONU |
| 348 | ${sn}= Set Variable ${onus_bbf}[${I}][serial-num] |
| 349 | ${astate}= Set Variable ${onus_bbf}[${I}][admin-state] |
| 350 | ${ostate}= Set Variable ${onus_bbf}[${I}][oper-state] |
| 351 | #To modify when will add |
| 352 | #${cstate}= ${onus_bbf}[${I}][connect-state] |
| 353 | ${oreason}= Set Variable ${onus_bbf}[${I}][onu-reason] |
| 354 | #Check if status is correct to consider the ONU in a correct setup state |
| 355 | Should Be True ${passed} No match found for ${sn} to validate device |
| 356 | Log ${passed} |
| 357 | Should Be Equal '${admin_state}' '${astate}' Device ${sn} admin_state != ${admin_state} |
| 358 | ... passed=False |
| 359 | Should Be Equal '${oper_status}' '${ostate}' Device ${sn} oper_status != ${oper_status} |
| 360 | ... passed=False |
| 361 | #To modify when will add |
| 362 | #Should Be Equal '${connect_status}' '${cstate}' Device ${sn} conn_status != ${connect_status} |
| 363 | #... passed=False |
| 364 | #Should Be Equal '${onu_reasons}' '${oreason}' Device ${sn} reason != ${onu_reasons} |
| 365 | #... passed=False |
| 366 | #Run Keyword If '${onu}' == 'True' Should Contain '${onu_reason}' '${mib_state}' |
| 367 | #... Device ${sn} mib_state incorrect (${mib_state}) passed=False |
| 368 | Log ${sn} |
| 369 | Log ${astate} |
| 370 | Log ${ostate} |
| 371 | #Log ${cstate} |
| 372 | #Log ${oreason} |
| 373 | END |
| 374 | #If false can not are the ONU or there are problem with the states status |
| 375 | Should Be True ${passed} BBF Problem with this ONU SN: ${onu_serial_number} |
| 376 | |
| 377 | Validate Olt in BBF |
| 378 | [Documentation] Verify if the Olts are present inside the XML of the BBF adapter |
| 379 | ... and if the states are correct. |
| 380 | [Arguments] ${admin_state_voltha} ${oper_status_voltha} ${connect_status_voltha} |
| 381 | ... ${olt_serial_number} ${olt_device_id} |
| 382 | #Translate some states from VOLTHA to IETF to verify it in the BBF |
| 383 | ${admin_state}= Admin State Translation From VOLTHA to IETF ${admin_state_voltha} |
| 384 | ${oper_status}= Oper State Translation From VOLTHA to IETF ${oper_status_voltha} |
| 385 | #${connect_status_voltha}= Connect State Translation From VOLTHA to IETF ${connect_status_voltha} |
| 386 | #Define passed to understand if there are or not the consider OLT |
| 387 | ${passed}= Set Variable False |
| 388 | ${number_of_oltes}= Get Length ${oltes_bbf} |
| 389 | FOR ${I} IN RANGE 0 ${number_of_oltes} |
| 390 | Continue For Loop If "${olt_serial_number}"!="${oltes_bbf}[${I}][serial-num]" |
| 391 | #The OLT is in the BBF |
| 392 | ${passed}= Set Variable True |
| 393 | #Get information of the OLT |
| 394 | ${sn}= Set Variable ${oltes_bbf}[${I}][serial-num] |
| 395 | ${astate}= Set Variable ${oltes_bbf}[${I}][admin-state] |
| 396 | ${ostate}= Set Variable ${oltes_bbf}[${I}][oper-state] |
| 397 | #To modify when will add |
| 398 | #${cstate}= ${oltes_bbf}[${I}][connect-state] |
| 399 | #Check all the state status |
| 400 | Should Be True ${passed} No match found for ${sn} to validate device |
| 401 | Log ${passed} |
| 402 | Should Be Equal '${admin_state}' '${astate}' Device ${sn} admin_state != ${admin_state} |
| 403 | ... passed=False |
| 404 | Should Be Equal '${oper_status}' '${ostate}' Device ${sn} oper_status != ${oper_status} |
| 405 | ... passed=False |
| 406 | #To modify when will add |
| 407 | #Should Be Equal '${connect_status}' '${cstate}' Device ${sn} conn_status != ${connect_status} |
| 408 | #... passed=False |
| 409 | END |
| 410 | #If false can not are the OLT or there are problem with the states status |
| 411 | Should Be True ${passed} BBF Problem with this ONU SN: ${olt_serial_number} |
| 412 | |
| 413 | Validate Device in BBF |
| 414 | [Documentation] Verify if the Device (Olt or Onu) are present inside the XML of the BBF adapter |
| 415 | ... and if the states are correct. |
| 416 | [Arguments] ${admin_state_voltha} ${oper_status_voltha} ${connect_status_voltha} |
| 417 | ... ${serial_number} ${device_id} ${isONU} |
| 418 | Run Keyword If ${isONU} |
| 419 | ... Wait Until Keyword Succeeds ${timeout} 5s |
| 420 | ... Validate Onu in BBF ${admin_state_voltha} ${oper_status_voltha} ${connect_status_voltha} |
| 421 | ... ${serial_number} ${device_id} |
| 422 | ... ELSE |
| 423 | ... Wait Until Keyword Succeeds ${timeout} 5s |
| 424 | ... Validate Olt in BBF ${admin_state_voltha} ${oper_status_voltha} ${connect_status_voltha} |
| 425 | ... ${serial_number} ${device_id} |
| 426 | |
| 427 | Validate ONUs After OLT Disable in BBF |
| 428 | [Documentation] Validates the ONUs state in BBF, ONUs port state in ONOS |
| 429 | ... and that pings do not succeed After corresponding OLT is Disabled |
| 430 | [Arguments] ${olt_serial_number} |
| 431 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 432 | ${src}= Set Variable ${hosts.src[${I}]} |
| 433 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 434 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 435 | ${of_id}= Get ofID From OLT List ${src['olt']} |
| 436 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s |
| 437 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} ${src['uni_id']} |
| 438 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 439 | Wait Until Keyword Succeeds ${timeout} 2s |
| 440 | ... Verify UNI Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']} |
| 441 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure |
| 442 | ... Wait Until Keyword Succeeds ${timeout} 2s |
| 443 | ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} |
| 444 | ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 445 | ${onu_reasons}= Create List omci-flows-deleted |
| 446 | Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} stopping-openomci |
| 447 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s |
| 448 | ... Validate Onu in BBF ENABLED DISCOVERED |
| 449 | ... UNREACHABLE ${src['onu']} ${onu_reasons} |
| 450 | END |
| 451 | |
| 452 | Validate Olt Disabled in BBF |
| 453 | [Documentation] Validates the ONUs state in BBF, ONUs port state in ONOS |
| 454 | ... and that pings do not succeed After corresponding OLT is Disabled |
| 455 | [Arguments] ${olt_serial_number} ${olt_device_id} |
| 456 | Validate Olt in BBF admin_state_voltha=DISABLED oper_status_voltha=UNKNOWN |
| 457 | ... connect_status_voltha=REACHABLE olt_serial_number=${olt_serial_number} |
| 458 | ... olt_device_id=${olt_device_id} |
| 459 | |
| 460 | Validate Device Removed in BBF |
| 461 | [Documentation] Verify if the device with that ${serial_number}, has been removed |
| 462 | [Arguments] ${device_serial_number} |
| 463 | ${eliminated}= Set Variable True |
| 464 | ${number_of_devices}= Get Length ${all_devices_bbf} |
| 465 | FOR ${I} IN RANGE 0 ${number_of_devices} |
| 466 | Continue For Loop If "${device_serial_number}"!="${all_devices_bbf}[${I}][serial-num]" |
| 467 | ${eliminated}= Set Variable False |
| 468 | END |
| 469 | Should Be True ${eliminated} Device with ${device_serial_number} not eliminated |
| 470 | |
| 471 | Validate all ONUS for OLT Removed in BBF |
| 472 | [Arguments] ${olt_serial_number} |
| 473 | [Documentation] Verifys that all the ONUS for OLT ${serial_number}, has been removed |
| 474 | @{removed_onu_list}= Create List |
| 475 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 476 | ${src}= Set Variable ${hosts.src[${I}]} |
| 477 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 478 | ${removed_onu_seria_number}= Set Variable ${src['onu']} |
| 479 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s |
| 480 | ... Validate Device Removed in BBF ${removed_onu_seria_number} |
| 481 | Append To List ${removed_onu_list} ${removed_onu_seria_number} |
| 482 | END |
| 483 | Log ${removed_onu_list} |
| 484 | |
| 485 | Get Device ID From SN in BBF |
| 486 | [Documentation] Retrive from the XML the Device Id of a Device |
| 487 | ... using the Serial Number |
| 488 | [Arguments] ${device_serial_number} |
| 489 | ${Device_ID}= Set Variable 0 |
| 490 | ${number_of_devices}= Get Length ${all_devices_bbf} |
| 491 | FOR ${I} IN RANGE 0 ${number_of_devices} |
| 492 | Continue For Loop If "${device_serial_number}"!="${all_devices_bbf}[${I}][serial-num]" |
| 493 | ${Device_ID}= Set Variable ${all_devices_bbf}[${I}][name] |
| 494 | Log ${Device_ID} |
| 495 | END |
| 496 | [Return] ${Device_ID} |
| 497 | |
| 498 | Correct representation check VOLTHA-IETF |
| 499 | [Documentation] Check if all the information the VOLTHA have about a device |
| 500 | ... is a correct representation of the device in BBF-Adapter |
| 501 | ... Do to Ambiguity from Stats in IETF and VOLTHA is not possible to do |
| 502 | ... the reverse test. |
| 503 | [Arguments] ${device_serial_number} ${isONU} |
| 504 | ${cmd}= Catenate voltctl -c ${VOLTCTL_CONFIG} device list | grep ${device_serial_number} |
| 505 | ${rc} ${rest}= Run and Return Rc and Output ${cmd} |
| 506 | Should Not Be Empty ${rest} |
| 507 | Run Keyword If ${isONU} |
| 508 | ... Correct Representation check ONU Voltha-IETF ${rest} |
| 509 | ... ELSE |
| 510 | ... Correct Representation check OLT Voltha-IETF ${rest} |
| 511 | |
| 512 | Correct Representation check ONU Voltha-IETF |
| 513 | [Documentation] Check if all the information the VOLTHA have about a device |
| 514 | ... is a correct representation of the device in BBF-Adapter |
| 515 | ... Do to Ambiguity from Stats in IETF and VOLTHA is not possible to do |
| 516 | ... the reverse test. |
| 517 | [Arguments] ${rest} |
| 518 | ${rest} ${onu_reason} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 519 | ${rest} ${connect_state} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 520 | ${rest} ${oper_state} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 521 | ${rest} ${admin_state} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 522 | ${rest} ${serial_number} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 523 | ${rest} ${parent_id} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 524 | ${rest} ${root} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 525 | ${id} ${type} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 526 | |
| 527 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s |
| 528 | ... Validate Onu in BBF ${admin_state} ${oper_state} ${connect_state} |
| 529 | ... ${serial_number} ${onu_reason} |
| 530 | |
| 531 | Correct Representation check OLT Voltha-IETF |
| 532 | [Documentation] Check if all the information the VOLTHA have about a device |
| 533 | ... is a correct representation of the device in BBF-Adapter |
| 534 | ... Do to Ambiguity from Stats in IETF and VOLTHA is not possible to do |
| 535 | ... the reverse test. |
| 536 | [Arguments] ${rest} |
| 537 | ${rest} ${connect_state} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 538 | ${rest} ${oper_state} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 539 | ${rest} ${admin_state} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 540 | ${rest} ${serial_number} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 541 | ${rest} ${parent_id} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 542 | ${rest} ${root} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 543 | ${id} ${type} = Split String From Right ${rest} ${SPACE} max_split=1 |
| 544 | |
| 545 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s |
| 546 | ... Validate Olt in BBF ${admin_state} ${oper_state} ${connect_state} |
| 547 | ... ${serial_number} ${id} |