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 | |
| 27 | *** Keywords *** |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 28 | |
| 29 | Open ONOS SSH Connection |
| 30 | [Documentation] Establishes an ssh connection to ONOS contoller |
| 31 | [Arguments] ${host} ${port} ${user}=karaf ${pass}=karaf |
| 32 | ${conn_id}= SSHLibrary.Open Connection ${host} port=${port} timeout=300s alias=ONOS_SSH |
| 33 | SSHLibrary.Login ${user} ${pass} |
| 34 | [Return] ${conn_id} |
| 35 | |
| 36 | Execute ONOS CLI Command on open connection |
| 37 | [Documentation] Execute ONOS CLI Command On an Open Connection |
| 38 | [Arguments] ${connection_alias} ${cmd} |
| 39 | SSHLibrary.Switch Connection ${connection_alias} |
| 40 | @{result_values} SSHLibrary.Execute Command ${cmd} return_rc=True |
| 41 | ... return_stderr=True return_stdout=True |
| 42 | ${output} Set Variable @{result_values}[0] |
| 43 | Log ${output} |
| 44 | Should Be Empty @{result_values}[1] |
| 45 | Should Be Equal As Integers @{result_values}[2] 0 |
| 46 | [Return] ${output} |
| 47 | |
| 48 | Close ONOS SSH Connection |
| 49 | [Documentation] Close an SSH Connection |
| 50 | [Arguments] ${connection_alias} |
| 51 | SSHLibrary.Switch Connection ${connection_alias} |
| 52 | SSHLibrary.Close Connection |
| 53 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 54 | Validate OLT Device in ONOS |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 55 | # FIXME use volt-olts to check that the OLT is ONOS |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 56 | [Arguments] ${serial_number} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 57 | [Documentation] Checks if olt has been connected to ONOS |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 58 | ${resp}= Get Request ONOS onos/v1/devices |
| 59 | ${jsondata}= To Json ${resp.content} |
| 60 | Should Not Be Empty ${jsondata['devices']} |
| 61 | ${length}= Get Length ${jsondata['devices']} |
| 62 | @{serial_numbers}= Create List |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 63 | ${matched}= Set Variable False |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 64 | FOR ${INDEX} IN RANGE 0 ${length} |
| 65 | ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 66 | ${of_id}= Get From Dictionary ${value} id |
| 67 | ${sn}= Get From Dictionary ${value} serial |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 68 | ${matched}= Set Variable If '${sn}' == '${serial_number}' True False |
| 69 | Exit For Loop If ${matched} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 70 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 71 | Should Be True ${matched} No match for ${serial_number} found |
Kailash | 57210eb | 2019-08-30 13:27:19 -0700 | [diff] [blame] | 72 | [Return] ${of_id} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 73 | |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 74 | Get ONU Port in ONOS |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 75 | [Arguments] ${onu_serial_number} ${olt_of_id} |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 76 | [Documentation] Retrieves ONU port for the ONU in ONOS |
Suchitra Vemuri | a50c1c1 | 2019-09-30 19:54:26 -0700 | [diff] [blame] | 77 | ${onu_serial_number}= Catenate SEPARATOR=- ${onu_serial_number} 1 |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 78 | ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports |
| 79 | ${jsondata}= To Json ${resp.content} |
| 80 | Should Not Be Empty ${jsondata['ports']} |
| 81 | ${length}= Get Length ${jsondata['ports']} |
| 82 | @{ports}= Create List |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 83 | ${matched}= Set Variable False |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 84 | FOR ${INDEX} IN RANGE 0 ${length} |
| 85 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 86 | ${annotations}= Get From Dictionary ${value} annotations |
| 87 | ${onu_port}= Get From Dictionary ${value} port |
| 88 | ${portName}= Get From Dictionary ${annotations} portName |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 89 | ${matched}= Set Variable If '${portName}' == '${onu_serial_number}' True False |
| 90 | Exit For Loop If ${matched} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 91 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 92 | Should Be True ${matched} No match for ${onu_serial_number} found |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 93 | [Return] ${onu_port} |
| 94 | |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 95 | Get NNI Port in ONOS |
| 96 | [Arguments] ${olt_of_id} |
| 97 | [Documentation] Retrieves NNI port for the OLT in ONOS |
| 98 | ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports |
| 99 | ${jsondata}= To Json ${resp.content} |
| 100 | Should Not Be Empty ${jsondata['ports']} |
| 101 | ${length}= Get Length ${jsondata['ports']} |
| 102 | @{ports}= Create List |
| 103 | ${matched}= Set Variable False |
| 104 | FOR ${INDEX} IN RANGE 0 ${length} |
| 105 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 106 | ${annotations}= Get From Dictionary ${value} annotations |
| 107 | ${nni_port}= Get From Dictionary ${value} port |
| 108 | ${nniPortName}= Catenate SEPARATOR= nni- ${nni_port} |
| 109 | ${portName}= Get From Dictionary ${annotations} portName |
| 110 | ${matched}= Set Variable If '${portName}' == '${nniPortName}' True False |
| 111 | Exit For Loop If ${matched} |
| 112 | END |
| 113 | Should Be True ${matched} No match for NNI found for ${olt_of_id} |
| 114 | [Return] ${nni_port} |
| 115 | |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 116 | Get FabricSwitch in ONOS |
| 117 | [Documentation] Returns of_id of the Fabric Switch in ONOS |
| 118 | ${resp}= Get Request ONOS onos/v1/devices |
| 119 | ${jsondata}= To Json ${resp.content} |
| 120 | Should Not Be Empty ${jsondata['devices']} |
| 121 | ${length}= Get Length ${jsondata['devices']} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 122 | ${matched}= Set Variable False |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -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 | ${type}= Get From Dictionary ${value} type |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 127 | ${matched}= Set Variable If '${type}' == "SWITCH" True False |
| 128 | Exit For Loop If ${matched} |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 129 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 130 | Should Be True ${matched} No fabric switch found |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 131 | [Return] ${of_id} |
| 132 | |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 133 | Verify Subscriber Access Flows Added for ONU |
| 134 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${c_tag} ${s_tag} |
| 135 | [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU |
| 136 | # Verify upstream table=0 flow |
| 137 | ${upstream_flow_0_cmd}= Catenate SEPARATOR= |
| 138 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:0 | |
| 139 | ... grep VLAN_ID:${c_tag} | grep transition=TABLE:1 |
| 140 | ${upstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
| 141 | ... ${upstream_flow_0_cmd} |
| 142 | Should Not Be Empty ${upstream_flow_0_added} |
| 143 | # Verify upstream table=1 flow |
| 144 | ${flow_vlan_push_cmd}= Catenate SEPARATOR= |
| 145 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:${c_tag} | |
| 146 | ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port} |
| 147 | ${upstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
| 148 | ... ${flow_vlan_push_cmd} |
| 149 | Should Not Be Empty ${upstream_flow_1_added} |
| 150 | # Verify downstream table=0 flow |
| 151 | ${flow_vlan_pop_cmd}= Catenate SEPARATOR= |
| 152 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${s_tag} | |
| 153 | ... grep VLAN_POP | grep transition=TABLE:1 |
| 154 | ${downstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
| 155 | ... ${flow_vlan_pop_cmd} |
| 156 | Should Not Be Empty ${downstream_flow_0_added} |
| 157 | # Verify downstream table=1 flow |
| 158 | ${downstream_flow_1_cmd}= Catenate SEPARATOR= |
| 159 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${c_tag} | |
| 160 | ... grep VLAN_ID:0 | grep OUTPUT:${onu_port} |
| 161 | ${downstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
| 162 | ... ${downstream_flow_1_cmd} |
| 163 | Should Not Be Empty ${downstream_flow_1_added} |
| 164 | # Verify ipv4 dhcp upstream flow |
| 165 | ${upstream_flow_ipv4_cmd}= Catenate SEPARATOR= |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 166 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep ETH_TYPE:ipv4 | |
| 167 | ... grep IP_PROTO:17 | grep UDP_SRC:68 | grep UDP_DST:67 | grep VLAN_VID:${c_tag} | |
| 168 | ... grep OUTPUT:CONTROLLER |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 169 | ${upstream_flow_ipv4_added}= Execute ONOS CLI Command ${ip} ${port} |
| 170 | ... ${upstream_flow_ipv4_cmd} |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 171 | Should Not Be Empty ${upstream_flow_ipv4_added} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 172 | # Verify ipv4 dhcp downstream flow |
| 173 | # Note: This flow will be one per nni per olt |
| 174 | ${downstream_flow_ipv4_cmd}= Catenate SEPARATOR= |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 175 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep ETH_TYPE:ipv4 | |
| 176 | ... grep IP_PROTO:17 | grep UDP_SRC:67 | grep UDP_DST:68 | grep OUTPUT:CONTROLLER |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 177 | ${downstream_flow_ipv4_added}= Execute ONOS CLI Command ${ip} ${port} |
| 178 | ... ${downstream_flow_ipv4_cmd} |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 179 | Should Not Be Empty ${downstream_flow_ipv4_added} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 180 | |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 181 | Verify Subscriber Access Flows Added for ONU DT |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 182 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${s_tag} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 183 | [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU |
| 184 | # Verify upstream table=0 flow |
| 185 | ${upstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 186 | ... 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] | 187 | Should Not Be Empty ${upstream_flow_0_added} |
| 188 | # Verify upstream table=1 flow |
| 189 | ${flow_vlan_push_cmd}= Catenate SEPARATOR= |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 190 | ... 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] | 191 | ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port} |
| 192 | ${upstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
| 193 | ... ${flow_vlan_push_cmd} |
| 194 | Should Not Be Empty ${upstream_flow_1_added} |
| 195 | # Verify downstream table=0 flow |
| 196 | ${flow_vlan_pop_cmd}= Catenate SEPARATOR= |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 197 | ... 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] | 198 | ... grep VLAN_POP | grep transition=TABLE:1 |
| 199 | ${downstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
| 200 | ... ${flow_vlan_pop_cmd} |
| 201 | Should Not Be Empty ${downstream_flow_0_added} |
| 202 | # Verify downstream table=1 flow |
| 203 | ${downstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 204 | ... 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] | 205 | Should Not Be Empty ${downstream_flow_1_added} |
| 206 | |
| 207 | Verify Subscriber Access Flows Added Count DT |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 208 | [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 209 | [Documentation] Matches for total number of subscriber access flows added for all onus |
| 210 | ${access_flows_added}= Execute ONOS CLI Command ${ip} ${port} |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 211 | ... flows -s ADDED ${olt_of_id} | grep -v deviceId | grep -v ETH_TYPE:lldp | wc -l |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 212 | Should Be Equal As Integers ${access_flows_added} ${expected_flows} |
| 213 | |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 214 | Get Programmed Subscribers |
| 215 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} |
| 216 | [Documentation] Retrieves the subscriber details at a given location |
| 217 | ${sub_location}= Catenate SEPARATOR=/ ${olt_of_id} ${onu_port} |
| 218 | ${programmed_sub}= Execute ONOS CLI Command ${ip} ${port} |
| 219 | ... volt-programmed-subscribers | grep ${sub_location} |
| 220 | [Return] ${programmed_sub} |
| 221 | |
| 222 | Get Upstream and Downstream Bandwidth Profile Name |
| 223 | [Arguments] ${programmed_sub} |
| 224 | [Documentation] Retrieves the upstream and downstream bandwidth profile name |
| 225 | ... from the programmed subscriber |
| 226 | @{programmed_sub_array}= Split String ${programmed_sub} , |
| 227 | # Get upstream bandwidth profile name for the subscriber |
| 228 | @{param_val_pair}= Split String ${programmed_sub_array[9]} = |
| 229 | ${programmed_sub_param}= Set Variable ${param_val_pair[0]} |
| 230 | ${programmed_sub_val}= Set Variable ${param_val_pair[1]} |
| 231 | ${us_bw_profile}= Run Keyword If '${programmed_sub_param}' == ' upstreamBandwidthProfile' |
| 232 | ... Set Variable ${programmed_sub_val} |
| 233 | Log ${us_bw_profile} |
| 234 | # Get downstream bandwidth profile name for the subscriber |
| 235 | @{param_val_pair}= Split String ${programmed_sub_array[10]} = |
| 236 | ${programmed_sub_param}= Set Variable ${param_val_pair[0]} |
| 237 | ${programmed_sub_val}= Set Variable ${param_val_pair[1]} |
| 238 | ${ds_bw_profile}= Run Keyword If '${programmed_sub_param}' == ' downstreamBandwidthProfile' |
| 239 | ... Set Variable ${programmed_sub_val} |
| 240 | Log ${ds_bw_profile} |
| 241 | [Return] ${us_bw_profile} ${ds_bw_profile} |
| 242 | |
| 243 | Get Bandwidth Profile Details |
| 244 | [Arguments] ${ip} ${port} ${bw_profile} |
| 245 | [Documentation] Retrieves the details of the given bandwidth profile |
| 246 | ${bw_profile_values}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 247 | ... bandwidthprofile ${bw_profile} |
| 248 | @{bw_profile_array}= Split String ${bw_profile_values} , |
| 249 | @{param_val_pair}= Split String ${bw_profile_array[1]} = |
| 250 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 251 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 252 | ${cir} Run Keyword If '${bw_param}' == ' committedInformationRate' |
| 253 | ... Set Variable ${bw_val} |
| 254 | @{param_val_pair}= Split String ${bw_profile_array[2]} = |
| 255 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 256 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 257 | ${cbs} Run Keyword If '${bw_param}' == ' committedBurstSize' |
| 258 | ... Set Variable ${bw_val} |
| 259 | @{param_val_pair}= Split String ${bw_profile_array[3]} = |
| 260 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 261 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 262 | ${eir} Run Keyword If '${bw_param}' == ' exceededInformationRate' |
| 263 | ... Set Variable ${bw_val} |
| 264 | @{param_val_pair}= Split String ${bw_profile_array[4]} = |
| 265 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 266 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 267 | ${ebs} Run Keyword If '${bw_param}' == ' exceededBurstSize' |
| 268 | ... Set Variable ${bw_val} |
| 269 | @{param_val_pair}= Split String ${bw_profile_array[5]} = |
| 270 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 271 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 272 | @{bw_val_air}= Split String ${bw_val} } |
| 273 | ${air} Run Keyword If '${bw_param}' == ' assuredInformationRate' |
| 274 | ... Set Variable ${bw_val_air[0]} |
| 275 | [Return] ${cir} ${cbs} ${eir} ${ebs} ${air} |
| 276 | |
| 277 | Verify Meters in ONOS |
| 278 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} |
| 279 | [Documentation] Verifies the meters |
| 280 | # Get programmed subscriber |
| 281 | ${programmed_sub}= Get Programmed Subscribers ${ip} ${port} |
| 282 | ... ${olt_of_id} ${onu_port} |
| 283 | Log ${programmed_sub} |
| 284 | ${us_bw_profile} ${ds_bw_profile} Get Upstream and Downstream Bandwidth Profile Name |
| 285 | ... ${programmed_sub} |
| 286 | # Get upstream bandwidth profile details |
| 287 | ${us_cir} ${us_cbs} ${us_eir} ${us_ebs} ${us_air} Get Bandwidth Profile Details |
| 288 | ... ${ip} ${port} ${us_bw_profile} |
| 289 | Sleep 1s |
| 290 | # Verify meter for upstream bandwidth profile |
| 291 | ${us_meter_cmd}= Catenate SEPARATOR= |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 292 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}" |
| 293 | ... | grep "rate=${us_eir}, burst-size=${us_ebs}" | grep "rate=${us_air}, burst-size=0" | wc -l |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 294 | ${upstream_meter_added}= Execute ONOS CLI Command ${ip} ${port} |
| 295 | ... ${us_meter_cmd} |
| 296 | Should Be Equal As Integers ${upstream_meter_added} 1 |
| 297 | Sleep 1s |
| 298 | # Get downstream bandwidth profile details |
| 299 | ${ds_cir} ${ds_cbs} ${ds_eir} ${ds_ebs} ${ds_air} Get Bandwidth Profile Details |
| 300 | ... ${ip} ${port} ${ds_bw_profile} |
| 301 | Sleep 1s |
| 302 | # Verify meter for downstream bandwidth profile |
| 303 | ${ds_meter_cmd}= Catenate SEPARATOR= |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 304 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}" |
| 305 | ... | grep "rate=${ds_eir}, burst-size=${ds_ebs}" | grep "rate=${ds_air}, burst-size=0" | wc -l |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 306 | ${downstream_meter_added}= Execute ONOS CLI Command ${ip} ${port} |
| 307 | ... ${ds_meter_cmd} |
| 308 | Should Be Equal As Integers ${downstream_meter_added} 1 |
| 309 | |
| 310 | Verify Default Meter Present in ONOS |
| 311 | [Arguments] ${ip} ${port} ${olt_of_id} |
| 312 | [Documentation] Verifies the single default meter entry is present |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 313 | # Get default bandwidth profile details |
| 314 | ${cir} ${cbs} ${eir} ${ebs} ${air} Get Bandwidth Profile Details |
| 315 | ... ${ip} ${port} 'Default' |
| 316 | Sleep 1s |
| 317 | # Verify meter for default bandwidth profile |
| 318 | ${meter_cmd}= Catenate SEPARATOR= |
| 319 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${cir}, burst-size=${cbs}" |
| 320 | ... | grep "rate=${eir}, burst-size=${ebs}" | grep "rate=${air}, burst-size=0" | wc -l |
| 321 | ${default_meter_added}= Execute ONOS CLI Command ${ip} ${port} |
| 322 | ... ${meter_cmd} |
| 323 | Should Be Equal As Integers ${default_meter_added} 1 |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 324 | |
Hardik Windlass | 480f3e2 | 2020-04-02 20:14:14 +0530 | [diff] [blame] | 325 | Verify Device Flows Removed |
| 326 | [Arguments] ${ip} ${port} ${olt_of_id} |
| 327 | [Documentation] Verifies all flows are removed from the device |
| 328 | ${device_flows}= Execute ONOS CLI Command ${ip} ${port} |
| 329 | ... flows -s -f ${olt_of_id} | grep -v deviceId | wc -l |
| 330 | Should Be Equal As Integers ${device_flows} 0 |
| 331 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 332 | Verify Eapol Flows Added |
Andy Bavier | b0c0623 | 2019-08-29 12:58:53 -0700 | [diff] [blame] | 333 | [Arguments] ${ip} ${port} ${expected_flows} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 334 | [Documentation] Matches for number of eapol flows based on number of onus |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 335 | ${eapol_flows_added}= Execute ONOS CLI Command ${ip} ${port} |
| 336 | ... flows -s -f ADDED | grep eapol | grep IN_PORT | wc -l |
Andy Bavier | b0c0623 | 2019-08-29 12:58:53 -0700 | [diff] [blame] | 337 | Should Contain ${eapol_flows_added} ${expected_flows} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 338 | |
Suchitra Vemuri | 9da4430 | 2020-03-04 14:24:49 -0800 | [diff] [blame] | 339 | Verify No Pending Flows For ONU |
| 340 | [Arguments] ${ip} ${port} ${onu_port} |
| 341 | [Documentation] Verifies that there are no flows "PENDING" state for the ONU in ONOS |
| 342 | ${pending_flows}= Execute ONOS CLI Command ${ip} ${port} |
| 343 | ... flows -s | grep IN_PORT:${onu_port} | grep PENDING |
| 344 | Should Be Empty ${pending_flows} |
| 345 | |
Suchitra Vemuri | 3dd2f83 | 2019-10-18 13:14:54 -0700 | [diff] [blame] | 346 | Verify Eapol Flows Added For ONU |
| 347 | [Arguments] ${ip} ${port} ${onu_port} |
| 348 | [Documentation] Verifies if the Eapol Flows are added in ONOS for the ONU |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 349 | ${eapol_flows_added}= Execute ONOS CLI Command ${ip} ${port} |
| 350 | ... flows -s -f ADDED | grep eapol | grep IN_PORT:${onu_port} |
Suchitra Vemuri | 3dd2f83 | 2019-10-18 13:14:54 -0700 | [diff] [blame] | 351 | Should Not Be Empty ${eapol_flows_added} |
| 352 | |
Suchitra Vemuri | 8078b97 | 2020-02-06 19:07:41 -0800 | [diff] [blame] | 353 | Verify ONU Port Is Enabled |
Suchitra Vemuri | 760bdd3 | 2020-06-17 12:34:48 -0700 | [diff] [blame] | 354 | [Arguments] ${ip} ${port} ${onu_name} |
Suchitra Vemuri | 8078b97 | 2020-02-06 19:07:41 -0800 | [diff] [blame] | 355 | [Documentation] Verifies if the ONU port is enabled in ONOS |
| 356 | ${onu_port_enabled}= Execute ONOS CLI Command ${ip} ${port} |
Suchitra Vemuri | 760bdd3 | 2020-06-17 12:34:48 -0700 | [diff] [blame] | 357 | ... ports -e | grep portName=${onu_name} |
Suchitra Vemuri | 8078b97 | 2020-02-06 19:07:41 -0800 | [diff] [blame] | 358 | Log ${onu_port_enabled} |
| 359 | Should Not Be Empty ${onu_port_enabled} |
| 360 | |
Hardik Windlass | 63d5e00 | 2020-03-06 21:07:09 +0530 | [diff] [blame] | 361 | Verify ONU Port Is Disabled |
Suchitra Vemuri | 760bdd3 | 2020-06-17 12:34:48 -0700 | [diff] [blame] | 362 | [Arguments] ${ip} ${port} ${onu_name} |
Hardik Windlass | 63d5e00 | 2020-03-06 21:07:09 +0530 | [diff] [blame] | 363 | [Documentation] Verifies if the ONU port is disabled in ONOS |
| 364 | ${onu_port_disabled}= Execute ONOS CLI Command ${ip} ${port} |
Suchitra Vemuri | 760bdd3 | 2020-06-17 12:34:48 -0700 | [diff] [blame] | 365 | ... ports -e | grep portName=${onu_name} |
Hardik Windlass | 63d5e00 | 2020-03-06 21:07:09 +0530 | [diff] [blame] | 366 | Log ${onu_port_disabled} |
| 367 | Should Be Empty ${onu_port_disabled} |
| 368 | |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 369 | Verify ONU in AAA-Users |
| 370 | [Arguments] ${ip} ${port} ${onu_port} |
| 371 | [Documentation] Verifies that the specified onu_port exists in aaa-users output |
| 372 | ${aaa_users}= Execute ONOS CLI Command ${ip} ${port} aaa-users | grep AUTHORIZED | grep ${onu_port} |
| 373 | Should Not Be Empty ${aaa_users} ONU port ${onu_port} not found in aaa-users |
| 374 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 375 | Assert Number of AAA-Users |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 376 | [Arguments] ${onos_ssh_connection} ${expected_onus} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 377 | [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] | 378 | ${aaa_users}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 379 | ... aaa-users | grep AUTHORIZED | wc -l |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 380 | Should Be Equal As Integers ${aaa_users} ${expected_onus} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 381 | |
| 382 | Validate DHCP Allocations |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 383 | [Arguments] ${onos_ssh_connection} ${expected_onus} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 384 | [Documentation] Matches for number of dhcpacks based on number of onus |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 385 | ${allocations}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 386 | ... dhcpl2relay-allocations | grep DHCPACK | wc -l |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 387 | Should Be Equal As Integers ${allocations} ${expected_onus} |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 388 | |
| 389 | Validate Subscriber DHCP Allocation |
| 390 | [Arguments] ${ip} ${port} ${onu_port} |
| 391 | [Documentation] Verifies that the specified subscriber is found in DHCP allocations |
| 392 | ##TODO: Enhance the keyword to include DHCP allocated address is not 0.0.0.0 |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 393 | ${allocations}= Execute ONOS CLI Command ${ip} ${port} |
| 394 | ... dhcpl2relay-allocations | grep DHCPACK | grep ${onu_port} |
| 395 | 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] | 396 | |
| 397 | Device Is Available In ONOS |
| 398 | [Arguments] ${url} ${dpid} |
| 399 | [Documentation] Validates the device exists and it available in ONOS |
| 400 | ${rc} ${json} Run And Return Rc And Output curl --fail -sSL ${url}/onos/v1/devices/${dpid} |
| 401 | Should Be Equal As Integers 0 ${rc} |
| 402 | ${rc} ${value} Run And Return Rc And Output echo '${json}' | jq -r .available |
| 403 | Should Be Equal As Integers 0 ${rc} |
| 404 | Should Be Equal 'true' '${value}' |
| 405 | |
| 406 | Remove All Devices From ONOS |
| 407 | [Arguments] ${url} |
| 408 | [Documentation] Executes the device-remove command on each device in ONOS |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 409 | ${rc} ${output} Run And Return Rc And Output |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 410 | ... curl --fail -sSL ${url}/onos/v1/devices | jq -r '.devices[].id' |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 411 | Should Be Equal As Integers ${rc} 0 |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 412 | @{dpids} Split String ${output} |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 413 | ${count}= Get length ${dpids} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 414 | FOR ${dpid} IN @{dpids} |
| 415 | ${rc}= Run Keyword If '${dpid}' != '' |
| 416 | ... Run And Return Rc curl -XDELETE --fail -sSL ${url}/onos/v1/devices/${dpid} |
| 417 | Run Keyword If '${dpid}' != '' |
| 418 | ... Should Be Equal As Integers ${rc} 0 |
| 419 | END |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 420 | |
| 421 | Assert Ports in ONOS |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 422 | [Arguments] ${onos_ssh_connection} ${count} ${filter} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 423 | [Documentation] Check that a certain number of ports are enabled in ONOS |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 424 | ${ports}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 425 | ... ports -e | grep ${filter} | wc -l |
| 426 | Should Be Equal As Integers ${ports} ${count} |
| 427 | |
| 428 | Wait for Ports in ONOS |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 429 | [Arguments] ${onos_ssh_connection} ${count} ${filter} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 430 | [Documentation] Waits untill a certain number of ports are enabled in ONOS |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 431 | Wait Until Keyword Succeeds 10m 5s Assert Ports in ONOS |
| 432 | ... ${onos_ssh_connection} ${count} ${filter} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 433 | |
| 434 | Wait for AAA Authentication |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 435 | [Arguments] ${onos_ssh_connection} ${count} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 436 | [Documentation] Waits untill a certain number of subscribers are authenticated in ONOS |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 437 | Wait Until Keyword Succeeds 10m 5s Assert Number of AAA-Users ${onos_ssh_connection} ${count} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 438 | |
| 439 | Wait for DHCP Ack |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 440 | [Arguments] ${onos_ssh_connection} ${count} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 441 | [Documentation] Waits untill a certain number of subscribers have received a DHCP_ACK |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 442 | Wait Until Keyword Succeeds 10m 5s Validate DHCP Allocations ${onos_ssh_connection} ${count} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 443 | |
| 444 | Provision subscriber |
| 445 | [Documentation] Calls volt-add-subscriber-access in ONOS |
| 446 | [Arguments] ${onos_ip} ${onos_port} ${of_id} ${onu_port} |
| 447 | Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 448 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 449 | |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 450 | Provision subscriber REST |
| 451 | [Documentation] Uses the rest APIs to provision a subscriber |
| 452 | [Arguments] ${onos_ip} ${onos_port} ${of_id} ${onu_port} |
| 453 | ${resp}= Post Request ONOS |
| 454 | ... /onos/olt/oltapp/${of_id}/${onu_port} |
| 455 | Should Be Equal As Strings ${resp.status_code} 200 |
| 456 | |
| 457 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 458 | List Enabled UNI Ports |
| 459 | [Documentation] List all the UNI Ports, the only way we have is to filter out the one called NNI |
| 460 | ... Creates a list of dictionaries |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 461 | [Arguments] ${onos_ssh_connection} ${of_id} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 462 | [Return] [{'port': '16', 'of_id': 'of:00000a0a0a0a0a00'}, {'port': '32', 'of_id': 'of:00000a0a0a0a0a00'}] |
| 463 | ${result}= Create List |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 464 | ${out}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 465 | ... ports -e ${of_id} | grep -v SWITCH | grep -v nni |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 466 | @{unis}= Split To Lines ${out} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 467 | FOR ${uni} IN @{unis} |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 468 | ${matches} = Get Regexp Matches ${uni} .*port=([0-9]+),.* 1 |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 469 | &{portDict} Create Dictionary of_id=${of_id} port=${matches[0]} |
| 470 | Append To List ${result} ${portDict} |
| 471 | END |
| 472 | Log ${result} |
| 473 | Return From Keyword ${result} |
| 474 | |
| 475 | Provision all subscribers on device |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 476 | [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] | 477 | [Arguments] ${onos_ssh_connection} ${onos_ip} ${onos_rest_port} ${of_id} |
| 478 | ${unis}= List Enabled UNI Ports ${onos_ssh_connection} ${of_id} |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 479 | ${onos_auth}= Create List karaf karaf |
| 480 | Create Session ONOS http://${onos_ip}:${onos_rest_port} auth=${onos_auth} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 481 | FOR ${uni} IN @{unis} |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 482 | 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] | 483 | END |
| 484 | |
| 485 | List OLTs |
| 486 | [Documentation] Returns a list of OLTs known to ONOS |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 487 | [Arguments] ${onos_ssh_connection} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 488 | [Return] ['of:00000a0a0a0a0a00', 'of:00000a0a0a0a0a01'] |
| 489 | ${result}= Create List |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 490 | ${out}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 491 | ... volt-olts |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 492 | @{olts}= Split To Lines ${out} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 493 | FOR ${olt} IN @{olts} |
| 494 | Log ${olt} |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 495 | ${matches} = Get Regexp Matches ${olt} ^OLT (.+)$ 1 |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 496 | # there may be some logs mixed with the output so only append if we have a match |
| 497 | ${matches_length}= Get Length ${matches} |
| 498 | Run Keyword If ${matches_length}==1 |
| 499 | ... Append To List ${result} ${matches[0]} |
| 500 | END |
| 501 | Return From Keyword ${result} |
| 502 | |
| 503 | Count ADDED flows |
| 504 | [Documentation] Count the flows in ADDED state in ONOS |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 505 | [Arguments] ${onos_ssh_connection} ${targetFlows} |
| 506 | ${flows}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 507 | ... flows -s | grep ADDED | wc -l |
| 508 | Should Be Equal As Integers ${targetFlows} ${flows} |
| 509 | |
| 510 | Wait for all flows to in ADDED state |
| 511 | [Documentation] Waits until the flows have been provisioned |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 512 | [Arguments] ${onos_ssh_connection} ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 513 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 514 | ${targetFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 515 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 516 | Wait Until Keyword Succeeds 10m 5s Count ADDED flows |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 517 | ... ${onos_ssh_connection} ${targetFlows} |
Gayathri.Selvan | 92d1686 | 2020-03-19 14:47:58 +0000 | [diff] [blame] | 518 | |
| 519 | Get Bandwidth Details |
| 520 | [Arguments] ${bandwidth_profile_name} |
| 521 | [Documentation] Collects the bandwidth profile details for the given bandwidth profile and |
| 522 | ... returns the limiting bandwidth |
| 523 | ${bandwidth_profile_values}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 524 | ... bandwidthprofile ${bandwidth_profile_name} |
| 525 | @{bandwidth_profile_array}= Split String ${bandwidth_profile_values} , |
| 526 | @{parameter_value_pair}= Split String ${bandwidth_profile_array[1]} = |
| 527 | ${bandwidthparameter}= Set Variable ${parameter_value_pair[0]} |
| 528 | ${value}= Set Variable ${parameter_value_pair[1]} |
| 529 | ${cir_value} Run Keyword If '${bandwidthparameter}' == ' committedInformationRate' |
| 530 | ... Set Variable ${value} |
| 531 | @{parameter_value_pair}= Split String ${bandwidth_profile_array[2]} = |
| 532 | ${bandwidthparameter}= Set Variable ${parameter_value_pair[0]} |
| 533 | ${value}= Set Variable ${parameter_value_pair[1]} |
| 534 | ${cbs_value} Run Keyword If '${bandwidthparameter}' == ' committedBurstSize' Set Variable ${value} |
| 535 | @{parameter_value_pair}= Split String ${bandwidth_profile_array[3]} = |
| 536 | ${bandwidthparameter}= Set Variable ${parameter_value_pair[0]} |
| 537 | ${value}= Set Variable ${parameter_value_pair[1]} |
| 538 | ${eir_value} Run Keyword If '${bandwidthparameter}' == ' exceededInformationRate' Set Variable ${value} |
| 539 | @{parameter_value_pair}= Split String ${bandwidth_profile_array[4]} = |
| 540 | ${bandwidthparameter}= Set Variable ${parameter_value_pair[0]} |
| 541 | ${value}= Set Variable ${parameter_value_pair[1]} |
| 542 | ${ebs_value} Run Keyword If '${bandwidthparameter}' == ' exceededBurstSize' Set Variable ${value} |
| 543 | ${limiting_BW}= Evaluate ${cir_value}+${eir_value} |
| 544 | [Return] ${limiting_BW} |