blob: 7d9944f3f7d4020981174e7c9bff63f7f3a481ac [file] [log] [blame]
Kailash6f5acb62019-08-28 14:38:45 -07001# 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.
Kailash6f5acb62019-08-28 14:38:45 -070014# onos common functions
15
16*** Settings ***
17Documentation Library for various utilities
18Library SSHLibrary
Kailash6f5acb62019-08-28 14:38:45 -070019Library String
20Library DateTime
21Library Process
22Library Collections
23Library RequestsLibrary
24Library OperatingSystem
Matteo Scandoloeb26a842020-05-08 10:06:24 -070025Resource ./flows.robot
Kailash6f5acb62019-08-28 14:38:45 -070026
TorstenThiemeb198c482020-12-14 19:45:23 +000027*** Variables ***
28@{connection_list}
29
Kailash6f5acb62019-08-28 14:38:45 -070030*** Keywords ***
Matteo Scandolo37bca8d2020-07-31 11:28:40 -070031
32Open 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}
TorstenThiemeb198c482020-12-14 19:45:23 +000037 ${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 Scandolo37bca8d2020-07-31 11:28:40 -070042
TorstenThieme4e2168e2021-06-22 14:01:47 +000043Execute ONOS CLI Command use single connection
44 [Documentation] Execute ONOS CLI Command use an Open Connection
45 ... In case no connection is open a connection will be opened
46 [Arguments] ${host} ${port} ${cmd}
47 ${connection_list_id}= Get Conn List Id ${host} ${port}
48 ${connection_list_id}= Run Keyword If "${connection_list_id}"=="${EMPTY}"
49 ... Open ONOS SSH Connection ${host} ${port}
50 ... ELSE Set Variable ${connection_list_id}
51 ${connection_entry}= Get From List ${connection_list} ${connection_list_id}
52 SSHLibrary.Switch Connection ${connection_entry.conn_id}
53 ${PassOrFail} @{result_values} Run Keyword And Ignore Error SSHLibrary.Execute Command ${cmd}
54 ... return_rc=True return_stderr=True return_stdout=True
55 Run Keyword If '${PassOrFail}'=='FAIL' Reconnect ONOS SSH Connection ${connection_list_id}
56 @{result_values}= Run Keyword If '${PassOrFail}'=='FAIL'
57 ... SSHLibrary.Execute Command ${cmd} return_rc=True return_stderr=True return_stdout=True
58 ... ELSE Set Variable @{result_values}
59 ${output} Set Variable @{result_values}[0]
60 Log Command output: ${output}
61 Should Be Empty @{result_values}[1]
62 Should Be Equal As Integers @{result_values}[2] 0
63 [Return] ${output}
64
65Get Conn List Id
66 [Documentation] Looks up for an Open Connection with passed host and port in conection list
67 ... First match connection will be used.
68 [Arguments] ${host} ${port}
69 ${connection_list_id}= Set Variable ${EMPTY}
70 ${match}= Set Variable False
71 ${length}= Get Length ${connection_list}
72 FOR ${INDEX} IN RANGE 0 ${length}
73 #${Item}= Get From List ${connection_list} ${INDEX}
74 ${conndata}= Get Connection ${connection_list[${INDEX}].conn_id}
75 ${match}= Set Variable If '${conndata.host}'=='${host}' and '${conndata.port}'=='${port}' True False
76 ${connection_list_id}= Set Variable If ${match} ${INDEX} ${EMPTY}
77 Exit For Loop If ${match}
78 END
79 [Return] ${connection_list_id}
80
TorstenThiemeb198c482020-12-14 19:45:23 +000081Reconnect ONOS SSH Connection
82 [Documentation] Reconnect an SSH Connection
83 [Arguments] ${connection_list_id}
84 ${connection_entry}= Get From List ${connection_list} ${connection_list_id}
85 ${user}= Get From Dictionary ${connection_entry} user
86 ${pass}= Get From Dictionary ${connection_entry} pass
87 ${oldconndata}= Get Connection ${connection_entry.conn_id}
88 SSHLibrary.Switch Connection ${connection_entry.conn_id}
TorstenThiemebcf14612021-01-27 10:19:18 +000089 Run Keyword And Ignore Error SSHLibrary.Close Connection
TorstenThiemeb198c482020-12-14 19:45:23 +000090 ${conn_id}= SSHLibrary.Open Connection ${oldconndata.host} port=${oldconndata.port}
91 ... timeout=300s alias=ONOS_SSH
92 SSHLibrary.Login ${user} ${pass}
93 ${conn_list_entry}= Create Dictionary conn_id=${conn_id} user=${user} pass=${pass}
94 Set List Value ${connection_list} ${connection_list_id} ${conn_list_entry}
95 Set Global Variable ${connection_list}
96
Matteo Scandolo37bca8d2020-07-31 11:28:40 -070097Close ONOS SSH Connection
98 [Documentation] Close an SSH Connection
TorstenThiemeb198c482020-12-14 19:45:23 +000099 [Arguments] ${connection_list_id}
100 ${connection_entry}= Get From List ${connection_list} ${connection_list_id}
101 ${connection_alias}= Get From Dictionary ${connection_entry} conn_id
102 ${oldconndata}= Get Connection ${connection_entry.conn_id}
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700103 SSHLibrary.Switch Connection ${connection_alias}
TorstenThiemebcf14612021-01-27 10:19:18 +0000104 Run Keyword And Ignore Error SSHLibrary.Close Connection
TorstenThiemeb198c482020-12-14 19:45:23 +0000105 Remove From List ${connection_list} ${connection_list_id}
106 Set Global Variable ${connection_list}
107
108Close All ONOS SSH Connections
109 [Documentation] Close all SSH Connection and clear connection list.
110 SSHLibrary.Close All Connections
111 @{connection_list} Create List
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700112
Kailash6f5acb62019-08-28 14:38:45 -0700113Validate OLT Device in ONOS
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700114 # FIXME use volt-olts to check that the OLT is ONOS
Kailash6f5acb62019-08-28 14:38:45 -0700115 [Arguments] ${serial_number}
Zack Williamsec53a1b2019-09-16 15:50:52 -0700116 [Documentation] Checks if olt has been connected to ONOS
Kailash6f5acb62019-08-28 14:38:45 -0700117 ${resp}= Get Request ONOS onos/v1/devices
118 ${jsondata}= To Json ${resp.content}
119 Should Not Be Empty ${jsondata['devices']}
120 ${length}= Get Length ${jsondata['devices']}
121 @{serial_numbers}= Create List
Andy Bavierb63f6d22020-03-12 15:34:37 -0700122 ${matched}= Set Variable False
Zack Williamsec53a1b2019-09-16 15:50:52 -0700123 FOR ${INDEX} IN RANGE 0 ${length}
124 ${value}= Get From List ${jsondata['devices']} ${INDEX}
125 ${of_id}= Get From Dictionary ${value} id
126 ${sn}= Get From Dictionary ${value} serial
Andy Bavierb63f6d22020-03-12 15:34:37 -0700127 ${matched}= Set Variable If '${sn}' == '${serial_number}' True False
128 Exit For Loop If ${matched}
Zack Williamsec53a1b2019-09-16 15:50:52 -0700129 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700130 Should Be True ${matched} No match for ${serial_number} found
Kailash57210eb2019-08-30 13:27:19 -0700131 [Return] ${of_id}
Kailash6f5acb62019-08-28 14:38:45 -0700132
Suchitra Vemuri102912a2019-09-24 00:35:42 -0700133Get ONU Port in ONOS
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000134 [Arguments] ${onu_serial_number} ${olt_of_id} ${onu_uni_id}=1
Suchitra Vemuri102912a2019-09-24 00:35:42 -0700135 [Documentation] Retrieves ONU port for the ONU in ONOS
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000136 ${onu_serial_number}= Catenate SEPARATOR=- ${onu_serial_number} ${onu_uni_id}
Suchitra Vemuri102912a2019-09-24 00:35:42 -0700137 ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports
138 ${jsondata}= To Json ${resp.content}
139 Should Not Be Empty ${jsondata['ports']}
140 ${length}= Get Length ${jsondata['ports']}
141 @{ports}= Create List
Andy Bavierb63f6d22020-03-12 15:34:37 -0700142 ${matched}= Set Variable False
Zack Williamsec53a1b2019-09-16 15:50:52 -0700143 FOR ${INDEX} IN RANGE 0 ${length}
144 ${value}= Get From List ${jsondata['ports']} ${INDEX}
145 ${annotations}= Get From Dictionary ${value} annotations
146 ${onu_port}= Get From Dictionary ${value} port
147 ${portName}= Get From Dictionary ${annotations} portName
Andy Bavierb63f6d22020-03-12 15:34:37 -0700148 ${matched}= Set Variable If '${portName}' == '${onu_serial_number}' True False
149 Exit For Loop If ${matched}
Zack Williamsec53a1b2019-09-16 15:50:52 -0700150 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700151 Should Be True ${matched} No match for ${onu_serial_number} found
Suchitra Vemuri102912a2019-09-24 00:35:42 -0700152 [Return] ${onu_port}
153
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530154Get NNI Port in ONOS
155 [Arguments] ${olt_of_id}
156 [Documentation] Retrieves NNI port for the OLT in ONOS
157 ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports
158 ${jsondata}= To Json ${resp.content}
159 Should Not Be Empty ${jsondata['ports']}
160 ${length}= Get Length ${jsondata['ports']}
161 @{ports}= Create List
162 ${matched}= Set Variable False
163 FOR ${INDEX} IN RANGE 0 ${length}
164 ${value}= Get From List ${jsondata['ports']} ${INDEX}
165 ${annotations}= Get From Dictionary ${value} annotations
166 ${nni_port}= Get From Dictionary ${value} port
167 ${nniPortName}= Catenate SEPARATOR= nni- ${nni_port}
168 ${portName}= Get From Dictionary ${annotations} portName
169 ${matched}= Set Variable If '${portName}' == '${nniPortName}' True False
170 Exit For Loop If ${matched}
171 END
172 Should Be True ${matched} No match for NNI found for ${olt_of_id}
173 [Return] ${nni_port}
174
Suchitra Vemuri532f67a2019-09-25 11:50:42 -0700175Get FabricSwitch in ONOS
176 [Documentation] Returns of_id of the Fabric Switch in ONOS
177 ${resp}= Get Request ONOS onos/v1/devices
178 ${jsondata}= To Json ${resp.content}
179 Should Not Be Empty ${jsondata['devices']}
180 ${length}= Get Length ${jsondata['devices']}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700181 ${matched}= Set Variable False
Suchitra Vemuri532f67a2019-09-25 11:50:42 -0700182 FOR ${INDEX} IN RANGE 0 ${length}
183 ${value}= Get From List ${jsondata['devices']} ${INDEX}
184 ${of_id}= Get From Dictionary ${value} id
185 ${type}= Get From Dictionary ${value} type
Andy Bavierb63f6d22020-03-12 15:34:37 -0700186 ${matched}= Set Variable If '${type}' == "SWITCH" True False
187 Exit For Loop If ${matched}
Suchitra Vemuri532f67a2019-09-25 11:50:42 -0700188 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700189 Should Be True ${matched} No fabric switch found
Suchitra Vemuri532f67a2019-09-25 11:50:42 -0700190 [Return] ${of_id}
191
Andrea Campanella4c404632020-08-26 14:41:36 +0200192Get Master Instace in ONOS
193 [Arguments] ${of_id}
194 [Documentation] Returns nodeId of the Master instace for a giver device in ONOS
195 ${resp}= Get Request ONOS onos/v1/mastership/${of_id}/master
196 ${jsondata}= To Json ${resp.content}
197 Should Not Be Empty ${jsondata['nodeId']}
198 ${master_node}= Get From Dictionary ${jsondata} nodeId
199 [Return] ${master_node}
200
Hardik Windlass21807632020-04-14 16:24:55 +0530201Verify Subscriber Access Flows Added for ONU
202 [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${c_tag} ${s_tag}
203 [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU
204 # Verify upstream table=0 flow
205 ${upstream_flow_0_cmd}= Catenate SEPARATOR=
206 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:0 |
207 ... grep VLAN_ID:${c_tag} | grep transition=TABLE:1
TorstenThieme4e2168e2021-06-22 14:01:47 +0000208 ${upstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530209 ... ${upstream_flow_0_cmd}
210 Should Not Be Empty ${upstream_flow_0_added}
211 # Verify upstream table=1 flow
212 ${flow_vlan_push_cmd}= Catenate SEPARATOR=
213 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:${c_tag} |
214 ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000215 ${upstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530216 ... ${flow_vlan_push_cmd}
217 Should Not Be Empty ${upstream_flow_1_added}
218 # Verify downstream table=0 flow
219 ${flow_vlan_pop_cmd}= Catenate SEPARATOR=
220 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${s_tag} |
221 ... grep VLAN_POP | grep transition=TABLE:1
TorstenThieme4e2168e2021-06-22 14:01:47 +0000222 ${downstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530223 ... ${flow_vlan_pop_cmd}
224 Should Not Be Empty ${downstream_flow_0_added}
225 # Verify downstream table=1 flow
226 ${downstream_flow_1_cmd}= Catenate SEPARATOR=
227 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${c_tag} |
228 ... grep VLAN_ID:0 | grep OUTPUT:${onu_port}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000229 ${downstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530230 ... ${downstream_flow_1_cmd}
231 Should Not Be Empty ${downstream_flow_1_added}
232 # Verify ipv4 dhcp upstream flow
233 ${upstream_flow_ipv4_cmd}= Catenate SEPARATOR=
Andrea Campanella5e9051c2020-04-30 14:38:35 +0200234 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep ETH_TYPE:ipv4 |
Andrea Campanella08678e12020-09-18 17:40:22 +0200235 ... grep IP_PROTO:17 | grep UDP_SRC:68 | grep UDP_DST:67 | grep VLAN_ID:${c_tag} |
Andrea Campanella5e9051c2020-04-30 14:38:35 +0200236 ... grep OUTPUT:CONTROLLER
TorstenThieme4e2168e2021-06-22 14:01:47 +0000237 ${upstream_flow_ipv4_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530238 ... ${upstream_flow_ipv4_cmd}
Andrea Campanella5e9051c2020-04-30 14:38:35 +0200239 Should Not Be Empty ${upstream_flow_ipv4_added}
Hardik Windlass21807632020-04-14 16:24:55 +0530240 # Verify ipv4 dhcp downstream flow
241 # Note: This flow will be one per nni per olt
242 ${downstream_flow_ipv4_cmd}= Catenate SEPARATOR=
Andrea Campanella5e9051c2020-04-30 14:38:35 +0200243 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep ETH_TYPE:ipv4 |
244 ... grep IP_PROTO:17 | grep UDP_SRC:67 | grep UDP_DST:68 | grep OUTPUT:CONTROLLER
TorstenThieme4e2168e2021-06-22 14:01:47 +0000245 ${downstream_flow_ipv4_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530246 ... ${downstream_flow_ipv4_cmd}
Andrea Campanella5e9051c2020-04-30 14:38:35 +0200247 Should Not Be Empty ${downstream_flow_ipv4_added}
Hardik Windlass21807632020-04-14 16:24:55 +0530248
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530249Verify Subscriber Access Flows Added for ONU DT
Hardik Windlass25e11702020-03-30 20:05:19 +0530250 [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${s_tag}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530251 [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU
252 # Verify upstream table=0 flow
TorstenThieme4e2168e2021-06-22 14:01:47 +0000253 ${upstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass25e11702020-03-30 20:05:19 +0530254 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:Any | grep transition=TABLE:1
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530255 Should Not Be Empty ${upstream_flow_0_added}
256 # Verify upstream table=1 flow
257 ${flow_vlan_push_cmd}= Catenate SEPARATOR=
Hardik Windlass25e11702020-03-30 20:05:19 +0530258 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:Any |
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530259 ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000260 ${upstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530261 ... ${flow_vlan_push_cmd}
262 Should Not Be Empty ${upstream_flow_1_added}
263 # Verify downstream table=0 flow
264 ${flow_vlan_pop_cmd}= Catenate SEPARATOR=
Hardik Windlass25e11702020-03-30 20:05:19 +0530265 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${s_tag} |
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530266 ... grep VLAN_POP | grep transition=TABLE:1
TorstenThieme4e2168e2021-06-22 14:01:47 +0000267 ${downstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530268 ... ${flow_vlan_pop_cmd}
269 Should Not Be Empty ${downstream_flow_0_added}
270 # Verify downstream table=1 flow
TorstenThieme4e2168e2021-06-22 14:01:47 +0000271 ${downstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass25e11702020-03-30 20:05:19 +0530272 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:Any | grep OUTPUT:${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530273 Should Not Be Empty ${downstream_flow_1_added}
274
275Verify Subscriber Access Flows Added Count DT
Hardik Windlass25e11702020-03-30 20:05:19 +0530276 [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530277 [Documentation] Matches for total number of subscriber access flows added for all onus
TorstenThieme4e2168e2021-06-22 14:01:47 +0000278 ${access_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700279 ... flows -s ADDED ${olt_of_id} | grep -v deviceId | grep -v ETH_TYPE:lldp | grep -v ETH_TYPE:arp
280 ${access_flows_added_count}= Get Line Count ${access_flows_added}
281 Should Be Equal As Integers ${access_flows_added_count} ${expected_flows}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530282
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000283Verify Added Flow Count for OLT TT
284 [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows}
285 [Documentation] Total number of added flows given OLT with subscriber flows
TorstenThieme4e2168e2021-06-22 14:01:47 +0000286 ${access_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700287 ... flows -s ADDED ${olt_of_id} | grep -v deviceId
288 ${access_flows_added_count}= Get Line Count ${access_flows_added}
289 Should Be Equal As Integers ${access_flows_added_count} ${expected_flows}
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000290
Emrehan UZUN2884ed52021-05-04 15:36:31 +0000291Verify Default Downstream Flows are added in ONOS for OLT TT
292 [Arguments] ${ip} ${port} ${olt_of_id} ${nni_port}
293 [Documentation] Verifies if the Default Downstream Flows are added in ONOS for the OLT
294 # Verify lldp flow
295 ${downstream_flow_lldp_cmd}= Catenate SEPARATOR=
296 ... flows -s ADDED ${olt_of_id} | grep lldp |
297 ... grep OUTPUT:CONTROLLER
TorstenThieme4e2168e2021-06-22 14:01:47 +0000298 ${downstream_flow_lldp_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Emrehan UZUN2884ed52021-05-04 15:36:31 +0000299 ... ${downstream_flow_lldp_cmd}
300 Should Not Be Empty ${downstream_flow_lldp_added}
301 # Verify downstream dhcp flow
302 ${downstream_flow_dhcp_cmd}= Catenate SEPARATOR=
303 ... flows -s ADDED ${olt_of_id} | grep IP_PROTO:17 | grep UDP_SRC:67 | grep UDP_DST:68 |
304 ... grep OUTPUT:CONTROLLER
TorstenThieme4e2168e2021-06-22 14:01:47 +0000305 ${downstream_flow_dhcp_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Emrehan UZUN2884ed52021-05-04 15:36:31 +0000306 ... ${downstream_flow_dhcp_cmd}
307 Should Not Be Empty ${downstream_flow_dhcp_added}
308 # Verify downstream igmp flow
309 ${downstream_flow_igmp_cmd}= Catenate SEPARATOR=
310 ... flows -s ADDED ${olt_of_id} | grep IP_PROTO:2 |
311 ... grep OUTPUT:CONTROLLER
TorstenThieme4e2168e2021-06-22 14:01:47 +0000312 ${downstream_flow_igmp_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Emrehan UZUN2884ed52021-05-04 15:36:31 +0000313 ... ${downstream_flow_igmp_cmd}
314 Should Not Be Empty ${downstream_flow_igmp_added}
315
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530316Get Programmed Subscribers
317 [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port}
318 [Documentation] Retrieves the subscriber details at a given location
319 ${sub_location}= Catenate SEPARATOR=/ ${olt_of_id} ${onu_port}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000320 ${programmed_sub}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530321 ... volt-programmed-subscribers | grep ${sub_location}
322 [Return] ${programmed_sub}
323
324Get Upstream and Downstream Bandwidth Profile Name
325 [Arguments] ${programmed_sub}
326 [Documentation] Retrieves the upstream and downstream bandwidth profile name
327 ... from the programmed subscriber
328 @{programmed_sub_array}= Split String ${programmed_sub} ,
329 # Get upstream bandwidth profile name for the subscriber
330 @{param_val_pair}= Split String ${programmed_sub_array[9]} =
331 ${programmed_sub_param}= Set Variable ${param_val_pair[0]}
332 ${programmed_sub_val}= Set Variable ${param_val_pair[1]}
333 ${us_bw_profile}= Run Keyword If '${programmed_sub_param}' == ' upstreamBandwidthProfile'
334 ... Set Variable ${programmed_sub_val}
335 Log ${us_bw_profile}
336 # Get downstream bandwidth profile name for the subscriber
337 @{param_val_pair}= Split String ${programmed_sub_array[10]} =
338 ${programmed_sub_param}= Set Variable ${param_val_pair[0]}
339 ${programmed_sub_val}= Set Variable ${param_val_pair[1]}
340 ${ds_bw_profile}= Run Keyword If '${programmed_sub_param}' == ' downstreamBandwidthProfile'
341 ... Set Variable ${programmed_sub_val}
342 Log ${ds_bw_profile}
343 [Return] ${us_bw_profile} ${ds_bw_profile}
344
345Get Bandwidth Profile Details
346 [Arguments] ${ip} ${port} ${bw_profile}
347 [Documentation] Retrieves the details of the given bandwidth profile
TorstenThieme4e2168e2021-06-22 14:01:47 +0000348 ${bw_profile_values}= Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530349 ... bandwidthprofile ${bw_profile}
350 @{bw_profile_array}= Split String ${bw_profile_values} ,
351 @{param_val_pair}= Split String ${bw_profile_array[1]} =
352 ${bw_param}= Set Variable ${param_val_pair[0]}
353 ${bw_val}= Set Variable ${param_val_pair[1]}
354 ${cir} Run Keyword If '${bw_param}' == ' committedInformationRate'
355 ... Set Variable ${bw_val}
356 @{param_val_pair}= Split String ${bw_profile_array[2]} =
357 ${bw_param}= Set Variable ${param_val_pair[0]}
358 ${bw_val}= Set Variable ${param_val_pair[1]}
359 ${cbs} Run Keyword If '${bw_param}' == ' committedBurstSize'
360 ... Set Variable ${bw_val}
361 @{param_val_pair}= Split String ${bw_profile_array[3]} =
362 ${bw_param}= Set Variable ${param_val_pair[0]}
363 ${bw_val}= Set Variable ${param_val_pair[1]}
364 ${eir} Run Keyword If '${bw_param}' == ' exceededInformationRate'
365 ... Set Variable ${bw_val}
366 @{param_val_pair}= Split String ${bw_profile_array[4]} =
367 ${bw_param}= Set Variable ${param_val_pair[0]}
368 ${bw_val}= Set Variable ${param_val_pair[1]}
369 ${ebs} Run Keyword If '${bw_param}' == ' exceededBurstSize'
370 ... Set Variable ${bw_val}
371 @{param_val_pair}= Split String ${bw_profile_array[5]} =
372 ${bw_param}= Set Variable ${param_val_pair[0]}
373 ${bw_val}= Set Variable ${param_val_pair[1]}
374 @{bw_val_air}= Split String ${bw_val} }
375 ${air} Run Keyword If '${bw_param}' == ' assuredInformationRate'
376 ... Set Variable ${bw_val_air[0]}
377 [Return] ${cir} ${cbs} ${eir} ${ebs} ${air}
378
Hardik Windlassba5add42021-05-04 12:41:29 +0000379Get Bandwidth Profile Details Rest
380 [Arguments] ${bw_profile_id}
381 [Documentation] Retrieves the details of the given bandwidth profile using REST API
Girish Gowdracb8482a2021-05-27 09:06:13 -0700382 ${bw_profile_id}= Remove String ${bw_profile_id} ' "
Hardik Windlassba5add42021-05-04 12:41:29 +0000383 ${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 ${eir}= Get From Dictionary ${value} eir
393 ${ebs}= Get From Dictionary ${value} ebs
394 ${cir}= Get From Dictionary ${value} cir
395 ${cbs}= Get From Dictionary ${value} cbs
396 ${air}= Get From Dictionary ${value} air
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} ${eir} ${ebs} ${air}
401
Hardik Windlass841979a2021-05-25 05:30:27 +0000402Get Bandwidth Profile Details Ietf Rest
403 [Arguments] ${bw_profile_id}
404 [Documentation] Retrieves the details of the given Ietf standard based bandwidth profile using REST API
405 ${bw_profile_id}= Remove String ${bw_profile_id} ' "
406 ${resp}= Get Request ONOS onos/sadis/bandwidthprofile/${bw_profile_id}
407 ${jsondata}= To Json ${resp.content}
408 Should Not Be Empty ${jsondata['entry']}
409 ${length}= Get Length ${jsondata['entry']}
410 ${matched}= Set Variable False
411 FOR ${INDEX} IN RANGE 0 ${length}
412 ${value}= Get From List ${jsondata['entry']} ${INDEX}
413 ${bw_id}= Get From Dictionary ${value} id
414 ${matched}= Set Variable If '${bw_id}' == '${bw_profile_id}' True False
415 ${pir}= Get From Dictionary ${value} pir
416 ${pbs}= Get From Dictionary ${value} pbs
417 ${cir}= Get From Dictionary ${value} cir
418 ${cbs}= Get From Dictionary ${value} cbs
419 ${gir}= Get From Dictionary ${value} gir
420 Exit For Loop If ${matched}
421 END
422 Should Be True ${matched} No bandwidth profile found for id: ${bw_profile_id}
423 [Return] ${cir} ${cbs} ${pir} ${pbs} ${gir}
424
Girish Gowdra21ec25d2021-05-24 10:07:01 -0700425Verify Meters in ONOS Ietf
426 [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port}
427 [Documentation] Verifies the meters with BW Ietf format (currently, DT workflow uses this format)
428 # Get programmed subscriber
429 ${programmed_sub}= Get Programmed Subscribers ${ip} ${port}
430 ... ${olt_of_id} ${onu_port}
431 Log ${programmed_sub}
432 ${us_bw_profile} ${ds_bw_profile} Get Upstream and Downstream Bandwidth Profile Name
433 ... ${programmed_sub}
434 # Get upstream bandwidth profile details
435 ${us_cir} ${us_cbs} ${us_pir} ${us_pbs} ${us_gir} Get Bandwidth Profile Details Ietf Rest
436 ... ${us_bw_profile}
437 # Verify meter for upstream bandwidth profile
438 ${us_meter_cmd}= Run Keyword If ${us_gir} != 0 Catenate SEPARATOR=
439 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}"
440 ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | grep "rate=${us_gir}, burst-size=0" | wc -l
441 ... ELSE Catenate SEPARATOR=
442 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}"
443 ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | wc -l
TorstenThieme4e2168e2021-06-22 14:01:47 +0000444 ${upstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Girish Gowdra21ec25d2021-05-24 10:07:01 -0700445 ... ${us_meter_cmd}
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700446 Should Be Equal As Integers ${upstream_meter_added} 1 Upstream meter is missing
Girish Gowdra21ec25d2021-05-24 10:07:01 -0700447 # Get downstream bandwidth profile details
448 ${ds_cir} ${ds_cbs} ${ds_pir} ${ds_pbs} ${ds_gir} Get Bandwidth Profile Details Ietf Rest
449 ... ${ds_bw_profile}
450 # Verify meter for downstream bandwidth profile
451 ${ds_meter_cmd}= Run Keyword If ${ds_gir} != 0 Catenate SEPARATOR=
452 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}"
453 ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | grep "rate=${ds_gir}, burst-size=0" | wc -l
454 ... ELSE Catenate SEPARATOR=
455 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}"
456 ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | wc -l
TorstenThieme4e2168e2021-06-22 14:01:47 +0000457 ${downstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Girish Gowdra21ec25d2021-05-24 10:07:01 -0700458 ... ${ds_meter_cmd}
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700459 Should Be Equal As Integers ${downstream_meter_added} 1 Downstream meter is missing
Girish Gowdra21ec25d2021-05-24 10:07:01 -0700460
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530461Verify Meters in ONOS
462 [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port}
463 [Documentation] Verifies the meters
464 # Get programmed subscriber
465 ${programmed_sub}= Get Programmed Subscribers ${ip} ${port}
466 ... ${olt_of_id} ${onu_port}
467 Log ${programmed_sub}
468 ${us_bw_profile} ${ds_bw_profile} Get Upstream and Downstream Bandwidth Profile Name
469 ... ${programmed_sub}
470 # Get upstream bandwidth profile details
471 ${us_cir} ${us_cbs} ${us_eir} ${us_ebs} ${us_air} Get Bandwidth Profile Details
472 ... ${ip} ${port} ${us_bw_profile}
473 Sleep 1s
Andrea Campanella2b367102021-05-04 19:33:46 +0200474 ${us_pbs}= Evaluate ${us_cbs}+${us_ebs}
475 ${us_pir}= Evaluate ${us_eir}+${us_cir}+${us_air}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530476 # Verify meter for upstream bandwidth profile
477 ${us_meter_cmd}= Catenate SEPARATOR=
Hardik Windlasse380bdb2020-07-30 19:09:25 +0530478 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}"
Andrea Campanella2b367102021-05-04 19:33:46 +0200479 ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | grep "rate=${us_air}, burst-size=0" | wc -l
TorstenThieme4e2168e2021-06-22 14:01:47 +0000480 ${upstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530481 ... ${us_meter_cmd}
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700482 Should Be Equal As Integers ${upstream_meter_added} 1 Upstream meter is missing
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530483 Sleep 1s
484 # Get downstream bandwidth profile details
485 ${ds_cir} ${ds_cbs} ${ds_eir} ${ds_ebs} ${ds_air} Get Bandwidth Profile Details
486 ... ${ip} ${port} ${ds_bw_profile}
487 Sleep 1s
488 # Verify meter for downstream bandwidth profile
Andrea Campanella2b367102021-05-04 19:33:46 +0200489 ${ds_pbs}= Evaluate ${ds_cbs}+${ds_ebs}
490 ${ds_pir}= Evaluate ${ds_eir}+${ds_cir}+${ds_air}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530491 ${ds_meter_cmd}= Catenate SEPARATOR=
Hardik Windlasse380bdb2020-07-30 19:09:25 +0530492 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}"
Andrea Campanella2b367102021-05-04 19:33:46 +0200493 ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | grep "rate=${ds_air}, burst-size=0" | wc -l
TorstenThieme4e2168e2021-06-22 14:01:47 +0000494 ${downstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530495 ... ${ds_meter_cmd}
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700496 Should Be Equal As Integers ${downstream_meter_added} 1 Downstream meter is missing
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530497
498Verify Default Meter Present in ONOS
499 [Arguments] ${ip} ${port} ${olt_of_id}
500 [Documentation] Verifies the single default meter entry is present
Hardik Windlasse380bdb2020-07-30 19:09:25 +0530501 # Get default bandwidth profile details
502 ${cir} ${cbs} ${eir} ${ebs} ${air} Get Bandwidth Profile Details
503 ... ${ip} ${port} 'Default'
504 Sleep 1s
Andrea Campanella2b367102021-05-04 19:33:46 +0200505 ${pbs}= Evaluate ${cbs}+${ebs}
506 ${pir}= Evaluate ${eir}+${cir}+${air}
Hardik Windlasse380bdb2020-07-30 19:09:25 +0530507 # Verify meter for default bandwidth profile
508 ${meter_cmd}= Catenate SEPARATOR=
509 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${cir}, burst-size=${cbs}"
Andrea Campanella2b367102021-05-04 19:33:46 +0200510 ... | grep "rate=${pir}, burst-size=${pbs}" | grep "rate=${air}, burst-size=0" | wc -l
TorstenThieme4e2168e2021-06-22 14:01:47 +0000511 ${default_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlasse380bdb2020-07-30 19:09:25 +0530512 ... ${meter_cmd}
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700513 Should Be Equal As Integers ${default_meter_added} 1 Default Meter not present
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530514
Hardik Windlass480f3e22020-04-02 20:14:14 +0530515Verify Device Flows Removed
516 [Arguments] ${ip} ${port} ${olt_of_id}
517 [Documentation] Verifies all flows are removed from the device
TorstenThieme4e2168e2021-06-22 14:01:47 +0000518 ${device_flows}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700519 ... flows -s -f ${olt_of_id} | grep -v deviceId
520 ${flow_count}= Get Line Count ${device_flows}
521 Should Be Equal As Integers ${flow_count} 0 Flows not removed
Hardik Windlass480f3e22020-04-02 20:14:14 +0530522
Kailash6f5acb62019-08-28 14:38:45 -0700523Verify Eapol Flows Added
Andy Bavierb0c06232019-08-29 12:58:53 -0700524 [Arguments] ${ip} ${port} ${expected_flows}
Kailash6f5acb62019-08-28 14:38:45 -0700525 [Documentation] Matches for number of eapol flows based on number of onus
TorstenThieme4e2168e2021-06-22 14:01:47 +0000526 ${eapol_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Gilles Depatie675a2062019-10-22 12:44:42 -0400527 ... flows -s -f ADDED | grep eapol | grep IN_PORT | wc -l
Andy Bavierb0c06232019-08-29 12:58:53 -0700528 Should Contain ${eapol_flows_added} ${expected_flows}
Kailash6f5acb62019-08-28 14:38:45 -0700529
Suchitra Vemuri9da44302020-03-04 14:24:49 -0800530Verify No Pending Flows For ONU
531 [Arguments] ${ip} ${port} ${onu_port}
532 [Documentation] Verifies that there are no flows "PENDING" state for the ONU in ONOS
TorstenThieme4e2168e2021-06-22 14:01:47 +0000533 ${pending_flows}= Execute ONOS CLI Command use single connection ${ip} ${port}
Suchitra Vemuri9da44302020-03-04 14:24:49 -0800534 ... flows -s | grep IN_PORT:${onu_port} | grep PENDING
535 Should Be Empty ${pending_flows}
536
Suchitra Vemuri3dd2f832019-10-18 13:14:54 -0700537Verify Eapol Flows Added For ONU
Matteo Scandolo7e519fb2021-08-13 11:35:16 -0700538 [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${c_tag}=4091
Suchitra Vemuri3dd2f832019-10-18 13:14:54 -0700539 [Documentation] Verifies if the Eapol Flows are added in ONOS for the ONU
Matteo Scandolo7e519fb2021-08-13 11:35:16 -0700540 ${eapol_flow_cmd}= Catenate SEPARATOR=
541 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep ETH_TYPE:eapol |
542 ... grep VLAN_ID:${c_tag} | grep OUTPUT:CONTROLLER
543 ${eapol_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port} ${eapol_flow_cmd}
Suchitra Vemuri3dd2f832019-10-18 13:14:54 -0700544 Should Not Be Empty ${eapol_flows_added}
545
Hardik Windlass39015672021-07-05 05:48:08 +0000546Verify UNI Port Is Enabled
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000547 [Arguments] ${ip} ${port} ${onu_name} ${onu_uni_id}=1
Hardik Windlass39015672021-07-05 05:48:08 +0000548 [Documentation] Verifies if the ONU's UNI port is enabled in ONOS
TorstenThieme4e2168e2021-06-22 14:01:47 +0000549 ${onu_port_enabled}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000550 ... ports -e | grep portName=${onu_name}-${onu_uni_id}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800551 Log ${onu_port_enabled}
552 Should Not Be Empty ${onu_port_enabled}
553
Hardik Windlass39015672021-07-05 05:48:08 +0000554Verify UNI Port Is Disabled
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000555 [Arguments] ${ip} ${port} ${onu_name} ${onu_uni_id}=1
Hardik Windlass39015672021-07-05 05:48:08 +0000556 [Documentation] Verifies if the ONU's UNI port is disabled in ONOS
TorstenThieme4e2168e2021-06-22 14:01:47 +0000557 ${onu_port_disabled}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo02768532021-10-21 15:14:12 -0700558 ... ports | grep portName=${onu_name}-${onu_uni_id} | grep state=disabled
Hardik Windlass63d5e002020-03-06 21:07:09 +0530559 Log ${onu_port_disabled}
Matteo Scandolo02768532021-10-21 15:14:12 -0700560 Should Not Be Empty ${onu_port_disabled}
Hardik Windlass63d5e002020-03-06 21:07:09 +0530561
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700562Verify ONU in AAA-Users
563 [Arguments] ${ip} ${port} ${onu_port}
564 [Documentation] Verifies that the specified onu_port exists in aaa-users output
TorstenThieme4e2168e2021-06-22 14:01:47 +0000565 ${aaa_users}= Execute ONOS CLI Command use single connection ${ip} ${port}
566 ... aaa-users | grep AUTHORIZED | grep ${onu_port}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700567 Should Not Be Empty ${aaa_users} ONU port ${onu_port} not found in aaa-users
568
Hardik Windlass513afd12021-02-03 15:19:46 +0000569Verify Empty Group in ONOS
570 [Documentation] Verifies zero group count on the device
TorstenThieme731a7592021-07-01 14:26:54 +0000571 [Arguments] ${ip} ${port} ${deviceId}
572 ${groups}= Execute ONOS CLI Command use single connection ${ip} ${port} groups | grep ${deviceId}
Hardik Windlass513afd12021-02-03 15:19:46 +0000573 @{groups_arr}= Split String ${groups} ,
574 @{group_count_arr}= Split String ${groups_arr[1]} =
575 ${group_count}= Set Variable ${group_count_arr[1]}
576 Should Be Equal As Integers ${group_count} 0
577
578Verify ONUs in Group Count in ONOS
579 [Documentation] Verifies there exists a group bucket list with certain entries/count
580 ... Note: Currently, this validates only if all ONUs of an OLT joined the same igmp group
TorstenThieme731a7592021-07-01 14:26:54 +0000581 [Arguments] ${ip} ${port} ${count} ${deviceId}
582 ${result}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolofd36e212021-03-02 11:36:10 -0800583 ... groups added ${deviceId} | grep bucket | wc -l
584 Should Be Equal As Integers ${result} ${count} Bucket list count for a group: Found=${result} Expected=${count}
Hardik Windlass513afd12021-02-03 15:19:46 +0000585
586Verify ONU in Group Bucket
587 [Documentation] Matches if ONU port in Group Bucket
588 [Arguments] ${group_bucket_values} ${onu_port}
589 ${len}= Get Length ${group_bucket_values}
590 ${matched}= Set Variable False
591 FOR ${INDEX} IN RANGE 0 ${len}
592 ${value_bucket}= Get From List ${group_bucket_values} ${INDEX}
593 ${treatment}= Get From Dictionary ${value_bucket} treatment
594 ${instructions}= Get From Dictionary ${treatment} instructions
595 ${instructions_val}= Get From List ${instructions} 0
596 ${port}= Get From Dictionary ${instructions_val} port
597 ${matched}= Set Variable If '${port}'=='${onu_port}' True False
598 Exit For Loop If ${matched}
599 END
600 [Return] ${matched}
601
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700602Verify ONU in Groups
603 [Arguments] ${ip_onos} ${port_onos} ${deviceId} ${onu_port} ${group_exist}=True
604 [Documentation] Verifies that the specified onu_port exists in groups output
TorstenThieme4e2168e2021-06-22 14:01:47 +0000605 ${result}= Execute ONOS CLI Command use single connection ${ip_onos} ${port_onos} groups -j
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700606 Log Groups: ${result}
607 ${groups}= To Json ${result}
608 ${length}= Get Length ${groups}
609 ${buckets}= Create List
610 ${matched}= Set Variable False
611 FOR ${INDEX} IN RANGE 0 ${length}
612 ${value}= Get From List ${groups} ${INDEX}
613 ${devId}= Get From Dictionary ${value} deviceId
614 ${bucket}= Get From Dictionary ${value} buckets
615 Run Keyword If '${devId}'=='${deviceId}'
616 ... Append To List ${buckets} ${bucket}
617 END
618 ${bucket_len}= Get Length ${buckets}
Hardik Windlass513afd12021-02-03 15:19:46 +0000619 FOR ${INDEX_1} IN RANGE 0 ${bucket_len}
620 ${value}= Get From List ${buckets} ${INDEX_1}
621 ${matched}= Verify ONU in Group Bucket ${value} ${onu_port}
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700622 Exit For Loop If ${matched}
623 END
624 Run Keyword If ${group_exist}
625 ... Should Be True ${matched} No match for ${deviceId} and ${onu_port} found in ONOS groups
626 ... ELSE
627 ... Should Be True '${matched}'=='False' Match for ${deviceId} and ${onu_port} found in ONOS groups
628
Matteo Scandolo142e6272020-04-29 17:36:59 -0700629Assert Number of AAA-Users
TorstenThieme731a7592021-07-01 14:26:54 +0000630 [Arguments] ${ip} ${port} ${expected_onus} ${deviceId}
Kailash6f5acb62019-08-28 14:38:45 -0700631 [Documentation] Matches for number of aaa-users authorized based on number of onus
TorstenThieme731a7592021-07-01 14:26:54 +0000632 ${aaa_users}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800633 ... aaa-users | grep ${deviceId} | grep AUTHORIZED | wc -l
634 Log Found ${aaa_users} of ${expected_onus} expected authenticated users on device ${deviceId}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700635 Should Be Equal As Integers ${aaa_users} ${expected_onus}
Kailash6f5acb62019-08-28 14:38:45 -0700636
637Validate DHCP Allocations
TorstenThieme731a7592021-07-01 14:26:54 +0000638 [Arguments] ${ip} ${port} ${count} ${workflow} ${deviceId}
Kailash6f5acb62019-08-28 14:38:45 -0700639 [Documentation] Matches for number of dhcpacks based on number of onus
TorstenThieme731a7592021-07-01 14:26:54 +0000640 ${allocations}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800641 ... dhcpl2relay-allocations | grep ${deviceId} | grep DHCPACK | wc -l
Matteo Scandoloda854b02020-09-01 16:20:51 -0700642 # if the workflow is TT we'll have 2 allocations for each ONU
643 ${ttAllocations}= Evaluate (${count} * 2)
644 ${count}= Set Variable If $workflow=='tt' ${ttAllocations} ${count}
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800645 Log Found ${allocations} of ${count} expected DHCPACK on device ${deviceId}
Matteo Scandoloda854b02020-09-01 16:20:51 -0700646 Should Be Equal As Integers ${allocations} ${count}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700647
648Validate Subscriber DHCP Allocation
Suchitra Vemuri42819412020-10-01 17:45:43 -0700649 [Arguments] ${ip} ${port} ${onu_port} ${vlan}=''
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700650 [Documentation] Verifies that the specified subscriber is found in DHCP allocations
651 ##TODO: Enhance the keyword to include DHCP allocated address is not 0.0.0.0
TorstenThieme4e2168e2021-06-22 14:01:47 +0000652 ${allocations}= Execute ONOS CLI Command use single connection ${ip} ${port}
Suchitra Vemuri42819412020-10-01 17:45:43 -0700653 ... dhcpl2relay-allocations | grep DHCPACK | grep ${onu_port} | grep ${vlan}
Gilles Depatie675a2062019-10-22 12:44:42 -0400654 Should Not Be Empty ${allocations} ONU port ${onu_port} not found in dhcpl2relay-allocations
David Bainbridgef81cd642019-11-20 00:14:47 +0000655
656Device Is Available In ONOS
Matteo Scandolo3218d5b2021-05-26 11:50:10 -0700657 [Arguments] ${url} ${dpid} ${available}=true
658 [Documentation] Validates the device exists and it has the expected availability in ONOS
David Bainbridgef81cd642019-11-20 00:14:47 +0000659 ${rc} ${json} Run And Return Rc And Output curl --fail -sSL ${url}/onos/v1/devices/${dpid}
660 Should Be Equal As Integers 0 ${rc}
661 ${rc} ${value} Run And Return Rc And Output echo '${json}' | jq -r .available
662 Should Be Equal As Integers 0 ${rc}
Matteo Scandolo3218d5b2021-05-26 11:50:10 -0700663 Should Be Equal ${available} ${value}
David Bainbridgef81cd642019-11-20 00:14:47 +0000664
665Remove All Devices From ONOS
666 [Arguments] ${url}
667 [Documentation] Executes the device-remove command on each device in ONOS
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000668 ${rc} ${output} Run And Return Rc And Output
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700669 ... curl --fail -sSL ${url}/onos/v1/devices | jq -r '.devices[].id'
David Bainbridgef81cd642019-11-20 00:14:47 +0000670 Should Be Equal As Integers ${rc} 0
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000671 @{dpids} Split String ${output}
David Bainbridgef81cd642019-11-20 00:14:47 +0000672 ${count}= Get length ${dpids}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700673 FOR ${dpid} IN @{dpids}
674 ${rc}= Run Keyword If '${dpid}' != ''
675 ... Run And Return Rc curl -XDELETE --fail -sSL ${url}/onos/v1/devices/${dpid}
676 Run Keyword If '${dpid}' != ''
677 ... Should Be Equal As Integers ${rc} 0
678 END
Matteo Scandolo142e6272020-04-29 17:36:59 -0700679
TorstenThieme440b7c02020-12-18 15:42:57 +0000680Assert ONU Port Is Disabled
TorstenThieme731a7592021-07-01 14:26:54 +0000681 [Arguments] ${ip} ${port} ${deviceId} ${onu_port}
TorstenThieme440b7c02020-12-18 15:42:57 +0000682 [Documentation] Verifies if the ONU port is disabled in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000683 ${onu_port_disabled}= Execute ONOS CLI Command use single connection ${ip} ${port}
TorstenThieme440b7c02020-12-18 15:42:57 +0000684 ... ports -d ${deviceId} | grep port=${onu_port}
685 Log ${onu_port_disabled}
686 Should Not Be Empty ${onu_port_disabled}
687
Matteo Scandolo7d1a80d2021-04-09 14:30:43 -0700688Assert Olts in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000689 [Arguments] ${ip} ${port} ${count}
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700690 [Documentation] DEPRECATED use Assert Olt in ONOS
691 ... Check that a certain number of olts are known to ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000692 ${olts}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700693 ... volt-olts | wc -l
Matteo Scandolo7d1a80d2021-04-09 14:30:43 -0700694 Log Found ${olts} of ${count} expected Olts
695 Should Be Equal As Integers ${olts} ${count}
696
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700697Assert Olt in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000698 [Arguments] ${ip} ${port} ${deviceId}
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700699 [Documentation] Check that a particular olt is known to ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000700 ${olts}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700701 ... volt-olts | grep ${deviceId} | wc -l
702 Should Be Equal As Integers ${olts} 1 "Device ${deviceId} is not recognized as an OLT"
703
Matteo Scandolo7d1a80d2021-04-09 14:30:43 -0700704Wait for Olts in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000705 [Arguments] ${ip} ${port} ${count} ${max_wait_time}=10m
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700706 [Documentation] DEPRECATED use Wait for Olt in ONOS
707 ... Waits untill a certain number of ports are enabled in ONOS for a particular deviceId
Matteo Scandolo7d1a80d2021-04-09 14:30:43 -0700708 Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Olts in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000709 ... ${ip} ${port} ${count}
Matteo Scandolo7d1a80d2021-04-09 14:30:43 -0700710
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700711Wait for Olt in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000712 [Arguments] ${ip} ${port} ${deviceId} ${max_wait_time}=10m
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700713 [Documentation] Waits until a particular deviceId is recognized by ONOS as an OLT
714 Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Olt in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000715 ... ${ip} ${port} ${deviceId}
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700716
Matteo Scandolo142e6272020-04-29 17:36:59 -0700717Assert Ports in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000718 [Arguments] ${ip} ${port} ${count} ${deviceId} ${filter}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700719 [Documentation] Check that a certain number of ports are enabled in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000720 ${ports}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800721 ... ports -e ${deviceId} | grep ${filter} | wc -l
722 Log Found ${ports} of ${count} expected ports on device ${deviceId}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700723 Should Be Equal As Integers ${ports} ${count}
724
725Wait for Ports in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000726 [Arguments] ${ip} ${port} ${count} ${deviceId} ${filter} ${max_wait_time}=10m
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800727 [Documentation] Waits untill a certain number of ports are enabled in ONOS for a particular deviceId
TorstenThiemed4f48962020-12-08 12:17:19 +0000728 Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Ports in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000729 ... ${ip} ${port} ${count} ${deviceId} ${filter}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700730
731Wait for AAA Authentication
TorstenThieme731a7592021-07-01 14:26:54 +0000732 [Arguments] ${ip} ${port} ${count} ${deviceId} ${max_wait_time}=10m
Matteo Scandolo142e6272020-04-29 17:36:59 -0700733 [Documentation] Waits untill a certain number of subscribers are authenticated in ONOS
TorstenThiemed4f48962020-12-08 12:17:19 +0000734 Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Number of AAA-Users
TorstenThieme731a7592021-07-01 14:26:54 +0000735 ... ${ip} ${port} ${count} ${deviceId}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700736
737Wait for DHCP Ack
TorstenThieme731a7592021-07-01 14:26:54 +0000738 [Arguments] ${ip} ${port} ${count} ${workflow} ${deviceId} ${max_wait_time}=10m
Matteo Scandolo142e6272020-04-29 17:36:59 -0700739 [Documentation] Waits untill a certain number of subscribers have received a DHCP_ACK
TorstenThiemed4f48962020-12-08 12:17:19 +0000740 Wait Until Keyword Succeeds ${max_wait_time} 5s Validate DHCP Allocations
TorstenThieme731a7592021-07-01 14:26:54 +0000741 ... ${ip} ${port} ${count} ${workflow} ${deviceId}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700742
Matteo Scandolo96dbe432020-05-28 10:51:57 -0700743Provision subscriber REST
744 [Documentation] Uses the rest APIs to provision a subscriber
TorstenThieme731a7592021-07-01 14:26:54 +0000745 [Arguments] ${of_id} ${onu_port}
Matteo Scandolo96dbe432020-05-28 10:51:57 -0700746 ${resp}= Post Request ONOS
747 ... /onos/olt/oltapp/${of_id}/${onu_port}
748 Should Be Equal As Strings ${resp.status_code} 200
749
Hardik Windlassea4caf72021-07-30 07:22:12 +0000750Count Enabled UNI Ports
751 [Documentation] Count all the UNI Ports on a Device
752 [Arguments] ${ip} ${port} ${of_id}
753 ${count}= Execute ONOS CLI Command use single connection ${ip} ${port}
754 ... ports -e ${of_id} | grep -v SWITCH | grep -v nni | wc -l
755 Log ${count}
756 [Return] ${count}
757
Matteo Scandolo142e6272020-04-29 17:36:59 -0700758List Enabled UNI Ports
759 [Documentation] List all the UNI Ports, the only way we have is to filter out the one called NNI
760 ... Creates a list of dictionaries
TorstenThieme731a7592021-07-01 14:26:54 +0000761 [Arguments] ${ip} ${port} ${of_id}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700762 [Return] [{'port': '16', 'of_id': 'of:00000a0a0a0a0a00'}, {'port': '32', 'of_id': 'of:00000a0a0a0a0a00'}]
763 ${result}= Create List
TorstenThieme731a7592021-07-01 14:26:54 +0000764 ${out}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700765 ... ports -e ${of_id} | grep -v SWITCH | grep -v nni
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000766 @{unis}= Split To Lines ${out}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700767 FOR ${uni} IN @{unis}
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000768 ${matches} = Get Regexp Matches ${uni} .*port=([0-9]+),.* 1
Matteo Scandolo142e6272020-04-29 17:36:59 -0700769 &{portDict} Create Dictionary of_id=${of_id} port=${matches[0]}
770 Append To List ${result} ${portDict}
771 END
772 Log ${result}
773 Return From Keyword ${result}
774
775Provision all subscribers on device
Matteo Scandolo96dbe432020-05-28 10:51:57 -0700776 [Documentation] Provisions a subscriber in ONOS for all the enabled UNI ports on a particular device
TorstenThieme731a7592021-07-01 14:26:54 +0000777 [Arguments] ${ip} ${port} ${onos_ip} ${onos_rest_port} ${of_id}
778 ${unis}= List Enabled UNI Ports ${ip} ${port} ${of_id}
Matteo Scandolo96dbe432020-05-28 10:51:57 -0700779 ${onos_auth}= Create List karaf karaf
780 Create Session ONOS http://${onos_ip}:${onos_rest_port} auth=${onos_auth}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700781 FOR ${uni} IN @{unis}
TorstenThieme731a7592021-07-01 14:26:54 +0000782 Provision Subscriber REST ${uni['of_id']} ${uni['port']}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700783 END
784
785List OLTs
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800786 # NOTE this method is not currently used but it can come useful in the future
787 [Documentation] Returns a list of all OLTs known to ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000788 [Arguments] ${ip} ${port}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700789 [Return] ['of:00000a0a0a0a0a00', 'of:00000a0a0a0a0a01']
790 ${result}= Create List
TorstenThieme731a7592021-07-01 14:26:54 +0000791 ${out}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700792 ... volt-olts
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000793 @{olts}= Split To Lines ${out}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700794 FOR ${olt} IN @{olts}
795 Log ${olt}
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000796 ${matches} = Get Regexp Matches ${olt} ^OLT (.+)$ 1
Matteo Scandolo142e6272020-04-29 17:36:59 -0700797 # there may be some logs mixed with the output so only append if we have a match
798 ${matches_length}= Get Length ${matches}
799 Run Keyword If ${matches_length}==1
800 ... Append To List ${result} ${matches[0]}
801 END
802 Return From Keyword ${result}
803
804Count ADDED flows
805 [Documentation] Count the flows in ADDED state in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000806 [Arguments] ${ip} ${port} ${targetFlows} ${deviceId}
807 ${flows}= Execute ONOS CLI Command use single connection ${ip} ${port}
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800808 ... flows -s any ${deviceId} | grep ADDED | wc -l
809 Log Found ${flows} of ${targetFlows} expected flows on device ${deviceId}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700810 Should Be Equal As Integers ${targetFlows} ${flows}
811
812Wait for all flows to in ADDED state
813 [Documentation] Waits until the flows have been provisioned
TorstenThieme731a7592021-07-01 14:26:54 +0000814 [Arguments] ${ip} ${port} ${deviceId} ${workflow} ${uni_count} ${olt_count}
TorstenThiemeb198c482020-12-14 19:45:23 +0000815 ... ${provisioned} ${withEapol} ${withDhcp} ${withIgmp} ${withLldp}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700816 ${targetFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned}
Andrea Campanella70cf0a72020-05-27 10:55:15 +0200817 ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700818 Wait Until Keyword Succeeds 10m 5s Count ADDED flows
TorstenThieme731a7592021-07-01 14:26:54 +0000819 ... ${ip} ${port} ${targetFlows} ${deviceId}
Gayathri.Selvan92d16862020-03-19 14:47:58 +0000820
Girish Gowdrad769b412021-05-16 11:09:46 -0700821Get Limiting Bandwidth Details
Gayathri.Selvan92d16862020-03-19 14:47:58 +0000822 [Arguments] ${bandwidth_profile_name}
823 [Documentation] Collects the bandwidth profile details for the given bandwidth profile and
824 ... returns the limiting bandwidth
Girish Gowdracb8482a2021-05-27 09:06:13 -0700825 ${cir} ${cbs} ${eir} ${ebs} ${air}= Get Bandwidth Profile Details Rest
826 ... ${bandwidth_profile_name}
Girish Gowdrad769b412021-05-16 11:09:46 -0700827 ${limiting_BW}= Evaluate ${eir}+${cir}+${air}
Gayathri.Selvan92d16862020-03-19 14:47:58 +0000828 [Return] ${limiting_BW}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000829
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000830Get Limiting Bandwidth Details for Fixed and Committed
831 [Arguments] ${bandwidth_profile_name}
832 [Documentation] Collects the bandwidth profile details for the given bandwidth profile and
833 ... returns the limiting bandwidth for fixed and committed
834 ${cir} ${cbs} ${eir} ${ebs} ${air}= Get Bandwidth Profile Details Rest
835 ... ${bandwidth_profile_name}
836 ${limiting_BW}= Evaluate ${cir}+${air}
837 [Return] ${limiting_BW}
838
Hardik Windlasse8b99222021-01-25 10:03:14 +0000839Validate Deleted Device Cleanup In ONOS
840 [Arguments] ${ip} ${port} ${olt_serial_number}
841 [Documentation] The keyword verifies that ports, flows, meters, subscribers, dhcp are all cleared in ONOS
842 # Fetch OF Id for OLT
843 ${olt_of_id}= Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device in ONOS ${olt_serial_number}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000844 # Verify Ports are Removed
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700845 ${ports}= Execute ONOS CLI Command use single connection ${ip} ${port}
846 ... ports ${olt_of_id} | grep -v ${olt_of_id}
847 ${port_count}= Get Line Count ${ports}
848 Should Be Equal As Integers ${port_count} 0 Ports have not been removed from ONOS after cleanup
Hardik Windlasse8b99222021-01-25 10:03:14 +0000849 # Verify Subscribers are Removed
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700850 ${sub}= Execute ONOS CLI Command use single connection ${ip} ${port}
851 ... volt-programmed-subscribers | grep ${olt_of_id}
852 ${sub_count}= Get Line Count ${sub}
853 Should Be Equal As Integers ${sub_count} 0 Subscribers have not been removed from ONOS after cleanup
Hardik Windlasse8b99222021-01-25 10:03:14 +0000854 # Verify Flows are Removed
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700855 ${flow}= Execute ONOS CLI Command use single connection ${ip} ${port}
856 ... flows -s -f ${olt_of_id} | grep -v deviceId
857 ${flow_count}= Get Line Count ${flow}
858 Should Be Equal As Integers ${flow_count} 0 Flows have not been removed from ONOS after cleanup
Hardik Windlasse8b99222021-01-25 10:03:14 +0000859 # Verify Meters are Removed
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700860 ${meter}= Execute ONOS CLI Command use single connection ${ip} ${port}
861 ... meters ${olt_of_id}
862 ${meter_count}= Get Line Count ${meter}
863 Should Be Equal As Integers ${meter_count} 0 Meters have not been removed from ONOS after cleanup
Hardik Windlasse8b99222021-01-25 10:03:14 +0000864 # Verify AAA-Users are Removed
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700865 ${aaa}= Execute ONOS CLI Command use single connection ${ip} ${port}
866 ... aaa-users ${olt_of_id}
867 ${aaa_count}= Get Line Count ${aaa}
868 Should Be Equal As Integers ${aaa_count} 0 AAA Users have not been removed from ONOS after cleanup
Hardik Windlasse8b99222021-01-25 10:03:14 +0000869 # Verify Dhcp-Allocations are Removed
Matteo Scandolo45645bd2021-11-02 10:09:07 -0700870 ${dhcp}= Execute ONOS CLI Command use single connection ${ip} ${port}
871 ... dhcpl2relay-allocations ${olt_of_id}
872 ${dhcp_count}= Get Line Count ${dhcp}
873 Should Be Equal As Integers ${dhcp_count} 0 DHCP Allocations have not been removed from ONOS after cleanup
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000874
875Delete ONOS App
876 [Arguments] ${url} ${app_name}
877 [Documentation] This keyword deactivates and uninstalls the given ONOS App
878 ${rc}= Run And Return Rc curl --fail -sSL -X DELETE ${url}/onos/v1/applications/${app_name}
Matteo Scandolo2769d2b2021-04-14 10:29:24 -0700879 Should Be Equal As Integers ${rc} 0 Can't delete ${app_name} from ONOS
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000880
881Verify ONOS App Active
882 [Arguments] ${url} ${app_name} ${app_version}=${EMPTY}
883 [Documentation] This keyword verifies that the given ONOS App status is Active
884 ${rc} ${output} Run And Return Rc And Output
885 ... curl --fail -sSL ${url}/onos/v1/applications/${app_name} | jq -r .state
886 Should Be Equal As Integers ${rc} 0
887 Should Be Equal '${output}' 'ACTIVE'
888 ${rc1} ${output1} Run And Return Rc And Output
889 ... curl --fail -sSL ${url}/onos/v1/applications/${app_name} | jq -r .version
890 Run Keyword If '${app_version}'!='${EMPTY}'
891 ... Run Keywords
Matteo Scandolo2769d2b2021-04-14 10:29:24 -0700892 ... Should Be Equal As Integers ${rc1} 0 Can't read app ${app_name} status from ONOS
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000893 ... AND Should Be Equal '${output1}' '${app_version}'
894
895Install And Activate ONOS App
896 [Arguments] ${url} ${app_oar_file}
897 [Documentation] This keyword installs and activates the given ONOS App
898 ${cmd}= Catenate SEPARATOR=
899 ... curl --fail -sSL -H Content-Type:application/octet-stream -
900 ... X POST ${url}/onos/v1/applications?activate=true --data-binary \@${app_oar_file}
901 ${rc} ${output} Run And Return Rc And Output ${cmd}
Matteo Scandolo2769d2b2021-04-14 10:29:24 -0700902 Should Be Equal As Integers ${rc} 0 Can't load onos app ${app_oar_file} to ONOS"
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000903 Log ${output}
Hardik Windlassdc2610f2021-03-09 07:33:51 +0000904
905Get ONOS App Details
906 [Arguments] ${url} ${app_name}
907 [Documentation] Retrieves ONOS App Details
908 ${rc} ${output} Run And Return Rc And Output
909 ... curl --fail -sSL ${url}/onos/v1/applications/${app_name}
Matteo Scandolo2769d2b2021-04-14 10:29:24 -0700910 Should Be Equal As Integers ${rc} 0 Can't read app ${app_name} details from ONOS
Hardik Windlassdc2610f2021-03-09 07:33:51 +0000911 [Return] ${output}