22 namespace gbp_endpoint_cmds {
24 static vapi_enum_gbp_endpoint_flags
43 const std::vector<boost::asio::ip::address>& ip_addrs,
49 , m_ip_addrs(ip_addrs)
59 return ((m_itf == other.m_itf) && (m_ip_addrs == other.m_ip_addrs) &&
60 (m_mac == other.m_mac) && (m_sclass == other.m_sclass) &&
61 (m_flags == other.m_flags));
67 msg_t req(con.
ctx(), m_ip_addrs.size() *
sizeof(vapi_type_address),
71 auto& payload = req.get_request().get_payload();
72 payload.endpoint.sw_if_index = m_itf.
value();
73 payload.endpoint.sclass = m_sclass;
74 payload.endpoint.n_ips = m_ip_addrs.size();
75 payload.endpoint.flags =
to_api(m_flags);
77 for (n = 0; n < payload.endpoint.n_ips; n++) {
78 VOM::to_api(m_ip_addrs[n], payload.endpoint.ips[n]);
80 to_api(m_mac, payload.endpoint.mac);
90 int handle = reply.get_response().get_payload().handle;
91 int retval = reply.get_response().get_payload().retval;
110 std::ostringstream s;
113 for (
auto ip : m_ip_addrs)
116 s <<
"] mac:" << m_mac <<
" slcass:" << m_sclass
136 msg_t req(con.
ctx(), std::ref(*
this));
138 auto& payload = req.get_request().get_payload();
149 std::ostringstream s;
168 m_dump.reset(
new msg_t(con.
ctx(), std::ref(*
this)));
180 return (
"gbp-endpoint-dump");
static const flags_t LEARNT
static const flags_t BOUNCE
static const rc_t & from_vpp_retval(int32_t rv)
Get the rc_t from the VPP API value.
uint32_t value() const
get the value of the handle
Error codes that VPP will return during a HW write.
static const log_level_t DEBUG
rc_t issue(connection &con)
Issue the command to VPP/HW.
static const handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
vapi_enum_ip_neighbor_flags to_api(const neighbour::flags_t &f)
A cmd class that deletes a GBP endpoint.
std::string to_string() const
convert to string format for debug purposes
rc_t wait()
Wait on the commands promise.
T & data()
Return the data read/written.
std::string to_string() const
convert to string format for debug purposes
A representation of the connection to VPP.
A cmd class that Dumps all the GBP endpoints.
static const flags_t REMOTE
A command class that creates or updates the GBP endpoint.
A base class for all RPC commands to VPP.
virtual vapi_error_e operator()(vapi::Gbp_endpoint_add &reply)
call operator used as a callback by VAPI when the reply is available
static const flags_t EXTERNAL
#define VAPI_CALL(_stmt)
Convenince wrapper macro for error handling in VAPI sends.
std::string to_string() const
convert to string format for debug purposes
std::string to_string() const
convert to string format for debug purposes
delete_cmd(HW::item< handle_t > &item)
Constructor.
void fulfill(const HW::item< handle_t > &d)
Fulfill the commands promise.
DEFINE_VAPI_MSG_IDS_GBP_API_JSON
create_cmd(HW::item< handle_t > &item, const handle_t &itf, const std::vector< boost::asio::ip::address > &ip_addrs, const mac_address_t &mac, sclass_t sclass, const gbp_endpoint::flags_t &flags)
Constructor.
A type declaration of an interface handle in VPP.
static const rc_t OK
The HW write was successfull.
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
rc_t issue(connection &con)
Issue the command to VPP/HW.
vapi::Connection & ctx()
Retrun the VAPI context the commands will use.
std::string to_string() const
convert to string format for debug purposes
The VPP Object Model (VOM) library.
const std::string & to_string() const
convert to string format for debug purposes
static vapi_enum_gbp_endpoint_flags to_api(const gbp_endpoint::flags_t &in)
bool operator==(const create_cmd &i) const
Comparison operator - only used for UT.
Type def of a Ethernet address.
rc_t issue(connection &con)
Issue the command to VPP/HW.
bool operator==(const delete_cmd &i) const
Comparison operator - only used for UT.
HW::item< handle_t > & m_hw_item
A reference to an object's HW::item that the command will update.
HW::item< handle_t > & item()
return the HW item the command updates
vapi::Gbp_endpoint_add msg_t
convenient typedef