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 RequestsLibrary
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 f14.xml f17.xml f19.xml f24.xml
22 [Documentation] Add all flows and waits for SM to collect data
23 FOR ${flowfile} IN @{xml_files}
25 Init Flow Variables ${flowfile}
26 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 f14.xml
86 Check Config Flow ${True}
87 Check Operational Table ${True}
90 [Documentation] Checks if flow is configured and operational
91 Init Flow Variables f17.xml
92 Check Config Flow ${True}
93 Check Operational Table ${True}
96 [Documentation] Checks if flow is configured and operational
97 Init Flow Variables f19.xml
98 Check Config Flow ${True}
99 Check Operational Table ${True}
101 Test Is Flow 24 Added
102 [Documentation] Checks if flow is configured and operational
103 Init Flow Variables f24.xml
104 Check Config Flow ${True}
105 Check Operational Table ${True}
108 [Documentation] Delete all flows and waits for SM to collect data
109 FOR ${flowfile} IN @{xml_files}
111 Init Flow Variables ${flowfile}
112 Run Keyword And Continue On Failure Delete Flow
115 Test Is Flow 1 Deleted
116 [Documentation] Checks if flow is not configured and operational
117 Init Flow Variables f1.xml
118 Check Config Flow ${False}
119 Check Operational Table ${False}
121 Test Is Flow 2 Deleted
122 [Documentation] Checks if flow is not configured and operational
123 Init Flow Variables f2.xml
124 Check Config Flow ${False}
125 Check Operational Table ${False}
127 Test Is Flow 3 Deleted
128 [Documentation] Checks if flow is not configured and operational
129 Init Flow Variables f3.xml
130 Check Config Flow ${False}
131 Check Operational Table ${False}
133 Test Is Flow 5 Deleted
134 [Documentation] Checks if flow is not configured and operational
135 Init Flow Variables f5.xml
136 Check Config Flow ${False}
137 Check Operational Table ${False}
139 Test Is Flow 7 Deleted
140 [Documentation] Checks if flow is not configured and operational
141 Init Flow Variables f7.xml
142 Check Config Flow ${False}
143 Check Operational Table ${False}
145 Test Is Flow 8 Deleted
146 [Documentation] Checks if flow is not configured and operational
147 Init Flow Variables f8.xml
148 Check Config Flow ${False}
149 Check Operational Table ${False}
151 Test Is Flow 9 Deleted
152 [Documentation] Checks if flow is not configured and operational
153 Init Flow Variables f9.xml
154 Check Config Flow ${False}
155 Check Operational Table ${False}
157 Test Is Flow 10 Deleted
158 [Documentation] Checks if flow is not configured and operational
159 Init Flow Variables f10.xml
160 Check Config Flow ${False}
161 Check Operational Table ${False}
163 Test Is Flow 11 Deleted
164 [Documentation] Checks if flow is not configured and operational
165 Init Flow Variables f11.xml
166 Check Config Flow ${False}
167 Check Operational Table ${False}
169 Test Is Flow 14 Deleted
170 [Documentation] Checks if flow is not configured and operational
171 Init Flow Variables f14.xml
172 Check Config Flow ${False}
173 Check Operational Table ${False}
175 Test Is Flow 17 Deleted
176 [Documentation] Checks if flow is not configured and operational
177 Init Flow Variables f17.xml
178 Check Config Flow ${False}
179 Check Operational Table ${False}
181 Test Is Flow 19 Deleted
182 [Documentation] Checks if flow is not configured and operational
183 Init Flow Variables f19.xml
184 Check Config Flow ${False}
185 Check Operational Table ${False}
187 Test Is Flow 24 Deleted
188 [Documentation] Checks if flow is not configured and operational
189 Init Flow Variables f24.xml
190 Check Config Flow ${False}
191 Check Operational Table ${False}
196 ${data}= Get File ${XmlsDir}/${file}
197 ${xmlroot}= Parse Xml ${XmlsDir}/${file}
198 ${table_id}= Get Element Text ${xmlroot} table_id
199 ${flow_id}= Get Element Text ${xmlroot} id
200 ${flow_priority}= Get Element Text ${xmlroot} priority
201 Set Suite Variable ${table_id}
202 Set Suite Variable ${flow_id}
203 Set Suite Variable ${flow_priority}
204 Set Suite Variable ${data}
205 Set Suite Variable ${xmlroot}
208 [Arguments] ${expected}
209 Wait Until Keyword Succeeds 40s 2s Check Config Flow Presence ${expected}
211 Check Config Flow Presence
212 [Arguments] ${expected}
213 ${presence_flow} ${msg}= Flow Presence Config Flow
214 ${msgf}= Get Presence Failure Message config ${expected} ${presence_flow} ${msg}
215 Should Be Equal ${expected} ${presence_flow} msg=${msgf}
217 Flow Presence Config Flow
218 ${headers}= Create Dictionary Accept=application/xml
219 ${resp}= RequestsLibrary.Get Request session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} headers=${headers}
222 Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
223 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
224 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
225 Return From Keyword ${pres} ${msg}
227 Check Operational Table
228 [Arguments] ${expected}
229 Wait Until Keyword Succeeds 120s 2s Check Operational Table Presence ${expected}
231 Check Operational Table Presence
232 [Arguments] ${expected}
233 ${presence_table} ${msg}= Flow Presence Operational Table
234 ${msgf}= Get Presence Failure Message config ${expected} ${presence_table} ${msg}
235 Should Be Equal ${expected} ${presence_table} msg=${msgf}
237 Flow Presence Operational Table
238 ${headers}= Create Dictionary Accept=application/xml
239 ${resp}= RequestsLibrary.Get Request session /restconf/operational/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id} headers=${headers}
242 Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
243 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
244 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
245 Return From Keyword ${pres} ${msg}
249 ${resp}= RequestsLibrary.Put Request session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} headers=${HEADERS_XML} data=${data}
250 ${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.
251 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
254 ${resp}= RequestsLibrary.Delete Request session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id}
255 ${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.
256 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
259 [Documentation] Deletes all flows
260 FOR ${flowfile} IN @{xml_files}
262 Init Flow Variables ${flowfile}
267 [Documentation] Initiate tcp connection with controller
268 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
271 [Documentation] Closes tcp connection with controller and removes flows
274 Get Presence Failure Message
275 [Arguments] ${ds} ${expected} ${presence} ${diffmsg}
276 Return From Keyword If '''${diffmsg}'''!='${EMPTY}' Flow found in ${ds} data store but: ${diffmsg}
277 ${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
278 ${msgp}= Set Variable If ${presence}==${True} it is present. it is not present.
279 Return From Keyword ${msgf} ${msgp}