FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
gbp_vxlan_cmds.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __VOM_GBP_VXLAN_CMDS_H__
17 #define __VOM_GBP_VXLAN_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/gbp_vxlan.hpp"
21 #include "vom/interface.hpp"
22 
23 #include <vapi/gbp.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace gbp_vxlan_cmds {
27 /**
28  * A command class that creates an Bridge-Domain
29  */
30 class create_cmd : public interface::create_cmd<vapi::Gbp_vxlan_tunnel_add>
31 {
32 public:
33  /**
34  * Constructor
35  */
37  const std::string& name,
38  const boost::asio::ip::address_v4& src,
39  uint32_t vni,
40  bool is_l2,
41  uint32_t bd_rd);
42 
43  /**
44  * Issue the command to VPP/HW
45  */
47  /**
48  * convert to string format for debug purposes
49  */
50  std::string to_string() const;
51 
52  /**
53  * Comparison operator - only used for UT
54  */
55  bool operator==(const create_cmd& i) const;
56 
57 private:
58  boost::asio::ip::address_v4 m_src;
59  uint32_t m_vni;
60  bool m_is_l2;
61  uint32_t m_bd_rd;
62 };
63 
64 /**
65  * A cmd class that Delete an Bridge-Domain
66  */
67 class delete_cmd : public interface::delete_cmd<vapi::Gbp_vxlan_tunnel_del>
68 {
69 public:
70  /**
71  * Constructor
72  */
74 
75  /**
76  * Issue the command to VPP/HW
77  */
79  /**
80  * convert to string format for debug purposes
81  */
82  std::string to_string() const;
83 
84  /**
85  * Comparison operator - only used for UT
86  */
87  bool operator==(const delete_cmd& i) const;
88 
89 private:
90  uint32_t m_vni;
91 };
92 
93 /**
94  * A cmd class that Dumps all the bridge domains
95  */
96 class dump_cmd : public VOM::dump_cmd<vapi::Gbp_vxlan_tunnel_dump>
97 {
98 public:
99  /**
100  * Constructor
101  */
102  dump_cmd();
103  dump_cmd(const dump_cmd& d);
104 
105  /**
106  * Issue the command to VPP/HW
107  */
109  /**
110  * convert to string format for debug purposes
111  */
112  std::string to_string() const;
113 
114  /**
115  * Comparison operator - only used for UT
116  */
117  bool operator==(const dump_cmd& i) const;
118 
119 private:
120  /**
121  * HW reutrn code
122  */
123  HW::item<bool> item;
124 };
125 
126 }; // gbp_vxlan_cmds
127 }; // VOM
128 
129 /*
130  * fd.io coding-style-patch-verification: OFF
131  *
132  * Local Variables:
133  * eval: (c-set-style "mozilla")
134  * End:
135  */
136 
137 #endif
VOM::HW::item< handle_t >
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
name
string name[64]
Definition: fib.api:25
vni
u32 vni
Definition: flow_types.api:160
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::gbp_vxlan_cmds::create_cmd::operator==
bool operator==(const create_cmd &i) const
Comparison operator - only used for UT.
VOM::gbp_vxlan_cmds::create_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: gbp_vxlan_cmds.cpp:61
VOM::interface::delete_cmd
Base class for intterface Delete commands.
Definition: interface.hpp:376
VOM::gbp_vxlan_cmds::dump_cmd::dump_cmd
dump_cmd()
Constructor.
Definition: gbp_vxlan_cmds.cpp:102
VOM::gbp_vxlan_cmds::delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: gbp_vxlan_cmds.cpp:94
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::gbp_vxlan_cmds::delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: gbp_vxlan_cmds.cpp:77
VOM::gbp_vxlan_cmds::dump_cmd
A cmd class that Dumps all the bridge domains.
Definition: gbp_vxlan_cmds.hpp:96
src
vl_api_address_t src
Definition: gre.api:54
VOM::gbp_vxlan_cmds::create_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: gbp_vxlan_cmds.cpp:36
VOM::interface::create_cmd
A base class for interface Create commands.
Definition: interface.hpp:309
VOM::gbp_vxlan_cmds::create_cmd
A command class that creates an Bridge-Domain.
Definition: gbp_vxlan_cmds.hpp:30
VOM::gbp_vxlan_cmds::create_cmd::create_cmd
create_cmd(HW::item< handle_t > &item, const std::string &name, const boost::asio::ip::address_v4 &src, uint32_t vni, bool is_l2, uint32_t bd_rd)
Constructor.
Definition: gbp_vxlan_cmds.cpp:21
dump_cmd.hpp
VOM::rpc_cmd< HW::item< handle_t >, vapi::Gbp_vxlan_tunnel_add >::item
HW::item< handle_t > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
gbp_vxlan.hpp
VOM::gbp_vxlan_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: gbp_vxlan_cmds.cpp:125
interface.hpp
VOM::gbp_vxlan_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: gbp_vxlan_cmds.cpp:113
VOM::gbp_vxlan_cmds::delete_cmd
A cmd class that Delete an Bridge-Domain.
Definition: gbp_vxlan_cmds.hpp:67
VOM::gbp_vxlan_cmds::delete_cmd::operator==
bool operator==(const delete_cmd &i) const
Comparison operator - only used for UT.
i
int i
Definition: flowhash_template.h:376
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
VOM::dump_cmd
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
VOM::gbp_vxlan_cmds::delete_cmd::delete_cmd
delete_cmd(HW::item< handle_t > &item, uint32_t vni)
Constructor.
Definition: gbp_vxlan_cmds.cpp:70
VOM::gbp_vxlan_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: gbp_vxlan_cmds.cpp:107
string
const char *const string
Definition: cJSON.h:172