- HostNs3* host_src = nullptr;
- HostNs3* host_dst = nullptr;
- if (src->isHost())
- host_src = sg_host_by_name(src->cname())->extension<HostNs3>();
- else
- host_src = static_cast<HostNs3*>(xbt_lib_get_or_null(as_router_lib, src->cname(), NS3_ASR_LEVEL));
-
- if (dst->isHost())
- host_dst = sg_host_by_name(dst->cname())->extension<HostNs3>();
- else
- host_dst = static_cast<HostNs3*>(xbt_lib_get_or_null(as_router_lib, dst->cname(), NS3_ASR_LEVEL));
-
- xbt_assert(host_src != nullptr, "Network element %s does not seem to be NS3-ready", src->cname());
- xbt_assert(host_dst != nullptr, "Network element %s does not seem to be NS3-ready", dst->cname());
-
- ns3_add_link(host_src->node_num, host_dst->node_num, link_bdw, link_lat);
- if (symmetrical)
- ns3_add_link(host_dst->node_num, host_src->node_num, link_bdw, link_lat);
-
- xbt_free(link_bdw);
- xbt_free(link_lat);
+ NetPointNs3* host_src = src->extension<NetPointNs3>();
+ NetPointNs3* host_dst = dst->extension<NetPointNs3>();
+
+ xbt_assert(host_src != nullptr, "Network element %s does not seem to be NS3-ready", src->getCname());
+ xbt_assert(host_dst != nullptr, "Network element %s does not seem to be NS3-ready", dst->getCname());
+
+ ns3_add_link(host_src, host_dst, link->bandwidth(), link->latency());
+ } else {
+ static bool warned_about_long_routes = false;
+
+ if (not warned_about_long_routes)
+ XBT_WARN("Ignoring a route between %s and %s of length %zu: Only routes of length 1 are considered with NS3.\n"
+ "WARNING: You can ignore this warning if your hosts can still communicate when only considering routes "
+ "of length 1.\n"
+ "WARNING: Remove long routes to avoid this harmless message; subsequent long routes will be silently "
+ "ignored.",
+ src->getCname(), dst->getCname(), link_list->size());
+ warned_about_long_routes = true;