-// xbt_dict_cursor_t cursor = NULL;
-// char *key, *data;
-// xbt_dict_t onelink_routes = global_routing->get_onelink_routes();
-// xbt_assert0(onelink_routes, "Error onelink_routes was not initialized");
-//
-// DEBUG0("Starting topology generation");
-// À refaire plus tard. Il faut prendre la liste des hôtes/routeurs (dans routing)
-// À partir de cette liste, on les numérote.
-// Ensuite, on peut utiliser les id pour refaire les appels GTNets qui suivent.
-
-// xbt_dict_foreach(onelink_routes, cursor, key, data){
-// s_onelink_t link = (s_onelink_t) data;
-//
-// DEBUG3("Link (#%d), src (#%s), dst (#%s)", ((network_link_GTNETS_t)(link->link_ptr))->id , link->src, link->dst);
-// DEBUG0("Calling one link route");
-// if(global_routing->is_router(link->src)){
-// gtnets_add_router(link->src_id);
-// }
-// if(global_routing->is_router(link->dst)){
-// gtnets_add_router(link->dst_id);
-// }
-// route_onehop_new(link->src_id, link->dst_id, (network_link_GTNETS_t)(link->link_ptr));
-// }
-//
-// xbt_dict_free(&route_table);
-// if (XBT_LOG_ISENABLED(surf_network_gtnets, xbt_log_priority_debug)) {
-// gtnets_print_topology();
-// }
+ XBT_DEBUG("Starting topology generation");
+// FIXME: We should take the list of hosts/routers (in the routing module), number the elements of this list,
+// and then you can use the id to reimplement properly the following GTNets calls
+
+ //get the onelinks from the parsed platform
+ xbt_dynar_t onelink_routes = routing_platf->get_onelink_routes();
+ if (!onelink_routes)
+ return;
+
+ //save them in trace file
+ onelink_t onelink;
+ unsigned int iter;
+ xbt_dynar_foreach(onelink_routes, iter, onelink) {
+ void *link = onelink->link_ptr;
+
+ if(onelink->src->id != onelink->dst->id){
+ XBT_DEBUG("Link (#%p), src (#%s), dst (#%s), src_id = %d, dst_id = %d",
+ link,
+ onelink->src->name,
+ onelink->dst->name,
+ onelink->src->id,
+ onelink->dst->id);
+ XBT_DEBUG("Calling one link route");
+ if(onelink->src->rc_type == SURF_NETWORK_ELEMENT_ROUTER){
+ gtnets_add_router(onelink->src->id);
+ }
+ if(onelink->dst->rc_type == SURF_NETWORK_ELEMENT_ROUTER){
+ gtnets_add_router(onelink->dst->id);
+ }
+ route_onehop_new(onelink->src->id, onelink->dst->id, (network_link_GTNETS_t)(link));
+ }
+ }
+
+ if (XBT_LOG_ISENABLED(surf_network_gtnets, xbt_log_priority_debug)) {
+ gtnets_print_topology();
+ }