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_validate_h 6 : #define vnsw_agent_test_xml_test_xml_validate_h 7 : 8 : #include <iostream> 9 : #include <vector> 10 : #include <pugixml/pugixml.hpp> 11 : #include <boost/uuid/uuid.hpp> 12 : 13 : #include <base/util.h> 14 : 15 : class AgentUtXmlTestCase; 16 : class AgentUtXmlNode; 17 : 18 : ///////////////////////////////////////////////////////////////////////////// 19 : // Validate nodes 20 : ///////////////////////////////////////////////////////////////////////////// 21 : class AgentUtXmlValidationNode; 22 : 23 : class AgentUtXmlValidate : public AgentUtXmlNode { 24 : private: 25 : typedef std::vector<AgentUtXmlValidationNode *> AgentUtXmlValidationList; 26 : public: 27 : AgentUtXmlValidate(const std::string &name, const pugi::xml_node &node, 28 : AgentUtXmlTestCase *test_case); 29 : ~AgentUtXmlValidate(); 30 : 31 : virtual bool ReadXml(); 32 : virtual bool ToXml(pugi::xml_node *parent); 33 : virtual std::string NodeType(); 34 : virtual void ToString(std::string *str); 35 : virtual bool Run(); 36 : private: 37 : AgentUtXmlValidationList node_list_; 38 : }; 39 : 40 : class AgentUtXmlValidationNode { 41 : public: 42 : AgentUtXmlValidationNode(const std::string &name, 43 : const pugi::xml_node &node); 44 : virtual ~AgentUtXmlValidationNode(); 45 : 46 : virtual bool ReadXml() = 0; 47 : virtual bool Validate() = 0; 48 : virtual const std::string ToString() = 0; 49 : 50 : bool ReadCmnXml(); 51 85 : const std::string &name() const { return name_; } 52 29 : uint16_t id() const { return id_; } 53 0 : bool delete_marked() const { return delete_marked_; } 54 106 : bool present() const { return present_; } 55 588 : const pugi::xml_node &node() const { return node_; } 56 34 : virtual uint32_t wait_count() const { return 500; } 57 0 : virtual uint32_t sleep_time() const { return 500; } 58 : 59 : private: 60 : std::string name_; 61 : pugi::xml_node node_; 62 : bool present_; 63 : bool delete_marked_; 64 : uint16_t id_; 65 : }; 66 : 67 : #endif //vnsw_agent_test_xml_test_xml_validate_h