const char *src, const char *dst,
route_t route)
{
- xbt_assert(asg && src
- && dst,
- "Invalid params for \"get_route\" function at AS \"%s\"",
- asg->name);
/* set utils vars */
as_dijkstra_t as = (as_dijkstra_t) asg;
generic_src_dst_check(asg, src, dst);
int *src_id = xbt_dict_get_or_null(asg->to_index, src);
int *dst_id = xbt_dict_get_or_null(asg->to_index, dst);
- xbt_assert(src_id
- && dst_id,
- "Ask for route \"from\"(%s) or \"to\"(%s) no found in the local table",
- src, dst);
+ if (!src_id || !dst_id)
+ THROWF(arg_error,0,"No route from '%s' to '%s'",src,dst);
int *pred_arr = NULL;
int src_node_id = 0;
graph_node_map_search(as, *src_id);
graph_node_map_element_t dst_elm =
graph_node_map_search(as, *dst_id);
- xbt_assert(src_elm != NULL
- && dst_elm != NULL, "src %d or dst %d does not exist",
- *src_id, *dst_id);
+
src_node_id = ((graph_node_data_t)
xbt_graph_node_get_data(src_elm->node))->graph_id;
dst_node_id = ((graph_node_data_t)
xbt_graph_node_get_data(dst_elm->node))->graph_id;
- /* if the src and dst are the same *//* fixed, missing in the previous version */
+ /* if the src and dst are the same */
if (src_node_id == dst_node_id) {
xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_node_id, xbt_node_t);
xbt_edge_t edge =
xbt_graph_get_edge(as->route_graph, node_s_v, node_e_v);
- xbt_assert(edge != NULL, "no route between host %d and %d", *src_id,
- *dst_id);
+ if (edge == NULL)
+ THROWF(arg_error,0,"No route from '%s' to '%s'",src,dst);
e_route = (route_t) xbt_graph_edge_get_data(edge);
xbt_edge_t edge =
xbt_graph_get_edge(as->route_graph, node_pred_v, node_v);
- xbt_assert(edge != NULL, "no route between host %d and %d", *src_id,
- *dst_id);
+ if (edge == NULL)
+ THROWF(arg_error,0,"No route from '%s' to '%s'",src,dst);
prev_gw_src = gw_src;
&& strcmp(gw_dst, prev_gw_src)) {
xbt_dynar_t e_route_as_to_as=NULL;
routing_get_route_and_latency(gw_dst, prev_gw_src,&e_route_as_to_as,NULL);
- xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"",
- gw_dst, prev_gw_src);
+ if (edge == NULL)
+ THROWF(arg_error,0,"No route from '%s' to '%s'",src,dst);
links = e_route_as_to_as;
int pos = 0;
xbt_dynar_foreach(links, cpt, link) {
static void floyd_get_route(AS_t asg, const char *src, const char *dst, route_t res)
{
- xbt_assert(asg && src
- && dst,
- "Invalid params for \"get_route\" function at AS \"%s\"",
- asg->name);
/* set utils vars */
as_floyd_t as = (as_floyd_t)asg;
generic_src_dst_check(asg, src, dst);
int *src_id = xbt_dict_get_or_null(asg->to_index, src);
int *dst_id = xbt_dict_get_or_null(asg->to_index, dst);
- xbt_assert(src_id
- && dst_id,
- "Ask for route \"from\"(%s) or \"to\"(%s) no found in the local table",
- src, dst);
+ if (src_id == NULL || dst_id == NULL)
+ THROWF(arg_error,0,"No route from '%s' to '%s'",src,dst);
/* create a result route */
&& strcmp(gw_dst, prev_gw_src)) {
xbt_dynar_t e_route_as_to_as=NULL;
routing_get_route_and_latency(gw_dst, prev_gw_src,&e_route_as_to_as,NULL);
- xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"",
- gw_dst, prev_gw_src);
links = e_route_as_to_as;
int pos = 0;
xbt_dynar_foreach(links, cpt, link) {
first = 0;
} while (pred != *src_id);
- xbt_assert(pred != -1, "no route from host %d to %d (\"%s\" to \"%s\")",
- *src_id, *dst_id, src, dst);
+ if (pred == -1)
+ THROWF(arg_error,0,"No route from '%s' to '%s'",src,dst);
if (asg->hierarchy == SURF_ROUTING_RECURSIVE) {
res->src_gateway = xbt_strdup(gw_src);
res->dst_gateway = xbt_strdup(first_gw);
}
-
}
static void floyd_finalize(AS_t rc)
const char *src, const char *dst,
route_t res)
{
- xbt_assert(rc && src
- && dst,
- "Invalid params for \"get_route\" function at AS \"%s\"",
- rc->name);
/* set utils vars */
routing_component_full_t routing = (routing_component_full_t) rc;
int *src_id = xbt_dict_get_or_null(routing->generic_routing.to_index, src);
int *dst_id = xbt_dict_get_or_null(routing->generic_routing.to_index, dst);
- xbt_assert(src_id
- && dst_id,
- "Ask for route \"from\"(%s) or \"to\"(%s) no found in the local table",
- src, dst);
+
+ if (!src_id || !dst_id)
+ THROWF(arg_error,0,"No route from '%s' to '%s'",src,dst);
route_t e_route = NULL;
void *link;
}
static void none_parse_AS(AS_t rc, const char *name) {
- /* even don't care about sub-ASes */
+ /* even don't care about sub-ASes -- I'm as nihilist as an old punk*/
}
/* Creation routing model functions */
are_processing_units = 0;
rule_list = routing->list_ASroute;
} else
- xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found in "
- "the local table", src, dst);
+ THROWF(arg_error,0,"No route from '%s' to '%s'",src,dst);
int rc_src = -1;
int rc_dst = -1;
} else if (!strcmp(src, dst) && are_processing_units) {
xbt_dynar_push(route->link_list, &(global_routing->loopback));
} else {
- xbt_dynar_reset(route->link_list);
+ THROWF(arg_error,0,"No route from '%s' to '%s'??",src,dst);
+ //xbt_dynar_reset(route->link_list);
}
if (!are_processing_units && !xbt_dynar_is_empty(route->link_list)) {