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