Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 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. |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 14 | # onos common functions |
| 15 | |
| 16 | *** Settings *** |
| 17 | Documentation Library for various utilities |
| 18 | Library SSHLibrary |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 19 | Library String |
| 20 | Library DateTime |
| 21 | Library Process |
| 22 | Library Collections |
| 23 | Library RequestsLibrary |
| 24 | Library OperatingSystem |
Matteo Scandolo | eb26a84 | 2020-05-08 10:06:24 -0700 | [diff] [blame] | 25 | Resource ./flows.robot |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 26 | |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 27 | *** Variables *** |
| 28 | @{connection_list} |
TorstenThieme | 1d1413b | 2022-02-04 12:41:01 +0000 | [diff] [blame] | 29 | ${alias} ONOS_SSH |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 30 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 31 | *** Keywords *** |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 32 | |
| 33 | Open ONOS SSH Connection |
| 34 | [Documentation] Establishes an ssh connection to ONOS contoller |
| 35 | [Arguments] ${host} ${port} ${user}=karaf ${pass}=karaf |
TorstenThieme | 1d1413b | 2022-02-04 12:41:01 +0000 | [diff] [blame] | 36 | ${conn_id}= SSHLibrary.Open Connection ${host} port=${port} timeout=5s alias=${alias} |
| 37 | SSHLibrary.Login username=${user} password=${pass} keep_alive_interval=30s |
| 38 | # set excepted prompt and terminal width to suppress unwanted line feeds |
| 39 | SSHLibrary.Set Client Configuration prompt=REGEXP:k.*a.*r.*a.*f.*@.*r.*o.*o.*t.* .*>.* width=400 |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 40 | ${conn_list_entry}= Create Dictionary conn_id=${conn_id} user=${user} pass=${pass} |
TorstenThieme | 1d1413b | 2022-02-04 12:41:01 +0000 | [diff] [blame] | 41 | ... host=${host} port=${port} alias=${alias} |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 42 | Append To List ${connection_list} ${conn_list_entry} |
| 43 | ${conn_list_id}= Get Index From List ${connection_list} ${conn_list_entry} |
| 44 | Set Global Variable ${connection_list} |
TorstenThieme | 1d1413b | 2022-02-04 12:41:01 +0000 | [diff] [blame] | 45 | # get connection settings, has no functional reason, only for info |
| 46 | ${connection_info}= SSHLibrary.Get Connection |
| 47 | # disable highlighting to suppress control sequences |
| 48 | ${Written}= Write setopt disable-highlighter |
| 49 | ${output}= Read Until Prompt strip_prompt=True |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 50 | [Return] ${conn_list_id} |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 51 | |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 52 | Execute ONOS CLI Command use single connection |
| 53 | [Documentation] Execute ONOS CLI Command use an Open Connection |
| 54 | ... In case no connection is open a connection will be opened |
TorstenThieme | 1d1413b | 2022-02-04 12:41:01 +0000 | [diff] [blame] | 55 | ... Using Write and Read instead of Execute Command to keep connection alive. |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 56 | [Arguments] ${host} ${port} ${cmd} |
| 57 | ${connection_list_id}= Get Conn List Id ${host} ${port} |
| 58 | ${connection_list_id}= Run Keyword If "${connection_list_id}"=="${EMPTY}" |
| 59 | ... Open ONOS SSH Connection ${host} ${port} |
| 60 | ... ELSE Set Variable ${connection_list_id} |
| 61 | ${connection_entry}= Get From List ${connection_list} ${connection_list_id} |
| 62 | SSHLibrary.Switch Connection ${connection_entry.conn_id} |
TorstenThieme | 1d1413b | 2022-02-04 12:41:01 +0000 | [diff] [blame] | 63 | ${connection_info}= SSHLibrary.Get Connection |
| 64 | ${PassOrFail} ${Written}= Run Keyword And Ignore Error Write ${cmd} |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 65 | Run Keyword If '${PassOrFail}'=='FAIL' Reconnect ONOS SSH Connection ${connection_list_id} |
TorstenThieme | 1d1413b | 2022-02-04 12:41:01 +0000 | [diff] [blame] | 66 | ${Written}= Run Keyword If '${PassOrFail}'=='FAIL' Write ${cmd} ELSE Set Variable ${Written} |
| 67 | Log pass_write: ${Written} |
| 68 | ${output}= Read Until Prompt strip_prompt=True |
| 69 | Log Result_values: ${output} |
| 70 | # we do not use strip of escape sequences integrated in ssh lib, we do it by ourself to have it under control |
| 71 | ${output}= Remove String Using Regexp ${output} \\x1b[>=]{0,1}(?:\\[[0-?]*(?:[hlm])[~]{0,1})* |
| 72 | # remove the endless spaces and two carrige returns at the end of output |
| 73 | ${output}= Remove String Using Regexp ${output} \\s*\\r \\r |
| 74 | # now we have the plain output text |
| 75 | Log Stripped Result_values: ${output} |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 76 | [Return] ${output} |
| 77 | |
| 78 | Get Conn List Id |
| 79 | [Documentation] Looks up for an Open Connection with passed host and port in conection list |
| 80 | ... First match connection will be used. |
| 81 | [Arguments] ${host} ${port} |
| 82 | ${connection_list_id}= Set Variable ${EMPTY} |
| 83 | ${match}= Set Variable False |
| 84 | ${length}= Get Length ${connection_list} |
| 85 | FOR ${INDEX} IN RANGE 0 ${length} |
| 86 | #${Item}= Get From List ${connection_list} ${INDEX} |
| 87 | ${conndata}= Get Connection ${connection_list[${INDEX}].conn_id} |
| 88 | ${match}= Set Variable If '${conndata.host}'=='${host}' and '${conndata.port}'=='${port}' True False |
| 89 | ${connection_list_id}= Set Variable If ${match} ${INDEX} ${EMPTY} |
| 90 | Exit For Loop If ${match} |
| 91 | END |
| 92 | [Return] ${connection_list_id} |
| 93 | |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 94 | Reconnect ONOS SSH Connection |
| 95 | [Documentation] Reconnect an SSH Connection |
| 96 | [Arguments] ${connection_list_id} |
| 97 | ${connection_entry}= Get From List ${connection_list} ${connection_list_id} |
| 98 | ${user}= Get From Dictionary ${connection_entry} user |
| 99 | ${pass}= Get From Dictionary ${connection_entry} pass |
| 100 | ${oldconndata}= Get Connection ${connection_entry.conn_id} |
TorstenThieme | 1d1413b | 2022-02-04 12:41:01 +0000 | [diff] [blame] | 101 | ${match}= Set Variable If |
| 102 | ... "${oldconndata.host}"=="${connection_entry.host}" and "${oldconndata.port}"=="${connection_entry.port}" |
| 103 | ... True False |
| 104 | Run Keyword If ${match} SSHLibrary.Switch Connection ${connection_entry.conn_id} |
| 105 | Run Keyword If ${match} Run Keyword And Ignore Error SSHLibrary.Close Connection |
| 106 | ${conn_id}= SSHLibrary.Open Connection ${connection_entry.host} port=${connection_entry.port} |
| 107 | ... timeout=5s alias=${alias} |
| 108 | SSHLibrary.Login username=${user} password=${pass} keep_alive_interval=30s |
| 109 | # set excepted prompt and terminal width to suppress unwanted line feeds |
| 110 | SSHLibrary.Set Client Configuration prompt=REGEXP:k.*a.*r.*a.*f.*@.*r.*o.*o.*t.* .*>.* width=400 |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 111 | ${conn_list_entry}= Create Dictionary conn_id=${conn_id} user=${user} pass=${pass} |
TorstenThieme | 1d1413b | 2022-02-04 12:41:01 +0000 | [diff] [blame] | 112 | ... host=${connection_entry.host} port=${connection_entry.port} alias=${alias} |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 113 | Set List Value ${connection_list} ${connection_list_id} ${conn_list_entry} |
| 114 | Set Global Variable ${connection_list} |
TorstenThieme | 1d1413b | 2022-02-04 12:41:01 +0000 | [diff] [blame] | 115 | # get connection settings, has no functional reason, only for info |
| 116 | ${connection_info}= SSHLibrary.Get Connection |
| 117 | # disable highlighting to suppress control sequences |
| 118 | ${Written}= Write setopt disable-highlighter |
| 119 | ${output}= Read Until Prompt strip_prompt=True |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 120 | |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 121 | Close ONOS SSH Connection |
| 122 | [Documentation] Close an SSH Connection |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 123 | [Arguments] ${connection_list_id} |
| 124 | ${connection_entry}= Get From List ${connection_list} ${connection_list_id} |
| 125 | ${connection_alias}= Get From Dictionary ${connection_entry} conn_id |
| 126 | ${oldconndata}= Get Connection ${connection_entry.conn_id} |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 127 | SSHLibrary.Switch Connection ${connection_alias} |
TorstenThieme | bcf1461 | 2021-01-27 10:19:18 +0000 | [diff] [blame] | 128 | Run Keyword And Ignore Error SSHLibrary.Close Connection |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 129 | Remove From List ${connection_list} ${connection_list_id} |
| 130 | Set Global Variable ${connection_list} |
| 131 | |
| 132 | Close All ONOS SSH Connections |
| 133 | [Documentation] Close all SSH Connection and clear connection list. |
| 134 | SSHLibrary.Close All Connections |
| 135 | @{connection_list} Create List |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 136 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 137 | Validate OLT Device in ONOS |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 138 | # FIXME use volt-olts to check that the OLT is ONOS |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 139 | [Arguments] ${serial_number} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 140 | [Documentation] Checks if olt has been connected to ONOS |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 141 | ${resp}= Get Request ONOS onos/v1/devices |
| 142 | ${jsondata}= To Json ${resp.content} |
| 143 | Should Not Be Empty ${jsondata['devices']} |
| 144 | ${length}= Get Length ${jsondata['devices']} |
| 145 | @{serial_numbers}= Create List |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 146 | ${matched}= Set Variable False |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 147 | FOR ${INDEX} IN RANGE 0 ${length} |
| 148 | ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 149 | ${of_id}= Get From Dictionary ${value} id |
| 150 | ${sn}= Get From Dictionary ${value} serial |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 151 | ${matched}= Set Variable If '${sn}' == '${serial_number}' True False |
| 152 | Exit For Loop If ${matched} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 153 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 154 | Should Be True ${matched} No match for ${serial_number} found |
Kailash | 57210eb | 2019-08-30 13:27:19 -0700 | [diff] [blame] | 155 | [Return] ${of_id} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 156 | |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 157 | Get ONU Port in ONOS |
Hardik Windlass | 1ed2eee | 2021-06-25 09:51:03 +0000 | [diff] [blame] | 158 | [Arguments] ${onu_serial_number} ${olt_of_id} ${onu_uni_id}=1 |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 159 | [Documentation] Retrieves ONU port for the ONU in ONOS |
Hardik Windlass | 1ed2eee | 2021-06-25 09:51:03 +0000 | [diff] [blame] | 160 | ${onu_serial_number}= Catenate SEPARATOR=- ${onu_serial_number} ${onu_uni_id} |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 161 | ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports |
| 162 | ${jsondata}= To Json ${resp.content} |
| 163 | Should Not Be Empty ${jsondata['ports']} |
| 164 | ${length}= Get Length ${jsondata['ports']} |
| 165 | @{ports}= Create List |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 166 | ${matched}= Set Variable False |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 167 | FOR ${INDEX} IN RANGE 0 ${length} |
| 168 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 169 | ${annotations}= Get From Dictionary ${value} annotations |
| 170 | ${onu_port}= Get From Dictionary ${value} port |
| 171 | ${portName}= Get From Dictionary ${annotations} portName |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 172 | ${matched}= Set Variable If '${portName}' == '${onu_serial_number}' True False |
| 173 | Exit For Loop If ${matched} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 174 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 175 | Should Be True ${matched} No match for ${onu_serial_number} found |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 176 | [Return] ${onu_port} |
| 177 | |
TorstenThieme | 9b25aab | 2021-12-16 15:59:45 +0000 | [diff] [blame] | 178 | Get Onu Ports in ONOS For ALL UNI per ONU |
| 179 | [Documentation] Retrieves ONU port(s) for the ONU in ONOS for all UNI-IDs, list of ports will return! |
| 180 | [Arguments] ${onu_serial_number} ${olt_of_id} |
| 181 | @{uni_id_list}= Create List |
| 182 | @{port_list}= Create List |
| 183 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 184 | ${src}= Set Variable ${hosts.src[${I}]} |
| 185 | Continue For Loop If "${src['onu']}" != "${onu_serial_number}" |
| 186 | ${uni_id}= Set Variable ${src['uni_id']} |
| 187 | # make sure all actions do only once per uni_id |
| 188 | ${id}= Get Index From List ${uni_id_list} ${uni_id} |
| 189 | Continue For Loop If -1 != ${id} |
| 190 | Append To List ${uni_id_list} ${uni_id} |
| 191 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${onu_serial_number} |
| 192 | ... ${olt_of_id} ${uni_id} |
| 193 | Append To List ${port_list} ${onu_port} |
| 194 | END |
| 195 | [return] ${port_list} |
| 196 | |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 197 | Get NNI Port in ONOS |
| 198 | [Arguments] ${olt_of_id} |
| 199 | [Documentation] Retrieves NNI port for the OLT in ONOS |
| 200 | ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports |
| 201 | ${jsondata}= To Json ${resp.content} |
| 202 | Should Not Be Empty ${jsondata['ports']} |
| 203 | ${length}= Get Length ${jsondata['ports']} |
| 204 | @{ports}= Create List |
| 205 | ${matched}= Set Variable False |
| 206 | FOR ${INDEX} IN RANGE 0 ${length} |
| 207 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 208 | ${annotations}= Get From Dictionary ${value} annotations |
| 209 | ${nni_port}= Get From Dictionary ${value} port |
| 210 | ${nniPortName}= Catenate SEPARATOR= nni- ${nni_port} |
| 211 | ${portName}= Get From Dictionary ${annotations} portName |
| 212 | ${matched}= Set Variable If '${portName}' == '${nniPortName}' True False |
| 213 | Exit For Loop If ${matched} |
| 214 | END |
| 215 | Should Be True ${matched} No match for NNI found for ${olt_of_id} |
| 216 | [Return] ${nni_port} |
| 217 | |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 218 | Get FabricSwitch in ONOS |
| 219 | [Documentation] Returns of_id of the Fabric Switch in ONOS |
| 220 | ${resp}= Get Request ONOS onos/v1/devices |
| 221 | ${jsondata}= To Json ${resp.content} |
| 222 | Should Not Be Empty ${jsondata['devices']} |
| 223 | ${length}= Get Length ${jsondata['devices']} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 224 | ${matched}= Set Variable False |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 225 | FOR ${INDEX} IN RANGE 0 ${length} |
| 226 | ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 227 | ${of_id}= Get From Dictionary ${value} id |
| 228 | ${type}= Get From Dictionary ${value} type |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 229 | ${matched}= Set Variable If '${type}' == "SWITCH" True False |
| 230 | Exit For Loop If ${matched} |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 231 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 232 | Should Be True ${matched} No fabric switch found |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 233 | [Return] ${of_id} |
| 234 | |
Andrea Campanella | 4c40463 | 2020-08-26 14:41:36 +0200 | [diff] [blame] | 235 | Get Master Instace in ONOS |
| 236 | [Arguments] ${of_id} |
| 237 | [Documentation] Returns nodeId of the Master instace for a giver device in ONOS |
| 238 | ${resp}= Get Request ONOS onos/v1/mastership/${of_id}/master |
| 239 | ${jsondata}= To Json ${resp.content} |
| 240 | Should Not Be Empty ${jsondata['nodeId']} |
| 241 | ${master_node}= Get From Dictionary ${jsondata} nodeId |
| 242 | [Return] ${master_node} |
| 243 | |
Matteo Scandolo | 7bdbe2d | 2021-11-29 15:48:25 -0800 | [diff] [blame] | 244 | Verify LLDP Flow Added |
| 245 | [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows} |
| 246 | [Documentation] Matches for total number of LLDP flows added for one OLT |
| 247 | ${lldp_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
| 248 | ... flows -s ADDED ${olt_of_id} | grep -v deviceId | grep ETH_TYPE:lldp | grep -v ETH_TYPE:arp |
| 249 | ${lldp_flows_added_count}= Get Line Count ${lldp_flows_added} |
| 250 | Should Be Equal As Integers ${lldp_flows_added_count} ${expected_flows} |
| 251 | |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 252 | Verify Subscriber Access Flows Added for ONU |
| 253 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${c_tag} ${s_tag} |
| 254 | [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU |
| 255 | # Verify upstream table=0 flow |
| 256 | ${upstream_flow_0_cmd}= Catenate SEPARATOR= |
| 257 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:0 | |
| 258 | ... grep VLAN_ID:${c_tag} | grep transition=TABLE:1 |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 259 | ${upstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 260 | ... ${upstream_flow_0_cmd} |
| 261 | Should Not Be Empty ${upstream_flow_0_added} |
| 262 | # Verify upstream table=1 flow |
| 263 | ${flow_vlan_push_cmd}= Catenate SEPARATOR= |
| 264 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:${c_tag} | |
| 265 | ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port} |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 266 | ${upstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 267 | ... ${flow_vlan_push_cmd} |
| 268 | Should Not Be Empty ${upstream_flow_1_added} |
| 269 | # Verify downstream table=0 flow |
| 270 | ${flow_vlan_pop_cmd}= Catenate SEPARATOR= |
| 271 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${s_tag} | |
| 272 | ... grep VLAN_POP | grep transition=TABLE:1 |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 273 | ${downstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 274 | ... ${flow_vlan_pop_cmd} |
| 275 | Should Not Be Empty ${downstream_flow_0_added} |
| 276 | # Verify downstream table=1 flow |
| 277 | ${downstream_flow_1_cmd}= Catenate SEPARATOR= |
| 278 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${c_tag} | |
| 279 | ... grep VLAN_ID:0 | grep OUTPUT:${onu_port} |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 280 | ${downstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 281 | ... ${downstream_flow_1_cmd} |
| 282 | Should Not Be Empty ${downstream_flow_1_added} |
| 283 | # Verify ipv4 dhcp upstream flow |
| 284 | ${upstream_flow_ipv4_cmd}= Catenate SEPARATOR= |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 285 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep ETH_TYPE:ipv4 | |
Andrea Campanella | 08678e1 | 2020-09-18 17:40:22 +0200 | [diff] [blame] | 286 | ... grep IP_PROTO:17 | grep UDP_SRC:68 | grep UDP_DST:67 | grep VLAN_ID:${c_tag} | |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 287 | ... grep OUTPUT:CONTROLLER |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 288 | ${upstream_flow_ipv4_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 289 | ... ${upstream_flow_ipv4_cmd} |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 290 | Should Not Be Empty ${upstream_flow_ipv4_added} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 291 | # Verify ipv4 dhcp downstream flow |
| 292 | # Note: This flow will be one per nni per olt |
| 293 | ${downstream_flow_ipv4_cmd}= Catenate SEPARATOR= |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 294 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep ETH_TYPE:ipv4 | |
| 295 | ... grep IP_PROTO:17 | grep UDP_SRC:67 | grep UDP_DST:68 | grep OUTPUT:CONTROLLER |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 296 | ${downstream_flow_ipv4_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 297 | ... ${downstream_flow_ipv4_cmd} |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 298 | Should Not Be Empty ${downstream_flow_ipv4_added} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 299 | |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 300 | Verify Subscriber Access Flows Added for ONU DT |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 301 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${s_tag} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 302 | [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU |
| 303 | # Verify upstream table=0 flow |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 304 | ${upstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 305 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:Any | grep transition=TABLE:1 |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 306 | Should Not Be Empty ${upstream_flow_0_added} |
| 307 | # Verify upstream table=1 flow |
| 308 | ${flow_vlan_push_cmd}= Catenate SEPARATOR= |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 309 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:Any | |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 310 | ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port} |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 311 | ${upstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 312 | ... ${flow_vlan_push_cmd} |
| 313 | Should Not Be Empty ${upstream_flow_1_added} |
| 314 | # Verify downstream table=0 flow |
| 315 | ${flow_vlan_pop_cmd}= Catenate SEPARATOR= |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 316 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${s_tag} | |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 317 | ... grep VLAN_POP | grep transition=TABLE:1 |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 318 | ${downstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 319 | ... ${flow_vlan_pop_cmd} |
| 320 | Should Not Be Empty ${downstream_flow_0_added} |
| 321 | # Verify downstream table=1 flow |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 322 | ${downstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 323 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:Any | grep OUTPUT:${onu_port} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 324 | Should Not Be Empty ${downstream_flow_1_added} |
| 325 | |
| 326 | Verify Subscriber Access Flows Added Count DT |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 327 | [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 328 | [Documentation] Matches for total number of subscriber access flows added for all onus |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 329 | ${access_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 330 | ... flows -s ADDED ${olt_of_id} | grep -v deviceId | grep -v ETH_TYPE:lldp | grep -v ETH_TYPE:arp |
| 331 | ${access_flows_added_count}= Get Line Count ${access_flows_added} |
| 332 | Should Be Equal As Integers ${access_flows_added_count} ${expected_flows} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 333 | |
Huseyin Ahmet AYDIN | 45922c8 | 2021-05-27 12:37:32 +0000 | [diff] [blame] | 334 | Verify Added Flow Count for OLT TT |
| 335 | [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows} |
| 336 | [Documentation] Total number of added flows given OLT with subscriber flows |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 337 | ${access_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 338 | ... flows -s ADDED ${olt_of_id} | grep -v deviceId |
| 339 | ${access_flows_added_count}= Get Line Count ${access_flows_added} |
| 340 | Should Be Equal As Integers ${access_flows_added_count} ${expected_flows} |
Huseyin Ahmet AYDIN | 45922c8 | 2021-05-27 12:37:32 +0000 | [diff] [blame] | 341 | |
Emrehan UZUN | 2884ed5 | 2021-05-04 15:36:31 +0000 | [diff] [blame] | 342 | Verify Default Downstream Flows are added in ONOS for OLT TT |
| 343 | [Arguments] ${ip} ${port} ${olt_of_id} ${nni_port} |
| 344 | [Documentation] Verifies if the Default Downstream Flows are added in ONOS for the OLT |
| 345 | # Verify lldp flow |
| 346 | ${downstream_flow_lldp_cmd}= Catenate SEPARATOR= |
| 347 | ... flows -s ADDED ${olt_of_id} | grep lldp | |
| 348 | ... grep OUTPUT:CONTROLLER |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 349 | ${downstream_flow_lldp_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Emrehan UZUN | 2884ed5 | 2021-05-04 15:36:31 +0000 | [diff] [blame] | 350 | ... ${downstream_flow_lldp_cmd} |
| 351 | Should Not Be Empty ${downstream_flow_lldp_added} |
| 352 | # Verify downstream dhcp flow |
| 353 | ${downstream_flow_dhcp_cmd}= Catenate SEPARATOR= |
| 354 | ... flows -s ADDED ${olt_of_id} | grep IP_PROTO:17 | grep UDP_SRC:67 | grep UDP_DST:68 | |
| 355 | ... grep OUTPUT:CONTROLLER |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 356 | ${downstream_flow_dhcp_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Emrehan UZUN | 2884ed5 | 2021-05-04 15:36:31 +0000 | [diff] [blame] | 357 | ... ${downstream_flow_dhcp_cmd} |
| 358 | Should Not Be Empty ${downstream_flow_dhcp_added} |
| 359 | # Verify downstream igmp flow |
| 360 | ${downstream_flow_igmp_cmd}= Catenate SEPARATOR= |
| 361 | ... flows -s ADDED ${olt_of_id} | grep IP_PROTO:2 | |
| 362 | ... grep OUTPUT:CONTROLLER |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 363 | ${downstream_flow_igmp_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Emrehan UZUN | 2884ed5 | 2021-05-04 15:36:31 +0000 | [diff] [blame] | 364 | ... ${downstream_flow_igmp_cmd} |
| 365 | Should Not Be Empty ${downstream_flow_igmp_added} |
| 366 | |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 367 | Get Programmed Subscribers |
| 368 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} |
| 369 | [Documentation] Retrieves the subscriber details at a given location |
| 370 | ${sub_location}= Catenate SEPARATOR=/ ${olt_of_id} ${onu_port} |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 371 | ${programmed_sub}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 372 | ... volt-programmed-subscribers | grep ${sub_location} |
| 373 | [Return] ${programmed_sub} |
| 374 | |
| 375 | Get Upstream and Downstream Bandwidth Profile Name |
| 376 | [Arguments] ${programmed_sub} |
| 377 | [Documentation] Retrieves the upstream and downstream bandwidth profile name |
| 378 | ... from the programmed subscriber |
| 379 | @{programmed_sub_array}= Split String ${programmed_sub} , |
| 380 | # Get upstream bandwidth profile name for the subscriber |
| 381 | @{param_val_pair}= Split String ${programmed_sub_array[9]} = |
| 382 | ${programmed_sub_param}= Set Variable ${param_val_pair[0]} |
| 383 | ${programmed_sub_val}= Set Variable ${param_val_pair[1]} |
| 384 | ${us_bw_profile}= Run Keyword If '${programmed_sub_param}' == ' upstreamBandwidthProfile' |
| 385 | ... Set Variable ${programmed_sub_val} |
| 386 | Log ${us_bw_profile} |
| 387 | # Get downstream bandwidth profile name for the subscriber |
| 388 | @{param_val_pair}= Split String ${programmed_sub_array[10]} = |
| 389 | ${programmed_sub_param}= Set Variable ${param_val_pair[0]} |
| 390 | ${programmed_sub_val}= Set Variable ${param_val_pair[1]} |
| 391 | ${ds_bw_profile}= Run Keyword If '${programmed_sub_param}' == ' downstreamBandwidthProfile' |
| 392 | ... Set Variable ${programmed_sub_val} |
| 393 | Log ${ds_bw_profile} |
| 394 | [Return] ${us_bw_profile} ${ds_bw_profile} |
| 395 | |
| 396 | Get Bandwidth Profile Details |
| 397 | [Arguments] ${ip} ${port} ${bw_profile} |
| 398 | [Documentation] Retrieves the details of the given bandwidth profile |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 399 | ${bw_profile_values}= Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 400 | ... bandwidthprofile ${bw_profile} |
| 401 | @{bw_profile_array}= Split String ${bw_profile_values} , |
| 402 | @{param_val_pair}= Split String ${bw_profile_array[1]} = |
| 403 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 404 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 405 | ${cir} Run Keyword If '${bw_param}' == ' committedInformationRate' |
| 406 | ... Set Variable ${bw_val} |
| 407 | @{param_val_pair}= Split String ${bw_profile_array[2]} = |
| 408 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 409 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 410 | ${cbs} Run Keyword If '${bw_param}' == ' committedBurstSize' |
| 411 | ... Set Variable ${bw_val} |
| 412 | @{param_val_pair}= Split String ${bw_profile_array[3]} = |
| 413 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 414 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 415 | ${eir} Run Keyword If '${bw_param}' == ' exceededInformationRate' |
| 416 | ... Set Variable ${bw_val} |
| 417 | @{param_val_pair}= Split String ${bw_profile_array[4]} = |
| 418 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 419 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 420 | ${ebs} Run Keyword If '${bw_param}' == ' exceededBurstSize' |
| 421 | ... Set Variable ${bw_val} |
| 422 | @{param_val_pair}= Split String ${bw_profile_array[5]} = |
| 423 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 424 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 425 | @{bw_val_air}= Split String ${bw_val} } |
| 426 | ${air} Run Keyword If '${bw_param}' == ' assuredInformationRate' |
| 427 | ... Set Variable ${bw_val_air[0]} |
| 428 | [Return] ${cir} ${cbs} ${eir} ${ebs} ${air} |
| 429 | |
Hardik Windlass | ba5add4 | 2021-05-04 12:41:29 +0000 | [diff] [blame] | 430 | Get Bandwidth Profile Details Rest |
| 431 | [Arguments] ${bw_profile_id} |
| 432 | [Documentation] Retrieves the details of the given bandwidth profile using REST API |
Girish Gowdra | cb8482a | 2021-05-27 09:06:13 -0700 | [diff] [blame] | 433 | ${bw_profile_id}= Remove String ${bw_profile_id} ' " |
Hardik Windlass | ba5add4 | 2021-05-04 12:41:29 +0000 | [diff] [blame] | 434 | ${resp}= Get Request ONOS onos/sadis/bandwidthprofile/${bw_profile_id} |
| 435 | ${jsondata}= To Json ${resp.content} |
| 436 | Should Not Be Empty ${jsondata['entry']} |
| 437 | ${length}= Get Length ${jsondata['entry']} |
| 438 | ${matched}= Set Variable False |
| 439 | FOR ${INDEX} IN RANGE 0 ${length} |
| 440 | ${value}= Get From List ${jsondata['entry']} ${INDEX} |
| 441 | ${bw_id}= Get From Dictionary ${value} id |
| 442 | ${matched}= Set Variable If '${bw_id}' == '${bw_profile_id}' True False |
| 443 | ${eir}= Get From Dictionary ${value} eir |
| 444 | ${ebs}= Get From Dictionary ${value} ebs |
| 445 | ${cir}= Get From Dictionary ${value} cir |
| 446 | ${cbs}= Get From Dictionary ${value} cbs |
| 447 | ${air}= Get From Dictionary ${value} air |
| 448 | Exit For Loop If ${matched} |
| 449 | END |
| 450 | Should Be True ${matched} No bandwidth profile found for id: ${bw_profile_id} |
| 451 | [Return] ${cir} ${cbs} ${eir} ${ebs} ${air} |
| 452 | |
Hardik Windlass | 841979a | 2021-05-25 05:30:27 +0000 | [diff] [blame] | 453 | Get Bandwidth Profile Details Ietf Rest |
| 454 | [Arguments] ${bw_profile_id} |
| 455 | [Documentation] Retrieves the details of the given Ietf standard based bandwidth profile using REST API |
| 456 | ${bw_profile_id}= Remove String ${bw_profile_id} ' " |
| 457 | ${resp}= Get Request ONOS onos/sadis/bandwidthprofile/${bw_profile_id} |
| 458 | ${jsondata}= To Json ${resp.content} |
| 459 | Should Not Be Empty ${jsondata['entry']} |
| 460 | ${length}= Get Length ${jsondata['entry']} |
| 461 | ${matched}= Set Variable False |
| 462 | FOR ${INDEX} IN RANGE 0 ${length} |
| 463 | ${value}= Get From List ${jsondata['entry']} ${INDEX} |
| 464 | ${bw_id}= Get From Dictionary ${value} id |
| 465 | ${matched}= Set Variable If '${bw_id}' == '${bw_profile_id}' True False |
| 466 | ${pir}= Get From Dictionary ${value} pir |
| 467 | ${pbs}= Get From Dictionary ${value} pbs |
| 468 | ${cir}= Get From Dictionary ${value} cir |
| 469 | ${cbs}= Get From Dictionary ${value} cbs |
| 470 | ${gir}= Get From Dictionary ${value} gir |
| 471 | Exit For Loop If ${matched} |
| 472 | END |
| 473 | Should Be True ${matched} No bandwidth profile found for id: ${bw_profile_id} |
| 474 | [Return] ${cir} ${cbs} ${pir} ${pbs} ${gir} |
| 475 | |
Girish Gowdra | 21ec25d | 2021-05-24 10:07:01 -0700 | [diff] [blame] | 476 | Verify Meters in ONOS Ietf |
| 477 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} |
| 478 | [Documentation] Verifies the meters with BW Ietf format (currently, DT workflow uses this format) |
| 479 | # Get programmed subscriber |
| 480 | ${programmed_sub}= Get Programmed Subscribers ${ip} ${port} |
| 481 | ... ${olt_of_id} ${onu_port} |
| 482 | Log ${programmed_sub} |
| 483 | ${us_bw_profile} ${ds_bw_profile} Get Upstream and Downstream Bandwidth Profile Name |
| 484 | ... ${programmed_sub} |
| 485 | # Get upstream bandwidth profile details |
| 486 | ${us_cir} ${us_cbs} ${us_pir} ${us_pbs} ${us_gir} Get Bandwidth Profile Details Ietf Rest |
| 487 | ... ${us_bw_profile} |
| 488 | # Verify meter for upstream bandwidth profile |
| 489 | ${us_meter_cmd}= Run Keyword If ${us_gir} != 0 Catenate SEPARATOR= |
| 490 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}" |
| 491 | ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | grep "rate=${us_gir}, burst-size=0" | wc -l |
| 492 | ... ELSE Catenate SEPARATOR= |
| 493 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}" |
| 494 | ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | wc -l |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 495 | ${upstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Girish Gowdra | 21ec25d | 2021-05-24 10:07:01 -0700 | [diff] [blame] | 496 | ... ${us_meter_cmd} |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 497 | Should Be Equal As Integers ${upstream_meter_added} 1 Upstream meter is missing |
Girish Gowdra | 21ec25d | 2021-05-24 10:07:01 -0700 | [diff] [blame] | 498 | # Get downstream bandwidth profile details |
| 499 | ${ds_cir} ${ds_cbs} ${ds_pir} ${ds_pbs} ${ds_gir} Get Bandwidth Profile Details Ietf Rest |
| 500 | ... ${ds_bw_profile} |
| 501 | # Verify meter for downstream bandwidth profile |
| 502 | ${ds_meter_cmd}= Run Keyword If ${ds_gir} != 0 Catenate SEPARATOR= |
| 503 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}" |
| 504 | ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | grep "rate=${ds_gir}, burst-size=0" | wc -l |
| 505 | ... ELSE Catenate SEPARATOR= |
| 506 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}" |
| 507 | ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | wc -l |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 508 | ${downstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Girish Gowdra | 21ec25d | 2021-05-24 10:07:01 -0700 | [diff] [blame] | 509 | ... ${ds_meter_cmd} |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 510 | Should Be Equal As Integers ${downstream_meter_added} 1 Downstream meter is missing |
Girish Gowdra | 21ec25d | 2021-05-24 10:07:01 -0700 | [diff] [blame] | 511 | |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 512 | Verify Meters in ONOS |
| 513 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} |
| 514 | [Documentation] Verifies the meters |
| 515 | # Get programmed subscriber |
| 516 | ${programmed_sub}= Get Programmed Subscribers ${ip} ${port} |
| 517 | ... ${olt_of_id} ${onu_port} |
| 518 | Log ${programmed_sub} |
| 519 | ${us_bw_profile} ${ds_bw_profile} Get Upstream and Downstream Bandwidth Profile Name |
| 520 | ... ${programmed_sub} |
Matteo Scandolo | 2056ed7 | 2021-11-02 17:38:03 -0700 | [diff] [blame] | 521 | # logging all meters to facilitate debug |
| 522 | ${all_meters}= Execute ONOS CLI Command use single connection ${ip} ${port} meters |
| 523 | Log ${all_meters} |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 524 | # Get upstream bandwidth profile details |
| 525 | ${us_cir} ${us_cbs} ${us_eir} ${us_ebs} ${us_air} Get Bandwidth Profile Details |
| 526 | ... ${ip} ${port} ${us_bw_profile} |
| 527 | Sleep 1s |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 528 | ${us_pbs}= Evaluate ${us_cbs}+${us_ebs} |
| 529 | ${us_pir}= Evaluate ${us_eir}+${us_cir}+${us_air} |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 530 | # Verify meter for upstream bandwidth profile |
| 531 | ${us_meter_cmd}= Catenate SEPARATOR= |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 532 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}" |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 533 | ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | grep "rate=${us_air}, burst-size=0" | wc -l |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 534 | ${upstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 535 | ... ${us_meter_cmd} |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 536 | Should Be Equal As Integers ${upstream_meter_added} 1 Upstream meter is missing |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 537 | Sleep 1s |
| 538 | # Get downstream bandwidth profile details |
| 539 | ${ds_cir} ${ds_cbs} ${ds_eir} ${ds_ebs} ${ds_air} Get Bandwidth Profile Details |
| 540 | ... ${ip} ${port} ${ds_bw_profile} |
| 541 | Sleep 1s |
| 542 | # Verify meter for downstream bandwidth profile |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 543 | ${ds_pbs}= Evaluate ${ds_cbs}+${ds_ebs} |
| 544 | ${ds_pir}= Evaluate ${ds_eir}+${ds_cir}+${ds_air} |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 545 | ${ds_meter_cmd}= Catenate SEPARATOR= |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 546 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}" |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 547 | ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | grep "rate=${ds_air}, burst-size=0" | wc -l |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 548 | ${downstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 549 | ... ${ds_meter_cmd} |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 550 | Should Be Equal As Integers ${downstream_meter_added} 1 Downstream meter is missing |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 551 | |
| 552 | Verify Default Meter Present in ONOS |
| 553 | [Arguments] ${ip} ${port} ${olt_of_id} |
| 554 | [Documentation] Verifies the single default meter entry is present |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 555 | # Get default bandwidth profile details |
| 556 | ${cir} ${cbs} ${eir} ${ebs} ${air} Get Bandwidth Profile Details |
| 557 | ... ${ip} ${port} 'Default' |
| 558 | Sleep 1s |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 559 | ${pbs}= Evaluate ${cbs}+${ebs} |
| 560 | ${pir}= Evaluate ${eir}+${cir}+${air} |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 561 | # Verify meter for default bandwidth profile |
| 562 | ${meter_cmd}= Catenate SEPARATOR= |
| 563 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${cir}, burst-size=${cbs}" |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 564 | ... | grep "rate=${pir}, burst-size=${pbs}" | grep "rate=${air}, burst-size=0" | wc -l |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 565 | ${default_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 566 | ... ${meter_cmd} |
Matteo Scandolo | 2056ed7 | 2021-11-02 17:38:03 -0700 | [diff] [blame] | 567 | # logging all meters to facilitate debug |
| 568 | ${all_meters}= Execute ONOS CLI Command use single connection ${ip} ${port} meters |
| 569 | Log ${all_meters} |
| 570 | # done logging all meters to facilitate debug |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 571 | Should Be Equal As Integers ${default_meter_added} 1 Default Meter not present |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 572 | |
Hardik Windlass | 480f3e2 | 2020-04-02 20:14:14 +0530 | [diff] [blame] | 573 | Verify Device Flows Removed |
| 574 | [Arguments] ${ip} ${port} ${olt_of_id} |
| 575 | [Documentation] Verifies all flows are removed from the device |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 576 | ${device_flows}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 577 | ... flows -s -f ${olt_of_id} | grep -v deviceId |
| 578 | ${flow_count}= Get Line Count ${device_flows} |
| 579 | Should Be Equal As Integers ${flow_count} 0 Flows not removed |
Hardik Windlass | 480f3e2 | 2020-04-02 20:14:14 +0530 | [diff] [blame] | 580 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 581 | Verify Eapol Flows Added |
Andy Bavier | b0c0623 | 2019-08-29 12:58:53 -0700 | [diff] [blame] | 582 | [Arguments] ${ip} ${port} ${expected_flows} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 583 | [Documentation] Matches for number of eapol flows based on number of onus |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 584 | ${eapol_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 585 | ... flows -s -f ADDED | grep eapol | grep IN_PORT | wc -l |
Andy Bavier | b0c0623 | 2019-08-29 12:58:53 -0700 | [diff] [blame] | 586 | Should Contain ${eapol_flows_added} ${expected_flows} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 587 | |
Suchitra Vemuri | 9da4430 | 2020-03-04 14:24:49 -0800 | [diff] [blame] | 588 | Verify No Pending Flows For ONU |
| 589 | [Arguments] ${ip} ${port} ${onu_port} |
| 590 | [Documentation] Verifies that there are no flows "PENDING" state for the ONU in ONOS |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 591 | ${pending_flows}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Suchitra Vemuri | 9da4430 | 2020-03-04 14:24:49 -0800 | [diff] [blame] | 592 | ... flows -s | grep IN_PORT:${onu_port} | grep PENDING |
| 593 | Should Be Empty ${pending_flows} |
| 594 | |
Suchitra Vemuri | 3dd2f83 | 2019-10-18 13:14:54 -0700 | [diff] [blame] | 595 | Verify Eapol Flows Added For ONU |
Matteo Scandolo | 7e519fb | 2021-08-13 11:35:16 -0700 | [diff] [blame] | 596 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${c_tag}=4091 |
Suchitra Vemuri | 3dd2f83 | 2019-10-18 13:14:54 -0700 | [diff] [blame] | 597 | [Documentation] Verifies if the Eapol Flows are added in ONOS for the ONU |
Matteo Scandolo | 7e519fb | 2021-08-13 11:35:16 -0700 | [diff] [blame] | 598 | ${eapol_flow_cmd}= Catenate SEPARATOR= |
| 599 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep ETH_TYPE:eapol | |
| 600 | ... grep VLAN_ID:${c_tag} | grep OUTPUT:CONTROLLER |
| 601 | ${eapol_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port} ${eapol_flow_cmd} |
Suchitra Vemuri | 3dd2f83 | 2019-10-18 13:14:54 -0700 | [diff] [blame] | 602 | Should Not Be Empty ${eapol_flows_added} |
| 603 | |
Hardik Windlass | 3901567 | 2021-07-05 05:48:08 +0000 | [diff] [blame] | 604 | Verify UNI Port Is Enabled |
Hardik Windlass | 1ed2eee | 2021-06-25 09:51:03 +0000 | [diff] [blame] | 605 | [Arguments] ${ip} ${port} ${onu_name} ${onu_uni_id}=1 |
Hardik Windlass | 3901567 | 2021-07-05 05:48:08 +0000 | [diff] [blame] | 606 | [Documentation] Verifies if the ONU's UNI port is enabled in ONOS |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 607 | ${onu_port_enabled}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Hardik Windlass | 1ed2eee | 2021-06-25 09:51:03 +0000 | [diff] [blame] | 608 | ... ports -e | grep portName=${onu_name}-${onu_uni_id} |
Suchitra Vemuri | 8078b97 | 2020-02-06 19:07:41 -0800 | [diff] [blame] | 609 | Log ${onu_port_enabled} |
| 610 | Should Not Be Empty ${onu_port_enabled} |
| 611 | |
Hardik Windlass | 3901567 | 2021-07-05 05:48:08 +0000 | [diff] [blame] | 612 | Verify UNI Port Is Disabled |
Hardik Windlass | 1ed2eee | 2021-06-25 09:51:03 +0000 | [diff] [blame] | 613 | [Arguments] ${ip} ${port} ${onu_name} ${onu_uni_id}=1 |
Hardik Windlass | 3901567 | 2021-07-05 05:48:08 +0000 | [diff] [blame] | 614 | [Documentation] Verifies if the ONU's UNI port is disabled in ONOS |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 615 | ${onu_port_disabled}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | 0276853 | 2021-10-21 15:14:12 -0700 | [diff] [blame] | 616 | ... ports | grep portName=${onu_name}-${onu_uni_id} | grep state=disabled |
Hardik Windlass | 63d5e00 | 2020-03-06 21:07:09 +0530 | [diff] [blame] | 617 | Log ${onu_port_disabled} |
Matteo Scandolo | 0276853 | 2021-10-21 15:14:12 -0700 | [diff] [blame] | 618 | Should Not Be Empty ${onu_port_disabled} |
Hardik Windlass | 63d5e00 | 2020-03-06 21:07:09 +0530 | [diff] [blame] | 619 | |
TorstenThieme | 9b25aab | 2021-12-16 15:59:45 +0000 | [diff] [blame] | 620 | Wait For All UNI Ports Are Disabled per ONU |
| 621 | [Documentation] Verifies all UNI Ports of passed ONU are disabled |
| 622 | [Arguments] ${ip} ${port} ${onu_serial_number} |
| 623 | @{uni_id_list}= Create List |
| 624 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 625 | ${src}= Set Variable ${hosts.src[${I}]} |
| 626 | Continue For Loop If "${src['onu']}" != "${onu_serial_number}" |
| 627 | ${uni_id}= Set Variable ${src['uni_id']} |
| 628 | # make sure all actions do only once per uni_id |
| 629 | ${id}= Get Index From List ${uni_id_list} ${uni_id} |
| 630 | Continue For Loop If -1 != ${id} |
| 631 | Append To List ${uni_id_list} ${uni_id} |
| 632 | Wait Until Keyword Succeeds ${timeout} 2s |
| 633 | ... Verify UNI Port Is Disabled ${ip} ${port} ${onu_serial_number} ${uni_id} |
| 634 | END |
| 635 | |
| 636 | Wait For All UNI Ports Are Enabled per ONU |
| 637 | [Documentation] Verifies all UNI Ports of passed ONU are enabled |
| 638 | [Arguments] ${ip} ${port} ${onu_serial_number} |
| 639 | @{uni_id_list}= Create List |
| 640 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 641 | ${src}= Set Variable ${hosts.src[${I}]} |
| 642 | Continue For Loop If "${src['onu']}" != "${onu_serial_number}" |
| 643 | ${uni_id}= Set Variable ${src['uni_id']} |
| 644 | # make sure all actions do only once per uni_id |
| 645 | ${id}= Get Index From List ${uni_id_list} ${uni_id} |
| 646 | Continue For Loop If -1 != ${id} |
| 647 | Append To List ${uni_id_list} ${uni_id} |
| 648 | Wait Until Keyword Succeeds ${timeout} 2s |
| 649 | ... Verify UNI Port Is Enabled ${ip} ${port} ${onu_serial_number} ${uni_id} |
| 650 | END |
| 651 | |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 652 | Verify ONU in AAA-Users |
| 653 | [Arguments] ${ip} ${port} ${onu_port} |
| 654 | [Documentation] Verifies that the specified onu_port exists in aaa-users output |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 655 | ${aaa_users}= Execute ONOS CLI Command use single connection ${ip} ${port} |
| 656 | ... aaa-users | grep AUTHORIZED | grep ${onu_port} |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 657 | Should Not Be Empty ${aaa_users} ONU port ${onu_port} not found in aaa-users |
| 658 | |
Hardik Windlass | 513afd1 | 2021-02-03 15:19:46 +0000 | [diff] [blame] | 659 | Verify Empty Group in ONOS |
| 660 | [Documentation] Verifies zero group count on the device |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 661 | [Arguments] ${ip} ${port} ${deviceId} |
| 662 | ${groups}= Execute ONOS CLI Command use single connection ${ip} ${port} groups | grep ${deviceId} |
Hardik Windlass | 513afd1 | 2021-02-03 15:19:46 +0000 | [diff] [blame] | 663 | @{groups_arr}= Split String ${groups} , |
| 664 | @{group_count_arr}= Split String ${groups_arr[1]} = |
| 665 | ${group_count}= Set Variable ${group_count_arr[1]} |
| 666 | Should Be Equal As Integers ${group_count} 0 |
| 667 | |
| 668 | Verify ONUs in Group Count in ONOS |
| 669 | [Documentation] Verifies there exists a group bucket list with certain entries/count |
| 670 | ... Note: Currently, this validates only if all ONUs of an OLT joined the same igmp group |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 671 | [Arguments] ${ip} ${port} ${count} ${deviceId} |
| 672 | ${result}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | fd36e21 | 2021-03-02 11:36:10 -0800 | [diff] [blame] | 673 | ... groups added ${deviceId} | grep bucket | wc -l |
| 674 | Should Be Equal As Integers ${result} ${count} Bucket list count for a group: Found=${result} Expected=${count} |
Hardik Windlass | 513afd1 | 2021-02-03 15:19:46 +0000 | [diff] [blame] | 675 | |
| 676 | Verify ONU in Group Bucket |
| 677 | [Documentation] Matches if ONU port in Group Bucket |
| 678 | [Arguments] ${group_bucket_values} ${onu_port} |
| 679 | ${len}= Get Length ${group_bucket_values} |
| 680 | ${matched}= Set Variable False |
| 681 | FOR ${INDEX} IN RANGE 0 ${len} |
| 682 | ${value_bucket}= Get From List ${group_bucket_values} ${INDEX} |
| 683 | ${treatment}= Get From Dictionary ${value_bucket} treatment |
| 684 | ${instructions}= Get From Dictionary ${treatment} instructions |
| 685 | ${instructions_val}= Get From List ${instructions} 0 |
| 686 | ${port}= Get From Dictionary ${instructions_val} port |
| 687 | ${matched}= Set Variable If '${port}'=='${onu_port}' True False |
| 688 | Exit For Loop If ${matched} |
| 689 | END |
| 690 | [Return] ${matched} |
| 691 | |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 692 | Verify ONU in Groups |
| 693 | [Arguments] ${ip_onos} ${port_onos} ${deviceId} ${onu_port} ${group_exist}=True |
| 694 | [Documentation] Verifies that the specified onu_port exists in groups output |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 695 | ${result}= Execute ONOS CLI Command use single connection ${ip_onos} ${port_onos} groups -j |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 696 | Log Groups: ${result} |
| 697 | ${groups}= To Json ${result} |
| 698 | ${length}= Get Length ${groups} |
| 699 | ${buckets}= Create List |
| 700 | ${matched}= Set Variable False |
| 701 | FOR ${INDEX} IN RANGE 0 ${length} |
| 702 | ${value}= Get From List ${groups} ${INDEX} |
| 703 | ${devId}= Get From Dictionary ${value} deviceId |
| 704 | ${bucket}= Get From Dictionary ${value} buckets |
| 705 | Run Keyword If '${devId}'=='${deviceId}' |
| 706 | ... Append To List ${buckets} ${bucket} |
| 707 | END |
| 708 | ${bucket_len}= Get Length ${buckets} |
Hardik Windlass | 513afd1 | 2021-02-03 15:19:46 +0000 | [diff] [blame] | 709 | FOR ${INDEX_1} IN RANGE 0 ${bucket_len} |
| 710 | ${value}= Get From List ${buckets} ${INDEX_1} |
| 711 | ${matched}= Verify ONU in Group Bucket ${value} ${onu_port} |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 712 | Exit For Loop If ${matched} |
| 713 | END |
| 714 | Run Keyword If ${group_exist} |
| 715 | ... Should Be True ${matched} No match for ${deviceId} and ${onu_port} found in ONOS groups |
| 716 | ... ELSE |
| 717 | ... Should Be True '${matched}'=='False' Match for ${deviceId} and ${onu_port} found in ONOS groups |
| 718 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 719 | Assert Number of AAA-Users |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 720 | [Arguments] ${ip} ${port} ${expected_onus} ${deviceId} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 721 | [Documentation] Matches for number of aaa-users authorized based on number of onus |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 722 | ${aaa_users}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 723 | ... aaa-users | grep ${deviceId} | grep AUTHORIZED | wc -l |
| 724 | Log Found ${aaa_users} of ${expected_onus} expected authenticated users on device ${deviceId} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 725 | Should Be Equal As Integers ${aaa_users} ${expected_onus} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 726 | |
| 727 | Validate DHCP Allocations |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 728 | [Arguments] ${ip} ${port} ${count} ${workflow} ${deviceId} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 729 | [Documentation] Matches for number of dhcpacks based on number of onus |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 730 | ${allocations}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 731 | ... dhcpl2relay-allocations | grep ${deviceId} | grep DHCPACK | wc -l |
Matteo Scandolo | da854b0 | 2020-09-01 16:20:51 -0700 | [diff] [blame] | 732 | # if the workflow is TT we'll have 2 allocations for each ONU |
| 733 | ${ttAllocations}= Evaluate (${count} * 2) |
| 734 | ${count}= Set Variable If $workflow=='tt' ${ttAllocations} ${count} |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 735 | Log Found ${allocations} of ${count} expected DHCPACK on device ${deviceId} |
Matteo Scandolo | da854b0 | 2020-09-01 16:20:51 -0700 | [diff] [blame] | 736 | Should Be Equal As Integers ${allocations} ${count} |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 737 | |
| 738 | Validate Subscriber DHCP Allocation |
Suchitra Vemuri | 4281941 | 2020-10-01 17:45:43 -0700 | [diff] [blame] | 739 | [Arguments] ${ip} ${port} ${onu_port} ${vlan}='' |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 740 | [Documentation] Verifies that the specified subscriber is found in DHCP allocations |
| 741 | ##TODO: Enhance the keyword to include DHCP allocated address is not 0.0.0.0 |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 742 | ${allocations}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Suchitra Vemuri | 4281941 | 2020-10-01 17:45:43 -0700 | [diff] [blame] | 743 | ... dhcpl2relay-allocations | grep DHCPACK | grep ${onu_port} | grep ${vlan} |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 744 | Should Not Be Empty ${allocations} ONU port ${onu_port} not found in dhcpl2relay-allocations |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 745 | |
| 746 | Device Is Available In ONOS |
Matteo Scandolo | 3218d5b | 2021-05-26 11:50:10 -0700 | [diff] [blame] | 747 | [Arguments] ${url} ${dpid} ${available}=true |
| 748 | [Documentation] Validates the device exists and it has the expected availability in ONOS |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 749 | ${rc} ${json} Run And Return Rc And Output curl --fail -sSL ${url}/onos/v1/devices/${dpid} |
| 750 | Should Be Equal As Integers 0 ${rc} |
| 751 | ${rc} ${value} Run And Return Rc And Output echo '${json}' | jq -r .available |
| 752 | Should Be Equal As Integers 0 ${rc} |
Matteo Scandolo | 3218d5b | 2021-05-26 11:50:10 -0700 | [diff] [blame] | 753 | Should Be Equal ${available} ${value} |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 754 | |
| 755 | Remove All Devices From ONOS |
| 756 | [Arguments] ${url} |
| 757 | [Documentation] Executes the device-remove command on each device in ONOS |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 758 | ${rc} ${output} Run And Return Rc And Output |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 759 | ... curl --fail -sSL ${url}/onos/v1/devices | jq -r '.devices[].id' |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 760 | Should Be Equal As Integers ${rc} 0 |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 761 | @{dpids} Split String ${output} |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 762 | ${count}= Get length ${dpids} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 763 | FOR ${dpid} IN @{dpids} |
| 764 | ${rc}= Run Keyword If '${dpid}' != '' |
| 765 | ... Run And Return Rc curl -XDELETE --fail -sSL ${url}/onos/v1/devices/${dpid} |
| 766 | Run Keyword If '${dpid}' != '' |
| 767 | ... Should Be Equal As Integers ${rc} 0 |
| 768 | END |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 769 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 770 | Assert ONU Port Is Disabled |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 771 | [Arguments] ${ip} ${port} ${deviceId} ${onu_port} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 772 | [Documentation] Verifies if the ONU port is disabled in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 773 | ${onu_port_disabled}= Execute ONOS CLI Command use single connection ${ip} ${port} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 774 | ... ports -d ${deviceId} | grep port=${onu_port} |
| 775 | Log ${onu_port_disabled} |
| 776 | Should Not Be Empty ${onu_port_disabled} |
| 777 | |
Matteo Scandolo | 7d1a80d | 2021-04-09 14:30:43 -0700 | [diff] [blame] | 778 | Assert Olts in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 779 | [Arguments] ${ip} ${port} ${count} |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 780 | [Documentation] DEPRECATED use Assert Olt in ONOS |
| 781 | ... Check that a certain number of olts are known to ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 782 | ${olts}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 783 | ... volt-olts | wc -l |
Matteo Scandolo | 7d1a80d | 2021-04-09 14:30:43 -0700 | [diff] [blame] | 784 | Log Found ${olts} of ${count} expected Olts |
| 785 | Should Be Equal As Integers ${olts} ${count} |
| 786 | |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 787 | Assert Olt in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 788 | [Arguments] ${ip} ${port} ${deviceId} |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 789 | [Documentation] Check that a particular olt is known to ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 790 | ${olts}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 791 | ... volt-olts | grep ${deviceId} | wc -l |
| 792 | Should Be Equal As Integers ${olts} 1 "Device ${deviceId} is not recognized as an OLT" |
| 793 | |
Matteo Scandolo | 7d1a80d | 2021-04-09 14:30:43 -0700 | [diff] [blame] | 794 | Wait for Olts in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 795 | [Arguments] ${ip} ${port} ${count} ${max_wait_time}=10m |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 796 | [Documentation] DEPRECATED use Wait for Olt in ONOS |
| 797 | ... Waits untill a certain number of ports are enabled in ONOS for a particular deviceId |
Matteo Scandolo | 7d1a80d | 2021-04-09 14:30:43 -0700 | [diff] [blame] | 798 | Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Olts in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 799 | ... ${ip} ${port} ${count} |
Matteo Scandolo | 7d1a80d | 2021-04-09 14:30:43 -0700 | [diff] [blame] | 800 | |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 801 | Wait for Olt in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 802 | [Arguments] ${ip} ${port} ${deviceId} ${max_wait_time}=10m |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 803 | [Documentation] Waits until a particular deviceId is recognized by ONOS as an OLT |
| 804 | Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Olt in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 805 | ... ${ip} ${port} ${deviceId} |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 806 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 807 | Assert Ports in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 808 | [Arguments] ${ip} ${port} ${count} ${deviceId} ${filter} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 809 | [Documentation] Check that a certain number of ports are enabled in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 810 | ${ports}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 811 | ... ports -e ${deviceId} | grep ${filter} | wc -l |
| 812 | Log Found ${ports} of ${count} expected ports on device ${deviceId} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 813 | Should Be Equal As Integers ${ports} ${count} |
| 814 | |
| 815 | Wait for Ports in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 816 | [Arguments] ${ip} ${port} ${count} ${deviceId} ${filter} ${max_wait_time}=10m |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 817 | [Documentation] Waits untill a certain number of ports are enabled in ONOS for a particular deviceId |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 818 | Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Ports in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 819 | ... ${ip} ${port} ${count} ${deviceId} ${filter} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 820 | |
| 821 | Wait for AAA Authentication |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 822 | [Arguments] ${ip} ${port} ${count} ${deviceId} ${max_wait_time}=10m |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 823 | [Documentation] Waits untill a certain number of subscribers are authenticated in ONOS |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 824 | Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Number of AAA-Users |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 825 | ... ${ip} ${port} ${count} ${deviceId} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 826 | |
| 827 | Wait for DHCP Ack |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 828 | [Arguments] ${ip} ${port} ${count} ${workflow} ${deviceId} ${max_wait_time}=10m |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 829 | [Documentation] Waits untill a certain number of subscribers have received a DHCP_ACK |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 830 | Wait Until Keyword Succeeds ${max_wait_time} 5s Validate DHCP Allocations |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 831 | ... ${ip} ${port} ${count} ${workflow} ${deviceId} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 832 | |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 833 | Provision subscriber REST |
| 834 | [Documentation] Uses the rest APIs to provision a subscriber |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 835 | [Arguments] ${of_id} ${onu_port} |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 836 | ${resp}= Post Request ONOS |
| 837 | ... /onos/olt/oltapp/${of_id}/${onu_port} |
| 838 | Should Be Equal As Strings ${resp.status_code} 200 |
| 839 | |
Hardik Windlass | ea4caf7 | 2021-07-30 07:22:12 +0000 | [diff] [blame] | 840 | Count Enabled UNI Ports |
| 841 | [Documentation] Count all the UNI Ports on a Device |
| 842 | [Arguments] ${ip} ${port} ${of_id} |
| 843 | ${count}= Execute ONOS CLI Command use single connection ${ip} ${port} |
| 844 | ... ports -e ${of_id} | grep -v SWITCH | grep -v nni | wc -l |
| 845 | Log ${count} |
| 846 | [Return] ${count} |
| 847 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 848 | List Enabled UNI Ports |
| 849 | [Documentation] List all the UNI Ports, the only way we have is to filter out the one called NNI |
| 850 | ... Creates a list of dictionaries |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 851 | [Arguments] ${ip} ${port} ${of_id} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 852 | [Return] [{'port': '16', 'of_id': 'of:00000a0a0a0a0a00'}, {'port': '32', 'of_id': 'of:00000a0a0a0a0a00'}] |
| 853 | ${result}= Create List |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 854 | ${out}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 855 | ... ports -e ${of_id} | grep -v SWITCH | grep -v nni |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 856 | @{unis}= Split To Lines ${out} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 857 | FOR ${uni} IN @{unis} |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 858 | ${matches} = Get Regexp Matches ${uni} .*port=([0-9]+),.* 1 |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 859 | &{portDict} Create Dictionary of_id=${of_id} port=${matches[0]} |
| 860 | Append To List ${result} ${portDict} |
| 861 | END |
| 862 | Log ${result} |
| 863 | Return From Keyword ${result} |
| 864 | |
| 865 | Provision all subscribers on device |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 866 | [Documentation] Provisions a subscriber in ONOS for all the enabled UNI ports on a particular device |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 867 | [Arguments] ${ip} ${port} ${onos_ip} ${onos_rest_port} ${of_id} |
| 868 | ${unis}= List Enabled UNI Ports ${ip} ${port} ${of_id} |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 869 | ${onos_auth}= Create List karaf karaf |
| 870 | Create Session ONOS http://${onos_ip}:${onos_rest_port} auth=${onos_auth} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 871 | FOR ${uni} IN @{unis} |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 872 | Provision Subscriber REST ${uni['of_id']} ${uni['port']} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 873 | END |
| 874 | |
| 875 | List OLTs |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 876 | # NOTE this method is not currently used but it can come useful in the future |
| 877 | [Documentation] Returns a list of all OLTs known to ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 878 | [Arguments] ${ip} ${port} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 879 | [Return] ['of:00000a0a0a0a0a00', 'of:00000a0a0a0a0a01'] |
| 880 | ${result}= Create List |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 881 | ${out}= Execute ONOS CLI Command use single connection ${ip} ${port} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 882 | ... volt-olts |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 883 | @{olts}= Split To Lines ${out} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 884 | FOR ${olt} IN @{olts} |
| 885 | Log ${olt} |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 886 | ${matches} = Get Regexp Matches ${olt} ^OLT (.+)$ 1 |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 887 | # there may be some logs mixed with the output so only append if we have a match |
| 888 | ${matches_length}= Get Length ${matches} |
| 889 | Run Keyword If ${matches_length}==1 |
| 890 | ... Append To List ${result} ${matches[0]} |
| 891 | END |
| 892 | Return From Keyword ${result} |
| 893 | |
Matteo Scandolo | 7591109 | 2021-11-16 17:05:36 -0800 | [diff] [blame] | 894 | Count flows |
| 895 | [Documentation] Count flows in a particular ${state} in ONOS |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 896 | ... Optionally for a certain onu-port. |
| 897 | [Arguments] ${ip} ${port} ${deviceId} ${state} ${onu_port}=${EMPTY} |
| 898 | ${cmd}= Catenate SEPARATOR= flows -s ${state} ${deviceId} | grep -v deviceId |
| 899 | ${cmd}= Run Keyword If "${onu_port}"!="${EMPTY}" Catenate SEPARATOR= ${cmd} | grep ${onu_port} |
| 900 | ... ELSE Set Variable ${cmd} |
| 901 | ${cmd}= Catenate SEPARATOR= ${cmd} | wc -l |
| 902 | ${flows}= Execute ONOS CLI Command use single connection ${ip} ${port} ${cmd} |
| 903 | [return] ${flows} |
| 904 | |
| 905 | Validate number of flows |
| 906 | [Documentation] Validates number of flows in a particular ${state} in ONOS |
| 907 | ... Optionally for a certain onu-port. |
| 908 | [Arguments] ${ip} ${port} ${targetFlows} ${deviceId} ${state} ${onu_port}=${EMPTY} |
| 909 | ${flows}= Count flows ${ip} ${port} ${deviceId} ${state} ${onu_port} |
Matteo Scandolo | 7591109 | 2021-11-16 17:05:36 -0800 | [diff] [blame] | 910 | Log Found ${state} ${flows} of ${targetFlows} expected flows on device ${deviceId} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 911 | Should Be Equal As Integers ${targetFlows} ${flows} |
| 912 | |
| 913 | Wait for all flows to in ADDED state |
| 914 | [Documentation] Waits until the flows have been provisioned |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 915 | [Arguments] ${ip} ${port} ${deviceId} ${workflow} ${uni_count} ${olt_count} |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 916 | ... ${provisioned} ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 917 | ${targetFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 918 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 919 | Wait Until Keyword Succeeds 10m 5s Validate number of flows |
Matteo Scandolo | 7591109 | 2021-11-16 17:05:36 -0800 | [diff] [blame] | 920 | ... ${ip} ${port} ${targetFlows} ${deviceId} added |
| 921 | |
| 922 | Wait for all flows to be removed |
| 923 | [Documentation] Wait for all flows to be removed from a particular device |
| 924 | [Arguments] ${ip} ${port} ${deviceId} |
TorstenThieme | f7cd2be | 2021-12-06 14:30:11 +0000 | [diff] [blame] | 925 | Wait Until Keyword Succeeds 10m 5s Validate number of flows |
Matteo Scandolo | 7591109 | 2021-11-16 17:05:36 -0800 | [diff] [blame] | 926 | ... ${ip} ${port} 0 ${deviceId} any |
| 927 | |
Gayathri.Selvan | 92d1686 | 2020-03-19 14:47:58 +0000 | [diff] [blame] | 928 | |
Girish Gowdra | d769b41 | 2021-05-16 11:09:46 -0700 | [diff] [blame] | 929 | Get Limiting Bandwidth Details |
Gayathri.Selvan | 92d1686 | 2020-03-19 14:47:58 +0000 | [diff] [blame] | 930 | [Arguments] ${bandwidth_profile_name} |
| 931 | [Documentation] Collects the bandwidth profile details for the given bandwidth profile and |
| 932 | ... returns the limiting bandwidth |
Girish Gowdra | cb8482a | 2021-05-27 09:06:13 -0700 | [diff] [blame] | 933 | ${cir} ${cbs} ${eir} ${ebs} ${air}= Get Bandwidth Profile Details Rest |
| 934 | ... ${bandwidth_profile_name} |
Girish Gowdra | d769b41 | 2021-05-16 11:09:46 -0700 | [diff] [blame] | 935 | ${limiting_BW}= Evaluate ${eir}+${cir}+${air} |
Gayathri.Selvan | 92d1686 | 2020-03-19 14:47:58 +0000 | [diff] [blame] | 936 | [Return] ${limiting_BW} |
Hardik Windlass | e8b9922 | 2021-01-25 10:03:14 +0000 | [diff] [blame] | 937 | |
Emrehan UZUN | d6f8589 | 2021-07-01 13:54:26 +0000 | [diff] [blame] | 938 | Get Limiting Bandwidth Details for Fixed and Committed |
| 939 | [Arguments] ${bandwidth_profile_name} |
| 940 | [Documentation] Collects the bandwidth profile details for the given bandwidth profile and |
| 941 | ... returns the limiting bandwidth for fixed and committed |
| 942 | ${cir} ${cbs} ${eir} ${ebs} ${air}= Get Bandwidth Profile Details Rest |
| 943 | ... ${bandwidth_profile_name} |
| 944 | ${limiting_BW}= Evaluate ${cir}+${air} |
| 945 | [Return] ${limiting_BW} |
| 946 | |
Hardik Windlass | e8b9922 | 2021-01-25 10:03:14 +0000 | [diff] [blame] | 947 | Validate Deleted Device Cleanup In ONOS |
| 948 | [Arguments] ${ip} ${port} ${olt_serial_number} |
| 949 | [Documentation] The keyword verifies that ports, flows, meters, subscribers, dhcp are all cleared in ONOS |
| 950 | # Fetch OF Id for OLT |
| 951 | ${olt_of_id}= Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device in ONOS ${olt_serial_number} |
Hardik Windlass | e8b9922 | 2021-01-25 10:03:14 +0000 | [diff] [blame] | 952 | # Verify Ports are Removed |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 953 | ${ports}= Execute ONOS CLI Command use single connection ${ip} ${port} |
| 954 | ... ports ${olt_of_id} | grep -v ${olt_of_id} |
| 955 | ${port_count}= Get Line Count ${ports} |
| 956 | Should Be Equal As Integers ${port_count} 0 Ports have not been removed from ONOS after cleanup |
Hardik Windlass | e8b9922 | 2021-01-25 10:03:14 +0000 | [diff] [blame] | 957 | # Verify Subscribers are Removed |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 958 | ${sub}= Execute ONOS CLI Command use single connection ${ip} ${port} |
| 959 | ... volt-programmed-subscribers | grep ${olt_of_id} |
| 960 | ${sub_count}= Get Line Count ${sub} |
| 961 | Should Be Equal As Integers ${sub_count} 0 Subscribers have not been removed from ONOS after cleanup |
Hardik Windlass | e8b9922 | 2021-01-25 10:03:14 +0000 | [diff] [blame] | 962 | # Verify Flows are Removed |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 963 | ${flow}= Execute ONOS CLI Command use single connection ${ip} ${port} |
| 964 | ... flows -s -f ${olt_of_id} | grep -v deviceId |
| 965 | ${flow_count}= Get Line Count ${flow} |
| 966 | Should Be Equal As Integers ${flow_count} 0 Flows have not been removed from ONOS after cleanup |
Hardik Windlass | e8b9922 | 2021-01-25 10:03:14 +0000 | [diff] [blame] | 967 | # Verify Meters are Removed |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 968 | ${meter}= Execute ONOS CLI Command use single connection ${ip} ${port} |
| 969 | ... meters ${olt_of_id} |
| 970 | ${meter_count}= Get Line Count ${meter} |
| 971 | Should Be Equal As Integers ${meter_count} 0 Meters have not been removed from ONOS after cleanup |
Hardik Windlass | e8b9922 | 2021-01-25 10:03:14 +0000 | [diff] [blame] | 972 | # Verify AAA-Users are Removed |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 973 | ${aaa}= Execute ONOS CLI Command use single connection ${ip} ${port} |
| 974 | ... aaa-users ${olt_of_id} |
| 975 | ${aaa_count}= Get Line Count ${aaa} |
| 976 | Should Be Equal As Integers ${aaa_count} 0 AAA Users have not been removed from ONOS after cleanup |
Hardik Windlass | e8b9922 | 2021-01-25 10:03:14 +0000 | [diff] [blame] | 977 | # Verify Dhcp-Allocations are Removed |
Matteo Scandolo | 45645bd | 2021-11-02 10:09:07 -0700 | [diff] [blame] | 978 | ${dhcp}= Execute ONOS CLI Command use single connection ${ip} ${port} |
| 979 | ... dhcpl2relay-allocations ${olt_of_id} |
| 980 | ${dhcp_count}= Get Line Count ${dhcp} |
| 981 | Should Be Equal As Integers ${dhcp_count} 0 DHCP Allocations have not been removed from ONOS after cleanup |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 982 | |
| 983 | Delete ONOS App |
| 984 | [Arguments] ${url} ${app_name} |
| 985 | [Documentation] This keyword deactivates and uninstalls the given ONOS App |
| 986 | ${rc}= Run And Return Rc curl --fail -sSL -X DELETE ${url}/onos/v1/applications/${app_name} |
Matteo Scandolo | 2769d2b | 2021-04-14 10:29:24 -0700 | [diff] [blame] | 987 | Should Be Equal As Integers ${rc} 0 Can't delete ${app_name} from ONOS |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 988 | |
| 989 | Verify ONOS App Active |
| 990 | [Arguments] ${url} ${app_name} ${app_version}=${EMPTY} |
| 991 | [Documentation] This keyword verifies that the given ONOS App status is Active |
| 992 | ${rc} ${output} Run And Return Rc And Output |
| 993 | ... curl --fail -sSL ${url}/onos/v1/applications/${app_name} | jq -r .state |
| 994 | Should Be Equal As Integers ${rc} 0 |
| 995 | Should Be Equal '${output}' 'ACTIVE' |
| 996 | ${rc1} ${output1} Run And Return Rc And Output |
| 997 | ... curl --fail -sSL ${url}/onos/v1/applications/${app_name} | jq -r .version |
| 998 | Run Keyword If '${app_version}'!='${EMPTY}' |
| 999 | ... Run Keywords |
Matteo Scandolo | 2769d2b | 2021-04-14 10:29:24 -0700 | [diff] [blame] | 1000 | ... Should Be Equal As Integers ${rc1} 0 Can't read app ${app_name} status from ONOS |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 1001 | ... AND Should Be Equal '${output1}' '${app_version}' |
| 1002 | |
| 1003 | Install And Activate ONOS App |
| 1004 | [Arguments] ${url} ${app_oar_file} |
| 1005 | [Documentation] This keyword installs and activates the given ONOS App |
| 1006 | ${cmd}= Catenate SEPARATOR= |
| 1007 | ... curl --fail -sSL -H Content-Type:application/octet-stream - |
| 1008 | ... X POST ${url}/onos/v1/applications?activate=true --data-binary \@${app_oar_file} |
| 1009 | ${rc} ${output} Run And Return Rc And Output ${cmd} |
Matteo Scandolo | 2769d2b | 2021-04-14 10:29:24 -0700 | [diff] [blame] | 1010 | Should Be Equal As Integers ${rc} 0 Can't load onos app ${app_oar_file} to ONOS" |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 1011 | Log ${output} |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 1012 | |
| 1013 | Get ONOS App Details |
| 1014 | [Arguments] ${url} ${app_name} |
| 1015 | [Documentation] Retrieves ONOS App Details |
| 1016 | ${rc} ${output} Run And Return Rc And Output |
| 1017 | ... curl --fail -sSL ${url}/onos/v1/applications/${app_name} |
Matteo Scandolo | 2769d2b | 2021-04-14 10:29:24 -0700 | [diff] [blame] | 1018 | Should Be Equal As Integers ${rc} 0 Can't read app ${app_name} details from ONOS |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 1019 | [Return] ${output} |
Hardik Windlass | 88075f9 | 2022-01-25 12:19:45 +0000 | [diff] [blame] | 1020 | |
| 1021 | Verify UniTag Subscriber |
| 1022 | [Documentation] Verifies the unitag subscriber is provisioned/un-provisioned |
| 1023 | [Arguments] ${ip} ${port} ${dev_id} ${onu_port} ${stag} ${ctag} ${tpid} ${sub_added}=True |
| 1024 | ${cmd}= Catenate SEPARATOR= |
| 1025 | ... volt-programmed-subscribers ${dev_id} ${onu_port} | grep "ponCTag=${ctag}, ponSTag=${stag}" | grep technologyProfileId |
| 1026 | ... =${tpid} --color=none |
| 1027 | ${subscriber}= Execute ONOS CLI Command use single connection ${ip} ${port} ${cmd} |
| 1028 | Log ${subscriber} |
| 1029 | ${sub_count}= Get Line Count ${subscriber} |
| 1030 | Run Keyword If ${sub_added} |
| 1031 | ... Should Be Equal As Integers ${sub_count} 1 UniTag Subscriber Not Added |
| 1032 | ... ELSE |
| 1033 | ... Should Be Equal As Integers ${sub_count} 0 UniTag Subscriber Not Removed |