- if(TO_FLOYD_LINK(dst->id(), src->id()))
- {
- if(!route->gw_dst && !route->gw_src)
- XBT_DEBUG("See Route from \"%s\" to \"%s\"", dst->name(), src->name());
- else
- XBT_DEBUG("See ASroute from \"%s(%s)\" to \"%s(%s)\"", dst->name(), route->gw_src->name(), src->name(), route->gw_dst->name());
-
- char * link_name;
- xbt_dynar_t link_route_to_test = xbt_dynar_new(sizeof(Link*), NULL);
- for(int i=xbt_dynar_length(route->link_list) ;i>0 ;i--) {
- link_name = xbt_dynar_get_as(route->link_list,i-1,char *);
- void *link = Link::byName(link_name);
- 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->id(), src->id())->link_list,
- link_route_to_test,
- (int_f_cpvoid_cpvoid_t) floyd_pointer_resource_cmp),
- "The route between \"%s\" and \"%s\" already exists", src->name(),dst->name());
+ 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;