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