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