Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
catch a given possible misconfiguration, and give more informative messages
[simgrid.git] / src / surf / surf_routing_full.c
index cc9c5419c18d5e52557751c89d782a6575337737..23654dfaaa6350adfdfb3d639c39e27385665244 100644 (file)
@@ -8,6 +8,7 @@
 
 /* Global vars */
 extern routing_global_t global_routing;
+extern int surf_parse_lineno;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 
@@ -190,17 +191,28 @@ void model_full_set_route(AS_t rc, const char *src,
                        xbt_assert(link,"Link : '%s' doesn't exists.",link_name);
                        xbt_dynar_push(link_route_to_test,&link);
                }
-               xbt_assert(!xbt_dynar_compare(
-                         (void*)TO_ROUTE_FULL(*src_id, *dst_id)->link_list,
-                         (void*)link_route_to_test,
-                         (int_f_cpvoid_cpvoid_t) full_pointer_resource_cmp),
-                         "The route between \"%s\" and \"%s\" already exists. If you are trying to define a reverse route, you must set the symmetrical=no attribute to your routes tags.", src,dst);
+               if (xbt_dynar_compare((void*)TO_ROUTE_FULL(*src_id, *dst_id)->link_list,
+                                             (void*)link_route_to_test,
+                                             (int_f_cpvoid_cpvoid_t) full_pointer_resource_cmp)) {
+                       surf_parse_error("A route between \"%s\" and \"%s\" already exists with a different content. "
+                                                "If you are trying to define a reverse route, you must set the symmetrical=no "
+                                                "attribute to your routes tags.", src,dst);
+               } else {
+                       surf_parse_warn("Ignoring the identical redefinition of the route between \"%s\" and \"%s\"",src,dst);
+               }
        }
        else
        {
                  if(!route->dst_gateway && !route->src_gateway)
                          XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
                  else{
+                         if (xbt_dict_get_or_null(rc->to_index, route->src_gateway) == NULL)
+                                 surf_parse_error("The ASroute source gateway must be part of the current AS (being in a sub-AS is not enough), but '%s' is not in '%s'.",
+                                                 route->src_gateway,rc->name);
+                         if (xbt_dict_get_or_null(rc->to_index, route->dst_gateway) == NULL)
+                                 surf_parse_error("The ASroute destination gateway must be part of the current AS (being in a sub-AS is not enough), but '%s' is not in '%s'.",
+                                                 route->dst_gateway,rc->name);
+
                          XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
                                 route->src_gateway, dst, route->dst_gateway);
                          if(routing_get_network_element_type((const char*)route->dst_gateway) == SURF_NETWORK_ELEMENT_NULL)