2 Documentation Test suite for Stats Manager flows collection
3 Suite Setup Initialization Phase
4 Suite Teardown Teardown Phase
5 Library OperatingSystem
8 Library ../../../libraries/XmlComparator.py
9 Variables ../../../variables/Variables.py
10 Library ../../../libraries/RequestsLibrary.py
11 Library ../../../libraries/Common.py
14 ${XmlsDir} ${CURDIR}/../../../variables/xmls
16 ${switch_name} s${switch_idx}
17 @{xml_files} f1.xml f2.xml f3.xml f5.xml f7.xml f8.xml f9.xml
18 ... f10.xml f11.xml f12.xml f13.xml f14.xml f17.xml f19.xml
23 [Documentation] Add all flows and waits for SM to collect data
24 : FOR ${flowfile} IN @{xml_files}
26 \ Init Flow Variables ${flowfile}
27 \ Run Keyword And Continue On Failure Add Flow
30 [Documentation] Checks if flow is configured and operational
31 Init Flow Variables f1.xml
32 Check Config Flow ${True}
33 Check Operational Table ${True}
36 [Documentation] Checks if flow is configured and operational
37 Init Flow Variables f2.xml
38 Check Config Flow ${True}
39 Check Operational Table ${True}
42 [Documentation] Checks if flow is configured and operational
43 Init Flow Variables f3.xml
44 Check Config Flow ${True}
45 Check Operational Table ${True}
48 [Documentation] Checks if flow is configured and operational
49 Init Flow Variables f5.xml
50 Check Config Flow ${True}
51 Check Operational Table ${True}
54 [Documentation] Checks if flow is configured and operational
55 Init Flow Variables f7.xml
56 Check Config Flow ${True}
57 Check Operational Table ${True}
60 [Documentation] Checks if flow is configured and operational
61 Init Flow Variables f8.xml
62 Check Config Flow ${True}
63 Check Operational Table ${True}
66 [Documentation] Checks if flow is configured and operational
67 Init Flow Variables f9.xml
68 Check Config Flow ${True}
69 Check Operational Table ${True}
72 [Documentation] Checks if flow is configured and operational
73 Init Flow Variables f10.xml
74 Check Config Flow ${True}
75 Check Operational Table ${True}
78 [Documentation] Checks if flow is configured and operational
79 Init Flow Variables f11.xml
80 Check Config Flow ${True}
81 Check Operational Table ${True}
84 [Documentation] Checks if flow is configured and operational
85 Init Flow Variables f12.xml
86 Check Config Flow ${True}
87 Check Operational Table ${True}
90 [Documentation] Checks if flow is configured and operational
91 Init Flow Variables f13.xml
92 Check Config Flow ${True}
93 Check Operational Table ${True}
96 [Documentation] Checks if flow is configured and operational
97 Init Flow Variables f14.xml
98 Check Config Flow ${True}
99 Check Operational Table ${True}
101 Test Is Flow 17 Added
102 [Documentation] Checks if flow is configured and operational
103 Init Flow Variables f17.xml
104 Check Config Flow ${True}
105 Check Operational Table ${True}
107 Test Is Flow 19 Added
108 [Documentation] Checks if flow is configured and operational
109 Init Flow Variables f19.xml
110 Check Config Flow ${True}
111 Check Operational Table ${True}
113 Test Is Flow 24 Added
114 [Documentation] Checks if flow is configured and operational
115 Init Flow Variables f24.xml
116 Check Config Flow ${True}
117 Check Operational Table ${True}
120 [Documentation] Delete all flows and waits for SM to collect data
121 : FOR ${flowfile} IN @{xml_files}
123 \ Init Flow Variables ${flowfile}
124 \ Run Keyword And Continue On Failure Delete Flow
126 Test Is Flow 1 Deleted
127 [Documentation] Checks if flow is not configured and operational
128 Init Flow Variables f1.xml
129 Check Config Flow ${False}
130 Check Operational Table ${False}
132 Test Is Flow 2 Deleted
133 [Documentation] Checks if flow is not configured and operational
134 Init Flow Variables f2.xml
135 Check Config Flow ${False}
136 Check Operational Table ${False}
138 Test Is Flow 3 Deleted
139 [Documentation] Checks if flow is not configured and operational
140 Init Flow Variables f3.xml
141 Check Config Flow ${False}
142 Check Operational Table ${False}
144 Test Is Flow 5 Deleted
145 [Documentation] Checks if flow is not configured and operational
146 Init Flow Variables f5.xml
147 Check Config Flow ${False}
148 Check Operational Table ${False}
150 Test Is Flow 7 Deleted
151 [Documentation] Checks if flow is not configured and operational
152 Init Flow Variables f7.xml
153 Check Config Flow ${False}
154 Check Operational Table ${False}
156 Test Is Flow 8 Deleted
157 [Documentation] Checks if flow is not configured and operational
158 Init Flow Variables f8.xml
159 Check Config Flow ${False}
160 Check Operational Table ${False}
162 Test Is Flow 9 Deleted
163 [Documentation] Checks if flow is not configured and operational
164 Init Flow Variables f9.xml
165 Check Config Flow ${False}
166 Check Operational Table ${False}
168 Test Is Flow 10 Deleted
169 [Documentation] Checks if flow is not configured and operational
170 Init Flow Variables f10.xml
171 Check Config Flow ${False}
172 Check Operational Table ${False}
174 Test Is Flow 11 Deleted
175 [Documentation] Checks if flow is not configured and operational
176 Init Flow Variables f11.xml
177 Check Config Flow ${False}
178 Check Operational Table ${False}
180 Test Is Flow 12 Deleted
181 [Documentation] Checks if flow is not configured and operational
182 Init Flow Variables f12.xml
183 Check Config Flow ${False}
184 Check Operational Table ${False}
186 Test Is Flow 13 Deleted
187 [Documentation] Checks if flow is not configured and operational
188 Init Flow Variables f13.xml
189 Check Config Flow ${False}
190 Check Operational Table ${False}
192 Test Is Flow 14 Deleted
193 [Documentation] Checks if flow is not configured and operational
194 Init Flow Variables f14.xml
195 Check Config Flow ${False}
196 Check Operational Table ${False}
198 Test Is Flow 17 Deleted
199 [Documentation] Checks if flow is not configured and operational
200 Init Flow Variables f17.xml
201 Check Config Flow ${False}
202 Check Operational Table ${False}
204 Test Is Flow 19 Deleted
205 [Documentation] Checks if flow is not configured and operational
206 Init Flow Variables f19.xml
207 Check Config Flow ${False}
208 Check Operational Table ${False}
210 Test Is Flow 24 Deleted
211 [Documentation] Checks if flow is not configured and operational
212 Init Flow Variables f24.xml
213 Check Config Flow ${False}
214 Check Operational Table ${False}
219 ${data}= Get File ${XmlsDir}/${file}
220 ${xmlroot}= Parse Xml ${XmlsDir}/${file}
221 ${table_id}= Get Element Text ${xmlroot} table_id
222 ${flow_id}= Get Element Text ${xmlroot} id
223 ${flow_priority}= Get Element Text ${xmlroot} priority
224 Set Suite Variable ${table_id}
225 Set Suite Variable ${flow_id}
226 Set Suite Variable ${flow_priority}
227 Set Suite Variable ${data}
228 Set Suite Variable ${xmlroot}
231 [Arguments] ${expected}
232 Wait Until Keyword Succeeds 40s 2s Check Config Flow Presence ${expected}
234 Check Config Flow Presence
235 [Arguments] ${expected}
236 ${presence_flow} ${msg}= Flow Presence Config Flow
237 ${msgf}= Get Presence Failure Message config ${expected} ${presence_flow} ${msg}
238 Should Be Equal ${expected} ${presence_flow} msg=${msgf}
240 Flow Presence Config Flow
241 ${headers}= Create Dictionary Accept application/xml
242 ${resp}= Get session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} headers=${headers}
245 Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
246 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
247 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
248 Return From Keyword ${pres} ${msg}
250 Check Operational Table
251 [Arguments] ${expected}
252 Wait Until Keyword Succeeds 40s 2s Check Operational Table Presence ${expected}
254 Check Operational Table Presence
255 [Arguments] ${expected}
256 ${presence_table} ${msg}= Flow Presence Operational Table
257 ${msgf}= Get Presence Failure Message config ${expected} ${presence_table} ${msg}
258 Should Be Equal ${expected} ${presence_table} msg=${msgf}
260 Flow Presence Operational Table
261 ${headers}= Create Dictionary Accept application/xml
262 ${resp}= Get session /restconf/operational/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id} headers=${headers}
265 Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
266 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
267 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
268 Return From Keyword ${pres} ${msg}
272 ${resp}= Putxml session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} data=${data}
273 ${msg}= Set Variable Adding flow for /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
274 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
277 ${resp}= Delete session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id}
278 ${msg}= Set Variable Delete flow for /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
279 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
282 [Documentation] Deletes all flows
283 : FOR ${flowfile} IN @{xml_files}
285 \ Init Flow Variables ${flowfile}
289 [Documentation] Initiate tcp connection with controller
290 Create Session session http://${CONTROLLER}:${PORT} auth=${AUTH} headers=${HEADERS_XML}
293 [Documentation] Closes tcp connection with controller and removes flows
296 Get Presence Failure Message
297 [Arguments] ${ds} ${expected} ${presence} ${diffmsg}
298 Return From Keyword If '''${diffmsg}'''!='${EMPTY}' Flow found in ${ds} data store but: ${diffmsg}
299 ${msgf}= Set Variable If ${expected}==${True} The flow is expected in operational data store, but The flow is not expected in operational data store, but
300 ${msgp}= Set Variable If ${presence}==${True} it is present. it is not present.
301 Return From Keyword ${msgf} ${msgp}