X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fvom%2Fvom%2Finterface.cpp;h=4f26ac80313639e1b961a47bc09ad73cff530bcd;hb=33b81da;hp=009e703000ffe2fba4a9f22b1dae1df37e5637c4;hpb=0af529c4c50bfa52e83cd4190e7d8baa5b20022f;p=vpp.git diff --git a/extras/vom/vom/interface.cpp b/extras/vom/vom/interface.cpp index 009e703000f..4f26ac80313 100644 --- a/extras/vom/vom/interface.cpp +++ b/extras/vom/vom/interface.cpp @@ -23,6 +23,7 @@ #include "vom/logger.hpp" #include "vom/prefix.hpp" #include "vom/singular_db_funcs.hpp" +#include "vom/tap_interface_cmds.hpp" namespace VOM { /** @@ -286,8 +287,7 @@ interface::mk_create_cmd(std::queue& q) q.push(new interface_cmds::af_packet_create_cmd(m_hdl, m_name)); if (!m_tag.empty()) q.push(new interface_cmds::set_tag(m_hdl, m_tag)); - } else if (type_t::TAP == m_type) { - q.push(new interface_cmds::tap_create_cmd(m_hdl, m_name)); + } else if (type_t::TAP == m_type || type_t::TAPV2 == m_type) { if (!m_tag.empty()) q.push(new interface_cmds::set_tag(m_hdl, m_tag)); } else if (type_t::VHOST == m_type) { @@ -306,8 +306,6 @@ interface::mk_delete_cmd(std::queue& q) q.push(new interface_cmds::loopback_delete_cmd(m_hdl)); } else if (type_t::AFPACKET == m_type) { q.push(new interface_cmds::af_packet_delete_cmd(m_hdl, m_name)); - } else if (type_t::TAP == m_type) { - q.push(new interface_cmds::tap_delete_cmd(m_hdl)); } else if (type_t::VHOST == m_type) { q.push(new interface_cmds::vhost_delete_cmd(m_hdl, m_name)); } @@ -491,7 +489,7 @@ void interface::event_handler::handle_populate(const client_db::key_t& key) { /* - * dump VPP current states + * dump VPP vhost-user interfaces */ std::shared_ptr vcmd = std::make_shared(); @@ -507,6 +505,9 @@ interface::event_handler::handle_populate(const client_db::key_t& key) OM::commit(key, *vitf); } + /* + * dump VPP af-packet interfaces + */ std::shared_ptr afcmd = std::make_shared(); @@ -521,6 +522,53 @@ interface::event_handler::handle_populate(const client_db::key_t& key) OM::commit(key, *afitf); } + /* + * dump VPP tap interfaces + */ + std::shared_ptr tapcmd = + std::make_shared(); + + HW::enqueue(tapcmd); + HW::write(); + + for (auto& tap_record : *tapcmd) { + std::shared_ptr tapitf = + interface_factory::new_tap_interface(tap_record.get_payload()); + VOM_LOG(log_level_t::DEBUG) << "tap-dump: " << tapitf->to_string(); + + /* + * Write each of the discovered interfaces into the OM, + * but disable the HW Command q whilst we do, so that no + * commands are sent to VPP + */ + OM::commit(key, *tapitf); + } + + /* + * dump VPP tapv2 interfaces + */ + std::shared_ptr tapv2cmd = + std::make_shared(); + + HW::enqueue(tapv2cmd); + HW::write(); + + for (auto& tapv2_record : *tapv2cmd) { + std::shared_ptr tapv2itf = + interface_factory::new_tap_v2_interface(tapv2_record.get_payload()); + VOM_LOG(log_level_t::DEBUG) << "tapv2-dump: " << tapv2itf->to_string(); + + /* + * Write each of the discovered interfaces into the OM, + * but disable the HW Command q whilst we do, so that no + * commands are sent to VPP + */ + OM::commit(key, *tapv2itf); + } + + /* + * dump VPP interfaces + */ std::shared_ptr cmd = std::make_shared(); @@ -567,6 +615,9 @@ interface::event_handler::handle_populate(const client_db::key_t& key) } } + /* + * dump VPP bond interfaces + */ std::shared_ptr bcmd = std::make_shared();