#include "vom/acl_ethertype.hpp"
#include "vom/acl_ethertype_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
namespace VOM {
namespace ACL {
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&
void
acl_ethertype::dump(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
void
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
void
acl_ethertype::event_handler::show(std::ostream& os)
{
- m_db.dump(os);
+ db_dump(m_db, os);
}
};
};