22 namespace gbp_endpoint_cmds {
26 const std::vector<boost::asio::ip::address>& ip_addrs,
31 , m_ip_addrs(ip_addrs)
40 return ((m_itf == other.m_itf) && (m_ip_addrs == other.m_ip_addrs) &&
41 (m_mac == other.m_mac) && (m_epg_id == other.m_epg_id));
47 msg_t req(con.
ctx(), m_ip_addrs.size() *
sizeof(vapi_type_address),
51 auto& payload = req.get_request().get_payload();
52 payload.endpoint.sw_if_index = m_itf.
value();
53 payload.endpoint.epg_id = m_epg_id;
54 payload.endpoint.n_ips = m_ip_addrs.size();
56 for (n = 0; n < payload.endpoint.n_ips; n++) {
57 to_api(m_ip_addrs[n], payload.endpoint.ips[n]);
59 to_api(m_mac, payload.endpoint.mac);
69 int handle = reply.get_response().get_payload().handle;
70 int retval = reply.get_response().get_payload().retval;
92 for (
auto ip : m_ip_addrs)
95 s <<
"] mac:" << m_mac;
96 s <<
" epg-id:" << m_epg_id;
115 msg_t req(con.
ctx(), std::ref(*
this));
117 auto& payload = req.get_request().get_payload();
128 std::ostringstream s;
147 m_dump.reset(
new msg_t(con.
ctx(), std::ref(*
this)));
159 return (
"gbp-endpoint-dump");
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
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
uint32_t epg_id_t
EPG IDs are 32 bit integers.
std::string to_string() const
convert to string format for debug purposes
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.
A cmd class that deletes a GBP endpoint.
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.
void to_api(const ip_address_t &a, vapi_type_address &v)
A cmd class that Dumps all the GBP endpoints.
std::string to_string() const
convert to string format for debug purposes
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
#define VAPI_CALL(_stmt)
Convenince wrapper macro for error handling in VAPI sends.
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
std::string to_string() const
convert to string format for debug purposes
A type declaration of an interface handle in VPP.
static const rc_t OK
The HW write was successfull.
std::string to_string() const
convert to string format for debug purposes
rc_t issue(connection &con)
Issue the command to VPP/HW.
vapi::Connection & ctx()
Retrun the VAPI context the commands will use.
The VPP Object Model (VOM) library.
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, epg_id_t epg_id)
Constructor.
bool operator==(const create_cmd &i) const
Comparison operator - only used for UT.
bool operator==(const delete_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.
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