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 | |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 27 | *** Variables *** |
| 28 | @{connection_list} |
| 29 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 30 | *** Keywords *** |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 31 | |
| 32 | Open ONOS SSH Connection |
| 33 | [Documentation] Establishes an ssh connection to ONOS contoller |
| 34 | [Arguments] ${host} ${port} ${user}=karaf ${pass}=karaf |
| 35 | ${conn_id}= SSHLibrary.Open Connection ${host} port=${port} timeout=300s alias=ONOS_SSH |
| 36 | SSHLibrary.Login ${user} ${pass} |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 37 | ${conn_list_entry}= Create Dictionary conn_id=${conn_id} user=${user} pass=${pass} |
| 38 | Append To List ${connection_list} ${conn_list_entry} |
| 39 | ${conn_list_id}= Get Index From List ${connection_list} ${conn_list_entry} |
| 40 | Set Global Variable ${connection_list} |
| 41 | [Return] ${conn_list_id} |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 42 | |
| 43 | Execute ONOS CLI Command on open connection |
| 44 | [Documentation] Execute ONOS CLI Command On an Open Connection |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 45 | [Arguments] ${connection_list_id} ${cmd} |
| 46 | ${connection_entry}= Get From List ${connection_list} ${connection_list_id} |
| 47 | SSHLibrary.Switch Connection ${connection_entry.conn_id} |
| 48 | ${PassOrFail} @{result_values} Run Keyword And Ignore Error SSHLibrary.Execute Command ${cmd} |
| 49 | ... return_rc=True return_stderr=True return_stdout=True |
| 50 | Run Keyword If '${PassOrFail}'=='FAIL' Reconnect ONOS SSH Connection ${connection_list_id} |
| 51 | @{result_values}= Run Keyword If '${PassOrFail}'=='FAIL' |
| 52 | ... SSHLibrary.Execute Command ${cmd} return_rc=True return_stderr=True return_stdout=True |
| 53 | ... ELSE Set Variable @{result_values} |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 54 | ${output} Set Variable @{result_values}[0] |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 55 | Log Command output: ${output} |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 56 | Should Be Empty @{result_values}[1] |
| 57 | Should Be Equal As Integers @{result_values}[2] 0 |
| 58 | [Return] ${output} |
| 59 | |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 60 | Reconnect ONOS SSH Connection |
| 61 | [Documentation] Reconnect an SSH Connection |
| 62 | [Arguments] ${connection_list_id} |
| 63 | ${connection_entry}= Get From List ${connection_list} ${connection_list_id} |
| 64 | ${user}= Get From Dictionary ${connection_entry} user |
| 65 | ${pass}= Get From Dictionary ${connection_entry} pass |
| 66 | ${oldconndata}= Get Connection ${connection_entry.conn_id} |
| 67 | SSHLibrary.Switch Connection ${connection_entry.conn_id} |
TorstenThieme | bcf1461 | 2021-01-27 10:19:18 +0000 | [diff] [blame] | 68 | Run Keyword And Ignore Error SSHLibrary.Close Connection |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 69 | ${conn_id}= SSHLibrary.Open Connection ${oldconndata.host} port=${oldconndata.port} |
| 70 | ... timeout=300s alias=ONOS_SSH |
| 71 | SSHLibrary.Login ${user} ${pass} |
| 72 | ${conn_list_entry}= Create Dictionary conn_id=${conn_id} user=${user} pass=${pass} |
| 73 | Set List Value ${connection_list} ${connection_list_id} ${conn_list_entry} |
| 74 | Set Global Variable ${connection_list} |
| 75 | |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 76 | Close ONOS SSH Connection |
| 77 | [Documentation] Close an SSH Connection |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 78 | [Arguments] ${connection_list_id} |
| 79 | ${connection_entry}= Get From List ${connection_list} ${connection_list_id} |
| 80 | ${connection_alias}= Get From Dictionary ${connection_entry} conn_id |
| 81 | ${oldconndata}= Get Connection ${connection_entry.conn_id} |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 82 | SSHLibrary.Switch Connection ${connection_alias} |
TorstenThieme | bcf1461 | 2021-01-27 10:19:18 +0000 | [diff] [blame] | 83 | Run Keyword And Ignore Error SSHLibrary.Close Connection |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 84 | Remove From List ${connection_list} ${connection_list_id} |
| 85 | Set Global Variable ${connection_list} |
| 86 | |
| 87 | Close All ONOS SSH Connections |
| 88 | [Documentation] Close all SSH Connection and clear connection list. |
| 89 | SSHLibrary.Close All Connections |
| 90 | @{connection_list} Create List |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 91 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 92 | Validate OLT Device in ONOS |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 93 | # FIXME use volt-olts to check that the OLT is ONOS |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 94 | [Arguments] ${serial_number} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 95 | [Documentation] Checks if olt has been connected to ONOS |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 96 | ${resp}= Get Request ONOS onos/v1/devices |
| 97 | ${jsondata}= To Json ${resp.content} |
| 98 | Should Not Be Empty ${jsondata['devices']} |
| 99 | ${length}= Get Length ${jsondata['devices']} |
| 100 | @{serial_numbers}= Create List |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 101 | ${matched}= Set Variable False |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 102 | FOR ${INDEX} IN RANGE 0 ${length} |
| 103 | ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 104 | ${of_id}= Get From Dictionary ${value} id |
| 105 | ${sn}= Get From Dictionary ${value} serial |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 106 | ${matched}= Set Variable If '${sn}' == '${serial_number}' True False |
| 107 | Exit For Loop If ${matched} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 108 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 109 | Should Be True ${matched} No match for ${serial_number} found |
Kailash | 57210eb | 2019-08-30 13:27:19 -0700 | [diff] [blame] | 110 | [Return] ${of_id} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 111 | |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 112 | Get ONU Port in ONOS |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 113 | [Arguments] ${onu_serial_number} ${olt_of_id} |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 114 | [Documentation] Retrieves ONU port for the ONU in ONOS |
Suchitra Vemuri | a50c1c1 | 2019-09-30 19:54:26 -0700 | [diff] [blame] | 115 | ${onu_serial_number}= Catenate SEPARATOR=- ${onu_serial_number} 1 |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 116 | ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports |
| 117 | ${jsondata}= To Json ${resp.content} |
| 118 | Should Not Be Empty ${jsondata['ports']} |
| 119 | ${length}= Get Length ${jsondata['ports']} |
| 120 | @{ports}= Create List |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 121 | ${matched}= Set Variable False |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 122 | FOR ${INDEX} IN RANGE 0 ${length} |
| 123 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 124 | ${annotations}= Get From Dictionary ${value} annotations |
| 125 | ${onu_port}= Get From Dictionary ${value} port |
| 126 | ${portName}= Get From Dictionary ${annotations} portName |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 127 | ${matched}= Set Variable If '${portName}' == '${onu_serial_number}' True False |
| 128 | Exit For Loop If ${matched} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 129 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 130 | Should Be True ${matched} No match for ${onu_serial_number} found |
Suchitra Vemuri | 102912a | 2019-09-24 00:35:42 -0700 | [diff] [blame] | 131 | [Return] ${onu_port} |
| 132 | |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 133 | Get NNI Port in ONOS |
| 134 | [Arguments] ${olt_of_id} |
| 135 | [Documentation] Retrieves NNI port for the OLT in ONOS |
| 136 | ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports |
| 137 | ${jsondata}= To Json ${resp.content} |
| 138 | Should Not Be Empty ${jsondata['ports']} |
| 139 | ${length}= Get Length ${jsondata['ports']} |
| 140 | @{ports}= Create List |
| 141 | ${matched}= Set Variable False |
| 142 | FOR ${INDEX} IN RANGE 0 ${length} |
| 143 | ${value}= Get From List ${jsondata['ports']} ${INDEX} |
| 144 | ${annotations}= Get From Dictionary ${value} annotations |
| 145 | ${nni_port}= Get From Dictionary ${value} port |
| 146 | ${nniPortName}= Catenate SEPARATOR= nni- ${nni_port} |
| 147 | ${portName}= Get From Dictionary ${annotations} portName |
| 148 | ${matched}= Set Variable If '${portName}' == '${nniPortName}' True False |
| 149 | Exit For Loop If ${matched} |
| 150 | END |
| 151 | Should Be True ${matched} No match for NNI found for ${olt_of_id} |
| 152 | [Return] ${nni_port} |
| 153 | |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 154 | Get FabricSwitch in ONOS |
| 155 | [Documentation] Returns of_id of the Fabric Switch in ONOS |
| 156 | ${resp}= Get Request ONOS onos/v1/devices |
| 157 | ${jsondata}= To Json ${resp.content} |
| 158 | Should Not Be Empty ${jsondata['devices']} |
| 159 | ${length}= Get Length ${jsondata['devices']} |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 160 | ${matched}= Set Variable False |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 161 | FOR ${INDEX} IN RANGE 0 ${length} |
| 162 | ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 163 | ${of_id}= Get From Dictionary ${value} id |
| 164 | ${type}= Get From Dictionary ${value} type |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 165 | ${matched}= Set Variable If '${type}' == "SWITCH" True False |
| 166 | Exit For Loop If ${matched} |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 167 | END |
Andy Bavier | b63f6d2 | 2020-03-12 15:34:37 -0700 | [diff] [blame] | 168 | Should Be True ${matched} No fabric switch found |
Suchitra Vemuri | 532f67a | 2019-09-25 11:50:42 -0700 | [diff] [blame] | 169 | [Return] ${of_id} |
| 170 | |
Andrea Campanella | 4c40463 | 2020-08-26 14:41:36 +0200 | [diff] [blame] | 171 | Get Master Instace in ONOS |
| 172 | [Arguments] ${of_id} |
| 173 | [Documentation] Returns nodeId of the Master instace for a giver device in ONOS |
| 174 | ${resp}= Get Request ONOS onos/v1/mastership/${of_id}/master |
| 175 | ${jsondata}= To Json ${resp.content} |
| 176 | Should Not Be Empty ${jsondata['nodeId']} |
| 177 | ${master_node}= Get From Dictionary ${jsondata} nodeId |
| 178 | [Return] ${master_node} |
| 179 | |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 180 | Verify Subscriber Access Flows Added for ONU |
| 181 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${c_tag} ${s_tag} |
| 182 | [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU |
| 183 | # Verify upstream table=0 flow |
| 184 | ${upstream_flow_0_cmd}= Catenate SEPARATOR= |
| 185 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:0 | |
| 186 | ... grep VLAN_ID:${c_tag} | grep transition=TABLE:1 |
| 187 | ${upstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
| 188 | ... ${upstream_flow_0_cmd} |
| 189 | Should Not Be Empty ${upstream_flow_0_added} |
| 190 | # Verify upstream table=1 flow |
| 191 | ${flow_vlan_push_cmd}= Catenate SEPARATOR= |
| 192 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:${c_tag} | |
| 193 | ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port} |
| 194 | ${upstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
| 195 | ... ${flow_vlan_push_cmd} |
| 196 | Should Not Be Empty ${upstream_flow_1_added} |
| 197 | # Verify downstream table=0 flow |
| 198 | ${flow_vlan_pop_cmd}= Catenate SEPARATOR= |
| 199 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${s_tag} | |
| 200 | ... grep VLAN_POP | grep transition=TABLE:1 |
| 201 | ${downstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
| 202 | ... ${flow_vlan_pop_cmd} |
| 203 | Should Not Be Empty ${downstream_flow_0_added} |
| 204 | # Verify downstream table=1 flow |
| 205 | ${downstream_flow_1_cmd}= Catenate SEPARATOR= |
| 206 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${c_tag} | |
| 207 | ... grep VLAN_ID:0 | grep OUTPUT:${onu_port} |
| 208 | ${downstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
| 209 | ... ${downstream_flow_1_cmd} |
| 210 | Should Not Be Empty ${downstream_flow_1_added} |
| 211 | # Verify ipv4 dhcp upstream flow |
| 212 | ${upstream_flow_ipv4_cmd}= Catenate SEPARATOR= |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 213 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep ETH_TYPE:ipv4 | |
Andrea Campanella | 08678e1 | 2020-09-18 17:40:22 +0200 | [diff] [blame] | 214 | ... grep IP_PROTO:17 | grep UDP_SRC:68 | grep UDP_DST:67 | grep VLAN_ID:${c_tag} | |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 215 | ... grep OUTPUT:CONTROLLER |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 216 | ${upstream_flow_ipv4_added}= Execute ONOS CLI Command ${ip} ${port} |
| 217 | ... ${upstream_flow_ipv4_cmd} |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 218 | Should Not Be Empty ${upstream_flow_ipv4_added} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 219 | # Verify ipv4 dhcp downstream flow |
| 220 | # Note: This flow will be one per nni per olt |
| 221 | ${downstream_flow_ipv4_cmd}= Catenate SEPARATOR= |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 222 | ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep ETH_TYPE:ipv4 | |
| 223 | ... 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] | 224 | ${downstream_flow_ipv4_added}= Execute ONOS CLI Command ${ip} ${port} |
| 225 | ... ${downstream_flow_ipv4_cmd} |
Andrea Campanella | 5e9051c | 2020-04-30 14:38:35 +0200 | [diff] [blame] | 226 | Should Not Be Empty ${downstream_flow_ipv4_added} |
Hardik Windlass | 2180763 | 2020-04-14 16:24:55 +0530 | [diff] [blame] | 227 | |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 228 | Verify Subscriber Access Flows Added for ONU DT |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 229 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${s_tag} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 230 | [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU |
| 231 | # Verify upstream table=0 flow |
| 232 | ${upstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 233 | ... 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] | 234 | Should Not Be Empty ${upstream_flow_0_added} |
| 235 | # Verify upstream table=1 flow |
| 236 | ${flow_vlan_push_cmd}= Catenate SEPARATOR= |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 237 | ... 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] | 238 | ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port} |
| 239 | ${upstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
| 240 | ... ${flow_vlan_push_cmd} |
| 241 | Should Not Be Empty ${upstream_flow_1_added} |
| 242 | # Verify downstream table=0 flow |
| 243 | ${flow_vlan_pop_cmd}= Catenate SEPARATOR= |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 244 | ... 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] | 245 | ... grep VLAN_POP | grep transition=TABLE:1 |
| 246 | ${downstream_flow_0_added}= Execute ONOS CLI Command ${ip} ${port} |
| 247 | ... ${flow_vlan_pop_cmd} |
| 248 | Should Not Be Empty ${downstream_flow_0_added} |
| 249 | # Verify downstream table=1 flow |
| 250 | ${downstream_flow_1_added}= Execute ONOS CLI Command ${ip} ${port} |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 251 | ... 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] | 252 | Should Not Be Empty ${downstream_flow_1_added} |
| 253 | |
| 254 | Verify Subscriber Access Flows Added Count DT |
Hardik Windlass | 25e1170 | 2020-03-30 20:05:19 +0530 | [diff] [blame] | 255 | [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows} |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 256 | [Documentation] Matches for total number of subscriber access flows added for all onus |
| 257 | ${access_flows_added}= Execute ONOS CLI Command ${ip} ${port} |
Girish Gowdra | 89f7377 | 2021-03-08 14:29:36 -0800 | [diff] [blame] | 258 | ... flows -s ADDED ${olt_of_id} | grep -v deviceId | grep -v ETH_TYPE:lldp | grep -v ETH_TYPE:arp | wc -l |
Hardik Windlass | fb5eace | 2020-03-26 14:49:01 +0530 | [diff] [blame] | 259 | Should Be Equal As Integers ${access_flows_added} ${expected_flows} |
| 260 | |
Huseyin Ahmet AYDIN | 45922c8 | 2021-05-27 12:37:32 +0000 | [diff] [blame] | 261 | Verify Added Flow Count for OLT TT |
| 262 | [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows} |
| 263 | [Documentation] Total number of added flows given OLT with subscriber flows |
| 264 | ${access_flows_added}= Execute ONOS CLI Command ${ip} ${port} |
| 265 | ... flows -s ADDED ${olt_of_id} | grep -v deviceId | wc -l |
| 266 | Should Be Equal As Integers ${access_flows_added} ${expected_flows} |
| 267 | |
Emrehan UZUN | 2884ed5 | 2021-05-04 15:36:31 +0000 | [diff] [blame] | 268 | Verify Default Downstream Flows are added in ONOS for OLT TT |
| 269 | [Arguments] ${ip} ${port} ${olt_of_id} ${nni_port} |
| 270 | [Documentation] Verifies if the Default Downstream Flows are added in ONOS for the OLT |
| 271 | # Verify lldp flow |
| 272 | ${downstream_flow_lldp_cmd}= Catenate SEPARATOR= |
| 273 | ... flows -s ADDED ${olt_of_id} | grep lldp | |
| 274 | ... grep OUTPUT:CONTROLLER |
| 275 | ${downstream_flow_lldp_added}= Execute ONOS CLI Command ${ip} ${port} |
| 276 | ... ${downstream_flow_lldp_cmd} |
| 277 | Should Not Be Empty ${downstream_flow_lldp_added} |
| 278 | # Verify downstream dhcp flow |
| 279 | ${downstream_flow_dhcp_cmd}= Catenate SEPARATOR= |
| 280 | ... flows -s ADDED ${olt_of_id} | grep IP_PROTO:17 | grep UDP_SRC:67 | grep UDP_DST:68 | |
| 281 | ... grep OUTPUT:CONTROLLER |
| 282 | ${downstream_flow_dhcp_added}= Execute ONOS CLI Command ${ip} ${port} |
| 283 | ... ${downstream_flow_dhcp_cmd} |
| 284 | Should Not Be Empty ${downstream_flow_dhcp_added} |
| 285 | # Verify downstream igmp flow |
| 286 | ${downstream_flow_igmp_cmd}= Catenate SEPARATOR= |
| 287 | ... flows -s ADDED ${olt_of_id} | grep IP_PROTO:2 | |
| 288 | ... grep OUTPUT:CONTROLLER |
| 289 | ${downstream_flow_igmp_added}= Execute ONOS CLI Command ${ip} ${port} |
| 290 | ... ${downstream_flow_igmp_cmd} |
| 291 | Should Not Be Empty ${downstream_flow_igmp_added} |
| 292 | |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 293 | Get Programmed Subscribers |
| 294 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} |
| 295 | [Documentation] Retrieves the subscriber details at a given location |
| 296 | ${sub_location}= Catenate SEPARATOR=/ ${olt_of_id} ${onu_port} |
| 297 | ${programmed_sub}= Execute ONOS CLI Command ${ip} ${port} |
| 298 | ... volt-programmed-subscribers | grep ${sub_location} |
| 299 | [Return] ${programmed_sub} |
| 300 | |
| 301 | Get Upstream and Downstream Bandwidth Profile Name |
| 302 | [Arguments] ${programmed_sub} |
| 303 | [Documentation] Retrieves the upstream and downstream bandwidth profile name |
| 304 | ... from the programmed subscriber |
| 305 | @{programmed_sub_array}= Split String ${programmed_sub} , |
| 306 | # Get upstream bandwidth profile name for the subscriber |
| 307 | @{param_val_pair}= Split String ${programmed_sub_array[9]} = |
| 308 | ${programmed_sub_param}= Set Variable ${param_val_pair[0]} |
| 309 | ${programmed_sub_val}= Set Variable ${param_val_pair[1]} |
| 310 | ${us_bw_profile}= Run Keyword If '${programmed_sub_param}' == ' upstreamBandwidthProfile' |
| 311 | ... Set Variable ${programmed_sub_val} |
| 312 | Log ${us_bw_profile} |
| 313 | # Get downstream bandwidth profile name for the subscriber |
| 314 | @{param_val_pair}= Split String ${programmed_sub_array[10]} = |
| 315 | ${programmed_sub_param}= Set Variable ${param_val_pair[0]} |
| 316 | ${programmed_sub_val}= Set Variable ${param_val_pair[1]} |
| 317 | ${ds_bw_profile}= Run Keyword If '${programmed_sub_param}' == ' downstreamBandwidthProfile' |
| 318 | ... Set Variable ${programmed_sub_val} |
| 319 | Log ${ds_bw_profile} |
| 320 | [Return] ${us_bw_profile} ${ds_bw_profile} |
| 321 | |
| 322 | Get Bandwidth Profile Details |
| 323 | [Arguments] ${ip} ${port} ${bw_profile} |
| 324 | [Documentation] Retrieves the details of the given bandwidth profile |
| 325 | ${bw_profile_values}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 326 | ... bandwidthprofile ${bw_profile} |
| 327 | @{bw_profile_array}= Split String ${bw_profile_values} , |
| 328 | @{param_val_pair}= Split String ${bw_profile_array[1]} = |
| 329 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 330 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 331 | ${cir} Run Keyword If '${bw_param}' == ' committedInformationRate' |
| 332 | ... Set Variable ${bw_val} |
| 333 | @{param_val_pair}= Split String ${bw_profile_array[2]} = |
| 334 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 335 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 336 | ${cbs} Run Keyword If '${bw_param}' == ' committedBurstSize' |
| 337 | ... Set Variable ${bw_val} |
| 338 | @{param_val_pair}= Split String ${bw_profile_array[3]} = |
| 339 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 340 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 341 | ${eir} Run Keyword If '${bw_param}' == ' exceededInformationRate' |
| 342 | ... Set Variable ${bw_val} |
| 343 | @{param_val_pair}= Split String ${bw_profile_array[4]} = |
| 344 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 345 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 346 | ${ebs} Run Keyword If '${bw_param}' == ' exceededBurstSize' |
| 347 | ... Set Variable ${bw_val} |
| 348 | @{param_val_pair}= Split String ${bw_profile_array[5]} = |
| 349 | ${bw_param}= Set Variable ${param_val_pair[0]} |
| 350 | ${bw_val}= Set Variable ${param_val_pair[1]} |
| 351 | @{bw_val_air}= Split String ${bw_val} } |
| 352 | ${air} Run Keyword If '${bw_param}' == ' assuredInformationRate' |
| 353 | ... Set Variable ${bw_val_air[0]} |
| 354 | [Return] ${cir} ${cbs} ${eir} ${ebs} ${air} |
| 355 | |
Hardik Windlass | ba5add4 | 2021-05-04 12:41:29 +0000 | [diff] [blame] | 356 | Get Bandwidth Profile Details Rest |
| 357 | [Arguments] ${bw_profile_id} |
| 358 | [Documentation] Retrieves the details of the given bandwidth profile using REST API |
Girish Gowdra | cb8482a | 2021-05-27 09:06:13 -0700 | [diff] [blame] | 359 | ${bw_profile_id}= Remove String ${bw_profile_id} ' " |
Hardik Windlass | ba5add4 | 2021-05-04 12:41:29 +0000 | [diff] [blame] | 360 | ${resp}= Get Request ONOS onos/sadis/bandwidthprofile/${bw_profile_id} |
| 361 | ${jsondata}= To Json ${resp.content} |
| 362 | Should Not Be Empty ${jsondata['entry']} |
| 363 | ${length}= Get Length ${jsondata['entry']} |
| 364 | ${matched}= Set Variable False |
| 365 | FOR ${INDEX} IN RANGE 0 ${length} |
| 366 | ${value}= Get From List ${jsondata['entry']} ${INDEX} |
| 367 | ${bw_id}= Get From Dictionary ${value} id |
| 368 | ${matched}= Set Variable If '${bw_id}' == '${bw_profile_id}' True False |
| 369 | ${eir}= Get From Dictionary ${value} eir |
| 370 | ${ebs}= Get From Dictionary ${value} ebs |
| 371 | ${cir}= Get From Dictionary ${value} cir |
| 372 | ${cbs}= Get From Dictionary ${value} cbs |
| 373 | ${air}= Get From Dictionary ${value} air |
| 374 | Exit For Loop If ${matched} |
| 375 | END |
| 376 | Should Be True ${matched} No bandwidth profile found for id: ${bw_profile_id} |
| 377 | [Return] ${cir} ${cbs} ${eir} ${ebs} ${air} |
| 378 | |
Hardik Windlass | 841979a | 2021-05-25 05:30:27 +0000 | [diff] [blame] | 379 | Get Bandwidth Profile Details Ietf Rest |
| 380 | [Arguments] ${bw_profile_id} |
| 381 | [Documentation] Retrieves the details of the given Ietf standard based bandwidth profile using REST API |
| 382 | ${bw_profile_id}= Remove String ${bw_profile_id} ' " |
| 383 | ${resp}= Get Request ONOS onos/sadis/bandwidthprofile/${bw_profile_id} |
| 384 | ${jsondata}= To Json ${resp.content} |
| 385 | Should Not Be Empty ${jsondata['entry']} |
| 386 | ${length}= Get Length ${jsondata['entry']} |
| 387 | ${matched}= Set Variable False |
| 388 | FOR ${INDEX} IN RANGE 0 ${length} |
| 389 | ${value}= Get From List ${jsondata['entry']} ${INDEX} |
| 390 | ${bw_id}= Get From Dictionary ${value} id |
| 391 | ${matched}= Set Variable If '${bw_id}' == '${bw_profile_id}' True False |
| 392 | ${pir}= Get From Dictionary ${value} pir |
| 393 | ${pbs}= Get From Dictionary ${value} pbs |
| 394 | ${cir}= Get From Dictionary ${value} cir |
| 395 | ${cbs}= Get From Dictionary ${value} cbs |
| 396 | ${gir}= Get From Dictionary ${value} gir |
| 397 | Exit For Loop If ${matched} |
| 398 | END |
| 399 | Should Be True ${matched} No bandwidth profile found for id: ${bw_profile_id} |
| 400 | [Return] ${cir} ${cbs} ${pir} ${pbs} ${gir} |
| 401 | |
Girish Gowdra | 21ec25d | 2021-05-24 10:07:01 -0700 | [diff] [blame] | 402 | Verify Meters in ONOS Ietf |
| 403 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} |
| 404 | [Documentation] Verifies the meters with BW Ietf format (currently, DT workflow uses this format) |
| 405 | # Get programmed subscriber |
| 406 | ${programmed_sub}= Get Programmed Subscribers ${ip} ${port} |
| 407 | ... ${olt_of_id} ${onu_port} |
| 408 | Log ${programmed_sub} |
| 409 | ${us_bw_profile} ${ds_bw_profile} Get Upstream and Downstream Bandwidth Profile Name |
| 410 | ... ${programmed_sub} |
| 411 | # Get upstream bandwidth profile details |
| 412 | ${us_cir} ${us_cbs} ${us_pir} ${us_pbs} ${us_gir} Get Bandwidth Profile Details Ietf Rest |
| 413 | ... ${us_bw_profile} |
| 414 | # Verify meter for upstream bandwidth profile |
| 415 | ${us_meter_cmd}= Run Keyword If ${us_gir} != 0 Catenate SEPARATOR= |
| 416 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}" |
| 417 | ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | grep "rate=${us_gir}, burst-size=0" | wc -l |
| 418 | ... ELSE Catenate SEPARATOR= |
| 419 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}" |
| 420 | ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | wc -l |
| 421 | ${upstream_meter_added}= Execute ONOS CLI Command ${ip} ${port} |
| 422 | ... ${us_meter_cmd} |
| 423 | Should Be Equal As Integers ${upstream_meter_added} 1 |
| 424 | # Get downstream bandwidth profile details |
| 425 | ${ds_cir} ${ds_cbs} ${ds_pir} ${ds_pbs} ${ds_gir} Get Bandwidth Profile Details Ietf Rest |
| 426 | ... ${ds_bw_profile} |
| 427 | # Verify meter for downstream bandwidth profile |
| 428 | ${ds_meter_cmd}= Run Keyword If ${ds_gir} != 0 Catenate SEPARATOR= |
| 429 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}" |
| 430 | ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | grep "rate=${ds_gir}, burst-size=0" | wc -l |
| 431 | ... ELSE Catenate SEPARATOR= |
| 432 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}" |
| 433 | ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | wc -l |
| 434 | ${downstream_meter_added}= Execute ONOS CLI Command ${ip} ${port} |
| 435 | ... ${ds_meter_cmd} |
| 436 | Should Be Equal As Integers ${downstream_meter_added} 1 |
| 437 | |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 438 | Verify Meters in ONOS |
| 439 | [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} |
| 440 | [Documentation] Verifies the meters |
| 441 | # Get programmed subscriber |
| 442 | ${programmed_sub}= Get Programmed Subscribers ${ip} ${port} |
| 443 | ... ${olt_of_id} ${onu_port} |
| 444 | Log ${programmed_sub} |
| 445 | ${us_bw_profile} ${ds_bw_profile} Get Upstream and Downstream Bandwidth Profile Name |
| 446 | ... ${programmed_sub} |
| 447 | # Get upstream bandwidth profile details |
| 448 | ${us_cir} ${us_cbs} ${us_eir} ${us_ebs} ${us_air} Get Bandwidth Profile Details |
| 449 | ... ${ip} ${port} ${us_bw_profile} |
| 450 | Sleep 1s |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 451 | ${us_pbs}= Evaluate ${us_cbs}+${us_ebs} |
| 452 | ${us_pir}= Evaluate ${us_eir}+${us_cir}+${us_air} |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 453 | # Verify meter for upstream bandwidth profile |
| 454 | ${us_meter_cmd}= Catenate SEPARATOR= |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 455 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}" |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 456 | ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | grep "rate=${us_air}, burst-size=0" | wc -l |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 457 | ${upstream_meter_added}= Execute ONOS CLI Command ${ip} ${port} |
| 458 | ... ${us_meter_cmd} |
| 459 | Should Be Equal As Integers ${upstream_meter_added} 1 |
| 460 | Sleep 1s |
| 461 | # Get downstream bandwidth profile details |
| 462 | ${ds_cir} ${ds_cbs} ${ds_eir} ${ds_ebs} ${ds_air} Get Bandwidth Profile Details |
| 463 | ... ${ip} ${port} ${ds_bw_profile} |
| 464 | Sleep 1s |
| 465 | # Verify meter for downstream bandwidth profile |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 466 | ${ds_pbs}= Evaluate ${ds_cbs}+${ds_ebs} |
| 467 | ${ds_pir}= Evaluate ${ds_eir}+${ds_cir}+${ds_air} |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 468 | ${ds_meter_cmd}= Catenate SEPARATOR= |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 469 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}" |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 470 | ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | grep "rate=${ds_air}, burst-size=0" | wc -l |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 471 | ${downstream_meter_added}= Execute ONOS CLI Command ${ip} ${port} |
| 472 | ... ${ds_meter_cmd} |
| 473 | Should Be Equal As Integers ${downstream_meter_added} 1 |
| 474 | |
| 475 | Verify Default Meter Present in ONOS |
| 476 | [Arguments] ${ip} ${port} ${olt_of_id} |
| 477 | [Documentation] Verifies the single default meter entry is present |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 478 | # Get default bandwidth profile details |
| 479 | ${cir} ${cbs} ${eir} ${ebs} ${air} Get Bandwidth Profile Details |
| 480 | ... ${ip} ${port} 'Default' |
| 481 | Sleep 1s |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 482 | ${pbs}= Evaluate ${cbs}+${ebs} |
| 483 | ${pir}= Evaluate ${eir}+${cir}+${air} |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 484 | # Verify meter for default bandwidth profile |
| 485 | ${meter_cmd}= Catenate SEPARATOR= |
| 486 | ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${cir}, burst-size=${cbs}" |
Andrea Campanella | 2b36710 | 2021-05-04 19:33:46 +0200 | [diff] [blame] | 487 | ... | grep "rate=${pir}, burst-size=${pbs}" | grep "rate=${air}, burst-size=0" | wc -l |
Hardik Windlass | e380bdb | 2020-07-30 19:09:25 +0530 | [diff] [blame] | 488 | ${default_meter_added}= Execute ONOS CLI Command ${ip} ${port} |
| 489 | ... ${meter_cmd} |
| 490 | Should Be Equal As Integers ${default_meter_added} 1 |
Hardik Windlass | 2a9b159 | 2020-07-23 18:28:13 +0530 | [diff] [blame] | 491 | |
Hardik Windlass | 480f3e2 | 2020-04-02 20:14:14 +0530 | [diff] [blame] | 492 | Verify Device Flows Removed |
| 493 | [Arguments] ${ip} ${port} ${olt_of_id} |
| 494 | [Documentation] Verifies all flows are removed from the device |
| 495 | ${device_flows}= Execute ONOS CLI Command ${ip} ${port} |
| 496 | ... flows -s -f ${olt_of_id} | grep -v deviceId | wc -l |
| 497 | Should Be Equal As Integers ${device_flows} 0 |
| 498 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 499 | Verify Eapol Flows Added |
Andy Bavier | b0c0623 | 2019-08-29 12:58:53 -0700 | [diff] [blame] | 500 | [Arguments] ${ip} ${port} ${expected_flows} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 501 | [Documentation] Matches for number of eapol flows based on number of onus |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 502 | ${eapol_flows_added}= Execute ONOS CLI Command ${ip} ${port} |
| 503 | ... flows -s -f ADDED | grep eapol | grep IN_PORT | wc -l |
Andy Bavier | b0c0623 | 2019-08-29 12:58:53 -0700 | [diff] [blame] | 504 | Should Contain ${eapol_flows_added} ${expected_flows} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 505 | |
Suchitra Vemuri | 9da4430 | 2020-03-04 14:24:49 -0800 | [diff] [blame] | 506 | Verify No Pending Flows For ONU |
| 507 | [Arguments] ${ip} ${port} ${onu_port} |
| 508 | [Documentation] Verifies that there are no flows "PENDING" state for the ONU in ONOS |
| 509 | ${pending_flows}= Execute ONOS CLI Command ${ip} ${port} |
| 510 | ... flows -s | grep IN_PORT:${onu_port} | grep PENDING |
| 511 | Should Be Empty ${pending_flows} |
| 512 | |
Suchitra Vemuri | 3dd2f83 | 2019-10-18 13:14:54 -0700 | [diff] [blame] | 513 | Verify Eapol Flows Added For ONU |
| 514 | [Arguments] ${ip} ${port} ${onu_port} |
| 515 | [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] | 516 | ${eapol_flows_added}= Execute ONOS CLI Command ${ip} ${port} |
| 517 | ... flows -s -f ADDED | grep eapol | grep IN_PORT:${onu_port} |
Suchitra Vemuri | 3dd2f83 | 2019-10-18 13:14:54 -0700 | [diff] [blame] | 518 | Should Not Be Empty ${eapol_flows_added} |
| 519 | |
Suchitra Vemuri | 8078b97 | 2020-02-06 19:07:41 -0800 | [diff] [blame] | 520 | Verify ONU Port Is Enabled |
Suchitra Vemuri | 760bdd3 | 2020-06-17 12:34:48 -0700 | [diff] [blame] | 521 | [Arguments] ${ip} ${port} ${onu_name} |
Suchitra Vemuri | 8078b97 | 2020-02-06 19:07:41 -0800 | [diff] [blame] | 522 | [Documentation] Verifies if the ONU port is enabled in ONOS |
| 523 | ${onu_port_enabled}= Execute ONOS CLI Command ${ip} ${port} |
Suchitra Vemuri | 760bdd3 | 2020-06-17 12:34:48 -0700 | [diff] [blame] | 524 | ... ports -e | grep portName=${onu_name} |
Suchitra Vemuri | 8078b97 | 2020-02-06 19:07:41 -0800 | [diff] [blame] | 525 | Log ${onu_port_enabled} |
| 526 | Should Not Be Empty ${onu_port_enabled} |
| 527 | |
Hardik Windlass | 63d5e00 | 2020-03-06 21:07:09 +0530 | [diff] [blame] | 528 | Verify ONU Port Is Disabled |
Suchitra Vemuri | 760bdd3 | 2020-06-17 12:34:48 -0700 | [diff] [blame] | 529 | [Arguments] ${ip} ${port} ${onu_name} |
Hardik Windlass | 63d5e00 | 2020-03-06 21:07:09 +0530 | [diff] [blame] | 530 | [Documentation] Verifies if the ONU port is disabled in ONOS |
| 531 | ${onu_port_disabled}= Execute ONOS CLI Command ${ip} ${port} |
Suchitra Vemuri | 760bdd3 | 2020-06-17 12:34:48 -0700 | [diff] [blame] | 532 | ... ports -e | grep portName=${onu_name} |
Hardik Windlass | 63d5e00 | 2020-03-06 21:07:09 +0530 | [diff] [blame] | 533 | Log ${onu_port_disabled} |
| 534 | Should Be Empty ${onu_port_disabled} |
| 535 | |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 536 | Verify ONU in AAA-Users |
| 537 | [Arguments] ${ip} ${port} ${onu_port} |
| 538 | [Documentation] Verifies that the specified onu_port exists in aaa-users output |
| 539 | ${aaa_users}= Execute ONOS CLI Command ${ip} ${port} aaa-users | grep AUTHORIZED | grep ${onu_port} |
| 540 | Should Not Be Empty ${aaa_users} ONU port ${onu_port} not found in aaa-users |
| 541 | |
Hardik Windlass | 513afd1 | 2021-02-03 15:19:46 +0000 | [diff] [blame] | 542 | Verify Empty Group in ONOS |
| 543 | [Documentation] Verifies zero group count on the device |
| 544 | [Arguments] ${onos_ssh_connection} ${deviceId} |
| 545 | ${groups}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} groups | grep ${deviceId} |
| 546 | @{groups_arr}= Split String ${groups} , |
| 547 | @{group_count_arr}= Split String ${groups_arr[1]} = |
| 548 | ${group_count}= Set Variable ${group_count_arr[1]} |
| 549 | Should Be Equal As Integers ${group_count} 0 |
| 550 | |
| 551 | Verify ONUs in Group Count in ONOS |
| 552 | [Documentation] Verifies there exists a group bucket list with certain entries/count |
| 553 | ... Note: Currently, this validates only if all ONUs of an OLT joined the same igmp group |
| 554 | [Arguments] ${onos_ssh_connection} ${count} ${deviceId} |
Matteo Scandolo | fd36e21 | 2021-03-02 11:36:10 -0800 | [diff] [blame] | 555 | ${result}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 556 | ... groups added ${deviceId} | grep bucket | wc -l |
| 557 | Should Be Equal As Integers ${result} ${count} Bucket list count for a group: Found=${result} Expected=${count} |
Hardik Windlass | 513afd1 | 2021-02-03 15:19:46 +0000 | [diff] [blame] | 558 | |
| 559 | Verify ONU in Group Bucket |
| 560 | [Documentation] Matches if ONU port in Group Bucket |
| 561 | [Arguments] ${group_bucket_values} ${onu_port} |
| 562 | ${len}= Get Length ${group_bucket_values} |
| 563 | ${matched}= Set Variable False |
| 564 | FOR ${INDEX} IN RANGE 0 ${len} |
| 565 | ${value_bucket}= Get From List ${group_bucket_values} ${INDEX} |
| 566 | ${treatment}= Get From Dictionary ${value_bucket} treatment |
| 567 | ${instructions}= Get From Dictionary ${treatment} instructions |
| 568 | ${instructions_val}= Get From List ${instructions} 0 |
| 569 | ${port}= Get From Dictionary ${instructions_val} port |
| 570 | ${matched}= Set Variable If '${port}'=='${onu_port}' True False |
| 571 | Exit For Loop If ${matched} |
| 572 | END |
| 573 | [Return] ${matched} |
| 574 | |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 575 | Verify ONU in Groups |
| 576 | [Arguments] ${ip_onos} ${port_onos} ${deviceId} ${onu_port} ${group_exist}=True |
| 577 | [Documentation] Verifies that the specified onu_port exists in groups output |
| 578 | ${result}= Execute ONOS CLI Command ${ip_onos} ${port_onos} groups -j |
| 579 | Log Groups: ${result} |
| 580 | ${groups}= To Json ${result} |
| 581 | ${length}= Get Length ${groups} |
| 582 | ${buckets}= Create List |
| 583 | ${matched}= Set Variable False |
| 584 | FOR ${INDEX} IN RANGE 0 ${length} |
| 585 | ${value}= Get From List ${groups} ${INDEX} |
| 586 | ${devId}= Get From Dictionary ${value} deviceId |
| 587 | ${bucket}= Get From Dictionary ${value} buckets |
| 588 | Run Keyword If '${devId}'=='${deviceId}' |
| 589 | ... Append To List ${buckets} ${bucket} |
| 590 | END |
| 591 | ${bucket_len}= Get Length ${buckets} |
Hardik Windlass | 513afd1 | 2021-02-03 15:19:46 +0000 | [diff] [blame] | 592 | FOR ${INDEX_1} IN RANGE 0 ${bucket_len} |
| 593 | ${value}= Get From List ${buckets} ${INDEX_1} |
| 594 | ${matched}= Verify ONU in Group Bucket ${value} ${onu_port} |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 595 | Exit For Loop If ${matched} |
| 596 | END |
| 597 | Run Keyword If ${group_exist} |
| 598 | ... Should Be True ${matched} No match for ${deviceId} and ${onu_port} found in ONOS groups |
| 599 | ... ELSE |
| 600 | ... Should Be True '${matched}'=='False' Match for ${deviceId} and ${onu_port} found in ONOS groups |
| 601 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 602 | Assert Number of AAA-Users |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 603 | [Arguments] ${onos_ssh_connection} ${expected_onus} ${deviceId} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 604 | [Documentation] Matches for number of aaa-users authorized based on number of onus |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 605 | ${aaa_users}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 606 | ... aaa-users | grep ${deviceId} | grep AUTHORIZED | wc -l |
| 607 | Log Found ${aaa_users} of ${expected_onus} expected authenticated users on device ${deviceId} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 608 | Should Be Equal As Integers ${aaa_users} ${expected_onus} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 609 | |
| 610 | Validate DHCP Allocations |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 611 | [Arguments] ${onos_ssh_connection} ${count} ${workflow} ${deviceId} |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 612 | [Documentation] Matches for number of dhcpacks based on number of onus |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 613 | ${allocations}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 614 | ... dhcpl2relay-allocations | grep ${deviceId} | grep DHCPACK | wc -l |
Matteo Scandolo | da854b0 | 2020-09-01 16:20:51 -0700 | [diff] [blame] | 615 | # if the workflow is TT we'll have 2 allocations for each ONU |
| 616 | ${ttAllocations}= Evaluate (${count} * 2) |
| 617 | ${count}= Set Variable If $workflow=='tt' ${ttAllocations} ${count} |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 618 | Log Found ${allocations} of ${count} expected DHCPACK on device ${deviceId} |
Matteo Scandolo | da854b0 | 2020-09-01 16:20:51 -0700 | [diff] [blame] | 619 | Should Be Equal As Integers ${allocations} ${count} |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 620 | |
| 621 | Validate Subscriber DHCP Allocation |
Suchitra Vemuri | 4281941 | 2020-10-01 17:45:43 -0700 | [diff] [blame] | 622 | [Arguments] ${ip} ${port} ${onu_port} ${vlan}='' |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 623 | [Documentation] Verifies that the specified subscriber is found in DHCP allocations |
| 624 | ##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] | 625 | ${allocations}= Execute ONOS CLI Command ${ip} ${port} |
Suchitra Vemuri | 4281941 | 2020-10-01 17:45:43 -0700 | [diff] [blame] | 626 | ... dhcpl2relay-allocations | grep DHCPACK | grep ${onu_port} | grep ${vlan} |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 627 | 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] | 628 | |
| 629 | Device Is Available In ONOS |
Matteo Scandolo | 3218d5b | 2021-05-26 11:50:10 -0700 | [diff] [blame] | 630 | [Arguments] ${url} ${dpid} ${available}=true |
| 631 | [Documentation] Validates the device exists and it has the expected availability in ONOS |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 632 | ${rc} ${json} Run And Return Rc And Output curl --fail -sSL ${url}/onos/v1/devices/${dpid} |
| 633 | Should Be Equal As Integers 0 ${rc} |
| 634 | ${rc} ${value} Run And Return Rc And Output echo '${json}' | jq -r .available |
| 635 | Should Be Equal As Integers 0 ${rc} |
Matteo Scandolo | 3218d5b | 2021-05-26 11:50:10 -0700 | [diff] [blame] | 636 | Should Be Equal ${available} ${value} |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 637 | |
| 638 | Remove All Devices From ONOS |
| 639 | [Arguments] ${url} |
| 640 | [Documentation] Executes the device-remove command on each device in ONOS |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 641 | ${rc} ${output} Run And Return Rc And Output |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 642 | ... curl --fail -sSL ${url}/onos/v1/devices | jq -r '.devices[].id' |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 643 | Should Be Equal As Integers ${rc} 0 |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 644 | @{dpids} Split String ${output} |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 645 | ${count}= Get length ${dpids} |
Zack Williams | a8fe75a | 2020-01-10 14:25:27 -0700 | [diff] [blame] | 646 | FOR ${dpid} IN @{dpids} |
| 647 | ${rc}= Run Keyword If '${dpid}' != '' |
| 648 | ... Run And Return Rc curl -XDELETE --fail -sSL ${url}/onos/v1/devices/${dpid} |
| 649 | Run Keyword If '${dpid}' != '' |
| 650 | ... Should Be Equal As Integers ${rc} 0 |
| 651 | END |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 652 | |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 653 | Assert ONU Port Is Disabled |
| 654 | [Arguments] ${onos_ssh_connection} ${deviceId} ${onu_port} |
| 655 | [Documentation] Verifies if the ONU port is disabled in ONOS |
| 656 | ${onu_port_disabled}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 657 | ... ports -d ${deviceId} | grep port=${onu_port} |
| 658 | Log ${onu_port_disabled} |
| 659 | Should Not Be Empty ${onu_port_disabled} |
| 660 | |
Matteo Scandolo | 7d1a80d | 2021-04-09 14:30:43 -0700 | [diff] [blame] | 661 | Assert Olts in ONOS |
| 662 | [Arguments] ${onos_ssh_connection} ${count} |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 663 | [Documentation] DEPRECATED use Assert Olt in ONOS |
| 664 | ... Check that a certain number of olts are known to ONOS |
Matteo Scandolo | 7d1a80d | 2021-04-09 14:30:43 -0700 | [diff] [blame] | 665 | ${olts}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 666 | ... volt-olts | wc -l |
Matteo Scandolo | 7d1a80d | 2021-04-09 14:30:43 -0700 | [diff] [blame] | 667 | Log Found ${olts} of ${count} expected Olts |
| 668 | Should Be Equal As Integers ${olts} ${count} |
| 669 | |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 670 | Assert Olt in ONOS |
| 671 | [Arguments] ${onos_ssh_connection} ${deviceId} |
| 672 | [Documentation] Check that a particular olt is known to ONOS |
| 673 | ${olts}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 674 | ... volt-olts | grep ${deviceId} | wc -l |
| 675 | Should Be Equal As Integers ${olts} 1 "Device ${deviceId} is not recognized as an OLT" |
| 676 | |
Matteo Scandolo | 7d1a80d | 2021-04-09 14:30:43 -0700 | [diff] [blame] | 677 | Wait for Olts in ONOS |
| 678 | [Arguments] ${onos_ssh_connection} ${count} ${max_wait_time}=10m |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 679 | [Documentation] DEPRECATED use Wait for Olt in ONOS |
| 680 | ... Waits untill a certain number of ports are enabled in ONOS for a particular deviceId |
Matteo Scandolo | 7d1a80d | 2021-04-09 14:30:43 -0700 | [diff] [blame] | 681 | Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Olts in ONOS |
| 682 | ... ${onos_ssh_connection} ${count} |
| 683 | |
Matteo Scandolo | 520f77e | 2021-06-01 16:14:47 -0700 | [diff] [blame] | 684 | Wait for Olt in ONOS |
| 685 | [Arguments] ${onos_ssh_connection} ${deviceId} ${max_wait_time}=10m |
| 686 | [Documentation] Waits until a particular deviceId is recognized by ONOS as an OLT |
| 687 | Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Olt in ONOS |
| 688 | ... ${onos_ssh_connection} ${deviceId} |
| 689 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 690 | Assert Ports in ONOS |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 691 | [Arguments] ${onos_ssh_connection} ${count} ${deviceId} ${filter} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 692 | [Documentation] Check that a certain number of ports are enabled in ONOS |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 693 | ${ports}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 694 | ... ports -e ${deviceId} | grep ${filter} | wc -l |
| 695 | Log Found ${ports} of ${count} expected ports on device ${deviceId} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 696 | Should Be Equal As Integers ${ports} ${count} |
| 697 | |
| 698 | Wait for Ports in ONOS |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 699 | [Arguments] ${onos_ssh_connection} ${count} ${deviceId} ${filter} ${max_wait_time}=10m |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 700 | [Documentation] Waits untill a certain number of ports are enabled in ONOS for a particular deviceId |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 701 | Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Ports in ONOS |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 702 | ... ${onos_ssh_connection} ${count} ${deviceId} ${filter} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 703 | |
| 704 | Wait for AAA Authentication |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 705 | [Arguments] ${onos_ssh_connection} ${count} ${deviceId} ${max_wait_time}=10m |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 706 | [Documentation] Waits untill a certain number of subscribers are authenticated in ONOS |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 707 | Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Number of AAA-Users |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 708 | ... ${onos_ssh_connection} ${count} ${deviceId} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 709 | |
| 710 | Wait for DHCP Ack |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 711 | [Arguments] ${onos_ssh_connection} ${count} ${workflow} ${deviceId} ${max_wait_time}=10m |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 712 | [Documentation] Waits untill a certain number of subscribers have received a DHCP_ACK |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 713 | Wait Until Keyword Succeeds ${max_wait_time} 5s Validate DHCP Allocations |
| 714 | ... ${onos_ssh_connection} ${count} ${workflow} ${deviceId} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 715 | |
| 716 | Provision subscriber |
| 717 | [Documentation] Calls volt-add-subscriber-access in ONOS |
| 718 | [Arguments] ${onos_ip} ${onos_port} ${of_id} ${onu_port} |
| 719 | Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 720 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 721 | |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 722 | Provision subscriber REST |
| 723 | [Documentation] Uses the rest APIs to provision a subscriber |
| 724 | [Arguments] ${onos_ip} ${onos_port} ${of_id} ${onu_port} |
| 725 | ${resp}= Post Request ONOS |
| 726 | ... /onos/olt/oltapp/${of_id}/${onu_port} |
| 727 | Should Be Equal As Strings ${resp.status_code} 200 |
| 728 | |
| 729 | |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 730 | List Enabled UNI Ports |
| 731 | [Documentation] List all the UNI Ports, the only way we have is to filter out the one called NNI |
| 732 | ... Creates a list of dictionaries |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 733 | [Arguments] ${onos_ssh_connection} ${of_id} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 734 | [Return] [{'port': '16', 'of_id': 'of:00000a0a0a0a0a00'}, {'port': '32', 'of_id': 'of:00000a0a0a0a0a00'}] |
| 735 | ${result}= Create List |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 736 | ${out}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 737 | ... ports -e ${of_id} | grep -v SWITCH | grep -v nni |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 738 | @{unis}= Split To Lines ${out} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 739 | FOR ${uni} IN @{unis} |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 740 | ${matches} = Get Regexp Matches ${uni} .*port=([0-9]+),.* 1 |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 741 | &{portDict} Create Dictionary of_id=${of_id} port=${matches[0]} |
| 742 | Append To List ${result} ${portDict} |
| 743 | END |
| 744 | Log ${result} |
| 745 | Return From Keyword ${result} |
| 746 | |
| 747 | Provision all subscribers on device |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 748 | [Documentation] Provisions a subscriber in ONOS for all the enabled UNI ports on a particular device |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 749 | [Arguments] ${onos_ssh_connection} ${onos_ip} ${onos_rest_port} ${of_id} |
| 750 | ${unis}= List Enabled UNI Ports ${onos_ssh_connection} ${of_id} |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 751 | ${onos_auth}= Create List karaf karaf |
| 752 | Create Session ONOS http://${onos_ip}:${onos_rest_port} auth=${onos_auth} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 753 | FOR ${uni} IN @{unis} |
Matteo Scandolo | 96dbe43 | 2020-05-28 10:51:57 -0700 | [diff] [blame] | 754 | 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] | 755 | END |
| 756 | |
| 757 | List OLTs |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 758 | # NOTE this method is not currently used but it can come useful in the future |
| 759 | [Documentation] Returns a list of all OLTs known to ONOS |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 760 | [Arguments] ${onos_ssh_connection} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 761 | [Return] ['of:00000a0a0a0a0a00', 'of:00000a0a0a0a0a01'] |
| 762 | ${result}= Create List |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 763 | ${out}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 764 | ... volt-olts |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 765 | @{olts}= Split To Lines ${out} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 766 | FOR ${olt} IN @{olts} |
| 767 | Log ${olt} |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 768 | ${matches} = Get Regexp Matches ${olt} ^OLT (.+)$ 1 |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 769 | # there may be some logs mixed with the output so only append if we have a match |
| 770 | ${matches_length}= Get Length ${matches} |
| 771 | Run Keyword If ${matches_length}==1 |
| 772 | ... Append To List ${result} ${matches[0]} |
| 773 | END |
| 774 | Return From Keyword ${result} |
| 775 | |
| 776 | Count ADDED flows |
| 777 | [Documentation] Count the flows in ADDED state in ONOS |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 778 | [Arguments] ${onos_ssh_connection} ${targetFlows} ${deviceId} |
Matteo Scandolo | 37bca8d | 2020-07-31 11:28:40 -0700 | [diff] [blame] | 779 | ${flows}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 780 | ... flows -s any ${deviceId} | grep ADDED | wc -l |
| 781 | Log Found ${flows} of ${targetFlows} expected flows on device ${deviceId} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 782 | Should Be Equal As Integers ${targetFlows} ${flows} |
| 783 | |
| 784 | Wait for all flows to in ADDED state |
| 785 | [Documentation] Waits until the flows have been provisioned |
TorstenThieme | b198c48 | 2020-12-14 19:45:23 +0000 | [diff] [blame] | 786 | [Arguments] ${onos_ssh_connection} ${deviceId} ${workflow} ${uni_count} ${olt_count} |
| 787 | ... ${provisioned} ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 788 | ${targetFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned} |
Andrea Campanella | 70cf0a7 | 2020-05-27 10:55:15 +0200 | [diff] [blame] | 789 | ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp} |
Matteo Scandolo | 142e627 | 2020-04-29 17:36:59 -0700 | [diff] [blame] | 790 | Wait Until Keyword Succeeds 10m 5s Count ADDED flows |
Matteo Scandolo | 50be75c | 2020-11-12 11:14:12 -0800 | [diff] [blame] | 791 | ... ${onos_ssh_connection} ${targetFlows} ${deviceId} |
Gayathri.Selvan | 92d1686 | 2020-03-19 14:47:58 +0000 | [diff] [blame] | 792 | |
Girish Gowdra | d769b41 | 2021-05-16 11:09:46 -0700 | [diff] [blame] | 793 | Get Limiting Bandwidth Details |
Gayathri.Selvan | 92d1686 | 2020-03-19 14:47:58 +0000 | [diff] [blame] | 794 | [Arguments] ${bandwidth_profile_name} |
| 795 | [Documentation] Collects the bandwidth profile details for the given bandwidth profile and |
| 796 | ... returns the limiting bandwidth |
Girish Gowdra | cb8482a | 2021-05-27 09:06:13 -0700 | [diff] [blame] | 797 | ${cir} ${cbs} ${eir} ${ebs} ${air}= Get Bandwidth Profile Details Rest |
| 798 | ... ${bandwidth_profile_name} |
Girish Gowdra | d769b41 | 2021-05-16 11:09:46 -0700 | [diff] [blame] | 799 | ${limiting_BW}= Evaluate ${eir}+${cir}+${air} |
Gayathri.Selvan | 92d1686 | 2020-03-19 14:47:58 +0000 | [diff] [blame] | 800 | [Return] ${limiting_BW} |
Hardik Windlass | e8b9922 | 2021-01-25 10:03:14 +0000 | [diff] [blame] | 801 | |
| 802 | Validate Deleted Device Cleanup In ONOS |
| 803 | [Arguments] ${ip} ${port} ${olt_serial_number} |
| 804 | [Documentation] The keyword verifies that ports, flows, meters, subscribers, dhcp are all cleared in ONOS |
| 805 | # Fetch OF Id for OLT |
| 806 | ${olt_of_id}= Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device in ONOS ${olt_serial_number} |
| 807 | # Open ONOS SSH Connection |
| 808 | ${onos_ssh_connection} Open ONOS SSH Connection ${ip} ${port} |
| 809 | # Verify Ports are Removed |
| 810 | ${port_count}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 811 | ... ports ${olt_of_id} | grep -v ${olt_of_id} | wc -l |
| 812 | Should Be Equal As Integers ${port_count} 0 |
| 813 | # Verify Subscribers are Removed |
| 814 | ${sub_count}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 815 | ... volt-programmed-subscribers | grep ${olt_of_id} | wc -l |
| 816 | Should Be Equal As Integers ${sub_count} 0 |
| 817 | # Verify Flows are Removed |
| 818 | ${flow_count}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 819 | ... flows -s -f ${olt_of_id} | grep -v deviceId | wc -l |
| 820 | Should Be Equal As Integers ${flow_count} 0 |
| 821 | # Verify Meters are Removed |
| 822 | ${meter_count}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 823 | ... meters ${olt_of_id} | wc -l |
| 824 | Should Be Equal As Integers ${meter_count} 0 |
| 825 | # Verify AAA-Users are Removed |
| 826 | ${aaa_count}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 827 | ... aaa-users ${olt_of_id} | wc -l |
| 828 | Should Be Equal As Integers ${aaa_count} 0 |
| 829 | # Verify Dhcp-Allocations are Removed |
| 830 | ${dhcp_count}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 831 | ... dhcpl2relay-allocations ${olt_of_id} | wc -l |
| 832 | Should Be Equal As Integers ${dhcp_count} 0 |
| 833 | # Close ONOS SSH Connection |
| 834 | Close ONOS SSH Connection ${onos_ssh_connection} |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 835 | |
| 836 | Delete ONOS App |
| 837 | [Arguments] ${url} ${app_name} |
| 838 | [Documentation] This keyword deactivates and uninstalls the given ONOS App |
| 839 | ${rc}= Run And Return Rc curl --fail -sSL -X DELETE ${url}/onos/v1/applications/${app_name} |
Matteo Scandolo | 2769d2b | 2021-04-14 10:29:24 -0700 | [diff] [blame] | 840 | Should Be Equal As Integers ${rc} 0 Can't delete ${app_name} from ONOS |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 841 | |
| 842 | Verify ONOS App Active |
| 843 | [Arguments] ${url} ${app_name} ${app_version}=${EMPTY} |
| 844 | [Documentation] This keyword verifies that the given ONOS App status is Active |
| 845 | ${rc} ${output} Run And Return Rc And Output |
| 846 | ... curl --fail -sSL ${url}/onos/v1/applications/${app_name} | jq -r .state |
| 847 | Should Be Equal As Integers ${rc} 0 |
| 848 | Should Be Equal '${output}' 'ACTIVE' |
| 849 | ${rc1} ${output1} Run And Return Rc And Output |
| 850 | ... curl --fail -sSL ${url}/onos/v1/applications/${app_name} | jq -r .version |
| 851 | Run Keyword If '${app_version}'!='${EMPTY}' |
| 852 | ... Run Keywords |
Matteo Scandolo | 2769d2b | 2021-04-14 10:29:24 -0700 | [diff] [blame] | 853 | ... Should Be Equal As Integers ${rc1} 0 Can't read app ${app_name} status from ONOS |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 854 | ... AND Should Be Equal '${output1}' '${app_version}' |
| 855 | |
| 856 | Install And Activate ONOS App |
| 857 | [Arguments] ${url} ${app_oar_file} |
| 858 | [Documentation] This keyword installs and activates the given ONOS App |
| 859 | ${cmd}= Catenate SEPARATOR= |
| 860 | ... curl --fail -sSL -H Content-Type:application/octet-stream - |
| 861 | ... X POST ${url}/onos/v1/applications?activate=true --data-binary \@${app_oar_file} |
| 862 | ${rc} ${output} Run And Return Rc And Output ${cmd} |
Matteo Scandolo | 2769d2b | 2021-04-14 10:29:24 -0700 | [diff] [blame] | 863 | Should Be Equal As Integers ${rc} 0 Can't load onos app ${app_oar_file} to ONOS" |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 864 | Log ${output} |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 865 | |
| 866 | Get ONOS App Details |
| 867 | [Arguments] ${url} ${app_name} |
| 868 | [Documentation] Retrieves ONOS App Details |
| 869 | ${rc} ${output} Run And Return Rc And Output |
| 870 | ... curl --fail -sSL ${url}/onos/v1/applications/${app_name} |
Matteo Scandolo | 2769d2b | 2021-04-14 10:29:24 -0700 | [diff] [blame] | 871 | Should Be Equal As Integers ${rc} 0 Can't read app ${app_name} details from ONOS |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 872 | [Return] ${output} |