XBT_PUBLIC(void) sg_platf_new_process(sg_platf_process_cbarg_t process);
// Add route and Asroute without xml file with those functions
-XBT_PUBLIC(void) sg_platf_route_begin (sg_platf_route_cbarg_t route); // Initialize route
+XBT_PUBLIC(void) sg_platf_route_begin (sg_platf_route_cbarg_t route); // Initialize route FIXME:KILLME
XBT_PUBLIC(void) sg_platf_route_end (sg_platf_route_cbarg_t route); // Finalize and add a route
XBT_PUBLIC(void) sg_platf_route_add_link (const char* link_id, sg_platf_route_cbarg_t route); // Add a link to link list
{
const char *src = route->src;
const char *dst = route->dst;
-
- if(!route->gw_dst && !route->gw_src)
- XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
- else{
- XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
- route->gw_src->name(), dst, route->gw_dst->name());
- if(route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL)
- surf_parse_error("The gw_dst '%s' does not exist!",route->gw_dst->name());
- if(route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL)
- surf_parse_error("The gw_src '%s' does not exist!",route->gw_src->name());
- }
-
NetCard *src_net_elm = sg_netcard_by_name_or_null(src);
NetCard *dst_net_elm = sg_netcard_by_name_or_null(dst);
- xbt_assert(src_net_elm, "Network elements %s not found", src);
- xbt_assert(dst_net_elm, "Network elements %s not found", dst);
+ parseRouteCheckParams(route);
/* Create the topology graph */
if(!p_routeGraph)
if(!route->gw_dst && !route->gw_src)
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
else
- XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
- route->gw_dst->name(), src, route->gw_src->name());
+ XBT_DEBUG("Load ASroute from %s@%s to %s@%s", dst, route->gw_dst->name(), src, route->gw_src->name());
xbt_dynar_t nodes = xbt_graph_get_nodes(p_routeGraph);
xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_net_elm->id(), xbt_node_t);
xbt_edge_t edge = xbt_graph_get_edge(p_routeGraph, node_e_v, node_s_v);
if (edge)
- THROWF(arg_error,0, "Route from '%s' to '%s' already exists",src,dst);
+ THROWF(arg_error,0, "Route from %s@%s to %s@%s already exists", dst, route->gw_dst->name(), src, route->gw_src->name());
if (route->gw_dst && route->gw_src) {
NetCard *gw_tmp = route->gw_src;
NetCard *src_net_elm = sg_netcard_by_name_or_null(src);
NetCard *dst_net_elm = sg_netcard_by_name_or_null(dst);
- xbt_assert(src_net_elm, "Network elements %s not found", src);
- xbt_assert(dst_net_elm, "Network elements %s not found", dst);
+ parseRouteCheckParams(route);
if(!p_linkTable)
{
TO_FLOYD_LINK(i, j) = NULL; /* fixed, missing in the previous version */
}
}
- if(!route->gw_dst && !route->gw_src)
- XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
- else{
- XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
- route->gw_src->name(), dst, route->gw_dst->name());
- if(route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL)
- surf_parse_error("The dst_gateway '%s' does not exist!",route->gw_dst->name());
- if(route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL)
- surf_parse_error("The src_gateway '%s' does not exist!",route->gw_src->name());
- }
if(TO_FLOYD_LINK(src_net_elm->id(), dst_net_elm->id()))
{
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, missing in the previous version */
+ TO_FLOYD_LINK(i, j) = NULL;
}
}
NetCard *src_net_elm = sg_netcard_by_name_or_null(src);
NetCard *dst_net_elm = sg_netcard_by_name_or_null(dst);
- xbt_assert(src_net_elm, "Network elements %s not found", src);
- xbt_assert(dst_net_elm, "Network elements %s not found", dst);
+ parseRouteCheckParams(route);
size_t table_size = xbt_dynar_length(vertices_);
- xbt_assert(!xbt_dynar_is_empty(route->link_list),
- "Invalid count of links, must be greater than zero (%s,%s)",
- src, dst);
-
if (!p_routingTable)
p_routingTable = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);
if (!route->gw_src && !route->gw_dst)
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
else {
- // FIXME We can call a gw which is down the current AS (cf g5k.xml) but not upper.
- // AS_t subas = xbt_dict_get_or_null(rc->routing_sons, src);
- // if (subas == NULL)
- // surf_parse_error("The source of an ASroute must be a sub-AS "
- // "declared within the current AS, "
- // "but '%s' is not an AS within '%s'", src, rc->name);
- // if (subas->to_index
- // && xbt_dict_get_or_null(subas->to_index, route->src_gateway) == NULL)
- // surf_parse_error("In an ASroute, source gateway must be part of "
- // "the source sub-AS (in particular, being in a "
- // "sub-sub-AS is not allowed), "
- // "but '%s' is not in '%s'.",
- // route->src_gateway, subas->name);
- //
- // subas = xbt_dict_get_or_null(rc->routing_sons, dst);
- // if (subas == NULL)
- // surf_parse_error("The destination of an ASroute must be a sub-AS "
- // "declared within the current AS, "
- // "but '%s' is not an AS within '%s'", dst, rc->name);
- // if (subas->to_index
- // && xbt_dict_get_or_null(subas->to_index, route->dst_gateway) == NULL)
- // surf_parse_error("In an ASroute, destination gateway must be "
- // "part of the destination sub-AS (in particular, "
- // "in a sub-sub-AS is not allowed), "
- // "but '%s' is not in '%s'.",
- // route->dst_gateway, subas->name);
XBT_DEBUG("Load ASroute from \"%s\" to \"%s\"", src, dst);
- if (!route->gw_src ||
- route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL)
- surf_parse_error("The src_gateway \"%s\" does not exist!",
- route->gw_src ? route->gw_src->name() : "(null)");
- if (!route->gw_dst ||
- route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL)
+ if (!route->gw_src || route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL)
+ surf_parse_error("The src_gateway \"%s\" does not exist!",
+ route->gw_src ? route->gw_src->name() : "(null)");
+ if (!route->gw_dst || route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL)
surf_parse_error("The dst_gateway \"%s\" does not exist!",
route->gw_dst ? route->gw_dst->name() : "(null)");
XBT_DEBUG("ASroute goes from \"%s\" to \"%s\"",
if (TO_ROUTE_FULL(dst_net_elm->id(), src_net_elm->id())) {
char *link_name;
unsigned int i;
- xbt_dynar_t link_route_to_test =
- xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
+ 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 = Link::byName(link_name);
if (hierarchy == SURF_ROUTING_RECURSIVE) {
xbt_assert(routearg->gw_src && routearg->gw_dst,
- "NULL is obviously a bad gateway");
+ "NULL is obviously a deficient gateway");
/* remember not erase the gateway names */
result->gw_src = routearg->gw_src;
"Internal error: route destination %s@%s is not in AS %s as expected (route source: %s@%s). Please report that bug.",
src->name(), dst->name(), src_as->name_, dst_as->name_, name_);
}
+void AsGeneric::parseRouteCheckParams(sg_platf_route_cbarg_t route) {
+ const char *src = route->src;
+ const char *dst = route->dst;
+ NetCard *src_net_elm = sg_netcard_by_name_or_null(src);
+ NetCard *dst_net_elm = sg_netcard_by_name_or_null(dst);
+
+ if(!route->gw_dst && !route->gw_src) {
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
+ xbt_assert(src_net_elm, "Cannot add a route from %s to %s: %s does not exist.", src, dst, src);
+ xbt_assert(dst_net_elm, "Cannot add a route from %s to %s: %s does not exist.", src, dst, dst);
+ xbt_assert(!xbt_dynar_is_empty(route->link_list), "Empty route (between %s and %s) forbidden.", src, dst);
+ } else {
+ XBT_DEBUG("Load ASroute from %s@%s to %s@%s", src, route->gw_src->name(), dst, route->gw_dst->name());
+ xbt_assert(src_net_elm, "Cannot add a route from %s@%s to %s@%s: %s does not exist.",
+ src,route->gw_src->name(), dst,route->gw_dst->name(), src);
+ xbt_assert(dst_net_elm, "Cannot add a route from %s@%s to %s@%s: %s does not exist.",
+ src,route->gw_src->name(), dst,route->gw_dst->name(), dst);
+ xbt_assert(!xbt_dynar_is_empty(route->link_list), "Empty route (between %s@%s and %s@%s) forbidden.",
+ src,route->gw_src->name(), dst,route->gw_dst->name());
+ }
+}
}
}
virtual void parseBypassroute(sg_platf_route_cbarg_t e_route) override;
virtual sg_platf_route_cbarg_t newExtendedRoute(e_surf_routing_hierarchy_t hierarchy, sg_platf_route_cbarg_t routearg, int change_order);
- virtual void srcDstCheck(NetCard *src, NetCard *dst);
+protected:
+ void srcDstCheck(NetCard *src, NetCard *dst);
+ void parseRouteCheckParams(sg_platf_route_cbarg_t route);
};
}