LCOV - code coverage report
Current view: top level - vnsw/agent/test-xml - test_xml_oper.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 9 11 81.8 %
Date: 2026-11-09 02:10:49 Functions: 4 6 66.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14