- XBT_DEBUG("Starting topology generation");
-
- xbt_dynar_shrink(IPV4addr,0);
-
- //get the onelinks from the parsed platform
- xbt_dynar_t onelink_routes = routing_platf->getOneLinkRoutes();
-
- std::unordered_set<simgrid::surf::LinkNS3*> already_seen = std::unordered_set<simgrid::surf::LinkNS3*>();
-
- XBT_DEBUG("There is %ld one-link routes",onelink_routes->used);
- simgrid::surf::Onelink *onelink;
- unsigned int iter;
- xbt_dynar_foreach(onelink_routes, iter, onelink) {
- char *src = onelink->src_->name();
- char *dst = onelink->dst_->name();
- simgrid::surf::LinkNS3 *link = static_cast<simgrid::surf::LinkNS3 *>(onelink->link_);
-
- 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->getBandwidth());
- char * link_lat = bprintf("%fs", link->getLatency());
-
- // 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
- ns3_node_t host_src = ns3_find_host(src);
- if (!host_src)
- host_src = static_cast<ns3_node_t>(xbt_lib_get_or_null(as_router_lib,src,NS3_ASR_LEVEL));
- ns3_node_t host_dst = ns3_find_host(dst);
- if(!host_dst)
- host_dst = static_cast<ns3_node_t>(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);
- }
- }