5 #ifndef vnsw_agent_test_xml_test_xml_h
6 #define vnsw_agent_test_xml_test_xml_h
10 #include <pugixml/pugixml.hpp>
11 #include <boost/uuid/uuid.hpp>
19 namespace AgentUtXmlUtils {
24 bool GetIntAttribute(
const pugi::xml_node &node,
const std::string &name,
31 const std::string &mac,
const std::string vm_name);
32 void LinkXmlNode(pugi::xml_node *parent,
const std::string <ype,
33 const std::string lname,
const std::string &rtype,
34 const std::string rname);
37 const std::string &value);
47 const std::string &name,
49 const pugi::xml_node &node,
54 (
const std::string &
type,
const std::string &name,
58 typedef std::map<std::string, AgentUtXmlTestConfigCreateFn>
60 typedef std::map<std::string, AgentUtXmlTestValidateCreateFn>
70 bool Run(std::string test_case);
98 virtual void ToString(std::string *str);
116 AgentUtXmlNode(
const std::string &name,
const pugi::xml_node &node,
121 virtual bool ToXml(pugi::xml_node *parent) = 0;
123 virtual void ToString(std::string *str);
124 virtual bool Run() { assert(0);
return false; }
153 virtual bool ToXml(pugi::xml_node *parent);
155 virtual void ToString(std::string *str);
173 virtual bool ToXml(pugi::xml_node *parent);
175 virtual void ToString(std::string *str);
194 const pugi::xml_node &node,
bool gen_xml,
199 virtual void ToString(std::string *str);
208 #endif //vnsw_agent_test_xml_test_xml_h
boost::function< AgentUtXmlValidationNode *(const std::string &type, const std::string &name, const boost::uuids::uuid &id, const pugi::xml_node &node)> AgentUtXmlTestValidateCreateFn
virtual void ToString(std::string *str)
virtual ~AgentUtXmlTest()
virtual std::string NodeType()
void set_gen_xml(bool val)
std::vector< AgentUtXmlNode * > AgentUtXmlNodeList
virtual void ToString(std::string *str)
virtual void ToString(std::string *str)
xml_node AddXmlNodeWithIntValue(xml_node *parent, const char *name, int val)
void set_verbose(bool val)
AgentUtXmlNode(const std::string &name, const pugi::xml_node &node, AgentUtXmlTestCase *test_case)
bool GetIntAttribute(const xml_node &node, const string &name, int *value)
virtual void ToString(std::string *str)
AgentUtXmlTestValidateFactory validate_factory_
AgentUtXmlTestValidateCreateFn GetValidateCreateFn(const std::string &name)
const std::string & name() const
AgentUtXmlTask(const pugi::xml_node &node, AgentUtXmlTestCase *test_case)
void ToString(std::string *str)
DISALLOW_COPY_AND_ASSIGN(AgentUtXmlNode)
std::map< std::string, AgentUtXmlTestConfigCreateFn > AgentUtXmlTestConfigFactory
virtual ~AgentUtXmlConfig()
AgentUtXmlTestList test_list_
std::map< std::string, AgentUtXmlTestValidateCreateFn > AgentUtXmlTestValidateFactory
void NovaIntfAdd(bool op_delete, const uuid &id, const Ip4Address &ip, const uuid &vm_uuid, const uuid vn_uuid, const string &name, const string &mac, const string vm_name)
bool GetBoolAttribute(const xml_node &node, const string &name, bool *value)
xml_node AddXmlNodeWithValue(xml_node *parent, const char *name, const string &value)
DISALLOW_COPY_AND_ASSIGN(AgentUtXmlLink)
virtual ~AgentUtXmlNode()
AgentUtXmlTestCase(const std::string &name, const pugi::xml_node &node, AgentUtXmlTest *test)
DISALLOW_COPY_AND_ASSIGN(AgentUtXmlTask)
virtual std::string NodeType()=0
xml_node AddXmlNodeWithAttr(xml_node *parent, const char *attr)
void AddIdPerms(pugi::xml_node *parent)
boost::function< AgentUtXmlNode *(const std::string type, const std::string &name, const boost::uuids::uuid &id, const pugi::xml_node &node, AgentUtXmlTestCase *test_case)> AgentUtXmlTestConfigCreateFn
virtual std::string NodeType()
virtual ~AgentUtXmlTask()
AgentUtXmlTest(const std::string &file_name)
pugi::xml_document gen_doc_
void AddConfigEntry(const std::string &name, AgentUtXmlTestConfigCreateFn fn)
std::vector< AgentUtXmlTestCase * > AgentUtXmlTestList
bool GetStringAttribute(const xml_node &node, const string &name, string *value)
virtual ~AgentUtXmlTestCase()
boost::asio::ip::address_v4 Ip4Address
AgentUtXmlLink(const pugi::xml_node &node, AgentUtXmlTestCase *test_case)
virtual bool ToXml(pugi::xml_node *parent)
virtual bool ToXml(pugi::xml_node *parent)
bool GetUintAttribute(const xml_node &node, const string &name, uint16_t *value)
const boost::uuids::uuid & id() const
virtual ~AgentUtXmlLink()
void AddValidateEntry(const std::string &name, AgentUtXmlTestValidateCreateFn fn)
void set_op_delete(bool val)
DISALLOW_COPY_AND_ASSIGN(AgentUtXmlTest)
AgentUtXmlConfig(const std::string &name, const boost::uuids::uuid &uuid, const pugi::xml_node &node, AgentUtXmlTestCase *test_case)
virtual bool ToXml(pugi::xml_node *parent)=0
AgentUtXmlTestCase * test_case()
AgentUtXmlTestConfigFactory config_factory_
AgentUtXmlTestCase * test_case_
const pugi::xml_node & node() const
virtual void ToString(std::string *str)
DISALLOW_COPY_AND_ASSIGN(AgentUtXmlConfig)
const std::string & name() const
AgentUtXmlTestConfigCreateFn GetConfigCreateFn(const std::string &name)
void LinkXmlNode(xml_node *parent, const string <ype, const string lname, const string &rtype, const string rname)
DISALLOW_COPY_AND_ASSIGN(AgentUtXmlTestCase)
AgentUtXmlNodeList node_list_