34 vxlan_tunnel::mode_t::mode_t(
int v,
const std::string s)
64 <<
"src:" <<
src.to_string() <<
" dst:" <<
dst.to_string() <<
" vni:" <<
vni 78 s << VXLAN_TUNNEL_NAME <<
"-" << mode.
to_string() <<
"-" << src <<
"-" << dst
91 , m_tep(src, dst, vni)
103 :
interface(mk_name(src, dst, mode, vni),
106 , m_tep(src, dst, vni)
118 :
interface(mk_name(src, dst, mode, vni),
121 , m_tep(src, dst, vni)
132 , m_mcast_itf(o.m_mcast_itf)
134 , m_table_id(o.m_table_id)
140 return ((m_tep == other.m_tep) && (m_mode == other.m_mode) &&
141 (m_mcast_itf == other.m_mcast_itf));
150 std::shared_ptr<vxlan_tunnel>
157 vxlan_tunnel::sweep()
169 vxlan_tunnel::replay()
210 std::ostringstream s;
214 s <<
" " << m_mcast_itf->to_string();
247 if (!m_table_id && m_rd) {
255 std::shared_ptr<vxlan_tunnel>
258 return std::dynamic_pointer_cast<
vxlan_tunnel>(singular_i());
261 std::shared_ptr<interface>
262 vxlan_tunnel::singular_i()
const 264 return m_db.find_or_add(
key(), *
this);
274 std::shared_ptr<vxlan_tunnel_cmds::dump_cmd>
cmd =
275 std::make_shared<vxlan_tunnel_cmds::dump_cmd>();
280 for (
auto& record : *cmd) {
281 auto& payload = record.get_payload();
284 from_bytes(payload.src_address.af, (uint8_t*)&payload.src_address.un);
286 from_bytes(payload.dst_address.af, (uint8_t*)&payload.dst_address.un);
288 std::shared_ptr<vxlan_tunnel> vt =
298 std::shared_ptr<vxlan_gbp_tunnel_cmds::dump_cmd>
cmd =
299 std::make_shared<vxlan_gbp_tunnel_cmds::dump_cmd>();
304 for (
auto& record : *cmd) {
305 auto& payload = record.get_payload();
306 handle_t hdl(payload.tunnel.sw_if_index);
310 std::shared_ptr<vxlan_tunnel> vt =
334 vxlan_tunnel::event_handler::handle_replay()
340 vxlan_tunnel::event_handler::order()
const A Command class that creates an VXLAN tunnel.
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.
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.
rc_t rc() const
Get the HW return code.
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.
virtual std::string to_string() const
Debug rpint function.
A Command class that creates an VXLAN tunnel.
T & data()
Return the data read/written.
static const mode_t GBP_L3
std::string to_string() const
convert to string format for debug purposes
static singular_db< key_t, interface > m_db
A map of all interfaces key against the interface's name.
const std::string & name() const
Return the interface type.
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.
vl_api_tunnel_mode_t mode
A command class that binds an interface to an L3 table.
The admin state of the interface.
A representation of an interface in VPP.
const handle_t & handle() const
Return VPP's handle to this object.
A type declaration of an interface handle in VPP.
const std::string & to_string() const
convert to string format for debug purposes
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.
static void enqueue(cmd *f)
Enqueue A command for execution.
manual_print typedef address
boost::asio::ip::address from_bytes(uint8_t is_ip6, const uint8_t *bytes)
Convert a VPP byte stinrg into a boost addresss.
bool operator==(const vxlan_tunnel &vx) const
comparison operator
static const mode_t STANDARD
bool operator==(const endpoint_t &o) const
Comparison operator.
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.
std::shared_ptr< vxlan_tunnel > singular() const
Return the matching 'singular instance'.
uint32_t vni
The VNI of the endpoint.
static const mode_t GBP_L2
std::string to_string() const
Debug print function.
const key_t & key() const
Return the interface type.
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.