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