Line data Source code
1 : /*
2 : * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
3 : */
4 :
5 : #ifndef vnsw_agent_test_xml_test_xml_oper_h
6 : #define vnsw_agent_test_xml_test_xml_oper_h
7 :
8 : #include <test-xml/test_xml.h>
9 : #include <test-xml/test_xml_validate.h>
10 :
11 : void AgentUtXmlOperInit(AgentUtXmlTest *test);
12 :
13 : class AgentUtXmlGlobalVrouter : public AgentUtXmlConfig {
14 : public:
15 : AgentUtXmlGlobalVrouter(const std::string &name,
16 : const boost::uuids::uuid &uuid,
17 : const pugi::xml_node &node,
18 : AgentUtXmlTestCase *test_case);
19 : ~AgentUtXmlGlobalVrouter();
20 :
21 : virtual bool ReadXml();
22 : virtual bool ToXml(pugi::xml_node *parent);
23 : virtual std::string NodeType();
24 : virtual void ToString(std::string *str);
25 :
26 0 : std::string &vxlan_mode() { return vxlan_mode_;}
27 0 : int flow_export_rate() const { return flow_export_rate_; }
28 :
29 : private:
30 : std::string vxlan_mode_;
31 : int flow_export_rate_;
32 : };
33 :
34 : class AgentUtXmlVn : public AgentUtXmlConfig {
35 : public:
36 : AgentUtXmlVn(const std::string &name, const boost::uuids::uuid &uuid,
37 : const pugi::xml_node &node, AgentUtXmlTestCase *test_case);
38 : ~AgentUtXmlVn();
39 :
40 : virtual bool ReadXml();
41 : virtual bool ToXml(pugi::xml_node *parent);
42 : virtual std::string NodeType();
43 : virtual void ToString(std::string *str);
44 :
45 15 : std::string &vxlan_id() { return vxlan_id_;}
46 15 : std::string &network_id() { return network_id_;}
47 12 : std::string &flood_unknown_unicast() {
48 12 : return flood_unknown_unicast_;
49 : }
50 :
51 : private:
52 : std::string vxlan_id_;
53 : std::string network_id_;
54 : std::string flood_unknown_unicast_;
55 : };
56 :
57 : class AgentUtXmlVm : public AgentUtXmlConfig {
58 : public:
59 : AgentUtXmlVm(const std::string &name, const boost::uuids::uuid &uuid,
60 : const pugi::xml_node &node, AgentUtXmlTestCase *test_case);
61 : ~AgentUtXmlVm();
62 :
63 : virtual bool ReadXml();
64 : virtual bool ToXml(pugi::xml_node *parent);
65 : virtual std::string NodeType();
66 : virtual void ToString(std::string *str);
67 :
68 : private:
69 : };
70 :
71 : class AgentUtXmlVmInterface : public AgentUtXmlConfig {
72 : public:
73 : AgentUtXmlVmInterface(const std::string &name,
74 : const boost::uuids::uuid &uuid,
75 : const pugi::xml_node &node,
76 : AgentUtXmlTestCase *test_case);
77 : ~AgentUtXmlVmInterface();
78 :
79 : virtual bool ReadXml();
80 : virtual bool ToXml(pugi::xml_node *parent);
81 : virtual std::string NodeType();
82 : virtual void ToString(std::string *str);
83 :
84 : private:
85 : std::string mac_;
86 : boost::uuids::uuid vn_uuid_;
87 : std::string vn_name_;
88 : boost::uuids::uuid vm_uuid_;
89 : std::string vm_name_;
90 : std::string vrf_;
91 : std::string ip_;
92 : bool add_nova_;
93 : uint16_t vlan_tag_;
94 : std::vector<uint16_t> fat_flow_port_;
95 : std::string parent_vmi_;
96 : };
97 :
98 : class AgentUtXmlEthInterface : public AgentUtXmlConfig {
99 : public:
100 : AgentUtXmlEthInterface(const std::string &name,
101 : const boost::uuids::uuid &uuid,
102 : const pugi::xml_node &node,
103 : AgentUtXmlTestCase *test_case);
104 : ~AgentUtXmlEthInterface();
105 :
106 : virtual bool ReadXml();
107 : virtual bool ToXml(pugi::xml_node *parent);
108 : virtual std::string NodeType();
109 : virtual void ToString(std::string *str);
110 : virtual bool Run();
111 :
112 : private:
113 : };
114 :
115 : class AgentUtXmlVrf : public AgentUtXmlConfig {
116 : public:
117 : AgentUtXmlVrf(const std::string &name, const boost::uuids::uuid &uuid,
118 : const pugi::xml_node &node, AgentUtXmlTestCase *test_case);
119 : ~AgentUtXmlVrf();
120 :
121 : virtual bool ReadXml();
122 : virtual bool ToXml(pugi::xml_node *parent);
123 : virtual std::string NodeType();
124 : virtual void ToString(std::string *str);
125 :
126 : private:
127 : std::string vn_name_;
128 : };
129 :
130 : class AgentUtXmlVmiVrf : public AgentUtXmlConfig {
131 : public:
132 : AgentUtXmlVmiVrf(const std::string &name, const boost::uuids::uuid &uuid,
133 : const pugi::xml_node &node, AgentUtXmlTestCase *test_case);
134 : ~AgentUtXmlVmiVrf();
135 :
136 : virtual bool ReadXml();
137 : virtual bool ToXml(pugi::xml_node *parent);
138 : virtual std::string NodeType();
139 : virtual void ToString(std::string *str);
140 :
141 : private:
142 : };
143 :
144 : class AgentUtXmlAcl : public AgentUtXmlConfig {
145 : public:
146 : struct Ace {
147 12 : Ace() :
148 12 : src_sg_(0), dst_sg_(0), src_vn_(""), dst_vn_(""), src_ip_(""),
149 12 : src_ip_plen_(0), dst_ip_(""), dst_ip_plen_(0), proto_(0),
150 12 : sport_begin_(-1), sport_end_(-1), dport_begin_(-1), dport_end_(-1) {
151 12 : }
152 :
153 : uint16_t src_sg_;
154 : uint16_t dst_sg_;
155 : std::string src_vn_;
156 : std::string dst_vn_;
157 : std::string src_ip_;
158 : uint16_t src_ip_plen_;
159 : std::string dst_ip_;
160 : uint16_t dst_ip_plen_;
161 : uint8_t proto_;
162 : int sport_begin_;
163 : int sport_end_;
164 : int dport_begin_;
165 : int dport_end_;
166 : std::string action_;
167 : std::string direction_;
168 : };
169 : typedef std::vector<Ace> AceList;
170 :
171 : AgentUtXmlAcl(const std::string &name, const boost::uuids::uuid &uuid,
172 : const pugi::xml_node &node, AgentUtXmlTestCase *test_case);
173 : ~AgentUtXmlAcl();
174 :
175 : virtual bool ReadXml();
176 : virtual bool ToXml(pugi::xml_node *parent);
177 : virtual std::string NodeType();
178 : virtual void ToString(std::string *str);
179 :
180 : private:
181 : AceList ace_list_;
182 : };
183 :
184 : class AgentUtXmlSg : public AgentUtXmlConfig {
185 : public:
186 : AgentUtXmlSg(const std::string &name, const boost::uuids::uuid &uuid,
187 : const pugi::xml_node &node, AgentUtXmlTestCase *test_case);
188 : ~AgentUtXmlSg();
189 :
190 : virtual bool ReadXml();
191 : virtual bool ToXml(pugi::xml_node *parent);
192 : virtual std::string NodeType();
193 : virtual void ToString(std::string *str);
194 :
195 : private:
196 : std::string ingress_;
197 : std::string egress_;
198 : std::string sg_id_;
199 : };
200 :
201 : class AgentUtXmlTag : public AgentUtXmlConfig {
202 : public:
203 : AgentUtXmlTag(const std::string &name, const boost::uuids::uuid &uuid,
204 : const pugi::xml_node &node, AgentUtXmlTestCase *test_case);
205 : ~AgentUtXmlTag();
206 :
207 : virtual bool ReadXml();
208 : virtual bool ToXml(pugi::xml_node *parent);
209 : virtual std::string NodeType();
210 : virtual void ToString(std::string *str);
211 :
212 : private:
213 : std::string tag_id_;
214 : };
215 :
216 : class AgentUtXmlInstanceIp : public AgentUtXmlConfig {
217 : public:
218 : AgentUtXmlInstanceIp(const std::string &name, const boost::uuids::uuid &uuid,
219 : const pugi::xml_node &node, AgentUtXmlTestCase *test_case);
220 : ~AgentUtXmlInstanceIp();
221 :
222 : virtual bool ReadXml();
223 : virtual bool ToXml(pugi::xml_node *parent);
224 : virtual std::string NodeType();
225 : virtual void ToString(std::string *str);
226 :
227 : private:
228 : std::string ip_;
229 : std::string vmi_;
230 : bool ecmp_;
231 : };
232 :
233 : /////////////////////////////////////////////////////////////////////////////
234 : // Nova messages
235 : /////////////////////////////////////////////////////////////////////////////
236 : class AgentUtXmlNova : public AgentUtXmlConfig {
237 : public:
238 : AgentUtXmlNova(const std::string &name, const boost::uuids::uuid &uuid,
239 : const pugi::xml_node &node, AgentUtXmlTestCase *test_case);
240 : ~AgentUtXmlNova();
241 :
242 : virtual bool ReadXml();
243 : virtual bool ToXml(pugi::xml_node *parent);
244 : virtual std::string NodeType();
245 : virtual void ToString(std::string *str);
246 : virtual bool Run();
247 :
248 : private:
249 : std::string mac_;
250 : std::string vm_name_;
251 : boost::uuids::uuid vn_uuid_;
252 : boost::uuids::uuid vm_uuid_;
253 : std::string ip_;
254 : };
255 :
256 : class AgentUtXmlGlobalVrouterValidate : public AgentUtXmlValidationNode {
257 : public:
258 : AgentUtXmlGlobalVrouterValidate(const std::string &name,
259 : const boost::uuids::uuid &id,
260 : const pugi::xml_node &node);
261 : virtual ~AgentUtXmlGlobalVrouterValidate();
262 :
263 : virtual bool ReadXml();
264 : virtual bool Validate();
265 : virtual const std::string ToString();
266 : private:
267 : const boost::uuids::uuid id_;
268 : int flow_export_rate_;
269 : };
270 :
271 : class AgentUtXmlVnValidate : public AgentUtXmlValidationNode {
272 : public:
273 : AgentUtXmlVnValidate(const std::string &name,
274 : const boost::uuids::uuid &id,
275 : const pugi::xml_node &node);
276 : virtual ~AgentUtXmlVnValidate();
277 :
278 : virtual bool ReadXml();
279 : virtual bool Validate();
280 : virtual const std::string ToString();
281 : private:
282 : const boost::uuids::uuid id_;
283 : uint16_t vxlan_id_;
284 : bool check_vxlan_id_ref_;
285 : uint16_t vxlan_id_ref_;
286 : };
287 :
288 : class AgentUtXmlVmValidate : public AgentUtXmlValidationNode {
289 : public:
290 : AgentUtXmlVmValidate(const std::string &name,
291 : const boost::uuids::uuid &id,
292 : const pugi::xml_node &node);
293 : virtual ~AgentUtXmlVmValidate();
294 :
295 : virtual bool ReadXml();
296 : virtual bool Validate();
297 : virtual const std::string ToString();
298 : private:
299 : const boost::uuids::uuid id_;
300 : };
301 :
302 : class AgentUtXmlVxlanValidate : public AgentUtXmlValidationNode {
303 : public:
304 : AgentUtXmlVxlanValidate(const std::string &name,
305 : const boost::uuids::uuid &id,
306 : const pugi::xml_node &node);
307 : virtual ~AgentUtXmlVxlanValidate();
308 :
309 : virtual bool ReadXml();
310 : virtual bool Validate();
311 : virtual const std::string ToString();
312 : private:
313 : const boost::uuids::uuid id_;
314 : uint16_t vxlan_id_;
315 : std::string vrf_;
316 : std::string flood_unknown_unicast_;
317 : };
318 :
319 : class AgentUtXmlVmInterfaceValidate : public AgentUtXmlValidationNode {
320 : public:
321 : AgentUtXmlVmInterfaceValidate(const std::string &name,
322 : const boost::uuids::uuid &id,
323 : const pugi::xml_node &node);
324 : virtual ~AgentUtXmlVmInterfaceValidate();
325 :
326 : virtual bool ReadXml();
327 : virtual bool Validate();
328 : virtual const std::string ToString();
329 : private:
330 : const boost::uuids::uuid id_;
331 : std::string active_;
332 : std::string device_type_;
333 : std::string vmi_type_;
334 : uint16_t vlan_tag_;
335 : std::vector<uint16_t> fat_flow_port_;
336 :
337 : boost::uuids::uuid vn_uuid_;
338 : };
339 :
340 : class AgentUtXmlEthInterfaceValidate : public AgentUtXmlValidationNode {
341 : public:
342 : AgentUtXmlEthInterfaceValidate(const std::string &name,
343 : const boost::uuids::uuid &id,
344 : const pugi::xml_node &node);
345 : virtual ~AgentUtXmlEthInterfaceValidate();
346 :
347 : virtual bool ReadXml();
348 : virtual bool Validate();
349 : virtual const std::string ToString();
350 : private:
351 : const boost::uuids::uuid id_;
352 : };
353 :
354 : class AgentUtXmlVrfValidate : public AgentUtXmlValidationNode {
355 : public:
356 : AgentUtXmlVrfValidate(const std::string &name,
357 : const pugi::xml_node &node);
358 : virtual ~AgentUtXmlVrfValidate();
359 :
360 : virtual bool ReadXml();
361 : virtual bool Validate();
362 : virtual const std::string ToString();
363 : private:
364 : std::string vn_name_;
365 : };
366 :
367 : class AgentUtXmlAclValidate : public AgentUtXmlValidationNode {
368 : public:
369 : AgentUtXmlAclValidate(const std::string &name,
370 : const pugi::xml_node &node);
371 : virtual ~AgentUtXmlAclValidate();
372 :
373 : virtual bool ReadXml();
374 : virtual bool Validate();
375 : virtual const std::string ToString();
376 : private:
377 : };
378 :
379 : class AgentUtXmlFlowValidate : public AgentUtXmlValidationNode {
380 : public:
381 : AgentUtXmlFlowValidate(const std::string &name,
382 : const pugi::xml_node &node);
383 : virtual ~AgentUtXmlFlowValidate();
384 :
385 : virtual bool ReadXml();
386 : virtual bool Validate();
387 : virtual const std::string ToString();
388 : virtual uint32_t wait_count() const;
389 : private:
390 : uint16_t nh_id_;
391 : std::string sip_;
392 : std::string dip_;
393 : std::string proto_;
394 : uint16_t sport_;
395 : uint16_t dport_;
396 : uint16_t proto_id_;
397 : std::string svn_;
398 : std::string dvn_;
399 : std::string action_;
400 : uint16_t rpf_nh_;
401 : std::string deleted_;
402 : std::string vrf_;
403 : };
404 :
405 : class AgentUtXmlL2Route : public AgentUtXmlNode {
406 : public:
407 : AgentUtXmlL2Route(const std::string &name, const boost::uuids::uuid &uuid,
408 : const pugi::xml_node &node,
409 : AgentUtXmlTestCase *test_case);
410 : ~AgentUtXmlL2Route();
411 :
412 : virtual bool ReadXml();
413 : virtual bool ToXml(pugi::xml_node *parent);
414 : virtual std::string NodeType();
415 : virtual void ToString(std::string *str);
416 : virtual bool Run();
417 :
418 : private:
419 : std::string mac_;
420 : std::string vrf_;
421 : std::string vn_name_;
422 : std::string ip_;
423 : uint16_t vxlan_id_;
424 : std::string vn_;
425 : std::string tunnel_dest_;
426 : std::string tunnel_type_;
427 : uint16_t sg_id_;
428 : uint16_t tag_id_;
429 : uint16_t label_;
430 : };
431 :
432 : class AgentUtXmlL2RouteValidate : public AgentUtXmlValidationNode {
433 : public:
434 : AgentUtXmlL2RouteValidate(const std::string &name,
435 : const pugi::xml_node &node);
436 : virtual ~AgentUtXmlL2RouteValidate();
437 :
438 : virtual bool ReadXml();
439 : virtual bool Validate();
440 : virtual const std::string ToString();
441 : private:
442 : std::string mac_;
443 : std::string vrf_;
444 : uint16_t vxlan_id_;
445 : IpAddress ip_;
446 : std::string vn_;
447 : std::string nh_type_;
448 : std::string tunnel_dest_;
449 : std::string tunnel_type_;
450 : uint16_t intf_uuid_;
451 : };
452 :
453 : class AgentUtXmlL3Route : public AgentUtXmlNode {
454 : public:
455 : AgentUtXmlL3Route(const std::string &name, const boost::uuids::uuid &uuid,
456 : const pugi::xml_node &node,
457 : AgentUtXmlTestCase *test_case);
458 : ~AgentUtXmlL3Route();
459 :
460 : virtual bool ReadXml();
461 : virtual bool ToXml(pugi::xml_node *parent);
462 : virtual std::string NodeType();
463 : virtual void ToString(std::string *str);
464 : virtual bool Run();
465 :
466 : private:
467 : std::string src_ip_;
468 : std::string vrf_;
469 : std::string vn_name_;
470 : std::string ip_;
471 : uint16_t vxlan_id_;
472 : std::string vn_;
473 : std::string tunnel_dest_;
474 : std::string tunnel_type_;
475 : uint16_t sg_id_;
476 : uint16_t tag_id_;
477 : uint16_t label_;
478 : uint16_t plen_;
479 : };
480 :
481 :
482 : class AgentUtXmlL3RouteValidate : public AgentUtXmlValidationNode {
483 : public:
484 : AgentUtXmlL3RouteValidate(const std::string &name,
485 : const pugi::xml_node &node);
486 : virtual ~AgentUtXmlL3RouteValidate();
487 :
488 : virtual bool ReadXml();
489 : virtual bool Validate();
490 : virtual const std::string ToString();
491 : private:
492 : std::string src_ip_;
493 : std::string vrf_;
494 : uint16_t vxlan_id_;
495 : IpAddress ip_;
496 : std::string vn_;
497 : std::string nh_type_;
498 : std::string tunnel_dest_;
499 : std::string tunnel_type_;
500 : uint16_t intf_uuid_;
501 : };
502 : #endif //vnsw_agent_test_xml_test_xml_oper_h
|