24 vxlan_tunnel::event_handler vxlan_tunnel::m_evh;
34 const boost::asio::ip::address& dst,
74 <<
"src:" <<
src.to_string() <<
" dst:" <<
dst.to_string() <<
" vni:" <<
vni 89 vxlan_tunnel::mk_name(
const boost::asio::ip::address&
src,
90 const boost::asio::ip::address&
dst,
95 s << VXLAN_TUNNEL_NAME <<
"-" << src <<
"-" << dst <<
":" <<
vni;
101 const boost::asio::ip::address& dst,
106 , m_tep(src, dst, vni)
123 vxlan_tunnel::sweep()
132 vxlan_tunnel::replay()
147 m_db.release(m_tep,
this);
153 std::ostringstream s;
170 std::shared_ptr<vxlan_tunnel>
177 std::shared_ptr<vxlan_tunnel> sp;
179 sp = m_db.find_or_add(temp.m_tep, temp);
186 std::shared_ptr<vxlan_tunnel>
189 return (find_or_add(*
this));
192 std::shared_ptr<interface>
193 vxlan_tunnel::singular_i()
const 195 return find_or_add(*
this);
210 std::shared_ptr<vxlan_tunnel_cmds::dump_cmd>
cmd =
211 std::make_shared<vxlan_tunnel_cmds::dump_cmd>();
216 for (
auto& record : *cmd) {
217 auto& payload = record.get_payload();
219 boost::asio::ip::address src =
220 from_bytes(payload.is_ipv6, payload.src_address);
221 boost::asio::ip::address dst =
222 from_bytes(payload.is_ipv6, payload.dst_address);
224 std::shared_ptr<vxlan_tunnel> vt =
234 vxlan_tunnel::event_handler::event_handler()
241 vxlan_tunnel::event_handler::handle_replay()
247 vxlan_tunnel::event_handler::order()
const 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
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
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.
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 void dump(std::ostream &os)
Dump all L3Configs into the stream provided.
static rc_t write()
Write/Execute all commands hitherto enqueued.
static const log_level_t DEBUG
Tunnel or virtual interfaces next.
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 singular_db< key_t, interface > m_db
A map of all interfaces key against the interface's name.
A functor class that creates an VXLAN tunnel.
std::shared_ptr< vxlan_tunnel > singular() const
Return the matching 'singular instance'.
A Database to store the unique 'singular' instances of a single object type.
The admin state of the interface.
A representation of an interface in VPP.
A type declaration of an interface handle in VPP.
boost::asio::ip::address from_bytes(uint8_t is_ip6, uint8_t *bytes)
Convert a VPP byte stinrg into a boost addresss.
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.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
const std::string & name() const
Return the interface type.
static void enqueue(cmd *f)
Enqueue A command for execution.
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
vxlan_tunnel(const boost::asio::ip::address &src, const boost::asio::ip::address &dst, uint32_t vni)
Construct a new object matching the desried state.
bool operator<(const endpoint_t &o) const
less-than operator for map storage
The VPP Object Model (VOM) library.
A representation of a method call to VPP.
bool operator==(const endpoint_t &o) const
Comparison operator.
uint32_t vni
The VNI of the endpoint.
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.