summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/interface.cpp
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2018-03-02 12:31:37 +0100
committerNeale Ranns <nranns@cisco.com>2018-03-27 15:44:19 +0000
commited76ee24dfe76fb9400470a4efb3871acd37cad9 (patch)
tree2684523782279294dc609d03e4838d51bc54e4d4 /src/vpp-api/vom/interface.cpp
parentde91006803f823a149b04738dd2bbfe18bfe9791 (diff)
VOM: bond: Add support for LACP
Change-Id: I0245263b212142858d3305b0f365d8342912dbb9 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vpp-api/vom/interface.cpp')
-rw-r--r--src/vpp-api/vom/interface.cpp65
1 files changed, 61 insertions, 4 deletions
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<interface_cmds::vhost_dump_cmd> vcmd =
std::make_shared<interface_cmds::vhost_dump_cmd>();
@@ -474,13 +480,10 @@ interface::event_handler::handle_populate(const client_db::key_t& key)
std::shared_ptr<interface> 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<interface_cmds::dump_cmd> cmd =
std::make_shared<interface_cmds::dump_cmd>();
@@ -522,6 +525,60 @@ interface::event_handler::handle_populate(const client_db::key_t& key)
}
}
}
+
+ std::shared_ptr<bond_interface_cmds::dump_cmd> bcmd =
+ std::make_shared<bond_interface_cmds::dump_cmd>();
+
+ HW::enqueue(bcmd);
+ HW::write();
+
+ for (auto& bond_itf_record : *bcmd) {
+ std::shared_ptr<bond_interface> 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<bond_group_binding_cmds::dump_cmd> scmd =
+ std::make_shared<bond_group_binding_cmds::dump_cmd>(
+ 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()