VOM: Fix state reconciliation
This commit also fixes the acl and arp handle for inspector to view internal state of VOM. Change-Id: Ibc8ff6cb51d2a77b4c04993ac7212564b8892337 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
This commit is contained in:

committed by
Neale Ranns

parent
3f6ede3ab3
commit
b5eb3b185f
@ -18,6 +18,13 @@
|
|||||||
|
|
||||||
namespace VOM {
|
namespace VOM {
|
||||||
namespace ACL {
|
namespace ACL {
|
||||||
|
template <>
|
||||||
|
l2_binding::event_handler::event_handler()
|
||||||
|
{
|
||||||
|
OM::register_listener(this);
|
||||||
|
inspect::register_handler({ "l2-acl-binding" }, "L2 ACL bindings", this);
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
l2_binding::event_handler::handle_populate(const client_db::key_t& key)
|
l2_binding::event_handler::handle_populate(const client_db::key_t& key)
|
||||||
@ -46,6 +53,13 @@ l2_binding::event_handler::handle_populate(const client_db::key_t& key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
l3_binding::event_handler::event_handler()
|
||||||
|
{
|
||||||
|
OM::register_listener(this);
|
||||||
|
inspect::register_handler({ "l3-acl-binding" }, "L3 ACL bindings", this);
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
l3_binding::event_handler::handle_populate(const client_db::key_t& key)
|
l3_binding::event_handler::handle_populate(const client_db::key_t& key)
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
: m_direction(direction)
|
: m_direction(direction)
|
||||||
, m_itf(itf.singular())
|
, m_itf(itf.singular())
|
||||||
, m_acl(acl.singular())
|
, m_acl(acl.singular())
|
||||||
, m_binding(0)
|
, m_binding(false)
|
||||||
{
|
{
|
||||||
m_evh.order();
|
m_evh.order();
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ public:
|
|||||||
: m_direction(o.m_direction)
|
: m_direction(o.m_direction)
|
||||||
, m_itf(o.m_itf)
|
, m_itf(o.m_itf)
|
||||||
, m_acl(o.m_acl)
|
, m_acl(o.m_acl)
|
||||||
, m_binding(0)
|
, m_binding(o.m_binding)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,6 +97,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void dump(std::ostream& os) { m_db.dump(os); }
|
static void dump(std::ostream& os) { m_db.dump(os); }
|
||||||
|
|
||||||
|
static dependency_t order() { return m_evh.order(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Class definition for listeners to OM events
|
* Class definition for listeners to OM events
|
||||||
@ -104,11 +106,8 @@ private:
|
|||||||
class event_handler : public OM::listener, public inspect::command_handler
|
class event_handler : public OM::listener, public inspect::command_handler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
event_handler()
|
event_handler();
|
||||||
{
|
|
||||||
OM::register_listener(this);
|
|
||||||
inspect::register_handler({ "acl-binding" }, "ACL bindings", this);
|
|
||||||
}
|
|
||||||
virtual ~event_handler() = default;
|
virtual ~event_handler() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -222,6 +221,11 @@ singular_db<typename ACL::binding<LIST>::key_t, ACL::binding<LIST>>
|
|||||||
|
|
||||||
template <typename LIST>
|
template <typename LIST>
|
||||||
typename ACL::binding<LIST>::event_handler binding<LIST>::m_evh;
|
typename ACL::binding<LIST>::event_handler binding<LIST>::m_evh;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
const static dependency_t __attribute__((unused)) l2o = l2_binding::order();
|
||||||
|
const static dependency_t __attribute__((unused)) l3o = l3_binding::order();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os,
|
std::ostream& operator<<(std::ostream& os,
|
||||||
|
@ -39,6 +39,17 @@ l3_bind_cmd::issue(connection& con)
|
|||||||
return rc_t::OK;
|
return rc_t::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
std::string
|
||||||
|
l3_bind_cmd::to_string() const
|
||||||
|
{
|
||||||
|
std::ostringstream s;
|
||||||
|
s << "l3-acl-bind:[" << m_direction.to_string()
|
||||||
|
<< " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
|
||||||
|
|
||||||
|
return (s.str());
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
rc_t
|
rc_t
|
||||||
l3_unbind_cmd::issue(connection& con)
|
l3_unbind_cmd::issue(connection& con)
|
||||||
@ -58,6 +69,17 @@ l3_unbind_cmd::issue(connection& con)
|
|||||||
return rc_t::OK;
|
return rc_t::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
std::string
|
||||||
|
l3_unbind_cmd::to_string() const
|
||||||
|
{
|
||||||
|
std::ostringstream s;
|
||||||
|
s << "l3-acl-unbind:[" << m_direction.to_string()
|
||||||
|
<< " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
|
||||||
|
|
||||||
|
return (s.str());
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
rc_t
|
rc_t
|
||||||
l3_dump_cmd::issue(connection& con)
|
l3_dump_cmd::issue(connection& con)
|
||||||
@ -74,6 +96,13 @@ l3_dump_cmd::issue(connection& con)
|
|||||||
return rc_t::OK;
|
return rc_t::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
std::string
|
||||||
|
l3_dump_cmd::to_string() const
|
||||||
|
{
|
||||||
|
return ("l3-acl-bind-dump");
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
rc_t
|
rc_t
|
||||||
l2_bind_cmd::issue(connection& con)
|
l2_bind_cmd::issue(connection& con)
|
||||||
@ -83,7 +112,6 @@ l2_bind_cmd::issue(connection& con)
|
|||||||
auto& payload = req.get_request().get_payload();
|
auto& payload = req.get_request().get_payload();
|
||||||
payload.sw_if_index = m_itf.value();
|
payload.sw_if_index = m_itf.value();
|
||||||
payload.is_add = 1;
|
payload.is_add = 1;
|
||||||
// payload.is_input = (m_direction == direction_t::INPUT ? 1 : 0);
|
|
||||||
payload.acl_index = m_acl.value();
|
payload.acl_index = m_acl.value();
|
||||||
|
|
||||||
VAPI_CALL(req.execute());
|
VAPI_CALL(req.execute());
|
||||||
@ -93,6 +121,17 @@ l2_bind_cmd::issue(connection& con)
|
|||||||
return rc_t::OK;
|
return rc_t::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
std::string
|
||||||
|
l2_bind_cmd::to_string() const
|
||||||
|
{
|
||||||
|
std::ostringstream s;
|
||||||
|
s << "l2-acl-bind:[" << m_direction.to_string()
|
||||||
|
<< " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
|
||||||
|
|
||||||
|
return (s.str());
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
rc_t
|
rc_t
|
||||||
l2_unbind_cmd::issue(connection& con)
|
l2_unbind_cmd::issue(connection& con)
|
||||||
@ -102,7 +141,6 @@ l2_unbind_cmd::issue(connection& con)
|
|||||||
auto& payload = req.get_request().get_payload();
|
auto& payload = req.get_request().get_payload();
|
||||||
payload.sw_if_index = m_itf.value();
|
payload.sw_if_index = m_itf.value();
|
||||||
payload.is_add = 0;
|
payload.is_add = 0;
|
||||||
// payload.is_input = (m_direction == direction_t::INPUT ? 1 : 0);
|
|
||||||
payload.acl_index = m_acl.value();
|
payload.acl_index = m_acl.value();
|
||||||
|
|
||||||
VAPI_CALL(req.execute());
|
VAPI_CALL(req.execute());
|
||||||
@ -112,6 +150,17 @@ l2_unbind_cmd::issue(connection& con)
|
|||||||
return rc_t::OK;
|
return rc_t::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
std::string
|
||||||
|
l2_unbind_cmd::to_string() const
|
||||||
|
{
|
||||||
|
std::ostringstream s;
|
||||||
|
s << "l2-acl-unbind:[" << m_direction.to_string()
|
||||||
|
<< " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
|
||||||
|
|
||||||
|
return (s.str());
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
rc_t
|
rc_t
|
||||||
l2_dump_cmd::issue(connection& con)
|
l2_dump_cmd::issue(connection& con)
|
||||||
@ -128,6 +177,13 @@ l2_dump_cmd::issue(connection& con)
|
|||||||
return rc_t::OK;
|
return rc_t::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
std::string
|
||||||
|
l2_dump_cmd::to_string() const
|
||||||
|
{
|
||||||
|
return ("l2-acl-bind-dump");
|
||||||
|
}
|
||||||
|
|
||||||
}; // namespace binding_cmds
|
}; // namespace binding_cmds
|
||||||
}; // namespace ACL
|
}; // namespace ACL
|
||||||
}; // namespace VOM
|
}; // namespace VOM
|
||||||
|
@ -54,14 +54,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* convert to string format for debug purposes
|
* convert to string format for debug purposes
|
||||||
*/
|
*/
|
||||||
std::string to_string() const
|
std::string to_string() const;
|
||||||
{
|
|
||||||
std::ostringstream s;
|
|
||||||
s << "acl-bind:[" << m_direction.to_string() << " itf:" << m_itf.to_string()
|
|
||||||
<< " acl:" << m_acl.to_string() << "]";
|
|
||||||
|
|
||||||
return (s.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comparison operator - only used for UT
|
* Comparison operator - only used for UT
|
||||||
@ -117,14 +110,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* convert to string format for debug purposes
|
* convert to string format for debug purposes
|
||||||
*/
|
*/
|
||||||
std::string to_string() const
|
std::string to_string() const;
|
||||||
{
|
|
||||||
std::ostringstream s;
|
|
||||||
s << "acl-unbind:[" << m_direction.to_string()
|
|
||||||
<< " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
|
|
||||||
|
|
||||||
return (s.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comparison operator - only used for UT
|
* Comparison operator - only used for UT
|
||||||
@ -171,7 +157,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* convert to string format for debug purposes
|
* convert to string format for debug purposes
|
||||||
*/
|
*/
|
||||||
std::string to_string() const { return ("acl-bind-dump"); }
|
std::string to_string() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +19,14 @@
|
|||||||
|
|
||||||
namespace VOM {
|
namespace VOM {
|
||||||
namespace ACL {
|
namespace ACL {
|
||||||
|
|
||||||
|
template <>
|
||||||
|
l2_list::event_handler::event_handler()
|
||||||
|
{
|
||||||
|
OM::register_listener(this);
|
||||||
|
inspect::register_handler({ "l2-acl-list" }, "L2 ACL lists", this);
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
l2_list::event_handler::handle_populate(const client_db::key_t& key)
|
l2_list::event_handler::handle_populate(const client_db::key_t& key)
|
||||||
@ -61,6 +69,13 @@ l2_list::event_handler::handle_populate(const client_db::key_t& key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
l3_list::event_handler::event_handler()
|
||||||
|
{
|
||||||
|
OM::register_listener(this);
|
||||||
|
inspect::register_handler({ "l3-acl-list" }, "L3 ACL lists", this);
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
l3_list::event_handler::handle_populate(const client_db::key_t& key)
|
l3_list::event_handler::handle_populate(const client_db::key_t& key)
|
||||||
@ -120,7 +135,7 @@ l3_list::update(const l3_list& obj)
|
|||||||
/*
|
/*
|
||||||
* always update the instance with the latest rule set
|
* always update the instance with the latest rule set
|
||||||
*/
|
*/
|
||||||
if (!m_hdl || obj.m_rules != m_rules) {
|
if (rc_t::OK != m_hdl.rc() || obj.m_rules != m_rules) {
|
||||||
HW::enqueue(new list_cmds::l3_update_cmd(m_hdl, m_key, m_rules));
|
HW::enqueue(new list_cmds::l3_update_cmd(m_hdl, m_key, m_rules));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -137,7 +152,7 @@ l2_list::update(const l2_list& obj)
|
|||||||
/*
|
/*
|
||||||
* always update the instance with the latest rule set
|
* always update the instance with the latest rule set
|
||||||
*/
|
*/
|
||||||
if (!m_hdl || obj.m_rules != m_rules) {
|
if (rc_t::OK != m_hdl.rc() || obj.m_rules != m_rules) {
|
||||||
HW::enqueue(new list_cmds::l2_update_cmd(m_hdl, m_key, m_rules));
|
HW::enqueue(new list_cmds::l2_update_cmd(m_hdl, m_key, m_rules));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -53,7 +53,8 @@ public:
|
|||||||
* Construct a new object matching the desried state
|
* Construct a new object matching the desried state
|
||||||
*/
|
*/
|
||||||
list(const key_t& key)
|
list(const key_t& key)
|
||||||
: m_key(key)
|
: m_hdl(handle_t::INVALID)
|
||||||
|
, m_key(key)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,10 +65,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
list(const key_t& key, const rules_t& rules)
|
list(const key_t& key, const rules_t& rules)
|
||||||
: m_key(key)
|
: m_hdl(handle_t::INVALID)
|
||||||
|
, m_key(key)
|
||||||
, m_rules(rules)
|
, m_rules(rules)
|
||||||
{
|
{
|
||||||
m_evh.order();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,7 +130,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Return the VPP assign handle
|
* Return the VPP assign handle
|
||||||
*/
|
*/
|
||||||
const handle_t& handle() const { return m_hdl.data(); }
|
const handle_t& handle() const { return (singular()->handle_i()); }
|
||||||
|
|
||||||
static std::shared_ptr<list> find(const handle_t& handle)
|
static std::shared_ptr<list> find(const handle_t& handle)
|
||||||
{
|
{
|
||||||
@ -141,12 +142,19 @@ public:
|
|||||||
return (m_db.find(key));
|
return (m_db.find(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add(const handle_t& handle, std::shared_ptr<list> sp)
|
static void add(const key_t& key, const HW::item<handle_t>& item)
|
||||||
{
|
{
|
||||||
m_hdl_db[handle] = sp;
|
std::shared_ptr<list> sp = find(key);
|
||||||
|
|
||||||
|
if (sp && item) {
|
||||||
|
m_hdl_db[item.data()] = sp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remove(const handle_t& handle) { m_hdl_db.erase(handle); }
|
static void remove(const HW::item<handle_t>& item)
|
||||||
|
{
|
||||||
|
m_hdl_db.erase(item.data());
|
||||||
|
}
|
||||||
|
|
||||||
const key_t& key() const { return m_key; }
|
const key_t& key() const { return m_key; }
|
||||||
|
|
||||||
@ -167,11 +175,8 @@ private:
|
|||||||
class event_handler : public OM::listener, public inspect::command_handler
|
class event_handler : public OM::listener, public inspect::command_handler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
event_handler()
|
event_handler();
|
||||||
{
|
|
||||||
OM::register_listener(this);
|
|
||||||
inspect::register_handler({ "acl" }, "ACL lists", this);
|
|
||||||
}
|
|
||||||
virtual ~event_handler() = default;
|
virtual ~event_handler() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -215,9 +220,14 @@ private:
|
|||||||
*/
|
*/
|
||||||
static std::shared_ptr<list> find_or_add(const list& temp)
|
static std::shared_ptr<list> find_or_add(const list& temp)
|
||||||
{
|
{
|
||||||
return (m_db.find_or_add(temp.m_key, temp));
|
return (m_db.find_or_add(temp.key(), temp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return the acl-list's handle in the singular instance
|
||||||
|
*/
|
||||||
|
const handle_t& handle_i() const { return (m_hdl.data()); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It's the VOM::OM class that updates call update
|
* It's the VOM::OM class that updates call update
|
||||||
*/
|
*/
|
||||||
@ -246,7 +256,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* A map of all ACLs keyed against VPP's handle
|
* A map of all ACLs keyed against VPP's handle
|
||||||
*/
|
*/
|
||||||
static std::map<const handle_t, std::weak_ptr<list>> m_hdl_db;
|
static std::map<handle_t, std::weak_ptr<list>> m_hdl_db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Key is a user defined identifer for this ACL
|
* The Key is a user defined identifer for this ACL
|
||||||
@ -279,7 +289,7 @@ singular_db<typename ACL::list<RULE>::key_t, ACL::list<RULE>> list<RULE>::m_db;
|
|||||||
* Definition of the static per-handle DB for ACL Lists
|
* Definition of the static per-handle DB for ACL Lists
|
||||||
*/
|
*/
|
||||||
template <typename RULE>
|
template <typename RULE>
|
||||||
std::map<const handle_t, std::weak_ptr<ACL::list<RULE>>> list<RULE>::m_hdl_db;
|
std::map<handle_t, std::weak_ptr<ACL::list<RULE>>> list<RULE>::m_hdl_db;
|
||||||
|
|
||||||
template <typename RULE>
|
template <typename RULE>
|
||||||
typename ACL::list<RULE>::event_handler list<RULE>::m_evh;
|
typename ACL::list<RULE>::event_handler list<RULE>::m_evh;
|
||||||
|
@ -75,7 +75,8 @@ l3_update_cmd::issue(connection& con)
|
|||||||
VAPI_CALL(req.execute());
|
VAPI_CALL(req.execute());
|
||||||
|
|
||||||
m_hw_item = wait();
|
m_hw_item = wait();
|
||||||
complete();
|
if (m_hw_item.rc() == rc_t::OK)
|
||||||
|
insert_acl();
|
||||||
|
|
||||||
return rc_t::OK;
|
return rc_t::OK;
|
||||||
}
|
}
|
||||||
@ -94,6 +95,8 @@ l3_delete_cmd::issue(connection& con)
|
|||||||
wait();
|
wait();
|
||||||
m_hw_item.set(rc_t::NOOP);
|
m_hw_item.set(rc_t::NOOP);
|
||||||
|
|
||||||
|
remove_acl();
|
||||||
|
|
||||||
return rc_t::OK;
|
return rc_t::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +141,8 @@ l2_update_cmd::issue(connection& con)
|
|||||||
VAPI_CALL(req.execute());
|
VAPI_CALL(req.execute());
|
||||||
|
|
||||||
m_hw_item = wait();
|
m_hw_item = wait();
|
||||||
|
if (m_hw_item.rc() == rc_t::OK)
|
||||||
|
insert_acl();
|
||||||
|
|
||||||
return rc_t::OK;
|
return rc_t::OK;
|
||||||
}
|
}
|
||||||
@ -156,6 +161,8 @@ l2_delete_cmd::issue(connection& con)
|
|||||||
wait();
|
wait();
|
||||||
m_hw_item.set(rc_t::NOOP);
|
m_hw_item.set(rc_t::NOOP);
|
||||||
|
|
||||||
|
remove_acl();
|
||||||
|
|
||||||
return rc_t::OK;
|
return rc_t::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,18 +76,10 @@ public:
|
|||||||
return ((m_key == other.m_key) && (m_rules == other.m_rules));
|
return ((m_key == other.m_key) && (m_rules == other.m_rules));
|
||||||
}
|
}
|
||||||
|
|
||||||
void complete()
|
|
||||||
{
|
|
||||||
std::shared_ptr<list<RULE>> sp = list<RULE>::find(m_key);
|
|
||||||
if (sp && this->item()) {
|
|
||||||
list<RULE>::add(this->item().data(), sp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void succeeded()
|
void succeeded()
|
||||||
{
|
{
|
||||||
rpc_cmd<HW::item<handle_t>, HW::item<handle_t>, UPDATE>::succeeded();
|
rpc_cmd<HW::item<handle_t>, HW::item<handle_t>, UPDATE>::succeeded();
|
||||||
complete();
|
list<RULE>::add(m_key, this->item());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,9 +90,13 @@ public:
|
|||||||
int acl_index = reply.get_response().get_payload().acl_index;
|
int acl_index = reply.get_response().get_payload().acl_index;
|
||||||
int retval = reply.get_response().get_payload().retval;
|
int retval = reply.get_response().get_payload().retval;
|
||||||
|
|
||||||
VOM_LOG(log_level_t::DEBUG) << this->to_string() << " " << retval;
|
VOM_LOG(log_level_t::DEBUG) << this->to_string() << " retval:" << retval
|
||||||
|
<< " acl_index:" << acl_index;
|
||||||
|
|
||||||
HW::item<handle_t> res(acl_index, rc_t::from_vpp_retval(retval));
|
rc_t rc = rc_t::from_vpp_retval(retval);
|
||||||
|
handle_t handle(acl_index);
|
||||||
|
|
||||||
|
HW::item<handle_t> res(handle, rc);
|
||||||
|
|
||||||
this->fulfill(res);
|
this->fulfill(res);
|
||||||
|
|
||||||
@ -108,6 +104,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* add the created acl to the DB
|
||||||
|
*/
|
||||||
|
void insert_acl() { list<RULE>::add(m_key, this->item()); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The key.
|
* The key.
|
||||||
*/
|
*/
|
||||||
@ -122,7 +123,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* A cmd class that Deletes an ACL
|
* A cmd class that Deletes an ACL
|
||||||
*/
|
*/
|
||||||
template <typename DELETE>
|
template <typename RULE, typename DELETE>
|
||||||
class delete_cmd : public rpc_cmd<HW::item<handle_t>, rc_t, DELETE>
|
class delete_cmd : public rpc_cmd<HW::item<handle_t>, rc_t, DELETE>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -157,6 +158,12 @@ public:
|
|||||||
{
|
{
|
||||||
return (this->item().data() == other.item().data());
|
return (this->item().data() == other.item().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* remove the acl from the DB
|
||||||
|
*/
|
||||||
|
void remove_acl() { list<RULE>::remove(this->item()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,37 +177,35 @@ public:
|
|||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
dump_cmd() = default;
|
dump_cmd() = default;
|
||||||
dump_cmd(const dump_cmd& d) = default;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Issue the command to VPP/HW
|
* Issue the command to VPP/HW
|
||||||
*/
|
*/
|
||||||
rc_t issue(connection& con) { return rc_t::INVALID; }
|
rc_t issue(connection& con);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* convert to string format for debug purposes
|
* convert to string format for debug purposes
|
||||||
*/
|
*/
|
||||||
std::string to_string() const { return ("acl-list-dump"); }
|
std::string to_string() const { return ("acl-list-dump"); }
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
/**
|
||||||
* HW reutrn code
|
* Comparison operator - only used for UT
|
||||||
*/
|
*/
|
||||||
HW::item<bool> item;
|
bool operator==(const dump_cmd& i) const { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Typedef the L3 ACL commands
|
* Typedef the L3 ACL commands
|
||||||
*/
|
*/
|
||||||
typedef update_cmd<l3_rule, vapi::Acl_add_replace> l3_update_cmd;
|
typedef update_cmd<l3_rule, vapi::Acl_add_replace> l3_update_cmd;
|
||||||
typedef delete_cmd<vapi::Acl_del> l3_delete_cmd;
|
typedef delete_cmd<l3_rule, vapi::Acl_del> l3_delete_cmd;
|
||||||
typedef dump_cmd<vapi::Acl_dump> l3_dump_cmd;
|
typedef dump_cmd<vapi::Acl_dump> l3_dump_cmd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Typedef the L2 ACL commands
|
* Typedef the L2 ACL commands
|
||||||
*/
|
*/
|
||||||
typedef update_cmd<l2_rule, vapi::Macip_acl_add> l2_update_cmd;
|
typedef update_cmd<l2_rule, vapi::Macip_acl_add> l2_update_cmd;
|
||||||
typedef delete_cmd<vapi::Macip_acl_del> l2_delete_cmd;
|
typedef delete_cmd<l2_rule, vapi::Macip_acl_del> l2_delete_cmd;
|
||||||
typedef dump_cmd<vapi::Macip_acl_dump> l2_dump_cmd;
|
typedef dump_cmd<vapi::Macip_acl_dump> l2_dump_cmd;
|
||||||
|
|
||||||
}; // namespace list_cmds
|
}; // namespace list_cmds
|
||||||
|
@ -109,7 +109,8 @@ arp_proxy_binding::singular() const
|
|||||||
arp_proxy_binding::event_handler::event_handler()
|
arp_proxy_binding::event_handler::event_handler()
|
||||||
{
|
{
|
||||||
OM::register_listener(this);
|
OM::register_listener(this);
|
||||||
inspect::register_handler({ "arp-proxy" }, "ARP proxy bindings", this);
|
inspect::register_handler({ "arp-proxy-binding" }, "ARP proxy bindings",
|
||||||
|
this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -101,7 +101,8 @@ arp_proxy_config::singular() const
|
|||||||
arp_proxy_config::event_handler::event_handler()
|
arp_proxy_config::event_handler::event_handler()
|
||||||
{
|
{
|
||||||
OM::register_listener(this);
|
OM::register_listener(this);
|
||||||
inspect::register_handler({ "arp-proxy" }, "ARP Proxy configurations", this);
|
inspect::register_handler({ "arp-proxy-config" }, "ARP Proxy configurations",
|
||||||
|
this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -87,9 +87,8 @@ OM::replay()
|
|||||||
*/
|
*/
|
||||||
for (listener* l : *m_listeners) {
|
for (listener* l : *m_listeners) {
|
||||||
l->handle_replay();
|
l->handle_replay();
|
||||||
|
HW::write();
|
||||||
}
|
}
|
||||||
|
|
||||||
HW::write();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user