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 |
| 25 | |
| 26 | *** Keywords *** |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 27 | Validate OLT Device in ONOS |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 28 | # FIXME use volt-olts to check that the OLT is ONOS |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 29 | [Arguments] ${serial_number} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 30 | [Documentation] Checks if olt has been connected to ONOS |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 31 | ${resp}= Get Request ONOS onos/v1/devices |
| 32 | ${jsondata}= To Json ${resp.content} |
| 33 | Should Not Be Empty ${jsondata['devices']} |
| 34 | ${length}= Get Length ${jsondata['devices']} |
| 35 | @{serial_numbers}= Create List |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 36 | ${matched}= Set Variable False |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 37 | FOR ${INDEX} IN RANGE 0 ${length} |
| 38 | ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 39 | ${of_id}= Get From Dictionary ${value} id |
| 40 | ${sn}= Get From Dictionary ${value} serial |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 41 | ${matched}= Set Variable If '${sn}' == '${serial_number}' True False |
| 42 | Exit For Loop If ${matched} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 43 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 44 | Should Be True ${matched} No match for ${serial_number} found |
Kailash | 57210eb | 2019-08-30 13:27:19 -0700 | [diff] [blame] | 45 | [Return] ${of_id} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 46 | |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 47 | Get ONU Port in ONOS |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 48 | [Arguments] ${onu_serial_number} ${olt_of_id} |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 49 | [Documentation] Retrieves ONU port for the ONU in ONOS |
Suchitra Vemuri | a50c1c1 | 2019-09-30 19:54:26 -0700 | [diff] [blame] | 50 | ${onu_serial_number}= Catenate SEPARATOR=- ${onu_serial_number} 1 |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 51 | ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports |
| 52 | ${jsondata}= To Json ${resp.content} |
| 53 | Should Not Be Empty ${jsondata['ports']} |
| 54 | ${length}= Get Length ${jsondata['ports']} |
| 55 | @{ports}= Create List |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 56 | ${matched}= Set Variable False |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 57 | FOR ${INDEX} IN RANGE 0 ${length} |
| 58 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 59 | ${annotations}= Get From Dictionary ${value} annotations |
| 60 | ${onu_port}= Get From Dictionary ${value} port |
| 61 | ${portName}= Get From Dictionary ${annotations} portName |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 62 | ${matched}= Set Variable If '${portName}' == '${onu_serial_number}' True False |
| 63 | Exit For Loop If ${matched} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 64 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 65 | Should Be True ${matched} No match for ${onu_serial_number} found |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 66 | [Return] ${onu_port} |
| 67 | |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 68 | Get NNI Port in ONOS |
| 69 | [Arguments] ${olt_of_id} |
| 70 | [Documentation] Retrieves NNI port for the OLT in ONOS |
| 71 | ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports |
| 72 | ${jsondata}= To Json ${resp.content} |
| 73 | Should Not Be Empty ${jsondata['ports']} |
| 74 | ${length}= Get Length ${jsondata['ports']} |
| 75 | @{ports}= Create List |
| 76 | ${matched}= Set Variable False |
| 77 | FOR ${INDEX} IN RANGE 0 ${length} |
| 78 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 79 | ${annotations}= Get From Dictionary ${value} annotations |
| 80 | ${nni_port}= Get From Dictionary ${value} port |
| 81 | ${nniPortName}= Catenate SEPARATOR= nni- ${nni_port} |
| 82 | ${portName}= Get From Dictionary ${annotations} portName |
| 83 | ${matched}= Set Variable If '${portName}' == '${nniPortName}' True False |
| 84 | Exit For Loop If ${matched} |
| 85 | END |
| 86 | Should Be True ${matched} No match for NNI found for ${olt_of_id} |
| 87 | [Return] ${nni_port} |
| 88 | |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 89 | Get FabricSwitch in ONOS |
| 90 | [Documentation] Returns of_id of the Fabric Switch in ONOS |
| 91 | ${resp}= Get Request ONOS onos/v1/devices |
| 92 | ${jsondata}= To Json ${resp.content} |
| 93 | Should Not Be Empty ${jsondata['devices']} |
| 94 | ${length}= Get Length ${jsondata['devices']} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 95 | ${matched}= Set Variable False |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 96 | FOR ${INDEX} IN RANGE 0 ${length} |
| 97 | ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 98 | ${of_id}= Get From Dictionary ${value} id |
| 99 | ${type}= Get From Dictionary ${value} type |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 100 | ${matched}= Set Variable If '${type}' == "SWITCH" True False |
| 101 | Exit For Loop If ${matched} |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 102 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 103 | Should Be True ${matched} No fabric switch found |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 104 | [Return] ${of_id} |
| 105 | |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 106 | Verify Subscriber Access Flows Added for ONU |
| 107 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${c_tag} ${s_tag} |
| 108 | [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU |
| 109 | # Verify upstream table=0 flow |
| 110 | ${upstream_flow_0_cmd}= Catenate SEPARATOR= |
| 111 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:0 | |
| 112 | ... grep VLAN_ID:${c_tag} | grep transition=TABLE:1 |
| 113 | ${upstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
| 114 | ... ${upstream_flow_0_cmd} |
| 115 | Should Not Be Empty ${upstream_flow_0_added} |
| 116 | # Verify upstream table=1 flow |
| 117 | ${flow_vlan_push_cmd}= Catenate SEPARATOR= |
| 118 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:${c_tag} | |
| 119 | ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port} |
| 120 | ${upstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
| 121 | ... ${flow_vlan_push_cmd} |
| 122 | Should Not Be Empty ${upstream_flow_1_added} |
| 123 | # Verify downstream table=0 flow |
| 124 | ${flow_vlan_pop_cmd}= Catenate SEPARATOR= |
| 125 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${s_tag} | |
| 126 | ... grep VLAN_POP | grep transition=TABLE:1 |
| 127 | ${downstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
| 128 | ... ${flow_vlan_pop_cmd} |
| 129 | Should Not Be Empty ${downstream_flow_0_added} |
| 130 | # Verify downstream table=1 flow |
| 131 | ${downstream_flow_1_cmd}= Catenate SEPARATOR= |
| 132 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${c_tag} | |
| 133 | ... grep VLAN_ID:0 | grep OUTPUT:${onu_port} |
| 134 | ${downstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
| 135 | ... ${downstream_flow_1_cmd} |
| 136 | Should Not Be Empty ${downstream_flow_1_added} |
| 137 | # Verify ipv4 dhcp upstream flow |
| 138 | ${upstream_flow_ipv4_cmd}= Catenate SEPARATOR= |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 139 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep ETH_TYPE:ipv4 | |
| 140 | ... grep IP_PROTO:17 | grep UDP_SRC:68 | grep UDP_DST:67 | grep VLAN_VID:${c_tag} | |
| 141 | ... grep OUTPUT:CONTROLLER |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 142 | ${upstream_flow_ipv4_added}= Execute ONOS CLI Command ${ip} ${port} |
| 143 | ... ${upstream_flow_ipv4_cmd} |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 144 | Should Not Be Empty ${upstream_flow_ipv4_added} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 145 | # Verify ipv4 dhcp downstream flow |
| 146 | # Note: This flow will be one per nni per olt |
| 147 | ${downstream_flow_ipv4_cmd}= Catenate SEPARATOR= |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 148 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep ETH_TYPE:ipv4 | |
| 149 | ... 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] | 150 | ${downstream_flow_ipv4_added}= Execute ONOS CLI Command ${ip} ${port} |
| 151 | ... ${downstream_flow_ipv4_cmd} |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 152 | Should Not Be Empty ${downstream_flow_ipv4_added} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 153 | |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 154 | Verify Subscriber Access Flows Added for ONU DT |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 155 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${s_tag} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 156 | [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU |
| 157 | # Verify upstream table=0 flow |
| 158 | ${upstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 159 | ... 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] | 160 | Should Not Be Empty ${upstream_flow_0_added} |
| 161 | # Verify upstream table=1 flow |
| 162 | ${flow_vlan_push_cmd}= Catenate SEPARATOR= |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 163 | ... 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] | 164 | ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port} |
| 165 | ${upstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
| 166 | ... ${flow_vlan_push_cmd} |
| 167 | Should Not Be Empty ${upstream_flow_1_added} |
| 168 | # Verify downstream table=0 flow |
| 169 | ${flow_vlan_pop_cmd}= Catenate SEPARATOR= |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 170 | ... 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] | 171 | ... grep VLAN_POP | grep transition=TABLE:1 |
| 172 | ${downstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
| 173 | ... ${flow_vlan_pop_cmd} |
| 174 | Should Not Be Empty ${downstream_flow_0_added} |
| 175 | # Verify downstream table=1 flow |
| 176 | ${downstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 177 | ... 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] | 178 | Should Not Be Empty ${downstream_flow_1_added} |
| 179 | |
| 180 | Verify Subscriber Access Flows Added Count DT |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 181 | [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 182 | [Documentation] Matches for total number of subscriber access flows added for all onus |
| 183 | ${access_flows_added}= Execute ONOS CLI Command ${ip} ${port} |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 184 | ... 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] | 185 | Should Be Equal As Integers ${access_flows_added} ${expected_flows} |
| 186 | |
Hardik Windlass | 480f3e2 | 2020-04-02 20:14:14 +0530 | [diff] [blame] | 187 | Verify Device Flows Removed |
| 188 | [Arguments] ${ip} ${port} ${olt_of_id} |
| 189 | [Documentation] Verifies all flows are removed from the device |
| 190 | ${device_flows}= Execute ONOS CLI Command ${ip} ${port} |
| 191 | ... flows -s -f ${olt_of_id} | grep -v deviceId | wc -l |
| 192 | Should Be Equal As Integers ${device_flows} 0 |
| 193 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 194 | Verify Eapol Flows Added |
Andy Bavier | b0c0623 | 2019-08-29 12:58:53 -0700 | [diff] [blame] | 195 | [Arguments] ${ip} ${port} ${expected_flows} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 196 | [Documentation] Matches for number of eapol flows based on number of onus |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 197 | ${eapol_flows_added}= Execute ONOS CLI Command ${ip} ${port} |
| 198 | ... flows -s -f ADDED | grep eapol | grep IN_PORT | wc -l |
Andy Bavier | b0c0623 | 2019-08-29 12:58:53 -0700 | [diff] [blame] | 199 | Should Contain ${eapol_flows_added} ${expected_flows} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 200 | |
Suchitra Vemuri | 9da4430 | 2020-03-04 14:24:49 -0800 | [diff] [blame] | 201 | Verify No Pending Flows For ONU |
| 202 | [Arguments] ${ip} ${port} ${onu_port} |
| 203 | [Documentation] Verifies that there are no flows "PENDING" state for the ONU in ONOS |
| 204 | ${pending_flows}= Execute ONOS CLI Command ${ip} ${port} |
| 205 | ... flows -s | grep IN_PORT:${onu_port} | grep PENDING |
| 206 | Should Be Empty ${pending_flows} |
| 207 | |
Suchitra Vemuri | 3dd2f83 | 2019-10-18 13:14:54 -0700 | [diff] [blame] | 208 | Verify Eapol Flows Added For ONU |
| 209 | [Arguments] ${ip} ${port} ${onu_port} |
| 210 | [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] | 211 | ${eapol_flows_added}= Execute ONOS CLI Command ${ip} ${port} |
| 212 | ... flows -s -f ADDED | grep eapol | grep IN_PORT:${onu_port} |
Suchitra Vemuri | 3dd2f83 | 2019-10-18 13:14:54 -0700 | [diff] [blame] | 213 | Should Not Be Empty ${eapol_flows_added} |
| 214 | |
Suchitra Vemuri | 8078b97 | 2020-02-06 19:07:41 -0800 | [diff] [blame] | 215 | Verify ONU Port Is Enabled |
| 216 | [Arguments] ${ip} ${port} ${onu_port} |
| 217 | [Documentation] Verifies if the ONU port is enabled in ONOS |
| 218 | ${onu_port_enabled}= Execute ONOS CLI Command ${ip} ${port} |
Suchitra Vemuri | 8e15ead | 2020-02-07 14:41:50 -0800 | [diff] [blame] | 219 | ... ports -e | grep port=${onu_port} |
Suchitra Vemuri | 8078b97 | 2020-02-06 19:07:41 -0800 | [diff] [blame] | 220 | Log ${onu_port_enabled} |
| 221 | Should Not Be Empty ${onu_port_enabled} |
| 222 | |
Hardik Windlass | 63d5e00 | 2020-03-06 21:07:09 +0530 | [diff] [blame] | 223 | Verify ONU Port Is Disabled |
| 224 | [Arguments] ${ip} ${port} ${onu_port} |
| 225 | [Documentation] Verifies if the ONU port is disabled in ONOS |
| 226 | ${onu_port_disabled}= Execute ONOS CLI Command ${ip} ${port} |
| 227 | ... ports -e | grep port=${onu_port} |
| 228 | Log ${onu_port_disabled} |
| 229 | Should Be Empty ${onu_port_disabled} |
| 230 | |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 231 | Verify ONU in AAA-Users |
| 232 | [Arguments] ${ip} ${port} ${onu_port} |
| 233 | [Documentation] Verifies that the specified onu_port exists in aaa-users output |
| 234 | ${aaa_users}= Execute ONOS CLI Command ${ip} ${port} aaa-users | grep AUTHORIZED | grep ${onu_port} |
| 235 | Should Not Be Empty ${aaa_users} ONU port ${onu_port} not found in aaa-users |
| 236 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 237 | Assert Number of AAA-Users |
Kailash | 2b963f0 | 2019-08-28 22:46:33 -0700 | [diff] [blame] | 238 | [Arguments] ${ip} ${port} ${expected_onus} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 239 | [Documentation] Matches for number of aaa-users authorized based on number of onus |
Kailash | 30c418f | 2019-09-11 13:50:10 -0700 | [diff] [blame] | 240 | ${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] | 241 | Should Be Equal As Integers ${aaa_users} ${expected_onus} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 242 | |
| 243 | Validate DHCP Allocations |
Kailash | 2b963f0 | 2019-08-28 22:46:33 -0700 | [diff] [blame] | 244 | [Arguments] ${ip} ${port} ${expected_onus} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 245 | [Documentation] Matches for number of dhcpacks based on number of onus |
Kailash | 30c418f | 2019-09-11 13:50:10 -0700 | [diff] [blame] | 246 | ${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] | 247 | Should Be Equal As Integers ${allocations} ${expected_onus} |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 248 | |
| 249 | Validate Subscriber DHCP Allocation |
| 250 | [Arguments] ${ip} ${port} ${onu_port} |
| 251 | [Documentation] Verifies that the specified subscriber is found in DHCP allocations |
| 252 | ##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] | 253 | ${allocations}= Execute ONOS CLI Command ${ip} ${port} |
| 254 | ... dhcpl2relay-allocations | grep DHCPACK | grep ${onu_port} |
| 255 | 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] | 256 | |
| 257 | Device Is Available In ONOS |
| 258 | [Arguments] ${url} ${dpid} |
| 259 | [Documentation] Validates the device exists and it available in ONOS |
| 260 | ${rc} ${json} Run And Return Rc And Output curl --fail -sSL ${url}/onos/v1/devices/${dpid} |
| 261 | Should Be Equal As Integers 0 ${rc} |
| 262 | ${rc} ${value} Run And Return Rc And Output echo '${json}' | jq -r .available |
| 263 | Should Be Equal As Integers 0 ${rc} |
| 264 | Should Be Equal 'true' '${value}' |
| 265 | |
| 266 | Remove All Devices From ONOS |
| 267 | [Arguments] ${url} |
| 268 | [Documentation] Executes the device-remove command on each device in ONOS |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 269 | ${rc} @{dpids} Run And Return Rc And Output |
| 270 | ... curl --fail -sSL ${url}/onos/v1/devices | jq -r '.devices[].id' |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 271 | Should Be Equal As Integers ${rc} 0 |
| 272 | ${count}= Get length ${dpids} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 273 | FOR ${dpid} IN @{dpids} |
| 274 | ${rc}= Run Keyword If '${dpid}' != '' |
| 275 | ... Run And Return Rc curl -XDELETE --fail -sSL ${url}/onos/v1/devices/${dpid} |
| 276 | Run Keyword If '${dpid}' != '' |
| 277 | ... Should Be Equal As Integers ${rc} 0 |
| 278 | END |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 279 | |
| 280 | Assert Ports in ONOS |
| 281 | [Arguments] ${ip} ${port} ${count} ${filter} |
| 282 | [Documentation] Check that a certain number of ports are enabled in ONOS |
| 283 | ${ports}= Execute ONOS CLI Command ${ip} ${port} |
| 284 | ... ports -e | grep ${filter} | wc -l |
| 285 | Should Be Equal As Integers ${ports} ${count} |
| 286 | |
| 287 | Wait for Ports in ONOS |
| 288 | [Arguments] ${ip} ${port} ${count} ${filter} |
| 289 | [Documentation] Waits untill a certain number of ports are enabled in ONOS |
| 290 | Wait Until Keyword Succeeds 10m 5s Assert Ports in ONOS ${ip} ${port} ${count} ${filter} |
| 291 | |
| 292 | Wait for AAA Authentication |
| 293 | [Arguments] ${ip} ${port} ${count} |
| 294 | [Documentation] Waits untill a certain number of subscribers are authenticated in ONOS |
| 295 | Wait Until Keyword Succeeds 10m 5s Assert Number of AAA-Users ${ip} ${port} ${count} |
| 296 | |
| 297 | Wait for DHCP Ack |
| 298 | [Arguments] ${ip} ${port} ${count} |
| 299 | [Documentation] Waits untill a certain number of subscribers have received a DHCP_ACK |
| 300 | Wait Until Keyword Succeeds 10m 5s Validate DHCP Allocations ${ip} ${port} ${count} |
| 301 | |
| 302 | Provision subscriber |
| 303 | [Documentation] Calls volt-add-subscriber-access in ONOS |
| 304 | [Arguments] ${onos_ip} ${onos_port} ${of_id} ${onu_port} |
| 305 | Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 306 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 307 | |
| 308 | List Enabled UNI Ports |
| 309 | [Documentation] List all the UNI Ports, the only way we have is to filter out the one called NNI |
| 310 | ... Creates a list of dictionaries |
| 311 | [Arguments] ${onos_ip} ${onos_port} ${of_id} |
| 312 | [Return] [{'port': '16', 'of_id': 'of:00000a0a0a0a0a00'}, {'port': '32', 'of_id': 'of:00000a0a0a0a0a00'}] |
| 313 | ${result}= Create List |
| 314 | ${out}= Execute ONOS CLI Command ${onos_ip} ${onos_port} |
| 315 | ... ports -e ${of_id} | grep -v SWITCH | grep -v nni |
| 316 | @{unis}= Split To Lines ${out} |
| 317 | FOR ${uni} IN @{unis} |
| 318 | ${matches} = Get Regexp Matches ${uni} .*port=([0-9]+),.* 1 |
| 319 | &{portDict} Create Dictionary of_id=${of_id} port=${matches[0]} |
| 320 | Append To List ${result} ${portDict} |
| 321 | END |
| 322 | Log ${result} |
| 323 | Return From Keyword ${result} |
| 324 | |
| 325 | Provision all subscribers on device |
| 326 | [Documentation] Calls volt-add-subscriber-access in ONOS for all the enabled UNI ports on a partivular device |
| 327 | [Arguments] ${onos_ip} ${onos_port} ${of_id} |
| 328 | ${unis}= List Enabled UNI Ports ${onos_ip} ${onos_port} ${of_id} |
| 329 | FOR ${uni} IN @{unis} |
| 330 | Provision subscriber ${onos_ip} ${onos_port} ${uni['of_id']} ${uni['port']} |
| 331 | END |
| 332 | |
| 333 | List OLTs |
| 334 | [Documentation] Returns a list of OLTs known to ONOS |
| 335 | [Arguments] ${onos_ip} ${onos_port} |
| 336 | [Return] ['of:00000a0a0a0a0a00', 'of:00000a0a0a0a0a01'] |
| 337 | ${result}= Create List |
| 338 | ${out}= Execute ONOS CLI Command ${onos_ip} ${onos_port} |
| 339 | ... volt-olts |
| 340 | @{olts}= Split To Lines ${out} |
| 341 | FOR ${olt} IN @{olts} |
| 342 | Log ${olt} |
| 343 | ${matches} = Get Regexp Matches ${olt} ^OLT (.+)$ 1 |
| 344 | # there may be some logs mixed with the output so only append if we have a match |
| 345 | ${matches_length}= Get Length ${matches} |
| 346 | Run Keyword If ${matches_length}==1 |
| 347 | ... Append To List ${result} ${matches[0]} |
| 348 | END |
| 349 | Return From Keyword ${result} |
| 350 | |
| 351 | Count ADDED flows |
| 352 | [Documentation] Count the flows in ADDED state in ONOS |
| 353 | [Arguments] ${onos_ip} ${onos_port} ${targetFlows} |
| 354 | ${flows}= Execute ONOS CLI Command ${onos_ip} ${onos_port} |
| 355 | ... flows -s | grep ADDED | wc -l |
| 356 | Should Be Equal As Integers ${targetFlows} ${flows} |
| 357 | |
| 358 | Wait for all flows to in ADDED state |
| 359 | [Documentation] Waits until the flows have been provisioned |
| 360 | [Arguments] ${onos_ip} ${onos_port} ${workflow} ${uni_count} ${olt_count} ${provisioned} |
| 361 | ${targetFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned} |
| 362 | Wait Until Keyword Succeeds 10m 5s Count ADDED flows |
| 363 | ... ${onos_ip} ${onos_port} ${targetFlows} |