16 #include <boost/algorithm/string.hpp> 25 std::shared_ptr<interface>
28 std::shared_ptr<interface> sp;
33 std::string
name =
reinterpret_cast<const char*
>(vd.interface_name);
38 l2_address_t l2_address(vd.l2_address, vd.l2_address_length);
57 name = name.substr(5);
64 tag = std::string(reinterpret_cast<const char*>(vd.tag));
80 if (sp && !tag.empty())
88 }
else if ((name.find(
".") != std::string::npos) && (0 != vd.sub_id)) {
93 std::vector<std::string> parts;
94 std::shared_ptr<interface> parent;
95 boost::split(parts, name, boost::is_any_of(
"."));
100 interface parent_itf(parts[0], type, state, tag);
133 std::shared_ptr<interface>
135 const vapi_payload_sw_interface_vhost_user_details& vd)
137 std::shared_ptr<interface> sp;
138 std::string
name =
reinterpret_cast<const char*
>(vd.sock_filename);
147 std::shared_ptr<interface>
149 const vapi_payload_af_packet_details& vd)
151 std::shared_ptr<interface> sp;
152 std::string
name =
reinterpret_cast<const char*
>(vd.host_if_name);
162 std::shared_ptr<tap_interface>
164 const vapi_payload_sw_interface_tap_details& vd)
166 std::shared_ptr<tap_interface> sp;
167 std::string
name =
reinterpret_cast<const char*
>(vd.dev_name);
177 std::shared_ptr<tap_interface>
179 const vapi_payload_sw_interface_tap_v2_details& vd)
181 std::shared_ptr<tap_interface> sp;
183 std::string
name =
reinterpret_cast<const char*
>(vd.host_if_name);
187 if (vd.host_ip4_prefix_len)
189 route::prefix_t(0, (uint8_t*)vd.host_ip4_addr, vd.host_ip4_prefix_len);
190 else if (vd.host_ip6_prefix_len)
192 route::prefix_t(1, (uint8_t*)vd.host_ip6_addr, vd.host_ip6_prefix_len);
204 std::shared_ptr<bond_interface>
206 const vapi_payload_sw_interface_bond_details& vd)
208 std::shared_ptr<bond_interface> sp;
209 std::string
name =
reinterpret_cast<const char*
>(vd.interface_name);
224 const vapi_payload_sw_interface_slave_details& vd)
226 std::shared_ptr<bond_member> sp;
227 std::string
name =
reinterpret_cast<const char*
>(vd.interface_name);
238 std::shared_ptr<pipe>
241 std::shared_ptr<pipe> sp;
245 payload.pipe_sw_if_index[1]);
250 sp->set_ends(hdl_pair);
static const type_t AFPACKET
AF-Packet interface type.
static const type_t BOND
bond interface type
static std::shared_ptr< interface > find(const handle_t &h)
The the singular instance of the interface in the DB by handle.
static std::shared_ptr< pipe > new_pipe_interface(const vapi_payload_pipe_details &payload)
static const type_t PIPE
pipe-parent type
std::shared_ptr< bond_interface > singular() const
Return the matching 'singular instance' of the BOND interface.
static const lb_t from_numeric_val(uint8_t v)
Convert VPP's value of the bond to a lb.
A bond interface load balance.
Type def of a L2 address as read from VPP.
static std::shared_ptr< interface > new_af_packet_interface(const vapi_payload_af_packet_details &vd)
vhost_vring_state_t state
std::shared_ptr< pipe > singular() const
Return the matching 'singular instance' of the sub-interface.
static std::shared_ptr< interface > new_interface(const vapi_payload_sw_interface_details &vd)
Factory method to construct a new interface from the VPP record.
static const mode_t UNSPECIFIED
Unspecificed bond interface mode.
static std::shared_ptr< interface > new_vhost_user_interface(const vapi_payload_sw_interface_vhost_user_details &vd)
static const mode_t from_numeric_val(uint8_t v)
Convert VPP's value of the bond to a mode.
static const rate_t from_numeric_val(uint8_t v)
Convert VPP's value of the bond to a mode.
static admin_state_t from_int(uint8_t val)
Convert VPP's numerical value to enum type.
static bond_member new_bond_member_interface(const vapi_payload_sw_interface_slave_details &vd)
The admin state of the interface.
static std::shared_ptr< tap_interface > new_tap_v2_interface(const vapi_payload_sw_interface_tap_v2_details &vd)
A representation of an interface in VPP.
A type declaration of an interface handle in VPP.
std::shared_ptr< interface > singular() const
Return the matching'singular' of the interface.
std::shared_ptr< tap_interface > singular() const
Return the matching 'singular instance' of the TAP interface.
static type_t from_string(const std::string &str)
Convert VPP's name of the interface to a type.
std::pair< handle_t, handle_t > handle_pair_t
static const type_t VXLAN
VXLAN interface.
The VPP Object Model (VOM) library.
static const admin_state_t UP
Admin UP state.
static const prefix_t ZERO
The all Zeros prefix.
static const admin_state_t DOWN
Admin DOWN state.
static const type_t TAP
TAP interface type.
static std::shared_ptr< bond_interface > find(const handle_t &hdl)
The the singular instance of the bond interface in the DB by handle.
static const type_t TAPV2
TAPv2 interface type.
static const mode_t from_numeric_val(uint8_t v)
Convert VPP's value of the bond to a mode.
static const type_t LOOPBACK
loopback interface type
static std::shared_ptr< tap_interface > new_tap_interface(const vapi_payload_sw_interface_tap_details &vd)
static const type_t VHOST
vhost-user interface type
std::shared_ptr< sub_interface > singular() const
Return the matching 'singular instance' of the sub-interface.
static std::shared_ptr< bond_interface > new_bond_interface(const vapi_payload_sw_interface_bond_details &vd)