Line data Source code
1 : /* 2 : * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved. 3 : * Copyright Contributors to the OpenSDN project 4 : */ 5 : 6 : #ifndef vnsw_agent_test_xml_test_xml_validate_h 7 : #define vnsw_agent_test_xml_test_xml_validate_h 8 : 9 : #include <iostream> 10 : #include <vector> 11 : #include <pugixml/pugixml.hpp> 12 : #include <boost/uuid/uuid.hpp> 13 : 14 : #include <base/util.h> 15 : 16 : class AgentUtXmlTestCase; 17 : class AgentUtXmlNode; 18 : 19 : ///////////////////////////////////////////////////////////////////////////// 20 : // Validate nodes 21 : ///////////////////////////////////////////////////////////////////////////// 22 : class AgentUtXmlValidationNode; 23 : 24 : class AgentUtXmlValidate : public AgentUtXmlNode { 25 : private: 26 : typedef std::vector<AgentUtXmlValidationNode *> AgentUtXmlValidationList; 27 : public: 28 : AgentUtXmlValidate(const std::string &name, const pugi::xml_node &node, 29 : AgentUtXmlTestCase *test_case); 30 : ~AgentUtXmlValidate(); 31 : 32 : virtual bool ReadXml(); 33 : virtual bool ToXml(pugi::xml_node *parent); 34 : virtual std::string NodeType(); 35 : virtual void ToString(std::string *str); 36 : virtual bool Run(); 37 : private: 38 : AgentUtXmlValidationList node_list_; 39 : }; 40 : 41 : class AgentUtXmlValidationNode { 42 : public: 43 : AgentUtXmlValidationNode(const std::string &name, 44 : const pugi::xml_node &node); 45 : virtual ~AgentUtXmlValidationNode(); 46 : 47 : virtual bool ReadXml() = 0; 48 : virtual bool Validate() = 0; 49 : virtual const std::string ToString() = 0; 50 : 51 : bool ReadCmnXml(); 52 135 : const std::string &name() const { return name_; } 53 32 : uint16_t id() const { return id_; } 54 0 : bool delete_marked() const { return delete_marked_; } 55 113 : bool present() const { return present_; } 56 631 : const pugi::xml_node &node() const { return node_; } 57 37 : virtual uint32_t wait_count() const { return 500; } 58 0 : virtual uint32_t sleep_time() const { return 500; } 59 : 60 : private: 61 : std::string name_; 62 : pugi::xml_node node_; 63 : bool present_; 64 : bool delete_marked_; 65 : uint16_t id_; 66 : }; 67 : 68 : #endif //vnsw_agent_test_xml_test_xml_validate_h