X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fvom%2Fvom%2Fgbp_subnet_cmds.cpp;h=3dcd652dd19b8dce9f1065e549438da511bf65f7;hb=8c8acc0;hp=3816a596e6d37720b4a894fc22fb5a0fae4e60ea;hpb=208c29aac523231af2420a95ba7e5d361698780b;p=vpp.git diff --git a/extras/vom/vom/gbp_subnet_cmds.cpp b/extras/vom/vom/gbp_subnet_cmds.cpp index 3816a596e6d..3dcd652dd19 100644 --- a/extras/vom/vom/gbp_subnet_cmds.cpp +++ b/extras/vom/vom/gbp_subnet_cmds.cpp @@ -14,6 +14,7 @@ */ #include "vom/gbp_subnet_cmds.hpp" +#include "vom/api_types.hpp" namespace VOM { namespace gbp_subnet_cmds { @@ -21,13 +22,13 @@ namespace gbp_subnet_cmds { create_cmd::create_cmd(HW::item& item, route::table_id_t rd, const route::prefix_t& prefix, - bool internal, + const gbp_subnet::type_t& type, const handle_t& itf, epg_id_t epg_id) : rpc_cmd(item) , m_rd(rd) , m_prefix(prefix) - , m_internal(internal) + , m_type(type) , m_itf(itf) , m_epg_id(epg_id) { @@ -37,8 +38,21 @@ bool create_cmd::operator==(const create_cmd& other) const { return ((m_itf == other.m_itf) && (m_rd == other.m_rd) && - (m_prefix == other.m_prefix) && (m_itf == other.m_itf) && - (m_epg_id == other.m_epg_id)); + (m_prefix == other.m_prefix) && (m_type == other.m_type) && + (m_itf == other.m_itf) && (m_epg_id == other.m_epg_id)); +} + +static vapi_enum_gbp_subnet_type +gbp_subnet_type_to_api(const gbp_subnet::type_t& type) +{ + if (gbp_subnet::type_t::STITCHED_INTERNAL == type) + return (GBP_API_SUBNET_STITCHED_INTERNAL); + if (gbp_subnet::type_t::STITCHED_EXTERNAL == type) + return (GBP_API_SUBNET_STITCHED_EXTERNAL); + if (gbp_subnet::type_t::TRANSPORT == type) + return (GBP_API_SUBNET_TRANSPORT); + + return (GBP_API_SUBNET_STITCHED_INTERNAL); } rc_t @@ -48,12 +62,11 @@ create_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 1; - payload.subnet.is_internal = m_internal; - payload.subnet.table_id = m_rd; + payload.subnet.type = gbp_subnet_type_to_api(m_type); + payload.subnet.rd_id = m_rd; payload.subnet.sw_if_index = m_itf.value(); payload.subnet.epg_id = m_epg_id; - m_prefix.to_vpp(&payload.subnet.is_ip6, payload.subnet.address, - &payload.subnet.address_length); + payload.subnet.prefix = to_api(m_prefix); VAPI_CALL(req.execute()); @@ -64,9 +77,9 @@ std::string create_cmd::to_string() const { std::ostringstream s; - s << "gbp-subnet-create: " << m_hw_item.to_string() - << "internal:" << m_internal << ", " << m_rd << ":" << m_prefix.to_string() - << " itf:" << m_itf << " epg-id:" << m_epg_id; + s << "gbp-subnet-create: " << m_hw_item.to_string() << "type:" << m_type + << ", " << m_rd << ":" << m_prefix.to_string() << " itf:" << m_itf + << " epg-id:" << m_epg_id; return (s.str()); } @@ -93,13 +106,8 @@ delete_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 0; - payload.subnet.table_id = m_rd; - m_prefix.to_vpp(&payload.subnet.is_ip6, payload.subnet.address, - &payload.subnet.address_length); - - payload.subnet.is_internal = 0; - payload.subnet.sw_if_index = ~0; - payload.subnet.epg_id = ~0; + payload.subnet.rd_id = m_rd; + payload.subnet.prefix = to_api(m_prefix); VAPI_CALL(req.execute());