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