34 vxlan_tunnel::mode_t::mode_t(
int v,
const std::string s)
67 <<
"src:" <<
src.to_string() <<
" dst:" <<
dst.to_string() <<
" vni:" <<
vni 81 s << VXLAN_TUNNEL_NAME <<
"-" << mode.
to_string() <<
"-" << src <<
"-" << dst
94 , m_tep(src, dst, vni)
107 :
interface(mk_name(src, dst, mode, vni),
110 , m_tep(src, dst, vni)
123 :
interface(mk_name(src, dst, mode, vni),
126 , m_tep(src, dst, vni)
130 , m_table_id(m_rd->table_id())
138 , m_mcast_itf(o.m_mcast_itf)
140 , m_table_id(o.m_table_id)
147 return ((m_tep == other.m_tep) && (m_mode == other.m_mode) &&
148 (m_mcast_itf == other.m_mcast_itf));
157 std::shared_ptr<vxlan_tunnel>
164 vxlan_tunnel::sweep()
176 vxlan_tunnel::replay()
209 std::ostringstream s;
213 s <<
" " << m_mcast_itf->to_string();
238 if (!m_table_id && m_rd) {
246 std::shared_ptr<vxlan_tunnel>
249 return std::dynamic_pointer_cast<
vxlan_tunnel>(singular_i());
252 std::shared_ptr<interface>
253 vxlan_tunnel::singular_i()
const 255 return m_db.find_or_add(
key(), *
this);
265 std::shared_ptr<vxlan_tunnel_cmds::dump_cmd>
cmd =
266 std::make_shared<vxlan_tunnel_cmds::dump_cmd>();
271 for (
auto& record : *cmd) {
272 auto& payload = record.get_payload();
275 from_bytes(payload.is_ipv6, payload.src_address);
277 from_bytes(payload.is_ipv6, payload.dst_address);
279 std::shared_ptr<vxlan_tunnel> vt =
289 std::shared_ptr<vxlan_gbp_tunnel_cmds::dump_cmd>
cmd =
290 std::make_shared<vxlan_gbp_tunnel_cmds::dump_cmd>();
295 for (
auto& record : *cmd) {
296 auto& payload = record.get_payload();
297 handle_t hdl(payload.tunnel.sw_if_index);
301 std::shared_ptr<vxlan_tunnel> vt =
323 vxlan_tunnel::event_handler::handle_replay()
329 vxlan_tunnel::event_handler::order()
const A Command class that creates an VXLAN tunnel.
std::string to_string() const
Debug print function.
A representation of a VXLAN Tunnel in VPP.
void release()
release/remove an interface form the singular store
const std::string VXLAN_TUNNEL_NAME
static std::shared_ptr< vxlan_tunnel > find(const interface::key_t &k)
Fond the singular instance of the interface in the DB by key.
A template base class for all enum types.
virtual std::string to_string() const
Debug rpint function.
Combaintion of attributes that are a unique key for a VXLAN tunnel.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
virtual interfaces - those that depend on some real interface
HW::item< handle_t > m_hdl
The SW interface handle VPP has asigned to the interface.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
boost::asio::ip::address dst
The destination IP address of the endpoint.
static rc_t write()
Write/Execute all commands hitherto enqueued.
static const log_level_t DEBUG
static const handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
A Command class that creates an VXLAN tunnel.
std::string to_string() const
convert to string format for debug purposes
T & data()
Return the data read/written.
static const mode_t GBP_L3
static singular_db< key_t, interface > m_db
A map of all interfaces key against the interface's name.
rc_t rc() const
Get the HW return code.
static const l3_proto_t IPV4
static const l3_proto_t IPV6
static const table_id_t DEFAULT_TABLE
The table-id for the default table.
A functor class that creates an VXLAN tunnel.
std::shared_ptr< vxlan_tunnel > singular() const
Return the matching 'singular instance'.
A command class that binds an interface to an L3 table.
The admin state of the interface.
A representation of an interface in VPP.
A type declaration of an interface handle in VPP.
vl_api_vxlan_gbp_api_tunnel_mode_t mode
endpoint_t()
Default constructor.
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
void event_handler(void *tls_async)
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
static const rc_t OK
The HW write was successfull.
const std::string & name() const
Return the interface type.
static void enqueue(cmd *f)
Enqueue A command for execution.
boost::asio::ip::address from_bytes(uint8_t is_ip6, const uint8_t *bytes)
Convert a VPP byte stinrg into a boost addresss.
static const mode_t STANDARD
The VPP Object Model (VOM) library.
const neighbour::flags_t from_api(vapi_enum_ip_neighbor_flags f)
A representation of a method call to VPP.
A functor class that creates an VXLAN tunnel.
bool operator==(const endpoint_t &o) const
Comparison operator.
uint32_t vni
The VNI of the endpoint.
static const mode_t GBP_L2
const std::string & to_string() const
convert to string format for debug purposes
std::string key_t
The key for interface's key.
vxlan_tunnel(const boost::asio::ip::address &src, const boost::asio::ip::address &dst, uint32_t vni, const mode_t &mode=mode_t::STANDARD)
Construct a new object matching the desried state.
boost::asio::ip::address src
The src IP address of the endpoint.
static bool register_listener(listener *listener)
Register a listener of events.
const key_t & key() const
Return the interface type.
const handle_t & handle() const
Return VPP's handle to this object.
bool operator==(const vxlan_tunnel &vx) const
comparison operator