- for (i = 0; i < totalHosts; i++) {
- for (j = 0; j < totalHosts; j++) {
- tmp = SD_route_get_list(hosts[i], hosts[j]);
- if (tmp) {
- printf(" <route src=\"%s\" dst=\"%s\">\n ",
- SD_workstation_get_name(hosts[i]),
- SD_workstation_get_name(hosts[j]));
-
- tmp_length = SD_route_get_size(hosts[i], hosts[j]);
- for (k = 0; k < tmp_length; k++) {
- printf("<link_ctn id=\"%s\"/>", SD_link_get_name(tmp[k]));
- }
- printf("\n </route>\n");
- }
- }
+ // Routes
+ xbt_dict_foreach(global_routing->where_network_elements, cursor_src, src, data)
+ {
+ if(((network_element_info_t)xbt_dict_get(global_routing->where_network_elements, src))->rc_type
+ == SURF_NETWORK_ELEMENT_ROUTER ||
+ ((network_element_info_t)xbt_dict_get(global_routing->where_network_elements, src))->rc_type
+ == SURF_NETWORK_ELEMENT_HOST)
+ {
+ xbt_dict_foreach(global_routing->where_network_elements, cursor_dst, dst, data)
+ {
+ if(((network_element_info_t)xbt_dict_get(global_routing->where_network_elements, dst))->rc_type
+ == SURF_NETWORK_ELEMENT_ROUTER ||
+ ((network_element_info_t)xbt_dict_get(global_routing->where_network_elements, dst))->rc_type
+ == SURF_NETWORK_ELEMENT_HOST)
+ {
+ printf(" <route src=\"%s\" dst=\"%s\">\n "
+ ,src
+ ,dst);
+ xbt_dynar_t route = global_routing->get_route(src,dst);
+ for(i=0;i<xbt_dynar_length(route) ;i++)
+ {
+ void *link = xbt_dynar_get_as(route,i,void *);
+
+ char *link_name = bprintf("%s",((surf_resource_t) link)->name);
+ printf("<link_ctn id=\"%s\"/>",link_name);
+ }
+ printf("\n </route>\n");
+
+ }
+ }
+ }