2 Documentation Test suite for Stats Manager flows collection
3 Library OperatingSystem
6 Library ../../../libraries/XmlComparator.py
7 Variables ../../../variables/Variables.py
8 Library ../../../libraries/RequestsLibrary.py
9 Library ../../../libraries/Common.py
10 Suite Setup Initialization Phase
11 Suite Teardown Teardown Phase
15 ${XmlsDir}= ${CURDIR}/../../../variables/xmls
17 ${switch_name}= s${switch_idx}
18 @{xml_files}= f1.xml f2.xml f3.xml f5.xml f7.xml f8.xml f9.xml f10.xml f11.xml f12.xml f13.xml f14.xml f17.xml f19.xml f24.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}
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}
40 [Documentation] Checks if flow is configured and operational
41 Init Flow Variables f3.xml
42 Check Config Flow ${True}
43 Check Operational Table ${True}
45 [Documentation] Checks if flow is configured and operational
46 Init Flow Variables f5.xml
47 Check Config Flow ${True}
48 Check Operational Table ${True}
50 [Documentation] Checks if flow is configured and operational
51 Init Flow Variables f7.xml
52 Check Config Flow ${True}
53 Check Operational Table ${True}
55 [Documentation] Checks if flow is configured and operational
56 Init Flow Variables f8.xml
57 Check Config Flow ${True}
58 Check Operational Table ${True}
60 [Documentation] Checks if flow is configured and operational
61 Init Flow Variables f9.xml
62 Check Config Flow ${True}
63 Check Operational Table ${True}
65 [Documentation] Checks if flow is configured and operational
66 Init Flow Variables f10.xml
67 Check Config Flow ${True}
68 Check Operational Table ${True}
70 [Documentation] Checks if flow is configured and operational
71 Init Flow Variables f11.xml
72 Check Config Flow ${True}
73 Check Operational Table ${True}
75 [Documentation] Checks if flow is configured and operational
76 Init Flow Variables f12.xml
77 Check Config Flow ${True}
78 Check Operational Table ${True}
80 [Documentation] Checks if flow is configured and operational
81 Init Flow Variables f13.xml
82 Check Config Flow ${True}
83 Check Operational Table ${True}
85 [Documentation] Checks if flow is configured and operational
86 Init Flow Variables f14.xml
87 Check Config Flow ${True}
88 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}
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 [Documentation] Checks if flow is configured and operational
101 Init Flow Variables f24.xml
102 Check Config Flow ${True}
103 Check Operational Table ${True}
105 [Documentation] Delete all flows and waits for SM to collect data
106 :FOR ${flowfile} IN @{xml_files}
108 \ Init Flow Variables ${flowfile}
109 \ Run Keyword And Continue On Failure Delete Flow
111 Test Is Flow 1 Deleted
112 [Documentation] Checks if flow is not configured and operational
113 Init Flow Variables f1.xml
114 Check Config Flow ${False}
115 Check Operational Table ${False}
116 Test Is Flow 2 Deleted
117 [Documentation] Checks if flow is not configured and operational
118 Init Flow Variables f2.xml
119 Check Config Flow ${False}
120 Check Operational Table ${False}
121 Test Is Flow 3 Deleted
122 [Documentation] Checks if flow is not configured and operational
123 Init Flow Variables f3.xml
124 Check Config Flow ${False}
125 Check Operational Table ${False}
126 Test Is Flow 5 Deleted
127 [Documentation] Checks if flow is not configured and operational
128 Init Flow Variables f5.xml
129 Check Config Flow ${False}
130 Check Operational Table ${False}
131 Test Is Flow 7 Deleted
132 [Documentation] Checks if flow is not configured and operational
133 Init Flow Variables f7.xml
134 Check Config Flow ${False}
135 Check Operational Table ${False}
136 Test Is Flow 8 Deleted
137 [Documentation] Checks if flow is not configured and operational
138 Init Flow Variables f8.xml
139 Check Config Flow ${False}
140 Check Operational Table ${False}
141 Test Is Flow 9 Deleted
142 [Documentation] Checks if flow is not configured and operational
143 Init Flow Variables f9.xml
144 Check Config Flow ${False}
145 Check Operational Table ${False}
146 Test Is Flow 10 Deleted
147 [Documentation] Checks if flow is not configured and operational
148 Init Flow Variables f10.xml
149 Check Config Flow ${False}
150 Check Operational Table ${False}
151 Test Is Flow 11 Deleted
152 [Documentation] Checks if flow is not configured and operational
153 Init Flow Variables f11.xml
154 Check Config Flow ${False}
155 Check Operational Table ${False}
156 Test Is Flow 12 Deleted
157 [Documentation] Checks if flow is not configured and operational
158 Init Flow Variables f12.xml
159 Check Config Flow ${False}
160 Check Operational Table ${False}
161 Test Is Flow 13 Deleted
162 [Documentation] Checks if flow is not configured and operational
163 Init Flow Variables f13.xml
164 Check Config Flow ${False}
165 Check Operational Table ${False}
166 Test Is Flow 14 Deleted
167 [Documentation] Checks if flow is not configured and operational
168 Init Flow Variables f14.xml
169 Check Config Flow ${False}
170 Check Operational Table ${False}
171 Test Is Flow 17 Deleted
172 [Documentation] Checks if flow is not configured and operational
173 Init Flow Variables f17.xml
174 Check Config Flow ${False}
175 Check Operational Table ${False}
176 Test Is Flow 19 Deleted
177 [Documentation] Checks if flow is not configured and operational
178 Init Flow Variables f19.xml
179 Check Config Flow ${False}
180 Check Operational Table ${False}
181 Test Is Flow 24 Deleted
182 [Documentation] Checks if flow is not configured and operational
183 Init Flow Variables f24.xml
184 Check Config Flow ${False}
185 Check Operational Table ${False}
189 Init Flow Variables [Arguments] ${file}
190 ${data}= Get File ${XmlsDir}/${file}
191 ${xmlroot}= Parse Xml ${XmlsDir}/${file}
192 ${table_id}= Get Element Text ${xmlroot} table_id
193 ${flow_id}= Get Element Text ${xmlroot} id
194 ${flow_priority}= Get Element Text ${xmlroot} priority
195 Set Suite Variable ${table_id}
196 Set Suite Variable ${flow_id}
197 Set Suite Variable ${flow_priority}
198 Set Suite Variable ${data}
199 Set Suite Variable ${xmlroot}
200 Check Config Flow [Arguments] ${expected}
201 ${presence_flow} ${msg}= Flow Presence Config Flow
202 ${msgf}= Get Presence Failure Message config ${expected} ${presence_flow} ${msg}
203 Should Be Equal ${expected} ${presence_flow} msg=${msgf}
204 Flow Presence Config Flow
205 ${headers}= Create Dictionary Accept application/xml
206 ${resp}= Get session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} headers=${headers}
209 Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
210 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
211 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
212 Return From Keyword ${pres} ${msg}
213 Check Operational Table [Arguments] ${expected}
214 ${presence_table} ${msg}= Flow Presence Operational Table
215 ${msgf}= Get Presence Failure Message config ${expected} ${presence_table} ${msg}
216 Should Be Equal ${expected} ${presence_table} msg=${msgf}
217 Flow Presence Operational Table
218 ${headers}= Create Dictionary Accept application/xml
219 ${resp}= Get session /restconf/operational/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id} headers=${headers}
222 Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
223 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
224 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
225 Return From Keyword ${pres} ${msg}
228 ${resp}= Putxml session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} data=${data}
229 ${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.
230 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
232 ${resp}= Delete session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id}
233 ${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.
234 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
236 [Documentation] Deletes all flows
237 :FOR ${flowfile} IN @{xml_files}
239 \ Init Flow Variables ${flowfile}
242 [Documentation] Initiate tcp connection with controller
243 Create Session session http://${CONTROLLER}:${PORT} auth=${AUTH} headers=${HEADERS_XML}
245 [Documentation] Closes tcp connection with controller and removes flows
247 Get Presence Failure Message [Arguments] ${ds} ${expected} ${presence} ${diffmsg}
248 Return From Keyword If '''${diffmsg}'''!='${EMPTY}' Flow found in ${ds} data store but: ${diffmsg}
249 ${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
250 ${msgp}= Set Variable If ${presence}==${True} it is present. it is not present.
251 Return From Keyword ${msgf} ${msgp}