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)
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.
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
vl_api_gre_tunnel_mode_t mode
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.
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.