- if ( (route->symmetrical == TRUE && as_route == 0)
- || (route->symmetrical == TRUE && as_route == 1)
- )
- {
- if(TO_FLOYD_LINK(dst_net_elm->getId(), src_net_elm->getId()))
- {
- if(!route->gw_dst && !route->gw_src)
- XBT_DEBUG("See Route from \"%s\" to \"%s\"", dst, src);
- else
- XBT_DEBUG("See ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
- route->gw_src->getName(), src, route->gw_dst->getName());
- char * link_name;
- unsigned int i;
- xbt_dynar_t link_route_to_test = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
- for(i=xbt_dynar_length(route->link_list) ;i>0 ;i--)
- {
- link_name = xbt_dynar_get_as(route->link_list,i-1,char *);
- void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
- xbt_assert(link,"Link : '%s' doesn't exists.",link_name);
- xbt_dynar_push(link_route_to_test,&link);
- }
- xbt_assert(!xbt_dynar_compare(
- TO_FLOYD_LINK(dst_net_elm->getId(), src_net_elm->getId())->link_list,
- link_route_to_test,
- (int_f_cpvoid_cpvoid_t) floyd_pointer_resource_cmp),
- "The route between \"%s\" and \"%s\" already exists", src,dst);
+ TO_FLOYD_LINK(src->id(), dst->id()) = newExtendedRoute(hierarchy_, route, 1);
+ TO_FLOYD_PRED(src->id(), dst->id()) = src->id();
+ TO_FLOYD_COST(src->id(), dst->id()) = (TO_FLOYD_LINK(src->id(), dst->id()))->link_list->size();
+
+
+ if (route->symmetrical == TRUE) {
+ if (route->gw_dst) // AS route (to adapt the error message, if any)
+ xbt_assert(nullptr == TO_FLOYD_LINK(dst->id(), src->id()),
+ "The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.",
+ dst->name(),route->gw_dst->name(),src->name(),route->gw_src->name());
+ else
+ xbt_assert(nullptr == TO_FLOYD_LINK(dst->id(), src->id()),
+ "The route between %s and %s already exists. You should not declare the reverse path as symmetrical.",
+ dst->name(),src->name());
+
+ if(route->gw_dst && route->gw_src) {
+ NetCard* gw_tmp = route->gw_src;
+ route->gw_src = route->gw_dst;
+ route->gw_dst = gw_tmp;