summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/gbp_endpoint.cpp
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-04-04 09:34:50 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2018-04-13 08:51:21 +0000
commit25b049484fcf9161edb2c19250066b893c38c264 (patch)
tree69204352a0648cfc4089fa0e37214bffbae61e81 /src/vpp-api/vom/gbp_endpoint.cpp
parent4f8863b21405d1ab3e067e978a60be72a343358b (diff)
GBP V2
update the GBP plugin to implement the full NAT feature set of opflex agent Change-Id: Ic06a039c889445ed0b9087fa1f292634192b0f8d Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vpp-api/vom/gbp_endpoint.cpp')
-rw-r--r--src/vpp-api/vom/gbp_endpoint.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/vpp-api/vom/gbp_endpoint.cpp b/src/vpp-api/vom/gbp_endpoint.cpp
index cd5d7e11ad6..9762a91429a 100644
--- a/src/vpp-api/vom/gbp_endpoint.cpp
+++ b/src/vpp-api/vom/gbp_endpoint.cpp
@@ -25,48 +25,48 @@ gbp_endpoint::event_handler gbp_endpoint::m_evh;
gbp_endpoint::gbp_endpoint(const interface& itf,
const boost::asio::ip::address& ip_addr,
- epg_id_t epg_id)
+ const mac_address_t& mac,
+ const gbp_endpoint_group& epg)
: m_hw(false)
, m_itf(itf.singular())
- , m_ip_addr(ip_addr)
- , m_epg_id(epg_id)
+ , m_ip(ip_addr)
+ , m_mac(mac)
+ , m_epg(epg.singular())
{
}
gbp_endpoint::gbp_endpoint(const gbp_endpoint& gbpe)
: m_hw(gbpe.m_hw)
, m_itf(gbpe.m_itf)
- , m_ip_addr(gbpe.m_ip_addr)
- , m_epg_id(gbpe.m_epg_id)
+ , m_ip(gbpe.m_ip)
+ , m_mac(gbpe.m_mac)
+ , m_epg(gbpe.m_epg)
{
}
gbp_endpoint::~gbp_endpoint()
{
sweep();
-
- // not in the DB anymore.
m_db.release(key(), this);
}
const gbp_endpoint::key_t
gbp_endpoint::key() const
{
- return (std::make_pair(m_itf->key(), m_ip_addr));
+ return (std::make_pair(m_itf->key(), m_ip));
}
bool
gbp_endpoint::operator==(const gbp_endpoint& gbpe) const
{
- return ((key() == gbpe.key()) && (m_epg_id == gbpe.m_epg_id));
+ return ((key() == gbpe.key()) && (m_epg == gbpe.m_epg));
}
void
gbp_endpoint::sweep()
{
if (m_hw) {
- HW::enqueue(
- new gbp_endpoint_cmds::delete_cmd(m_hw, m_itf->handle(), m_ip_addr));
+ HW::enqueue(new gbp_endpoint_cmds::delete_cmd(m_hw, m_itf->handle(), m_ip));
}
HW::write();
}
@@ -75,8 +75,8 @@ void
gbp_endpoint::replay()
{
if (m_hw) {
- HW::enqueue(new gbp_endpoint_cmds::create_cmd(m_hw, m_itf->handle(),
- m_ip_addr, m_epg_id));
+ HW::enqueue(new gbp_endpoint_cmds::create_cmd(m_hw, m_itf->handle(), m_ip,
+ m_mac, m_epg->id()));
}
}
@@ -84,8 +84,8 @@ std::string
gbp_endpoint::to_string() const
{
std::ostringstream s;
- s << "gbp-endpoint:[" << m_itf->to_string() << ", " << m_ip_addr.to_string()
- << ", epg-id:" << m_epg_id << "]";
+ s << "gbp-endpoint:[" << m_itf->to_string() << ", " << m_ip.to_string()
+ << ", " << m_mac.to_string() << ", epg:" << m_epg->to_string() << "]";
return (s.str());
}
@@ -93,12 +93,9 @@ gbp_endpoint::to_string() const
void
gbp_endpoint::update(const gbp_endpoint& r)
{
- /*
- * create the table if it is not yet created
- */
if (rc_t::OK != m_hw.rc()) {
- HW::enqueue(new gbp_endpoint_cmds::create_cmd(m_hw, m_itf->handle(),
- m_ip_addr, m_epg_id));
+ HW::enqueue(new gbp_endpoint_cmds::create_cmd(m_hw, m_itf->handle(), m_ip,
+ m_mac, m_epg->id()));
}
}
@@ -154,11 +151,14 @@ gbp_endpoint::event_handler::handle_populate(const client_db::key_t& key)
from_bytes(payload.endpoint.is_ip6, payload.endpoint.address);
std::shared_ptr<interface> itf =
interface::find(payload.endpoint.sw_if_index);
+ std::shared_ptr<gbp_endpoint_group> epg =
+ gbp_endpoint_group::find(payload.endpoint.epg_id);
+ mac_address_t mac(payload.endpoint.mac);
VOM_LOG(log_level_t::DEBUG) << "data: " << payload.endpoint.sw_if_index;
- if (itf) {
- gbp_endpoint gbpe(*itf, address, payload.endpoint.epg_id);
+ if (itf && epg) {
+ gbp_endpoint gbpe(*itf, address, mac, *epg);
OM::commit(key, gbpe);
VOM_LOG(log_level_t::DEBUG) << "read: " << gbpe.to_string();