X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fvom%2Fvom%2Fgbp_endpoint_cmds.cpp;h=f0c55ebc4dab81c73a29373feeff134b0833dedc;hb=95eb01fdc65b692065ace6d76870d8cc9f3e2c84;hp=2732d1cc2972dd313343b6ef524d3cc69334c02e;hpb=8006c6aa425126529b4017768a9201e4f03964ad;p=vpp.git diff --git a/extras/vom/vom/gbp_endpoint_cmds.cpp b/extras/vom/vom/gbp_endpoint_cmds.cpp index 2732d1cc297..f0c55ebc4da 100644 --- a/extras/vom/vom/gbp_endpoint_cmds.cpp +++ b/extras/vom/vom/gbp_endpoint_cmds.cpp @@ -21,16 +21,35 @@ DEFINE_VAPI_MSG_IDS_GBP_API_JSON; namespace VOM { namespace gbp_endpoint_cmds { +static vapi_enum_gbp_endpoint_flags +to_api(const gbp_endpoint::flags_t& in) +{ + vapi_enum_gbp_endpoint_flags out = GBP_API_ENDPOINT_FLAG_NONE; + + if (in & gbp_endpoint::flags_t::REMOTE) + out = (vapi_enum_gbp_endpoint_flags)(out | GBP_API_ENDPOINT_FLAG_REMOTE); + if (in & gbp_endpoint::flags_t::BOUNCE) + out = (vapi_enum_gbp_endpoint_flags)(out | GBP_API_ENDPOINT_FLAG_BOUNCE); + if (in & gbp_endpoint::flags_t::LEARNT) + out = (vapi_enum_gbp_endpoint_flags)(out | GBP_API_ENDPOINT_FLAG_LEARNT); + if (in & gbp_endpoint::flags_t::EXTERNAL) + out = (vapi_enum_gbp_endpoint_flags)(out | GBP_API_ENDPOINT_FLAG_EXTERNAL); + + return (out); +} + create_cmd::create_cmd(HW::item& item, const handle_t& itf, const std::vector& ip_addrs, const mac_address_t& mac, - epg_id_t epg_id) + sclass_t sclass, + const gbp_endpoint::flags_t& flags) : rpc_cmd(item) , m_itf(itf) , m_ip_addrs(ip_addrs) , m_mac(mac) - , m_epg_id(epg_id) + , m_sclass(sclass) + , m_flags(flags) { } @@ -38,7 +57,8 @@ bool create_cmd::operator==(const create_cmd& other) const { return ((m_itf == other.m_itf) && (m_ip_addrs == other.m_ip_addrs) && - (m_mac == other.m_mac) && (m_epg_id == other.m_epg_id)); + (m_mac == other.m_mac) && (m_sclass == other.m_sclass) && + (m_flags == other.m_flags)); } rc_t @@ -50,11 +70,12 @@ create_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.endpoint.sw_if_index = m_itf.value(); - payload.endpoint.epg_id = m_epg_id; + payload.endpoint.sclass = m_sclass; payload.endpoint.n_ips = m_ip_addrs.size(); + payload.endpoint.flags = to_api(m_flags); for (n = 0; n < payload.endpoint.n_ips; n++) { - to_api(m_ip_addrs[n], payload.endpoint.ips[n]); + VOM::to_api(m_ip_addrs[n], payload.endpoint.ips[n]); } to_api(m_mac, payload.endpoint.mac); @@ -92,8 +113,8 @@ create_cmd::to_string() const for (auto ip : m_ip_addrs) s << ip.to_string(); - s << "] mac:" << m_mac; - s << " epg-id:" << m_epg_id; + s << "] mac:" << m_mac << " slcass:" << m_sclass + << " flags:" << m_flags.to_string(); return (s.str()); }