OpenSDN source code
test_xml_packet.h
Go to the documentation of this file.
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_packet_h
7 #define vnsw_agent_test_xml_test_xmk_packet_h
8 
9 #include <agent_cmn.h>
10 #include <agent.h>
11 #include <oper/nexthop.h>
12 #include <pkt/pkt_handler.h>
13 
15 // Generic class to describe packets. Can be used for packet parse tests,
16 // flow tests etc...
19 public:
21  virtual ~AgentUtXmlPacketUtils();
22 
23  bool ReadXml(const pugi::xml_node &node);
24  const string ToString();
25 
26  bool Inet6Packet(Interface *intf, Agent *agent, PktGen *pkt);
27  bool InetPacket(Interface *intf, Agent *agent, PktGen *pkt);
28  bool MakePacket(Agent *agent, PktGen *pkt);
29 
31  uint8_t GetIpProto() const;
32  uint8_t GetTrapCode() const;
34  bool IsL2Mode() const;
35  bool IsL3Mode() const;
36 
37 public:
38  std::string name_;
39  uint32_t len_;
40  uint32_t vrf_id_;
41  std::string vrf_str_;
42  bool ingress_;
43  std::string fwd_mode_;
44  std::string pkt_module_;
45 
46  uint32_t intf_id_;
47  std::string intf_;
48 
49  std::string tunnel_type_;
50  std::string tunnel_sip_;
51  std::string tunnel_dip_;
52  uint32_t label_;
53  uint32_t vxlan_id_;
54 
55  std::string smac_;
56  std::string dmac_;
57  std::string sip_;
58  std::string dip_;
59  uint16_t proto_id_;
60  std::string proto_;
61  uint16_t sport_;
62  uint16_t dport_;
63  bool tcp_ack_;
64 
65  std::string trap_code_;
66  uint32_t hash_id_;
67 };
68 
70 // Packet nodes
73 public:
74  AgentUtXmlPacket(const std::string &name, const pugi::xml_node &node,
76  virtual ~AgentUtXmlPacket();
77 
78  virtual bool ReadXml();
79  virtual bool ToXml(pugi::xml_node *parent);
80  virtual std::string NodeType();
81  virtual void ToString(std::string *str);
82  virtual bool Run();
83 
84  bool TxInet6Packet();
85  bool TxInetPacket();
86 private:
88 };
89 
91 // Packet Parser Validation entries
94 public:
95  AgentUtXmlPktParseValidate(const std::string &name,
96  const pugi::xml_node &node);
98 
99  virtual bool ReadXml();
100  virtual bool Validate();
101  virtual const std::string ToString();
102  virtual uint32_t wait_count() { return 2; }
103 
105 private:
107 };
108 
109 #endif // vnsw_agent_test_xml_test_xml_packet_h
const pugi::xml_node & node() const
Definition: test_xml.h:132
AgentUtXmlTestCase * test_case()
Definition: test_xml.h:133
const std::string & name() const
Definition: test_xml.h:131
TunnelType::Type GetTunnelType() const
bool ReadXml(const pugi::xml_node &node)
bool InetPacket(Interface *intf, Agent *agent, PktGen *pkt)
virtual ~AgentUtXmlPacketUtils()
PktHandler::PktModuleName GetPacketModule() const
uint8_t GetTrapCode() const
bool MakePacket(Agent *agent, PktGen *pkt)
bool Inet6Packet(Interface *intf, Agent *agent, PktGen *pkt)
uint8_t GetIpProto() const
AgentUtXmlPacketUtils pkt_
virtual bool ReadXml()
virtual std::string NodeType()
virtual void ToString(std::string *str)
virtual bool Run()
AgentUtXmlPacket(const std::string &name, const pugi::xml_node &node, AgentUtXmlTestCase *test_case)
virtual ~AgentUtXmlPacket()
virtual bool ToXml(pugi::xml_node *parent)
virtual uint32_t wait_count()
virtual const std::string ToString()
AgentUtXmlPacketUtils pkt_
AgentUtXmlPktParseValidate(const std::string &name, const pugi::xml_node &node)
const pugi::xml_node & node() const
const std::string & name() const
Definition: agent.h:361
uint8_t type
Definition: load_balance.h:2