aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/acl_ethertype.cpp
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2018-03-07 19:53:51 +0100
committerNeale Ranns <nranns@cisco.com>2018-03-14 09:09:01 +0000
commit04def7418b649a94e32149ee924a3743358b5c84 (patch)
treec4773eefcf199477bc3628cdd6d05f7cec22f403 /src/vpp-api/vom/acl_ethertype.cpp
parentafb193019192a296e96c1008fdb788f70f5150d6 (diff)
VOM: acl: Add support for acl ethertype unbind and dump
Change-Id: I667b9ccabe54c8f9cff5b1a2e63864965f5064f5 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vpp-api/vom/acl_ethertype.cpp')
-rw-r--r--src/vpp-api/vom/acl_ethertype.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/vpp-api/vom/acl_ethertype.cpp b/src/vpp-api/vom/acl_ethertype.cpp
index 043f0b0e632..530a0aee604 100644
--- a/src/vpp-api/vom/acl_ethertype.cpp
+++ b/src/vpp-api/vom/acl_ethertype.cpp
@@ -95,6 +95,10 @@ acl_ethertype::~acl_ethertype()
void
acl_ethertype::sweep()
{
+ if (m_binding) {
+ HW::enqueue(new acl_ethertype_cmds::unbind_cmd(m_binding, m_itf->handle()));
+ }
+ HW::write();
}
const acl_ethertype::key_t&
@@ -187,7 +191,41 @@ acl_ethertype::event_handler::handle_replay()
void
acl_ethertype::event_handler::handle_populate(const client_db::key_t& key)
{
- // FIXME
+ /*
+ * dump VPP acl ethertypes
+ */
+ std::shared_ptr<acl_ethertype_cmds::dump_cmd> cmd =
+ std::make_shared<acl_ethertype_cmds::dump_cmd>(~0);
+
+ HW::enqueue(cmd);
+ HW::write();
+
+ for (auto& record : *cmd) {
+ auto& payload = record.get_payload();
+ handle_t hdl(payload.sw_if_index);
+ std::shared_ptr<interface> itf = interface::find(hdl);
+ uint8_t n_input = payload.n_input;
+ uint8_t count = payload.count;
+ ethertype_rules_t ler;
+ if (itf) {
+ for (int i = 0; i < count; i++) {
+ ethertype_t e = ethertype_t::from_numeric_val(payload.whitelist[i]);
+ if (n_input) {
+ ethertype_rule_t er(e, direction_t::INPUT);
+ ler.insert(er);
+ n_input--;
+ } else {
+ ethertype_rule_t er(e, direction_t::OUTPUT);
+ ler.insert(er);
+ }
+ }
+ if (!ler.empty()) {
+ acl_ethertype a_e(*itf, ler);
+ VOM_LOG(log_level_t::DEBUG) << "ethertype dump: " << a_e.to_string();
+ OM::commit(key, a_e);
+ }
+ }
+ }
}
dependency_t