X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvpp-api%2Fvom%2Finterface.cpp;h=f323727b052d8a25bdb76ef242f9a122d040fb06;hb=ed76ee24dfe76fb9400470a4efb3871acd37cad9;hp=f943bf4a616a66137d8b49e875dbf53b1120da3b;hpb=de91006803f823a149b04738dd2bbfe18bfe9791;p=vpp.git diff --git a/src/vpp-api/vom/interface.cpp b/src/vpp-api/vom/interface.cpp index f943bf4a616..f323727b052 100644 --- a/src/vpp-api/vom/interface.cpp +++ b/src/vpp-api/vom/interface.cpp @@ -14,6 +14,9 @@ */ #include "vom/interface.hpp" +#include "vom/bond_group_binding.hpp" +#include "vom/bond_group_binding_cmds.hpp" +#include "vom/bond_interface_cmds.hpp" #include "vom/interface_cmds.hpp" #include "vom/interface_factory.hpp" #include "vom/l3_binding_cmds.hpp" @@ -464,6 +467,9 @@ interface::dump(std::ostream& os) void interface::event_handler::handle_populate(const client_db::key_t& key) { + /* + * dump VPP current states + */ std::shared_ptr vcmd = std::make_shared(); @@ -474,13 +480,10 @@ interface::event_handler::handle_populate(const client_db::key_t& key) std::shared_ptr vitf = interface_factory::new_vhost_user_interface( vhost_itf_record.get_payload()); - VOM_LOG(log_level_t::DEBUG) << "dump: " << vitf->to_string(); + VOM_LOG(log_level_t::DEBUG) << " vhost-dump: " << vitf->to_string(); OM::commit(key, *vitf); } - /* - * dump VPP current states - */ std::shared_ptr cmd = std::make_shared(); @@ -522,6 +525,60 @@ interface::event_handler::handle_populate(const client_db::key_t& key) } } } + + std::shared_ptr bcmd = + std::make_shared(); + + HW::enqueue(bcmd); + HW::write(); + + for (auto& bond_itf_record : *bcmd) { + std::shared_ptr bond_itf = + interface_factory::new_bond_interface(bond_itf_record.get_payload()); + + VOM_LOG(log_level_t::DEBUG) << " bond-dump:" << bond_itf->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, *bond_itf); + + std::shared_ptr scmd = + std::make_shared( + bond_group_binding_cmds::dump_cmd(bond_itf->handle())); + + HW::enqueue(scmd); + HW::write(); + + bond_group_binding::enslaved_itf_t enslaved_itfs; + + for (auto& slave_itf_record : *scmd) { + bond_member slave_itf = interface_factory::new_bond_member_interface( + slave_itf_record.get_payload()); + + VOM_LOG(log_level_t::DEBUG) << " slave-dump:" << slave_itf.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(slave_itf->key(), *slave_itf); + enslaved_itfs.insert(slave_itf); + } + + if (!enslaved_itfs.empty()) { + bond_group_binding bid(*bond_itf, enslaved_itfs); + /* + * 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, bid); + } + } } interface::event_handler::event_handler()