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
29 [Documentation] Checks if flow is configured and operational
30 Init Flow Variables f1.xml
31 Check Config Flow ${True}
32 Check Operational Table ${True}
35 [Documentation] Checks if flow is configured and operational
36 Init Flow Variables f2.xml
37 Check Config Flow ${True}
38 Check Operational Table ${True}
41 [Documentation] Checks if flow is configured and operational
42 Init Flow Variables f3.xml
43 Check Config Flow ${True}
44 Check Operational Table ${True}
47 [Documentation] Checks if flow is configured and operational
48 Init Flow Variables f5.xml
49 Check Config Flow ${True}
50 Check Operational Table ${True}
53 [Documentation] Checks if flow is configured and operational
54 Init Flow Variables f7.xml
55 Check Config Flow ${True}
56 Check Operational Table ${True}
59 [Documentation] Checks if flow is configured and operational
60 Init Flow Variables f8.xml
61 Check Config Flow ${True}
62 Check Operational Table ${True}
65 [Documentation] Checks if flow is configured and operational
66 Init Flow Variables f9.xml
67 Check Config Flow ${True}
68 Check Operational Table ${True}
71 [Documentation] Checks if flow is configured and operational
72 Init Flow Variables f10.xml
73 Check Config Flow ${True}
74 Check Operational Table ${True}
77 [Documentation] Checks if flow is configured and operational
78 Init Flow Variables f11.xml
79 Check Config Flow ${True}
80 Check Operational Table ${True}
83 [Documentation] Checks if flow is configured and operational
84 Init Flow Variables f14.xml
85 Check Config Flow ${True}
86 Check Operational Table ${True}
89 [Documentation] Checks if flow is configured and operational
90 Init Flow Variables f17.xml
91 Check Config Flow ${True}
92 Check Operational Table ${True}
95 [Documentation] Checks if flow is configured and operational
96 Init Flow Variables f19.xml
97 Check Config Flow ${True}
98 Check Operational Table ${True}
100 Test Is Flow 24 Added
101 [Documentation] Checks if flow is configured and operational
102 Init Flow Variables f24.xml
103 Check Config Flow ${True}
104 Check Operational Table ${True}
107 [Documentation] Delete all flows and waits for SM to collect data
108 : FOR ${flowfile} IN @{xml_files}
110 \ Init Flow Variables ${flowfile}
111 \ Run Keyword And Continue On Failure Delete Flow
113 Test Is Flow 1 Deleted
114 [Documentation] Checks if flow is not configured and operational
115 Init Flow Variables f1.xml
116 Check Config Flow ${False}
117 Check Operational Table ${False}
119 Test Is Flow 2 Deleted
120 [Documentation] Checks if flow is not configured and operational
121 Init Flow Variables f2.xml
122 Check Config Flow ${False}
123 Check Operational Table ${False}
125 Test Is Flow 3 Deleted
126 [Documentation] Checks if flow is not configured and operational
127 Init Flow Variables f3.xml
128 Check Config Flow ${False}
129 Check Operational Table ${False}
131 Test Is Flow 5 Deleted
132 [Documentation] Checks if flow is not configured and operational
133 Init Flow Variables f5.xml
134 Check Config Flow ${False}
135 Check Operational Table ${False}
137 Test Is Flow 7 Deleted
138 [Documentation] Checks if flow is not configured and operational
139 Init Flow Variables f7.xml
140 Check Config Flow ${False}
141 Check Operational Table ${False}
143 Test Is Flow 8 Deleted
144 [Documentation] Checks if flow is not configured and operational
145 Init Flow Variables f8.xml
146 Check Config Flow ${False}
147 Check Operational Table ${False}
149 Test Is Flow 9 Deleted
150 [Documentation] Checks if flow is not configured and operational
151 Init Flow Variables f9.xml
152 Check Config Flow ${False}
153 Check Operational Table ${False}
155 Test Is Flow 10 Deleted
156 [Documentation] Checks if flow is not configured and operational
157 Init Flow Variables f10.xml
158 Check Config Flow ${False}
159 Check Operational Table ${False}
161 Test Is Flow 11 Deleted
162 [Documentation] Checks if flow is not configured and operational
163 Init Flow Variables f11.xml
164 Check Config Flow ${False}
165 Check Operational Table ${False}
167 Test Is Flow 14 Deleted
168 [Documentation] Checks if flow is not configured and operational
169 Init Flow Variables f14.xml
170 Check Config Flow ${False}
171 Check Operational Table ${False}
173 Test Is Flow 17 Deleted
174 [Documentation] Checks if flow is not configured and operational
175 Init Flow Variables f17.xml
176 Check Config Flow ${False}
177 Check Operational Table ${False}
179 Test Is Flow 19 Deleted
180 [Documentation] Checks if flow is not configured and operational
181 Init Flow Variables f19.xml
182 Check Config Flow ${False}
183 Check Operational Table ${False}
185 Test Is Flow 24 Deleted
186 [Documentation] Checks if flow is not configured and operational
187 Init Flow Variables f24.xml
188 Check Config Flow ${False}
189 Check Operational Table ${False}
194 ${data}= Get File ${XmlsDir}/${file}
195 ${xmlroot}= Parse Xml ${XmlsDir}/${file}
196 ${table_id}= Get Element Text ${xmlroot} table_id
197 ${flow_id}= Get Element Text ${xmlroot} id
198 ${flow_priority}= Get Element Text ${xmlroot} priority
199 Set Suite Variable ${table_id}
200 Set Suite Variable ${flow_id}
201 Set Suite Variable ${flow_priority}
202 Set Suite Variable ${data}
203 Set Suite Variable ${xmlroot}
206 [Arguments] ${expected}
207 Wait Until Keyword Succeeds 40s 2s Check Config Flow Presence ${expected}
209 Check Config Flow Presence
210 [Arguments] ${expected}
211 ${presence_flow} ${msg}= Flow Presence Config Flow
212 ${msgf}= Get Presence Failure Message config ${expected} ${presence_flow} ${msg}
213 Should Be Equal ${expected} ${presence_flow} msg=${msgf}
215 Flow Presence Config Flow
216 ${headers}= Create Dictionary Accept=application/xml
217 ${resp}= RequestsLibrary.Get Request session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} headers=${headers}
220 Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
221 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
222 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
223 Return From Keyword ${pres} ${msg}
225 Check Operational Table
226 [Arguments] ${expected}
227 Wait Until Keyword Succeeds 120s 2s Check Operational Table Presence ${expected}
229 Check Operational Table Presence
230 [Arguments] ${expected}
231 ${presence_table} ${msg}= Flow Presence Operational Table
232 ${msgf}= Get Presence Failure Message config ${expected} ${presence_table} ${msg}
233 Should Be Equal ${expected} ${presence_table} msg=${msgf}
235 Flow Presence Operational Table
236 ${headers}= Create Dictionary Accept=application/xml
237 ${resp}= RequestsLibrary.Get Request session /restconf/operational/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id} headers=${headers}
240 Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
241 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
242 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
243 Return From Keyword ${pres} ${msg}
247 ${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}
248 ${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.
249 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
252 ${resp}= RequestsLibrary.Delete Request session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id}
253 ${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.
254 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
257 [Documentation] Deletes all flows
258 : FOR ${flowfile} IN @{xml_files}
260 \ Init Flow Variables ${flowfile}
264 [Documentation] Initiate tcp connection with controller
265 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
268 [Documentation] Closes tcp connection with controller and removes flows
271 Get Presence Failure Message
272 [Arguments] ${ds} ${expected} ${presence} ${diffmsg}
273 Return From Keyword If '''${diffmsg}'''!='${EMPTY}' Flow found in ${ds} data store but: ${diffmsg}
274 ${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
275 ${msgp}= Set Variable If ${presence}==${True} it is present. it is not present.
276 Return From Keyword ${msgf} ${msgp}