- std::shared_ptr<ip_route_cmds::dump_v4_cmd> cmd_v4 =
- std::make_shared<ip_route_cmds::dump_v4_cmd>();
- std::shared_ptr<ip_route_cmds::dump_v6_cmd> cmd_v6 =
- std::make_shared<ip_route_cmds::dump_v6_cmd>();
-
- HW::enqueue(cmd_v4);
- HW::enqueue(cmd_v6);
- HW::write();
-
- for (auto& record : *cmd_v4) {
- auto& payload = record.get_payload();
-
- prefix_t pfx(0, payload.address, payload.address_length);
-
- /**
- * populating the route domain here
- */
- route_domain rd_temp(payload.table_id);
- std::shared_ptr<route_domain> rd = route_domain::find(payload.table_id);
- if (!rd) {
- OM::commit(key, rd_temp);
- }
- ip_route ip_r(rd_temp, pfx);
-
- for (unsigned int i = 0; i < payload.count; i++) {
- ip_r.add(from_vpp(payload.path[i], nh_proto_t::IPV4));
+ // for each known route-domain
+ auto it = route_domain::cbegin();
+
+ while (it != route_domain::cend()) {
+
+ std::vector<l3_proto_t> l3s = { l3_proto_t::IPV4, l3_proto_t::IPV4 };
+
+ for (auto l3 : l3s) {
+ std::shared_ptr<ip_route_cmds::dump_cmd> cmd =
+ std::make_shared<ip_route_cmds::dump_cmd>(it->second.lock()->table_id(),
+ l3);
+
+ HW::enqueue(cmd);
+ HW::write();
+
+ for (auto& record : *cmd) {
+ auto& payload = record.get_payload();
+
+ std::shared_ptr<route_domain> rd =
+ route_domain::find(payload.route.table_id);
+
+ if (!rd) {
+ continue;
+ }
+
+ prefix_t pfx = from_api(payload.route.prefix);
+ ip_route ip_r(*rd, pfx);
+
+ for (unsigned int i = 0; i < payload.route.n_paths; i++) {
+ ip_r.add(from_api(payload.route.paths[i]));
+
+ // vapi_type_fib_path& p = payload.route.paths[i];
+ /* if (p.is_local) { */
+ /* path path_v4(path::special_t::LOCAL); */
+ /* ip_r.add(path_v4); */
+ /* } */
+ /* } else if (p.is_drop) { */
+ /* path path_v4(path::special_t::DROP); */
+ /* ip_r.add(path_v4); */
+ /* } else if (p.is_unreach) { */
+ /* path path_v4(path::special_t::UNREACH); */
+ /* ip_r.add(path_v4); */
+ /* } else if (p.is_prohibit) { */
+ /* path path_v4(path::special_t::PROHIBIT); */
+ /* ip_r.add(path_v4); */
+ /* } else { */
+ /* boost::asio::ip::address address = from_bytes(0, p.next_hop);
+ */
+ /* std::shared_ptr<interface> itf =
+ * interface::find(p.sw_if_index); */
+ /* if (itf) { */
+ /* if (p.is_dvr) { */
+ /* path path_v4(*itf, nh_proto_t::IPV4,
+ * route::path::flags_t::DVR,
+ */
+ /* p.weight, p.preference); */
+ /* ip_r.add(path_v4); */
+ /* } else { */
+ /* path path_v4(address, *itf, p.weight, p.preference); */
+ /* ip_r.add(path_v4); */
+ /* } */
+ /* } else { */
+ /* path path_v4(rd_temp, address, p.weight, p.preference); */
+ /* ip_r.add(path_v4); */
+ /* } */
+ /* } */
+ }
+
+ VOM_LOG(log_level_t::DEBUG) << "ip-route-dump: " << ip_r.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, ip_r);
+ }