blob: 67b35899c1d3ca8875e17103e9f8b04bb82a0888 [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
43Execute ONOS CLI Command on open connection
44 [Documentation] Execute ONOS CLI Command On an Open Connection
TorstenThiemeb198c482020-12-14 19:45:23 +000045 [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 Scandolo37bca8d2020-07-31 11:28:40 -070054 ${output} Set Variable @{result_values}[0]
Matteo Scandolo50be75c2020-11-12 11:14:12 -080055 Log Command output: ${output}
Matteo Scandolo37bca8d2020-07-31 11:28:40 -070056 Should Be Empty @{result_values}[1]
57 Should Be Equal As Integers @{result_values}[2] 0
58 [Return] ${output}
59
TorstenThieme4e2168e2021-06-22 14:01:47 +000060Execute ONOS CLI Command use single connection
61 [Documentation] Execute ONOS CLI Command use an Open Connection
62 ... In case no connection is open a connection will be opened
63 [Arguments] ${host} ${port} ${cmd}
64 ${connection_list_id}= Get Conn List Id ${host} ${port}
65 ${connection_list_id}= Run Keyword If "${connection_list_id}"=="${EMPTY}"
66 ... Open ONOS SSH Connection ${host} ${port}
67 ... ELSE Set Variable ${connection_list_id}
68 ${connection_entry}= Get From List ${connection_list} ${connection_list_id}
69 SSHLibrary.Switch Connection ${connection_entry.conn_id}
70 ${PassOrFail} @{result_values} Run Keyword And Ignore Error SSHLibrary.Execute Command ${cmd}
71 ... return_rc=True return_stderr=True return_stdout=True
72 Run Keyword If '${PassOrFail}'=='FAIL' Reconnect ONOS SSH Connection ${connection_list_id}
73 @{result_values}= Run Keyword If '${PassOrFail}'=='FAIL'
74 ... SSHLibrary.Execute Command ${cmd} return_rc=True return_stderr=True return_stdout=True
75 ... ELSE Set Variable @{result_values}
76 ${output} Set Variable @{result_values}[0]
77 Log Command output: ${output}
78 Should Be Empty @{result_values}[1]
79 Should Be Equal As Integers @{result_values}[2] 0
80 [Return] ${output}
81
82Get Conn List Id
83 [Documentation] Looks up for an Open Connection with passed host and port in conection list
84 ... First match connection will be used.
85 [Arguments] ${host} ${port}
86 ${connection_list_id}= Set Variable ${EMPTY}
87 ${match}= Set Variable False
88 ${length}= Get Length ${connection_list}
89 FOR ${INDEX} IN RANGE 0 ${length}
90 #${Item}= Get From List ${connection_list} ${INDEX}
91 ${conndata}= Get Connection ${connection_list[${INDEX}].conn_id}
92 ${match}= Set Variable If '${conndata.host}'=='${host}' and '${conndata.port}'=='${port}' True False
93 ${connection_list_id}= Set Variable If ${match} ${INDEX} ${EMPTY}
94 Exit For Loop If ${match}
95 END
96 [Return] ${connection_list_id}
97
TorstenThiemeb198c482020-12-14 19:45:23 +000098Reconnect ONOS SSH Connection
99 [Documentation] Reconnect an SSH Connection
100 [Arguments] ${connection_list_id}
101 ${connection_entry}= Get From List ${connection_list} ${connection_list_id}
102 ${user}= Get From Dictionary ${connection_entry} user
103 ${pass}= Get From Dictionary ${connection_entry} pass
104 ${oldconndata}= Get Connection ${connection_entry.conn_id}
105 SSHLibrary.Switch Connection ${connection_entry.conn_id}
TorstenThiemebcf14612021-01-27 10:19:18 +0000106 Run Keyword And Ignore Error SSHLibrary.Close Connection
TorstenThiemeb198c482020-12-14 19:45:23 +0000107 ${conn_id}= SSHLibrary.Open Connection ${oldconndata.host} port=${oldconndata.port}
108 ... timeout=300s alias=ONOS_SSH
109 SSHLibrary.Login ${user} ${pass}
110 ${conn_list_entry}= Create Dictionary conn_id=${conn_id} user=${user} pass=${pass}
111 Set List Value ${connection_list} ${connection_list_id} ${conn_list_entry}
112 Set Global Variable ${connection_list}
113
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700114Close ONOS SSH Connection
115 [Documentation] Close an SSH Connection
TorstenThiemeb198c482020-12-14 19:45:23 +0000116 [Arguments] ${connection_list_id}
117 ${connection_entry}= Get From List ${connection_list} ${connection_list_id}
118 ${connection_alias}= Get From Dictionary ${connection_entry} conn_id
119 ${oldconndata}= Get Connection ${connection_entry.conn_id}
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700120 SSHLibrary.Switch Connection ${connection_alias}
TorstenThiemebcf14612021-01-27 10:19:18 +0000121 Run Keyword And Ignore Error SSHLibrary.Close Connection
TorstenThiemeb198c482020-12-14 19:45:23 +0000122 Remove From List ${connection_list} ${connection_list_id}
123 Set Global Variable ${connection_list}
124
125Close All ONOS SSH Connections
126 [Documentation] Close all SSH Connection and clear connection list.
127 SSHLibrary.Close All Connections
128 @{connection_list} Create List
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700129
Kailash6f5acb62019-08-28 14:38:45 -0700130Validate OLT Device in ONOS
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700131 # FIXME use volt-olts to check that the OLT is ONOS
Kailash6f5acb62019-08-28 14:38:45 -0700132 [Arguments] ${serial_number}
Zack Williamsec53a1b2019-09-16 15:50:52 -0700133 [Documentation] Checks if olt has been connected to ONOS
Kailash6f5acb62019-08-28 14:38:45 -0700134 ${resp}= Get Request ONOS onos/v1/devices
135 ${jsondata}= To Json ${resp.content}
136 Should Not Be Empty ${jsondata['devices']}
137 ${length}= Get Length ${jsondata['devices']}
138 @{serial_numbers}= Create List
Andy Bavierb63f6d22020-03-12 15:34:37 -0700139 ${matched}= Set Variable False
Zack Williamsec53a1b2019-09-16 15:50:52 -0700140 FOR ${INDEX} IN RANGE 0 ${length}
141 ${value}= Get From List ${jsondata['devices']} ${INDEX}
142 ${of_id}= Get From Dictionary ${value} id
143 ${sn}= Get From Dictionary ${value} serial
Andy Bavierb63f6d22020-03-12 15:34:37 -0700144 ${matched}= Set Variable If '${sn}' == '${serial_number}' True False
145 Exit For Loop If ${matched}
Zack Williamsec53a1b2019-09-16 15:50:52 -0700146 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700147 Should Be True ${matched} No match for ${serial_number} found
Kailash57210eb2019-08-30 13:27:19 -0700148 [Return] ${of_id}
Kailash6f5acb62019-08-28 14:38:45 -0700149
Suchitra Vemuri102912a2019-09-24 00:35:42 -0700150Get ONU Port in ONOS
Zack Williamsec53a1b2019-09-16 15:50:52 -0700151 [Arguments] ${onu_serial_number} ${olt_of_id}
Suchitra Vemuri102912a2019-09-24 00:35:42 -0700152 [Documentation] Retrieves ONU port for the ONU in ONOS
Suchitra Vemuria50c1c12019-09-30 19:54:26 -0700153 ${onu_serial_number}= Catenate SEPARATOR=- ${onu_serial_number} 1
Suchitra Vemuri102912a2019-09-24 00:35:42 -0700154 ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports
155 ${jsondata}= To Json ${resp.content}
156 Should Not Be Empty ${jsondata['ports']}
157 ${length}= Get Length ${jsondata['ports']}
158 @{ports}= Create List
Andy Bavierb63f6d22020-03-12 15:34:37 -0700159 ${matched}= Set Variable False
Zack Williamsec53a1b2019-09-16 15:50:52 -0700160 FOR ${INDEX} IN RANGE 0 ${length}
161 ${value}= Get From List ${jsondata['ports']} ${INDEX}
162 ${annotations}= Get From Dictionary ${value} annotations
163 ${onu_port}= Get From Dictionary ${value} port
164 ${portName}= Get From Dictionary ${annotations} portName
Andy Bavierb63f6d22020-03-12 15:34:37 -0700165 ${matched}= Set Variable If '${portName}' == '${onu_serial_number}' True False
166 Exit For Loop If ${matched}
Zack Williamsec53a1b2019-09-16 15:50:52 -0700167 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700168 Should Be True ${matched} No match for ${onu_serial_number} found
Suchitra Vemuri102912a2019-09-24 00:35:42 -0700169 [Return] ${onu_port}
170
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530171Get NNI Port in ONOS
172 [Arguments] ${olt_of_id}
173 [Documentation] Retrieves NNI port for the OLT in ONOS
174 ${resp}= Get Request ONOS onos/v1/devices/${olt_of_id}/ports
175 ${jsondata}= To Json ${resp.content}
176 Should Not Be Empty ${jsondata['ports']}
177 ${length}= Get Length ${jsondata['ports']}
178 @{ports}= Create List
179 ${matched}= Set Variable False
180 FOR ${INDEX} IN RANGE 0 ${length}
181 ${value}= Get From List ${jsondata['ports']} ${INDEX}
182 ${annotations}= Get From Dictionary ${value} annotations
183 ${nni_port}= Get From Dictionary ${value} port
184 ${nniPortName}= Catenate SEPARATOR= nni- ${nni_port}
185 ${portName}= Get From Dictionary ${annotations} portName
186 ${matched}= Set Variable If '${portName}' == '${nniPortName}' True False
187 Exit For Loop If ${matched}
188 END
189 Should Be True ${matched} No match for NNI found for ${olt_of_id}
190 [Return] ${nni_port}
191
Suchitra Vemuri532f67a2019-09-25 11:50:42 -0700192Get FabricSwitch in ONOS
193 [Documentation] Returns of_id of the Fabric Switch in ONOS
194 ${resp}= Get Request ONOS onos/v1/devices
195 ${jsondata}= To Json ${resp.content}
196 Should Not Be Empty ${jsondata['devices']}
197 ${length}= Get Length ${jsondata['devices']}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700198 ${matched}= Set Variable False
Suchitra Vemuri532f67a2019-09-25 11:50:42 -0700199 FOR ${INDEX} IN RANGE 0 ${length}
200 ${value}= Get From List ${jsondata['devices']} ${INDEX}
201 ${of_id}= Get From Dictionary ${value} id
202 ${type}= Get From Dictionary ${value} type
Andy Bavierb63f6d22020-03-12 15:34:37 -0700203 ${matched}= Set Variable If '${type}' == "SWITCH" True False
204 Exit For Loop If ${matched}
Suchitra Vemuri532f67a2019-09-25 11:50:42 -0700205 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700206 Should Be True ${matched} No fabric switch found
Suchitra Vemuri532f67a2019-09-25 11:50:42 -0700207 [Return] ${of_id}
208
Andrea Campanella4c404632020-08-26 14:41:36 +0200209Get Master Instace in ONOS
210 [Arguments] ${of_id}
211 [Documentation] Returns nodeId of the Master instace for a giver device in ONOS
212 ${resp}= Get Request ONOS onos/v1/mastership/${of_id}/master
213 ${jsondata}= To Json ${resp.content}
214 Should Not Be Empty ${jsondata['nodeId']}
215 ${master_node}= Get From Dictionary ${jsondata} nodeId
216 [Return] ${master_node}
217
Hardik Windlass21807632020-04-14 16:24:55 +0530218Verify Subscriber Access Flows Added for ONU
219 [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${c_tag} ${s_tag}
220 [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU
221 # Verify upstream table=0 flow
222 ${upstream_flow_0_cmd}= Catenate SEPARATOR=
223 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:0 |
224 ... grep VLAN_ID:${c_tag} | grep transition=TABLE:1
TorstenThieme4e2168e2021-06-22 14:01:47 +0000225 ${upstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530226 ... ${upstream_flow_0_cmd}
227 Should Not Be Empty ${upstream_flow_0_added}
228 # Verify upstream table=1 flow
229 ${flow_vlan_push_cmd}= Catenate SEPARATOR=
230 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:${c_tag} |
231 ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000232 ${upstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530233 ... ${flow_vlan_push_cmd}
234 Should Not Be Empty ${upstream_flow_1_added}
235 # Verify downstream table=0 flow
236 ${flow_vlan_pop_cmd}= Catenate SEPARATOR=
237 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${s_tag} |
238 ... grep VLAN_POP | grep transition=TABLE:1
TorstenThieme4e2168e2021-06-22 14:01:47 +0000239 ${downstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530240 ... ${flow_vlan_pop_cmd}
241 Should Not Be Empty ${downstream_flow_0_added}
242 # Verify downstream table=1 flow
243 ${downstream_flow_1_cmd}= Catenate SEPARATOR=
244 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${c_tag} |
245 ... grep VLAN_ID:0 | grep OUTPUT:${onu_port}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000246 ${downstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530247 ... ${downstream_flow_1_cmd}
248 Should Not Be Empty ${downstream_flow_1_added}
249 # Verify ipv4 dhcp upstream flow
250 ${upstream_flow_ipv4_cmd}= Catenate SEPARATOR=
Andrea Campanella5e9051c2020-04-30 14:38:35 +0200251 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep ETH_TYPE:ipv4 |
Andrea Campanella08678e12020-09-18 17:40:22 +0200252 ... grep IP_PROTO:17 | grep UDP_SRC:68 | grep UDP_DST:67 | grep VLAN_ID:${c_tag} |
Andrea Campanella5e9051c2020-04-30 14:38:35 +0200253 ... grep OUTPUT:CONTROLLER
TorstenThieme4e2168e2021-06-22 14:01:47 +0000254 ${upstream_flow_ipv4_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530255 ... ${upstream_flow_ipv4_cmd}
Andrea Campanella5e9051c2020-04-30 14:38:35 +0200256 Should Not Be Empty ${upstream_flow_ipv4_added}
Hardik Windlass21807632020-04-14 16:24:55 +0530257 # Verify ipv4 dhcp downstream flow
258 # Note: This flow will be one per nni per olt
259 ${downstream_flow_ipv4_cmd}= Catenate SEPARATOR=
Andrea Campanella5e9051c2020-04-30 14:38:35 +0200260 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep ETH_TYPE:ipv4 |
261 ... grep IP_PROTO:17 | grep UDP_SRC:67 | grep UDP_DST:68 | grep OUTPUT:CONTROLLER
TorstenThieme4e2168e2021-06-22 14:01:47 +0000262 ${downstream_flow_ipv4_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass21807632020-04-14 16:24:55 +0530263 ... ${downstream_flow_ipv4_cmd}
Andrea Campanella5e9051c2020-04-30 14:38:35 +0200264 Should Not Be Empty ${downstream_flow_ipv4_added}
Hardik Windlass21807632020-04-14 16:24:55 +0530265
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530266Verify Subscriber Access Flows Added for ONU DT
Hardik Windlass25e11702020-03-30 20:05:19 +0530267 [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${s_tag}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530268 [Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU
269 # Verify upstream table=0 flow
TorstenThieme4e2168e2021-06-22 14:01:47 +0000270 ${upstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass25e11702020-03-30 20:05:19 +0530271 ... 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 +0530272 Should Not Be Empty ${upstream_flow_0_added}
273 # Verify upstream table=1 flow
274 ${flow_vlan_push_cmd}= Catenate SEPARATOR=
Hardik Windlass25e11702020-03-30 20:05:19 +0530275 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${onu_port} | grep VLAN_VID:Any |
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530276 ... grep VLAN_PUSH | grep VLAN_ID:${s_tag} | grep OUTPUT:${nni_port}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000277 ${upstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530278 ... ${flow_vlan_push_cmd}
279 Should Not Be Empty ${upstream_flow_1_added}
280 # Verify downstream table=0 flow
281 ${flow_vlan_pop_cmd}= Catenate SEPARATOR=
Hardik Windlass25e11702020-03-30 20:05:19 +0530282 ... flows -s ADDED ${olt_of_id} | grep IN_PORT:${nni_port} | grep VLAN_VID:${s_tag} |
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530283 ... grep VLAN_POP | grep transition=TABLE:1
TorstenThieme4e2168e2021-06-22 14:01:47 +0000284 ${downstream_flow_0_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530285 ... ${flow_vlan_pop_cmd}
286 Should Not Be Empty ${downstream_flow_0_added}
287 # Verify downstream table=1 flow
TorstenThieme4e2168e2021-06-22 14:01:47 +0000288 ${downstream_flow_1_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass25e11702020-03-30 20:05:19 +0530289 ... 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 +0530290 Should Not Be Empty ${downstream_flow_1_added}
291
292Verify Subscriber Access Flows Added Count DT
Hardik Windlass25e11702020-03-30 20:05:19 +0530293 [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530294 [Documentation] Matches for total number of subscriber access flows added for all onus
TorstenThieme4e2168e2021-06-22 14:01:47 +0000295 ${access_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Girish Gowdra89f73772021-03-08 14:29:36 -0800296 ... flows -s ADDED ${olt_of_id} | grep -v deviceId | grep -v ETH_TYPE:lldp | grep -v ETH_TYPE:arp | wc -l
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530297 Should Be Equal As Integers ${access_flows_added} ${expected_flows}
298
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000299Verify Added Flow Count for OLT TT
300 [Arguments] ${ip} ${port} ${olt_of_id} ${expected_flows}
301 [Documentation] Total number of added flows given OLT with subscriber flows
TorstenThieme4e2168e2021-06-22 14:01:47 +0000302 ${access_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000303 ... flows -s ADDED ${olt_of_id} | grep -v deviceId | wc -l
304 Should Be Equal As Integers ${access_flows_added} ${expected_flows}
305
Emrehan UZUN2884ed52021-05-04 15:36:31 +0000306Verify Default Downstream Flows are added in ONOS for OLT TT
307 [Arguments] ${ip} ${port} ${olt_of_id} ${nni_port}
308 [Documentation] Verifies if the Default Downstream Flows are added in ONOS for the OLT
309 # Verify lldp flow
310 ${downstream_flow_lldp_cmd}= Catenate SEPARATOR=
311 ... flows -s ADDED ${olt_of_id} | grep lldp |
312 ... grep OUTPUT:CONTROLLER
TorstenThieme4e2168e2021-06-22 14:01:47 +0000313 ${downstream_flow_lldp_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Emrehan UZUN2884ed52021-05-04 15:36:31 +0000314 ... ${downstream_flow_lldp_cmd}
315 Should Not Be Empty ${downstream_flow_lldp_added}
316 # Verify downstream dhcp flow
317 ${downstream_flow_dhcp_cmd}= Catenate SEPARATOR=
318 ... flows -s ADDED ${olt_of_id} | grep IP_PROTO:17 | grep UDP_SRC:67 | grep UDP_DST:68 |
319 ... grep OUTPUT:CONTROLLER
TorstenThieme4e2168e2021-06-22 14:01:47 +0000320 ${downstream_flow_dhcp_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Emrehan UZUN2884ed52021-05-04 15:36:31 +0000321 ... ${downstream_flow_dhcp_cmd}
322 Should Not Be Empty ${downstream_flow_dhcp_added}
323 # Verify downstream igmp flow
324 ${downstream_flow_igmp_cmd}= Catenate SEPARATOR=
325 ... flows -s ADDED ${olt_of_id} | grep IP_PROTO:2 |
326 ... grep OUTPUT:CONTROLLER
TorstenThieme4e2168e2021-06-22 14:01:47 +0000327 ${downstream_flow_igmp_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Emrehan UZUN2884ed52021-05-04 15:36:31 +0000328 ... ${downstream_flow_igmp_cmd}
329 Should Not Be Empty ${downstream_flow_igmp_added}
330
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530331Get Programmed Subscribers
332 [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port}
333 [Documentation] Retrieves the subscriber details at a given location
334 ${sub_location}= Catenate SEPARATOR=/ ${olt_of_id} ${onu_port}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000335 ${programmed_sub}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530336 ... volt-programmed-subscribers | grep ${sub_location}
337 [Return] ${programmed_sub}
338
339Get Upstream and Downstream Bandwidth Profile Name
340 [Arguments] ${programmed_sub}
341 [Documentation] Retrieves the upstream and downstream bandwidth profile name
342 ... from the programmed subscriber
343 @{programmed_sub_array}= Split String ${programmed_sub} ,
344 # Get upstream bandwidth profile name for the subscriber
345 @{param_val_pair}= Split String ${programmed_sub_array[9]} =
346 ${programmed_sub_param}= Set Variable ${param_val_pair[0]}
347 ${programmed_sub_val}= Set Variable ${param_val_pair[1]}
348 ${us_bw_profile}= Run Keyword If '${programmed_sub_param}' == ' upstreamBandwidthProfile'
349 ... Set Variable ${programmed_sub_val}
350 Log ${us_bw_profile}
351 # Get downstream bandwidth profile name for the subscriber
352 @{param_val_pair}= Split String ${programmed_sub_array[10]} =
353 ${programmed_sub_param}= Set Variable ${param_val_pair[0]}
354 ${programmed_sub_val}= Set Variable ${param_val_pair[1]}
355 ${ds_bw_profile}= Run Keyword If '${programmed_sub_param}' == ' downstreamBandwidthProfile'
356 ... Set Variable ${programmed_sub_val}
357 Log ${ds_bw_profile}
358 [Return] ${us_bw_profile} ${ds_bw_profile}
359
360Get Bandwidth Profile Details
361 [Arguments] ${ip} ${port} ${bw_profile}
362 [Documentation] Retrieves the details of the given bandwidth profile
TorstenThieme4e2168e2021-06-22 14:01:47 +0000363 ${bw_profile_values}= Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530364 ... bandwidthprofile ${bw_profile}
365 @{bw_profile_array}= Split String ${bw_profile_values} ,
366 @{param_val_pair}= Split String ${bw_profile_array[1]} =
367 ${bw_param}= Set Variable ${param_val_pair[0]}
368 ${bw_val}= Set Variable ${param_val_pair[1]}
369 ${cir} Run Keyword If '${bw_param}' == ' committedInformationRate'
370 ... Set Variable ${bw_val}
371 @{param_val_pair}= Split String ${bw_profile_array[2]} =
372 ${bw_param}= Set Variable ${param_val_pair[0]}
373 ${bw_val}= Set Variable ${param_val_pair[1]}
374 ${cbs} Run Keyword If '${bw_param}' == ' committedBurstSize'
375 ... Set Variable ${bw_val}
376 @{param_val_pair}= Split String ${bw_profile_array[3]} =
377 ${bw_param}= Set Variable ${param_val_pair[0]}
378 ${bw_val}= Set Variable ${param_val_pair[1]}
379 ${eir} Run Keyword If '${bw_param}' == ' exceededInformationRate'
380 ... Set Variable ${bw_val}
381 @{param_val_pair}= Split String ${bw_profile_array[4]} =
382 ${bw_param}= Set Variable ${param_val_pair[0]}
383 ${bw_val}= Set Variable ${param_val_pair[1]}
384 ${ebs} Run Keyword If '${bw_param}' == ' exceededBurstSize'
385 ... Set Variable ${bw_val}
386 @{param_val_pair}= Split String ${bw_profile_array[5]} =
387 ${bw_param}= Set Variable ${param_val_pair[0]}
388 ${bw_val}= Set Variable ${param_val_pair[1]}
389 @{bw_val_air}= Split String ${bw_val} }
390 ${air} Run Keyword If '${bw_param}' == ' assuredInformationRate'
391 ... Set Variable ${bw_val_air[0]}
392 [Return] ${cir} ${cbs} ${eir} ${ebs} ${air}
393
Hardik Windlassba5add42021-05-04 12:41:29 +0000394Get Bandwidth Profile Details Rest
395 [Arguments] ${bw_profile_id}
396 [Documentation] Retrieves the details of the given bandwidth profile using REST API
Girish Gowdracb8482a2021-05-27 09:06:13 -0700397 ${bw_profile_id}= Remove String ${bw_profile_id} ' "
Hardik Windlassba5add42021-05-04 12:41:29 +0000398 ${resp}= Get Request ONOS onos/sadis/bandwidthprofile/${bw_profile_id}
399 ${jsondata}= To Json ${resp.content}
400 Should Not Be Empty ${jsondata['entry']}
401 ${length}= Get Length ${jsondata['entry']}
402 ${matched}= Set Variable False
403 FOR ${INDEX} IN RANGE 0 ${length}
404 ${value}= Get From List ${jsondata['entry']} ${INDEX}
405 ${bw_id}= Get From Dictionary ${value} id
406 ${matched}= Set Variable If '${bw_id}' == '${bw_profile_id}' True False
407 ${eir}= Get From Dictionary ${value} eir
408 ${ebs}= Get From Dictionary ${value} ebs
409 ${cir}= Get From Dictionary ${value} cir
410 ${cbs}= Get From Dictionary ${value} cbs
411 ${air}= Get From Dictionary ${value} air
412 Exit For Loop If ${matched}
413 END
414 Should Be True ${matched} No bandwidth profile found for id: ${bw_profile_id}
415 [Return] ${cir} ${cbs} ${eir} ${ebs} ${air}
416
Hardik Windlass841979a2021-05-25 05:30:27 +0000417Get Bandwidth Profile Details Ietf Rest
418 [Arguments] ${bw_profile_id}
419 [Documentation] Retrieves the details of the given Ietf standard based bandwidth profile using REST API
420 ${bw_profile_id}= Remove String ${bw_profile_id} ' "
421 ${resp}= Get Request ONOS onos/sadis/bandwidthprofile/${bw_profile_id}
422 ${jsondata}= To Json ${resp.content}
423 Should Not Be Empty ${jsondata['entry']}
424 ${length}= Get Length ${jsondata['entry']}
425 ${matched}= Set Variable False
426 FOR ${INDEX} IN RANGE 0 ${length}
427 ${value}= Get From List ${jsondata['entry']} ${INDEX}
428 ${bw_id}= Get From Dictionary ${value} id
429 ${matched}= Set Variable If '${bw_id}' == '${bw_profile_id}' True False
430 ${pir}= Get From Dictionary ${value} pir
431 ${pbs}= Get From Dictionary ${value} pbs
432 ${cir}= Get From Dictionary ${value} cir
433 ${cbs}= Get From Dictionary ${value} cbs
434 ${gir}= Get From Dictionary ${value} gir
435 Exit For Loop If ${matched}
436 END
437 Should Be True ${matched} No bandwidth profile found for id: ${bw_profile_id}
438 [Return] ${cir} ${cbs} ${pir} ${pbs} ${gir}
439
Girish Gowdra21ec25d2021-05-24 10:07:01 -0700440Verify Meters in ONOS Ietf
441 [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port}
442 [Documentation] Verifies the meters with BW Ietf format (currently, DT workflow uses this format)
443 # Get programmed subscriber
444 ${programmed_sub}= Get Programmed Subscribers ${ip} ${port}
445 ... ${olt_of_id} ${onu_port}
446 Log ${programmed_sub}
447 ${us_bw_profile} ${ds_bw_profile} Get Upstream and Downstream Bandwidth Profile Name
448 ... ${programmed_sub}
449 # Get upstream bandwidth profile details
450 ${us_cir} ${us_cbs} ${us_pir} ${us_pbs} ${us_gir} Get Bandwidth Profile Details Ietf Rest
451 ... ${us_bw_profile}
452 # Verify meter for upstream bandwidth profile
453 ${us_meter_cmd}= Run Keyword If ${us_gir} != 0 Catenate SEPARATOR=
454 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}"
455 ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | grep "rate=${us_gir}, burst-size=0" | wc -l
456 ... ELSE Catenate SEPARATOR=
457 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}"
458 ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | wc -l
TorstenThieme4e2168e2021-06-22 14:01:47 +0000459 ${upstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Girish Gowdra21ec25d2021-05-24 10:07:01 -0700460 ... ${us_meter_cmd}
461 Should Be Equal As Integers ${upstream_meter_added} 1
462 # Get downstream bandwidth profile details
463 ${ds_cir} ${ds_cbs} ${ds_pir} ${ds_pbs} ${ds_gir} Get Bandwidth Profile Details Ietf Rest
464 ... ${ds_bw_profile}
465 # Verify meter for downstream bandwidth profile
466 ${ds_meter_cmd}= Run Keyword If ${ds_gir} != 0 Catenate SEPARATOR=
467 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}"
468 ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | grep "rate=${ds_gir}, burst-size=0" | wc -l
469 ... ELSE Catenate SEPARATOR=
470 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}"
471 ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | wc -l
TorstenThieme4e2168e2021-06-22 14:01:47 +0000472 ${downstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Girish Gowdra21ec25d2021-05-24 10:07:01 -0700473 ... ${ds_meter_cmd}
474 Should Be Equal As Integers ${downstream_meter_added} 1
475
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530476Verify Meters in ONOS
477 [Arguments] ${ip} ${port} ${olt_of_id} ${onu_port}
478 [Documentation] Verifies the meters
479 # Get programmed subscriber
480 ${programmed_sub}= Get Programmed Subscribers ${ip} ${port}
481 ... ${olt_of_id} ${onu_port}
482 Log ${programmed_sub}
483 ${us_bw_profile} ${ds_bw_profile} Get Upstream and Downstream Bandwidth Profile Name
484 ... ${programmed_sub}
485 # Get upstream bandwidth profile details
486 ${us_cir} ${us_cbs} ${us_eir} ${us_ebs} ${us_air} Get Bandwidth Profile Details
487 ... ${ip} ${port} ${us_bw_profile}
488 Sleep 1s
Andrea Campanella2b367102021-05-04 19:33:46 +0200489 ${us_pbs}= Evaluate ${us_cbs}+${us_ebs}
490 ${us_pir}= Evaluate ${us_eir}+${us_cir}+${us_air}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530491 # Verify meter for upstream bandwidth profile
492 ${us_meter_cmd}= Catenate SEPARATOR=
Hardik Windlasse380bdb2020-07-30 19:09:25 +0530493 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${us_cir}, burst-size=${us_cbs}"
Andrea Campanella2b367102021-05-04 19:33:46 +0200494 ... | grep "rate=${us_pir}, burst-size=${us_pbs}" | grep "rate=${us_air}, burst-size=0" | wc -l
TorstenThieme4e2168e2021-06-22 14:01:47 +0000495 ${upstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530496 ... ${us_meter_cmd}
497 Should Be Equal As Integers ${upstream_meter_added} 1
498 Sleep 1s
499 # Get downstream bandwidth profile details
500 ${ds_cir} ${ds_cbs} ${ds_eir} ${ds_ebs} ${ds_air} Get Bandwidth Profile Details
501 ... ${ip} ${port} ${ds_bw_profile}
502 Sleep 1s
503 # Verify meter for downstream bandwidth profile
Andrea Campanella2b367102021-05-04 19:33:46 +0200504 ${ds_pbs}= Evaluate ${ds_cbs}+${ds_ebs}
505 ${ds_pir}= Evaluate ${ds_eir}+${ds_cir}+${ds_air}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530506 ${ds_meter_cmd}= Catenate SEPARATOR=
Hardik Windlasse380bdb2020-07-30 19:09:25 +0530507 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${ds_cir}, burst-size=${ds_cbs}"
Andrea Campanella2b367102021-05-04 19:33:46 +0200508 ... | grep "rate=${ds_pir}, burst-size=${ds_pbs}" | grep "rate=${ds_air}, burst-size=0" | wc -l
TorstenThieme4e2168e2021-06-22 14:01:47 +0000509 ${downstream_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530510 ... ${ds_meter_cmd}
511 Should Be Equal As Integers ${downstream_meter_added} 1
512
513Verify Default Meter Present in ONOS
514 [Arguments] ${ip} ${port} ${olt_of_id}
515 [Documentation] Verifies the single default meter entry is present
Hardik Windlasse380bdb2020-07-30 19:09:25 +0530516 # Get default bandwidth profile details
517 ${cir} ${cbs} ${eir} ${ebs} ${air} Get Bandwidth Profile Details
518 ... ${ip} ${port} 'Default'
519 Sleep 1s
Andrea Campanella2b367102021-05-04 19:33:46 +0200520 ${pbs}= Evaluate ${cbs}+${ebs}
521 ${pir}= Evaluate ${eir}+${cir}+${air}
Hardik Windlasse380bdb2020-07-30 19:09:25 +0530522 # Verify meter for default bandwidth profile
523 ${meter_cmd}= Catenate SEPARATOR=
524 ... meters ${olt_of_id} | grep state=ADDED | grep "rate=${cir}, burst-size=${cbs}"
Andrea Campanella2b367102021-05-04 19:33:46 +0200525 ... | grep "rate=${pir}, burst-size=${pbs}" | grep "rate=${air}, burst-size=0" | wc -l
TorstenThieme4e2168e2021-06-22 14:01:47 +0000526 ${default_meter_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlasse380bdb2020-07-30 19:09:25 +0530527 ... ${meter_cmd}
528 Should Be Equal As Integers ${default_meter_added} 1
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530529
Hardik Windlass480f3e22020-04-02 20:14:14 +0530530Verify Device Flows Removed
531 [Arguments] ${ip} ${port} ${olt_of_id}
532 [Documentation] Verifies all flows are removed from the device
TorstenThieme4e2168e2021-06-22 14:01:47 +0000533 ${device_flows}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlass480f3e22020-04-02 20:14:14 +0530534 ... flows -s -f ${olt_of_id} | grep -v deviceId | wc -l
535 Should Be Equal As Integers ${device_flows} 0
536
Kailash6f5acb62019-08-28 14:38:45 -0700537Verify Eapol Flows Added
Andy Bavierb0c06232019-08-29 12:58:53 -0700538 [Arguments] ${ip} ${port} ${expected_flows}
Kailash6f5acb62019-08-28 14:38:45 -0700539 [Documentation] Matches for number of eapol flows based on number of onus
TorstenThieme4e2168e2021-06-22 14:01:47 +0000540 ${eapol_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Gilles Depatie675a2062019-10-22 12:44:42 -0400541 ... flows -s -f ADDED | grep eapol | grep IN_PORT | wc -l
Andy Bavierb0c06232019-08-29 12:58:53 -0700542 Should Contain ${eapol_flows_added} ${expected_flows}
Kailash6f5acb62019-08-28 14:38:45 -0700543
Suchitra Vemuri9da44302020-03-04 14:24:49 -0800544Verify No Pending Flows For ONU
545 [Arguments] ${ip} ${port} ${onu_port}
546 [Documentation] Verifies that there are no flows "PENDING" state for the ONU in ONOS
TorstenThieme4e2168e2021-06-22 14:01:47 +0000547 ${pending_flows}= Execute ONOS CLI Command use single connection ${ip} ${port}
Suchitra Vemuri9da44302020-03-04 14:24:49 -0800548 ... flows -s | grep IN_PORT:${onu_port} | grep PENDING
549 Should Be Empty ${pending_flows}
550
Suchitra Vemuri3dd2f832019-10-18 13:14:54 -0700551Verify Eapol Flows Added For ONU
552 [Arguments] ${ip} ${port} ${onu_port}
553 [Documentation] Verifies if the Eapol Flows are added in ONOS for the ONU
TorstenThieme4e2168e2021-06-22 14:01:47 +0000554 ${eapol_flows_added}= Execute ONOS CLI Command use single connection ${ip} ${port}
Gilles Depatie675a2062019-10-22 12:44:42 -0400555 ... flows -s -f ADDED | grep eapol | grep IN_PORT:${onu_port}
Suchitra Vemuri3dd2f832019-10-18 13:14:54 -0700556 Should Not Be Empty ${eapol_flows_added}
557
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800558Verify ONU Port Is Enabled
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700559 [Arguments] ${ip} ${port} ${onu_name}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800560 [Documentation] Verifies if the ONU port is enabled in ONOS
TorstenThieme4e2168e2021-06-22 14:01:47 +0000561 ${onu_port_enabled}= Execute ONOS CLI Command use single connection ${ip} ${port}
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700562 ... ports -e | grep portName=${onu_name}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800563 Log ${onu_port_enabled}
564 Should Not Be Empty ${onu_port_enabled}
565
Hardik Windlass63d5e002020-03-06 21:07:09 +0530566Verify ONU Port Is Disabled
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700567 [Arguments] ${ip} ${port} ${onu_name}
Hardik Windlass63d5e002020-03-06 21:07:09 +0530568 [Documentation] Verifies if the ONU port is disabled in ONOS
TorstenThieme4e2168e2021-06-22 14:01:47 +0000569 ${onu_port_disabled}= Execute ONOS CLI Command use single connection ${ip} ${port}
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700570 ... ports -e | grep portName=${onu_name}
Hardik Windlass63d5e002020-03-06 21:07:09 +0530571 Log ${onu_port_disabled}
572 Should Be Empty ${onu_port_disabled}
573
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700574Verify ONU in AAA-Users
575 [Arguments] ${ip} ${port} ${onu_port}
576 [Documentation] Verifies that the specified onu_port exists in aaa-users output
TorstenThieme4e2168e2021-06-22 14:01:47 +0000577 ${aaa_users}= Execute ONOS CLI Command use single connection ${ip} ${port}
578 ... aaa-users | grep AUTHORIZED | grep ${onu_port}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700579 Should Not Be Empty ${aaa_users} ONU port ${onu_port} not found in aaa-users
580
Hardik Windlass513afd12021-02-03 15:19:46 +0000581Verify Empty Group in ONOS
582 [Documentation] Verifies zero group count on the device
583 [Arguments] ${onos_ssh_connection} ${deviceId}
584 ${groups}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} groups | grep ${deviceId}
585 @{groups_arr}= Split String ${groups} ,
586 @{group_count_arr}= Split String ${groups_arr[1]} =
587 ${group_count}= Set Variable ${group_count_arr[1]}
588 Should Be Equal As Integers ${group_count} 0
589
590Verify ONUs in Group Count in ONOS
591 [Documentation] Verifies there exists a group bucket list with certain entries/count
592 ... Note: Currently, this validates only if all ONUs of an OLT joined the same igmp group
593 [Arguments] ${onos_ssh_connection} ${count} ${deviceId}
Matteo Scandolofd36e212021-03-02 11:36:10 -0800594 ${result}= Execute ONOS CLI Command on open connection ${onos_ssh_connection}
595 ... groups added ${deviceId} | grep bucket | wc -l
596 Should Be Equal As Integers ${result} ${count} Bucket list count for a group: Found=${result} Expected=${count}
Hardik Windlass513afd12021-02-03 15:19:46 +0000597
598Verify ONU in Group Bucket
599 [Documentation] Matches if ONU port in Group Bucket
600 [Arguments] ${group_bucket_values} ${onu_port}
601 ${len}= Get Length ${group_bucket_values}
602 ${matched}= Set Variable False
603 FOR ${INDEX} IN RANGE 0 ${len}
604 ${value_bucket}= Get From List ${group_bucket_values} ${INDEX}
605 ${treatment}= Get From Dictionary ${value_bucket} treatment
606 ${instructions}= Get From Dictionary ${treatment} instructions
607 ${instructions_val}= Get From List ${instructions} 0
608 ${port}= Get From Dictionary ${instructions_val} port
609 ${matched}= Set Variable If '${port}'=='${onu_port}' True False
610 Exit For Loop If ${matched}
611 END
612 [Return] ${matched}
613
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700614Verify ONU in Groups
615 [Arguments] ${ip_onos} ${port_onos} ${deviceId} ${onu_port} ${group_exist}=True
616 [Documentation] Verifies that the specified onu_port exists in groups output
TorstenThieme4e2168e2021-06-22 14:01:47 +0000617 ${result}= Execute ONOS CLI Command use single connection ${ip_onos} ${port_onos} groups -j
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700618 Log Groups: ${result}
619 ${groups}= To Json ${result}
620 ${length}= Get Length ${groups}
621 ${buckets}= Create List
622 ${matched}= Set Variable False
623 FOR ${INDEX} IN RANGE 0 ${length}
624 ${value}= Get From List ${groups} ${INDEX}
625 ${devId}= Get From Dictionary ${value} deviceId
626 ${bucket}= Get From Dictionary ${value} buckets
627 Run Keyword If '${devId}'=='${deviceId}'
628 ... Append To List ${buckets} ${bucket}
629 END
630 ${bucket_len}= Get Length ${buckets}
Hardik Windlass513afd12021-02-03 15:19:46 +0000631 FOR ${INDEX_1} IN RANGE 0 ${bucket_len}
632 ${value}= Get From List ${buckets} ${INDEX_1}
633 ${matched}= Verify ONU in Group Bucket ${value} ${onu_port}
Matteo Scandoloa80b4732020-09-04 13:51:10 -0700634 Exit For Loop If ${matched}
635 END
636 Run Keyword If ${group_exist}
637 ... Should Be True ${matched} No match for ${deviceId} and ${onu_port} found in ONOS groups
638 ... ELSE
639 ... Should Be True '${matched}'=='False' Match for ${deviceId} and ${onu_port} found in ONOS groups
640
Matteo Scandolo142e6272020-04-29 17:36:59 -0700641Assert Number of AAA-Users
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800642 [Arguments] ${onos_ssh_connection} ${expected_onus} ${deviceId}
Kailash6f5acb62019-08-28 14:38:45 -0700643 [Documentation] Matches for number of aaa-users authorized based on number of onus
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700644 ${aaa_users}= Execute ONOS CLI Command on open connection ${onos_ssh_connection}
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800645 ... aaa-users | grep ${deviceId} | grep AUTHORIZED | wc -l
646 Log Found ${aaa_users} of ${expected_onus} expected authenticated users on device ${deviceId}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700647 Should Be Equal As Integers ${aaa_users} ${expected_onus}
Kailash6f5acb62019-08-28 14:38:45 -0700648
649Validate DHCP Allocations
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800650 [Arguments] ${onos_ssh_connection} ${count} ${workflow} ${deviceId}
Kailash6f5acb62019-08-28 14:38:45 -0700651 [Documentation] Matches for number of dhcpacks based on number of onus
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700652 ${allocations}= Execute ONOS CLI Command on open connection ${onos_ssh_connection}
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800653 ... dhcpl2relay-allocations | grep ${deviceId} | grep DHCPACK | wc -l
Matteo Scandoloda854b02020-09-01 16:20:51 -0700654 # if the workflow is TT we'll have 2 allocations for each ONU
655 ${ttAllocations}= Evaluate (${count} * 2)
656 ${count}= Set Variable If $workflow=='tt' ${ttAllocations} ${count}
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800657 Log Found ${allocations} of ${count} expected DHCPACK on device ${deviceId}
Matteo Scandoloda854b02020-09-01 16:20:51 -0700658 Should Be Equal As Integers ${allocations} ${count}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700659
660Validate Subscriber DHCP Allocation
Suchitra Vemuri42819412020-10-01 17:45:43 -0700661 [Arguments] ${ip} ${port} ${onu_port} ${vlan}=''
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700662 [Documentation] Verifies that the specified subscriber is found in DHCP allocations
663 ##TODO: Enhance the keyword to include DHCP allocated address is not 0.0.0.0
TorstenThieme4e2168e2021-06-22 14:01:47 +0000664 ${allocations}= Execute ONOS CLI Command use single connection ${ip} ${port}
Suchitra Vemuri42819412020-10-01 17:45:43 -0700665 ... dhcpl2relay-allocations | grep DHCPACK | grep ${onu_port} | grep ${vlan}
Gilles Depatie675a2062019-10-22 12:44:42 -0400666 Should Not Be Empty ${allocations} ONU port ${onu_port} not found in dhcpl2relay-allocations
David Bainbridgef81cd642019-11-20 00:14:47 +0000667
668Device Is Available In ONOS
Matteo Scandolo3218d5b2021-05-26 11:50:10 -0700669 [Arguments] ${url} ${dpid} ${available}=true
670 [Documentation] Validates the device exists and it has the expected availability in ONOS
David Bainbridgef81cd642019-11-20 00:14:47 +0000671 ${rc} ${json} Run And Return Rc And Output curl --fail -sSL ${url}/onos/v1/devices/${dpid}
672 Should Be Equal As Integers 0 ${rc}
673 ${rc} ${value} Run And Return Rc And Output echo '${json}' | jq -r .available
674 Should Be Equal As Integers 0 ${rc}
Matteo Scandolo3218d5b2021-05-26 11:50:10 -0700675 Should Be Equal ${available} ${value}
David Bainbridgef81cd642019-11-20 00:14:47 +0000676
677Remove All Devices From ONOS
678 [Arguments] ${url}
679 [Documentation] Executes the device-remove command on each device in ONOS
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000680 ${rc} ${output} Run And Return Rc And Output
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700681 ... curl --fail -sSL ${url}/onos/v1/devices | jq -r '.devices[].id'
David Bainbridgef81cd642019-11-20 00:14:47 +0000682 Should Be Equal As Integers ${rc} 0
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000683 @{dpids} Split String ${output}
David Bainbridgef81cd642019-11-20 00:14:47 +0000684 ${count}= Get length ${dpids}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700685 FOR ${dpid} IN @{dpids}
686 ${rc}= Run Keyword If '${dpid}' != ''
687 ... Run And Return Rc curl -XDELETE --fail -sSL ${url}/onos/v1/devices/${dpid}
688 Run Keyword If '${dpid}' != ''
689 ... Should Be Equal As Integers ${rc} 0
690 END
Matteo Scandolo142e6272020-04-29 17:36:59 -0700691
TorstenThieme440b7c02020-12-18 15:42:57 +0000692Assert ONU Port Is Disabled
693 [Arguments] ${onos_ssh_connection} ${deviceId} ${onu_port}
694 [Documentation] Verifies if the ONU port is disabled in ONOS
695 ${onu_port_disabled}= Execute ONOS CLI Command on open connection ${onos_ssh_connection}
696 ... ports -d ${deviceId} | grep port=${onu_port}
697 Log ${onu_port_disabled}
698 Should Not Be Empty ${onu_port_disabled}
699
Matteo Scandolo7d1a80d2021-04-09 14:30:43 -0700700Assert Olts in ONOS
701 [Arguments] ${onos_ssh_connection} ${count}
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700702 [Documentation] DEPRECATED use Assert Olt in ONOS
703 ... Check that a certain number of olts are known to ONOS
Matteo Scandolo7d1a80d2021-04-09 14:30:43 -0700704 ${olts}= Execute ONOS CLI Command on open connection ${onos_ssh_connection}
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700705 ... volt-olts | wc -l
Matteo Scandolo7d1a80d2021-04-09 14:30:43 -0700706 Log Found ${olts} of ${count} expected Olts
707 Should Be Equal As Integers ${olts} ${count}
708
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700709Assert Olt in ONOS
710 [Arguments] ${onos_ssh_connection} ${deviceId}
711 [Documentation] Check that a particular olt is known to ONOS
712 ${olts}= Execute ONOS CLI Command on open connection ${onos_ssh_connection}
713 ... volt-olts | grep ${deviceId} | wc -l
714 Should Be Equal As Integers ${olts} 1 "Device ${deviceId} is not recognized as an OLT"
715
Matteo Scandolo7d1a80d2021-04-09 14:30:43 -0700716Wait for Olts in ONOS
717 [Arguments] ${onos_ssh_connection} ${count} ${max_wait_time}=10m
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700718 [Documentation] DEPRECATED use Wait for Olt in ONOS
719 ... Waits untill a certain number of ports are enabled in ONOS for a particular deviceId
Matteo Scandolo7d1a80d2021-04-09 14:30:43 -0700720 Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Olts in ONOS
721 ... ${onos_ssh_connection} ${count}
722
Matteo Scandolo520f77e2021-06-01 16:14:47 -0700723Wait for Olt in ONOS
724 [Arguments] ${onos_ssh_connection} ${deviceId} ${max_wait_time}=10m
725 [Documentation] Waits until a particular deviceId is recognized by ONOS as an OLT
726 Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Olt in ONOS
727 ... ${onos_ssh_connection} ${deviceId}
728
Matteo Scandolo142e6272020-04-29 17:36:59 -0700729Assert Ports in ONOS
TorstenThiemed4f48962020-12-08 12:17:19 +0000730 [Arguments] ${onos_ssh_connection} ${count} ${deviceId} ${filter}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700731 [Documentation] Check that a certain number of ports are enabled in ONOS
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700732 ${ports}= Execute ONOS CLI Command on open connection ${onos_ssh_connection}
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800733 ... ports -e ${deviceId} | grep ${filter} | wc -l
734 Log Found ${ports} of ${count} expected ports on device ${deviceId}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700735 Should Be Equal As Integers ${ports} ${count}
736
737Wait for Ports in ONOS
TorstenThiemed4f48962020-12-08 12:17:19 +0000738 [Arguments] ${onos_ssh_connection} ${count} ${deviceId} ${filter} ${max_wait_time}=10m
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800739 [Documentation] Waits untill a certain number of ports are enabled in ONOS for a particular deviceId
TorstenThiemed4f48962020-12-08 12:17:19 +0000740 Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Ports in ONOS
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800741 ... ${onos_ssh_connection} ${count} ${deviceId} ${filter}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700742
743Wait for AAA Authentication
TorstenThiemed4f48962020-12-08 12:17:19 +0000744 [Arguments] ${onos_ssh_connection} ${count} ${deviceId} ${max_wait_time}=10m
Matteo Scandolo142e6272020-04-29 17:36:59 -0700745 [Documentation] Waits untill a certain number of subscribers are authenticated in ONOS
TorstenThiemed4f48962020-12-08 12:17:19 +0000746 Wait Until Keyword Succeeds ${max_wait_time} 5s Assert Number of AAA-Users
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800747 ... ${onos_ssh_connection} ${count} ${deviceId}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700748
749Wait for DHCP Ack
TorstenThiemed4f48962020-12-08 12:17:19 +0000750 [Arguments] ${onos_ssh_connection} ${count} ${workflow} ${deviceId} ${max_wait_time}=10m
Matteo Scandolo142e6272020-04-29 17:36:59 -0700751 [Documentation] Waits untill a certain number of subscribers have received a DHCP_ACK
TorstenThiemed4f48962020-12-08 12:17:19 +0000752 Wait Until Keyword Succeeds ${max_wait_time} 5s Validate DHCP Allocations
753 ... ${onos_ssh_connection} ${count} ${workflow} ${deviceId}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700754
755Provision subscriber
756 [Documentation] Calls volt-add-subscriber-access in ONOS
757 [Arguments] ${onos_ip} ${onos_port} ${of_id} ${onu_port}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000758 Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700759 ... volt-add-subscriber-access ${of_id} ${onu_port}
760
Matteo Scandolo96dbe432020-05-28 10:51:57 -0700761Provision subscriber REST
762 [Documentation] Uses the rest APIs to provision a subscriber
763 [Arguments] ${onos_ip} ${onos_port} ${of_id} ${onu_port}
764 ${resp}= Post Request ONOS
765 ... /onos/olt/oltapp/${of_id}/${onu_port}
766 Should Be Equal As Strings ${resp.status_code} 200
767
768
Matteo Scandolo142e6272020-04-29 17:36:59 -0700769List Enabled UNI Ports
770 [Documentation] List all the UNI Ports, the only way we have is to filter out the one called NNI
771 ... Creates a list of dictionaries
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700772 [Arguments] ${onos_ssh_connection} ${of_id}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700773 [Return] [{'port': '16', 'of_id': 'of:00000a0a0a0a0a00'}, {'port': '32', 'of_id': 'of:00000a0a0a0a0a00'}]
774 ${result}= Create List
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700775 ${out}= Execute ONOS CLI Command on open connection ${onos_ssh_connection}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700776 ... ports -e ${of_id} | grep -v SWITCH | grep -v nni
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000777 @{unis}= Split To Lines ${out}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700778 FOR ${uni} IN @{unis}
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000779 ${matches} = Get Regexp Matches ${uni} .*port=([0-9]+),.* 1
Matteo Scandolo142e6272020-04-29 17:36:59 -0700780 &{portDict} Create Dictionary of_id=${of_id} port=${matches[0]}
781 Append To List ${result} ${portDict}
782 END
783 Log ${result}
784 Return From Keyword ${result}
785
786Provision all subscribers on device
Matteo Scandolo96dbe432020-05-28 10:51:57 -0700787 [Documentation] Provisions a subscriber in ONOS for all the enabled UNI ports on a particular device
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700788 [Arguments] ${onos_ssh_connection} ${onos_ip} ${onos_rest_port} ${of_id}
789 ${unis}= List Enabled UNI Ports ${onos_ssh_connection} ${of_id}
Matteo Scandolo96dbe432020-05-28 10:51:57 -0700790 ${onos_auth}= Create List karaf karaf
791 Create Session ONOS http://${onos_ip}:${onos_rest_port} auth=${onos_auth}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700792 FOR ${uni} IN @{unis}
Matteo Scandolo96dbe432020-05-28 10:51:57 -0700793 Provision Subscriber REST ${onos_ip} ${onos_rest_port} ${uni['of_id']} ${uni['port']}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700794 END
795
796List OLTs
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800797 # NOTE this method is not currently used but it can come useful in the future
798 [Documentation] Returns a list of all OLTs known to ONOS
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700799 [Arguments] ${onos_ssh_connection}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700800 [Return] ['of:00000a0a0a0a0a00', 'of:00000a0a0a0a0a01']
801 ${result}= Create List
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700802 ${out}= Execute ONOS CLI Command on open connection ${onos_ssh_connection}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700803 ... volt-olts
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000804 @{olts}= Split To Lines ${out}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700805 FOR ${olt} IN @{olts}
806 Log ${olt}
TorstenThiemebccd3ae2020-02-20 12:56:44 +0000807 ${matches} = Get Regexp Matches ${olt} ^OLT (.+)$ 1
Matteo Scandolo142e6272020-04-29 17:36:59 -0700808 # there may be some logs mixed with the output so only append if we have a match
809 ${matches_length}= Get Length ${matches}
810 Run Keyword If ${matches_length}==1
811 ... Append To List ${result} ${matches[0]}
812 END
813 Return From Keyword ${result}
814
815Count ADDED flows
816 [Documentation] Count the flows in ADDED state in ONOS
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800817 [Arguments] ${onos_ssh_connection} ${targetFlows} ${deviceId}
Matteo Scandolo37bca8d2020-07-31 11:28:40 -0700818 ${flows}= Execute ONOS CLI Command on open connection ${onos_ssh_connection}
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800819 ... flows -s any ${deviceId} | grep ADDED | wc -l
820 Log Found ${flows} of ${targetFlows} expected flows on device ${deviceId}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700821 Should Be Equal As Integers ${targetFlows} ${flows}
822
823Wait for all flows to in ADDED state
824 [Documentation] Waits until the flows have been provisioned
TorstenThiemeb198c482020-12-14 19:45:23 +0000825 [Arguments] ${onos_ssh_connection} ${deviceId} ${workflow} ${uni_count} ${olt_count}
826 ... ${provisioned} ${withEapol} ${withDhcp} ${withIgmp} ${withLldp}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700827 ${targetFlows}= Calculate flows by workflow ${workflow} ${uni_count} ${olt_count} ${provisioned}
Andrea Campanella70cf0a72020-05-27 10:55:15 +0200828 ... ${withEapol} ${withDhcp} ${withIgmp} ${withLldp}
Matteo Scandolo142e6272020-04-29 17:36:59 -0700829 Wait Until Keyword Succeeds 10m 5s Count ADDED flows
Matteo Scandolo50be75c2020-11-12 11:14:12 -0800830 ... ${onos_ssh_connection} ${targetFlows} ${deviceId}
Gayathri.Selvan92d16862020-03-19 14:47:58 +0000831
Girish Gowdrad769b412021-05-16 11:09:46 -0700832Get Limiting Bandwidth Details
Gayathri.Selvan92d16862020-03-19 14:47:58 +0000833 [Arguments] ${bandwidth_profile_name}
834 [Documentation] Collects the bandwidth profile details for the given bandwidth profile and
835 ... returns the limiting bandwidth
Girish Gowdracb8482a2021-05-27 09:06:13 -0700836 ${cir} ${cbs} ${eir} ${ebs} ${air}= Get Bandwidth Profile Details Rest
837 ... ${bandwidth_profile_name}
Girish Gowdrad769b412021-05-16 11:09:46 -0700838 ${limiting_BW}= Evaluate ${eir}+${cir}+${air}
Gayathri.Selvan92d16862020-03-19 14:47:58 +0000839 [Return] ${limiting_BW}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000840
841Validate Deleted Device Cleanup In ONOS
842 [Arguments] ${ip} ${port} ${olt_serial_number}
843 [Documentation] The keyword verifies that ports, flows, meters, subscribers, dhcp are all cleared in ONOS
844 # Fetch OF Id for OLT
845 ${olt_of_id}= Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device in ONOS ${olt_serial_number}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000846 # Verify Ports are Removed
TorstenThieme4e2168e2021-06-22 14:01:47 +0000847 ${port_count}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000848 ... ports ${olt_of_id} | grep -v ${olt_of_id} | wc -l
849 Should Be Equal As Integers ${port_count} 0
850 # Verify Subscribers are Removed
TorstenThieme4e2168e2021-06-22 14:01:47 +0000851 ${sub_count}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000852 ... volt-programmed-subscribers | grep ${olt_of_id} | wc -l
853 Should Be Equal As Integers ${sub_count} 0
854 # Verify Flows are Removed
TorstenThieme4e2168e2021-06-22 14:01:47 +0000855 ${flow_count}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000856 ... flows -s -f ${olt_of_id} | grep -v deviceId | wc -l
857 Should Be Equal As Integers ${flow_count} 0
858 # Verify Meters are Removed
TorstenThieme4e2168e2021-06-22 14:01:47 +0000859 ${meter_count}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000860 ... meters ${olt_of_id} | wc -l
861 Should Be Equal As Integers ${meter_count} 0
862 # Verify AAA-Users are Removed
TorstenThieme4e2168e2021-06-22 14:01:47 +0000863 ${aaa_count}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000864 ... aaa-users ${olt_of_id} | wc -l
865 Should Be Equal As Integers ${aaa_count} 0
866 # Verify Dhcp-Allocations are Removed
TorstenThieme4e2168e2021-06-22 14:01:47 +0000867 ${dhcp_count}= Execute ONOS CLI Command use single connection ${ip} ${port}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000868 ... dhcpl2relay-allocations ${olt_of_id} | wc -l
869 Should Be Equal As Integers ${dhcp_count} 0
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000870
871Delete ONOS App
872 [Arguments] ${url} ${app_name}
873 [Documentation] This keyword deactivates and uninstalls the given ONOS App
874 ${rc}= Run And Return Rc curl --fail -sSL -X DELETE ${url}/onos/v1/applications/${app_name}
Matteo Scandolo2769d2b2021-04-14 10:29:24 -0700875 Should Be Equal As Integers ${rc} 0 Can't delete ${app_name} from ONOS
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000876
877Verify ONOS App Active
878 [Arguments] ${url} ${app_name} ${app_version}=${EMPTY}
879 [Documentation] This keyword verifies that the given ONOS App status is Active
880 ${rc} ${output} Run And Return Rc And Output
881 ... curl --fail -sSL ${url}/onos/v1/applications/${app_name} | jq -r .state
882 Should Be Equal As Integers ${rc} 0
883 Should Be Equal '${output}' 'ACTIVE'
884 ${rc1} ${output1} Run And Return Rc And Output
885 ... curl --fail -sSL ${url}/onos/v1/applications/${app_name} | jq -r .version
886 Run Keyword If '${app_version}'!='${EMPTY}'
887 ... Run Keywords
Matteo Scandolo2769d2b2021-04-14 10:29:24 -0700888 ... Should Be Equal As Integers ${rc1} 0 Can't read app ${app_name} status from ONOS
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000889 ... AND Should Be Equal '${output1}' '${app_version}'
890
891Install And Activate ONOS App
892 [Arguments] ${url} ${app_oar_file}
893 [Documentation] This keyword installs and activates the given ONOS App
894 ${cmd}= Catenate SEPARATOR=
895 ... curl --fail -sSL -H Content-Type:application/octet-stream -
896 ... X POST ${url}/onos/v1/applications?activate=true --data-binary \@${app_oar_file}
897 ${rc} ${output} Run And Return Rc And Output ${cmd}
Matteo Scandolo2769d2b2021-04-14 10:29:24 -0700898 Should Be Equal As Integers ${rc} 0 Can't load onos app ${app_oar_file} to ONOS"
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000899 Log ${output}
Hardik Windlassdc2610f2021-03-09 07:33:51 +0000900
901Get ONOS App Details
902 [Arguments] ${url} ${app_name}
903 [Documentation] Retrieves ONOS App Details
904 ${rc} ${output} Run And Return Rc And Output
905 ... curl --fail -sSL ${url}/onos/v1/applications/${app_name}
Matteo Scandolo2769d2b2021-04-14 10:29:24 -0700906 Should Be Equal As Integers ${rc} 0 Can't read app ${app_name} details from ONOS
Hardik Windlassdc2610f2021-03-09 07:33:51 +0000907 [Return] ${output}