summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/acl_list.cpp
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2017-11-03 04:39:05 -0700
committerNeale Ranns <nranns@cisco.com>2017-11-06 17:44:21 +0000
commit9ef1c0adbf9399c55deeede3cf629dd4e8c20304 (patch)
tree0eeed8f869eee35a48797b6b837c16222a627e46 /src/vpp-api/vom/acl_list.cpp
parentaddb55b9e0533c5f720b1cc1bdeeb4bbd0e6bf2a (diff)
VOM reshuffle
split the VOM into two halves; a top/front-end and a bottom/backend. Only the backend includes the auto-generated VAPI. This serves two purposes: 1 - improves ompile times for VOM, since the VAPI is included only in the backend. 2 - does not expose VAPI to users of VOM Change-Id: I17b93aeaef10c0eba8612016d9034aca5628d9f7 Signed-off-by: Neale Ranns <neale.ranns@cisco.com> Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vpp-api/vom/acl_list.cpp')
-rw-r--r--src/vpp-api/vom/acl_list.cpp86
1 files changed, 82 insertions, 4 deletions
diff --git a/src/vpp-api/vom/acl_list.cpp b/src/vpp-api/vom/acl_list.cpp
index 129be8faefe..0c92c02ad22 100644
--- a/src/vpp-api/vom/acl_list.cpp
+++ b/src/vpp-api/vom/acl_list.cpp
@@ -14,6 +14,7 @@
*/
#include "vom/acl_list.hpp"
+#include "vom/acl_list_cmds.hpp"
#include "vom/logger.hpp"
namespace VOM {
@@ -28,7 +29,7 @@ l2_list::event_handler::handle_populate(const client_db::key_t& key)
/*
* dump VPP Bridge domains
*/
- std::shared_ptr<l2_list::dump_cmd> cmd(new l2_list::dump_cmd());
+ std::shared_ptr<list_cmds::l2_dump_cmd> cmd(new list_cmds::l2_dump_cmd());
HW::enqueue(cmd);
HW::write();
@@ -69,7 +70,7 @@ l3_list::event_handler::handle_populate(const client_db::key_t& key)
/*
* dump VPP Bridge domains
*/
- std::shared_ptr<l3_list::dump_cmd> cmd(new l3_list::dump_cmd());
+ std::shared_ptr<list_cmds::l3_dump_cmd> cmd(new list_cmds::l3_dump_cmd());
HW::enqueue(cmd);
HW::write();
@@ -101,8 +102,85 @@ l3_list::event_handler::handle_populate(const client_db::key_t& key)
OM::commit(key, acl);
}
}
-};
-};
+
+template <>
+void
+l3_list::update(const l3_list& obj)
+{
+ /*
+ * always update the instance with the latest rule set
+ */
+ if (!m_hdl || obj.m_rules != m_rules) {
+ HW::enqueue(new list_cmds::l3_update_cmd(m_hdl, m_key, m_rules));
+ }
+ /*
+ * We don't, can't, read the priority from VPP,
+ * so the is equals check above does not include the priorty.
+ * but we save it now.
+ */
+ m_rules = obj.m_rules;
+}
+template <>
+void
+l2_list::update(const l2_list& obj)
+{
+ /*
+ * always update the instance with the latest rule set
+ */
+ if (!m_hdl || obj.m_rules != m_rules) {
+ HW::enqueue(new list_cmds::l2_update_cmd(m_hdl, m_key, m_rules));
+ }
+ /*
+ * We don't, can't, read the priority from VPP,
+ * so the is equals check above does not include the priorty.
+ * but we save it now.
+ */
+ m_rules = obj.m_rules;
+}
+/**
+ * Sweep/reap the object if still stale
+ */
+template <>
+void
+l3_list::sweep(void)
+{
+ if (m_hdl) {
+ HW::enqueue(new list_cmds::l3_delete_cmd(m_hdl));
+ }
+ HW::write();
+}
+template <>
+void
+l2_list::sweep(void)
+{
+ if (m_hdl) {
+ HW::enqueue(new list_cmds::l2_delete_cmd(m_hdl));
+ }
+ HW::write();
+}
+
+/**
+ * Replay the objects state to HW
+ */
+template <>
+void
+l3_list::replay(void)
+{
+ if (m_hdl) {
+ HW::enqueue(new list_cmds::l3_update_cmd(m_hdl, m_key, m_rules));
+ }
+}
+template <>
+void
+l2_list::replay(void)
+{
+ if (m_hdl) {
+ HW::enqueue(new list_cmds::l2_update_cmd(m_hdl, m_key, m_rules));
+ }
+}
+
+}; // namespace ACL
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON