surfxml_add_callback(ETag_surfxml_AS_cb_list, &parse_E_AS);
/* DEBUG ONLY */
- surfxml_add_callback(ETag_surfxml_platform_cb_list, &DEBUG_exit);
+ //surfxml_add_callback(ETag_surfxml_platform_cb_list, &DEBUG_exit);
+
+ // TODO checked if ANY AS are duplicated
}
/* ************************************************************************** */
/* Put the routes in position */
xbt_dict_foreach(routing->parse_routes, cursor, key, data) {
keys = xbt_str_split_str(key, sep);
- src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 16);
- dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 16);
+ src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 10);
+ dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 10);
TO_ROUTE_FULL(src_id,dst_id) = generic_new_extended_route(current_routing->hierarchy,data,1);
xbt_dynar_free(&keys);
}
if(first) first_gw = gw_dst;
if(rc->hierarchy == SURF_ROUTING_RECURSIVE && !first && strcmp(gw_dst,prev_gw_src)) {
- routing_component_t src_as = xbt_dict_get_or_null(global_routing->where_network_elements,gw_dst);
- routing_component_t dst_as = xbt_dict_get_or_null(global_routing->where_network_elements,prev_gw_src);
- xbt_assert4(src_as==dst_as,"bad routing, differents AS gateways in route \"%s\" to \"%s\" (\"%s\"-\"%s\")",src,dst,gw_dst,prev_gw_src);
- route_extended_t e_route_as_to_as = (*(src_as->get_route))(src_as,gw_dst,prev_gw_src);
+ //routing_component_t src_as = xbt_dict_get_or_null(global_routing->where_network_elements,gw_dst);
+ //routing_component_t dst_as = xbt_dict_get_or_null(global_routing->where_network_elements,prev_gw_src);
+ //xbt_assert4(src_as==dst_as,"bad routing, differents AS gateways in route \"%s\" to \"%s\" (\"%s\"-\"%s\")",src,dst,gw_dst,prev_gw_src);
+ //route_extended_t e_route_as_to_as = (*(src_as->get_route))(src_as,gw_dst,prev_gw_src);
+ // TODO: - check for error - is possible to generate a route like = as----as----as
+ xbt_dynar_t e_route_as_to_as = (*(global_routing->get_route))(gw_dst,prev_gw_src);
xbt_assert2(e_route_as_to_as,"no route between \"%s\" and \"%s\"",gw_dst,prev_gw_src);
- links = e_route_as_to_as->generic_route.link_list;
+ //links = e_route_as_to_as->generic_route.link_list;
+ links = e_route_as_to_as;
int pos = 0;
xbt_dynar_foreach(links, cpt, link) {
xbt_dynar_insert_at(new_e_route->generic_route.link_list,pos,&link);
pos++;
}
+// xbt_dynar_free(&(e_route_as_to_as->generic_route.link_list));
+// xbt_free(e_route_as_to_as);
}
links = e_route->generic_route.link_list;
for(j = 0; j<table_size;j++) {
TO_FLOYD_COST(i,j) = DBL_MAX;
TO_FLOYD_PRED(i,j) = -1;
- TO_FLOYD_LINK(i,j) = NULL; // FIXED DAVID
+ TO_FLOYD_LINK(i,j) = NULL; // FIXED by david
}
/* Put the routes in position */
xbt_dict_foreach(routing->parse_routes, cursor, key, data) {
keys = xbt_str_split_str(key, sep);
- src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 16);
- dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 16);
+ src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 10);
+ dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 10);
TO_FLOYD_LINK(src_id,dst_id) = generic_new_extended_route(current_routing->hierarchy,data,0);
TO_FLOYD_PRED(src_id,dst_id) = src_id;
//link cost
- TO_FLOYD_COST(src_id,dst_id) = 1; // assume 1 for now // TODO DAVID REDO
+ TO_FLOYD_COST(src_id,dst_id) = ((TO_FLOYD_LINK(src_id,dst_id))->generic_route.link_list)->used; // assume 1 for now // TODO DAVID REDO
xbt_dynar_free(&keys);
}
xbt_assert2(edge != NULL, "no route between host %d and %d", *src_id, *dst_id);
e_route = (route_extended_t)xbt_graph_edge_get_data(edge);
-
- // TODO: correct the order
+
links = e_route->generic_route.link_list;
xbt_dynar_foreach(links, cpt, link) {
- xbt_dynar_push(new_e_route->generic_route.link_list,&link);
+ xbt_dynar_unshift(new_e_route->generic_route.link_list,&link);
}
return new_e_route;
xbt_node_t u_node = xbt_graph_edge_get_target(edge);
graph_node_data_t data = xbt_graph_node_get_data(u_node);
int u_id = data->graph_id;
- int cost_v_u = 1; //fixed link cost for now // TODO DAVID REDO
+ route_extended_t tmp_e_route = (route_extended_t)xbt_graph_edge_get_data(edge); // added TODO DAVID REDO
+ int cost_v_u = (tmp_e_route->generic_route.link_list)->used; //fixed link cost for now // TODO DAVID REDO
if(cost_v_u + cost_arr[*v_id] < cost_arr[u_id]) {
pred_arr[u_id] = *v_id;
xbt_free(cost_arr);
xbt_heap_free(pqueue);
-
}
//compose route path with links
if(v==dst_node_id) first_gw = gw_dst;
if(rc->hierarchy == SURF_ROUTING_RECURSIVE && v!=dst_node_id && strcmp(gw_dst,prev_gw_src)) {
- routing_component_t src_as = xbt_dict_get_or_null(global_routing->where_network_elements,gw_dst);
- routing_component_t dst_as = xbt_dict_get_or_null(global_routing->where_network_elements,prev_gw_src);
- xbt_assert4(src_as==dst_as,"bad routing, differents AS gateways in route \"%s\" to \"%s\" (\"%s\"-\"%s\")",src,dst,gw_dst,prev_gw_src);
- route_extended_t e_route_as_to_as = (*(src_as->get_route))(src_as,gw_dst,prev_gw_src);
+ //routing_component_t src_as = xbt_dict_get_or_null(global_routing->where_network_elements,gw_dst);
+ //routing_component_t dst_as = xbt_dict_get_or_null(global_routing->where_network_elements,prev_gw_src);
+ //xbt_assert4(src_as==dst_as,"bad routing, differents AS gateways in route \"%s\" to \"%s\" (\"%s\"-\"%s\")",src,dst,gw_dst,prev_gw_src);
+ //route_extended_t e_route_as_to_as = (*(src_as->get_route))(src_as,gw_dst,prev_gw_src);
+ // TODO: - check for error - is possible to generate a route like = as----as----as
+ xbt_dynar_t e_route_as_to_as = (*(global_routing->get_route))(gw_dst,prev_gw_src);
xbt_assert2(e_route_as_to_as,"no route between \"%s\" and \"%s\"",gw_dst,prev_gw_src);
- links = e_route_as_to_as->generic_route.link_list;
+ //links = e_route_as_to_as->generic_route.link_list;
+ links = e_route_as_to_as;
int pos = 0;
xbt_dynar_foreach(links, cpt, link) {
xbt_dynar_insert_at(new_e_route->generic_route.link_list,pos,&link);
pos++;
}
- xbt_dynar_free(&(e_route_as_to_as->generic_route.link_list));
- xbt_free(e_route_as_to_as);
+// xbt_dynar_free(&(e_route_as_to_as->generic_route.link_list));
+// xbt_free(e_route_as_to_as);
}
links = e_route->generic_route.link_list;
/* Put the routes in position */
xbt_dict_foreach(routing->parse_routes, cursor, key, data) {
keys = xbt_str_split_str(key, sep);
- src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 16);
- dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 16);
+ src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 10);
+ dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 10);
route_extended_t e_route = generic_new_extended_route(current_routing->hierarchy,data,0);
route_new_dijkstra(routing,src_id,dst_id,e_route);
xbt_dynar_free(&keys);
printf("\n");
}
}
- for(i=0;i<total;i++) {
- for(j=0;j<total;j++) {
- printf("route from %s to %s >>>\n ",names[i],names[j]);
- links = (*(global_routing->get_route))(names[i],names[j]);
- printf(">>>");
- unsigned int cpt=0;
- xbt_dynar_foreach(links, cpt, link) {
- s_surf_resource_t* generic_resource = link;
- printf(" %s",generic_resource->name);
- }
- printf("\n");
- }
- }
- for(i=0;i<total;i++) {
- for(j=0;j<total;j++) {
- printf("route from %s to %s >>>\n ",names[i],names[j]);
- links = (*(global_routing->get_route))(names[i],names[j]);
- printf(">>>");
- unsigned int cpt=0;
- xbt_dynar_foreach(links, cpt, link) {
- s_surf_resource_t* generic_resource = link;
- printf(" %s",generic_resource->name);
- }
- printf("\n");
- }
- }
- for(i=0;i<total;i++) {
- for(j=0;j<total;j++) {
- printf("route from %s to %s >>>\n ",names[i],names[j]);
- links = (*(global_routing->get_route))(names[i],names[j]);
- printf(">>>");
- unsigned int cpt=0;
- xbt_dynar_foreach(links, cpt, link) {
- s_surf_resource_t* generic_resource = link;
- printf(" %s",generic_resource->name);
- }
- printf("\n");
- }
- }
printf("----------------------------------\n\n");
printf("---------- call finalize ---------\n");