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