- if (strcmp(src,dst) && (already_seen.find(link) == already_seen.end())) {
- already_seen.insert(link);
- XBT_DEBUG("Route from '%s' to '%s' with link '%s'", src, dst, link->getName());
- char* link_bdw = bprintf("%fBps", link->bandwidth());
- char* link_lat = bprintf("%fs", link->latency());
-
- // XBT_DEBUG("src (%s), dst (%s), src_id = %d, dst_id = %d",src,dst, src_id, dst_id);
- XBT_DEBUG("\tLink (%s) bdw:%s lat:%s", link->getName(), link_bdw, link_lat);
-
- //create link ns3
- HostNs3* host_src = ns3_find_host(src);
- if (!host_src)
- host_src = static_cast<HostNs3*>(xbt_lib_get_or_null(as_router_lib, src, NS3_ASR_LEVEL));
- HostNs3* host_dst = ns3_find_host(dst);
- if(!host_dst)
- host_dst = static_cast<HostNs3*>(xbt_lib_get_or_null(as_router_lib, dst, NS3_ASR_LEVEL));
-
- if (!host_src || !host_dst)
- xbt_die("\tns3_add_link from %d to %d",host_src->node_num,host_dst->node_num);
-
- ns3_add_link(host_src->node_num, host_dst->node_num, link_bdw, link_lat);
-
- xbt_free(link_bdw);
- xbt_free(link_lat);
- }
+ 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;