xbt_free(global_routing);
}
+static void get_onelink_routes(void)
+{
+ xbt_die("get_onelink_routes function not implemented yet!!!");
+}
+
+static int is_router(const char *name)
+{
+ xbt_die("is_router function not implemented yet!!!");
+}
+
/**
* \brief Generic method: create the global routing schema
*
/* Business methods */
static route_extended_t rulebased_get_route(routing_component_t rc, const char* src,const char* dst) {
xbt_assert1(rc&&src&&dst, "Invalid params for \"get_route\" function at AS \"%s\"",rc->name);
-
+
/* set utils vars */
routing_component_rulebased_t routing = (routing_component_rulebased_t) rc;
} else
xbt_assert2(NULL, "Ask for route \"from\"(%s) or \"to\"(%s) no found in the local table",src,dst);
- int rc_src,rc_dst;
+ int rc_src = -1;
+ int rc_dst = -1;
int src_length = (int)strlen(src);
int dst_length = (int)strlen(dst);
if(rc_src >= 0 && rc_dst >= 0) {
new_e_route = xbt_new0(s_route_extended_t,1);
new_e_route->generic_route.link_list = links_list;
+ } else if( !strcmp(src,dst) && are_processing_units ) {
+ new_e_route = xbt_new0(s_route_extended_t,1);
+ xbt_dynar_push(links_list,&(global_routing->loopback));
+ new_e_route->generic_route.link_list = links_list;
+ } else {
+ xbt_dynar_free(&link_list);
}
-
+
if(!are_processing_units && new_e_route)
{
rule_route_extended_t ruleroute_extended = (rule_route_extended_t)ruleroute;
static void routing_full_parse_Scluster(void)
{
+ static int AX_ptr = 0;
char *cluster_id = A_surfxml_cluster_id;
char *cluster_prefix = A_surfxml_cluster_prefix;
int start, end, i;
xbt_dynar_t radical_elements;
xbt_dynar_t radical_ends;
- static int AX_ptr = 0;
- static int surfxml_bufferstack_size = 2048;
- /* allocating memory for the buffer, I think 2kB should be enough */
- surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
+ static unsigned int surfxml_buffer_stack_stack_ptr = 1;
+ static unsigned int surfxml_buffer_stack_stack[1024];
+
+ surfxml_buffer_stack_stack[0]= 0;
-// DEBUG4("id='%s' prefix='%s' suffix='%s' radical='%s'",
-// cluster_id,cluster_prefix,cluster_suffix,cluster_radical);
-// DEBUG5("power='%s' bw='%s' lat='%s' bb_bw='%s' bb_lat='%s'",
-// cluster_power,cluster_bw,cluster_lat,cluster_bb_bw,cluster_bb_lat);
+ surfxml_bufferstack_push(1);
DEBUG1("<AS id=\"%s\"\trouting=\"RuleBased\">",cluster_id);
SURFXML_BUFFER_SET(AS_id, cluster_id);
link_id = bprintf("%s_link_%d", cluster_id, start);
DEBUG2("<host\tid=\"%s\"\tpower=\"%s\"/>",host_id,cluster_power);
- SURFXML_BUFFER_RESET();
SURFXML_BUFFER_SET(host_id, host_id);
SURFXML_BUFFER_SET(host_power, cluster_power);
SURFXML_BUFFER_SET(host_availability, "1.0");
SURFXML_END_TAG(host);
DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>",link_id,cluster_bw,cluster_lat);
- SURFXML_BUFFER_RESET();
SURFXML_BUFFER_SET(link_id, link_id);
SURFXML_BUFFER_SET(link_bandwidth, cluster_bw);
SURFXML_BUFFER_SET(link_latency, cluster_lat);
surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
surf_parse_get_int(&end, xbt_dynar_get_as(radical_ends, 1, char *));
+ DEBUG2("Create hosts and links from %d to %d",start,end);
for (i = start; i <= end; i++)
{
host_id = bprintf("%s%d%s", cluster_prefix, i, cluster_suffix);
link_id = bprintf("%s_link_%d", cluster_id, i);
DEBUG2("<host\tid=\"%s\"\tpower=\"%s\"/>",host_id,cluster_power);
- SURFXML_BUFFER_RESET();
SURFXML_BUFFER_SET(host_id, host_id);
SURFXML_BUFFER_SET(host_power, cluster_power);
SURFXML_BUFFER_SET(host_availability, "1.0");
SURFXML_END_TAG(host);
DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>",link_id,cluster_bw,cluster_lat);
- SURFXML_BUFFER_RESET();
SURFXML_BUFFER_SET(link_id, link_id);
SURFXML_BUFFER_SET(link_bandwidth, cluster_bw);
SURFXML_BUFFER_SET(link_latency, cluster_lat);
link_backbone = bprintf("%s_backbone",cluster_id);
DEBUG1("<router id=\"%s\"\">",router_id);
- SURFXML_BUFFER_RESET();
SURFXML_BUFFER_SET(router_id, router_id);;
SURFXML_START_TAG(router);
SURFXML_END_TAG(router);
DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>",link_router,cluster_bw,cluster_lat);
- SURFXML_BUFFER_RESET();
SURFXML_BUFFER_SET(link_id, link_router);
SURFXML_BUFFER_SET(link_bandwidth, cluster_bw);
SURFXML_BUFFER_SET(link_latency, cluster_lat);
SURFXML_END_TAG(link);
DEBUG3("<link\tid=\"%s\"\tbw=\"%s\"\tlat=\"%s\"/>",link_backbone,cluster_bb_bw,cluster_bb_lat);
- SURFXML_BUFFER_RESET();
SURFXML_BUFFER_SET(link_id, link_backbone);
SURFXML_BUFFER_SET(link_bandwidth, cluster_bb_bw);
SURFXML_BUFFER_SET(link_latency, cluster_bb_lat);
DEBUG0(" ");
DEBUG2("<route\tsrc=\"%s\"\tdst=\"%s\">",route_src_dst,route_src_dst);
- SURFXML_BUFFER_RESET();
SURFXML_BUFFER_SET(route_src, route_src_dst);
SURFXML_BUFFER_SET(route_dst, route_src_dst);
SURFXML_START_TAG(route);
DEBUG1("<link:ctn\tid=\"%s_link_$1src\"/>",cluster_id);
- SURFXML_BUFFER_RESET();
SURFXML_BUFFER_SET(link_c_ctn_id, bprintf("%s_link_$1src",cluster_id));
SURFXML_START_TAG(link_c_ctn);
SURFXML_END_TAG(link_c_ctn);
DEBUG1("<link:ctn\tid=\"%s_backbone\"/>",cluster_id);
- SURFXML_BUFFER_RESET();
SURFXML_BUFFER_SET(link_c_ctn_id, bprintf("%s_backbone",cluster_id));
SURFXML_START_TAG(link_c_ctn);
SURFXML_END_TAG(link_c_ctn);
DEBUG1("<link:ctn\tid=\"%s_link_$1dst\"/>",cluster_id);
- SURFXML_BUFFER_RESET();
SURFXML_BUFFER_SET(link_c_ctn_id, bprintf("%s_link_$1dst",cluster_id));
SURFXML_START_TAG(link_c_ctn);
SURFXML_END_TAG(link_c_ctn);
SURFXML_END_TAG(AS);
DEBUG0(" ");
+ surfxml_bufferstack_pop(1);
}