int COORD_HOST_LEVEL=0; //Coordinates level
int NS3_HOST_LEVEL; //host node for ns3
+xbt_dict_t watched_hosts_lib;
+
/**
* @ingroup SURF_build_api
* @brief A library containing all known links
{NULL, NULL, NULL, NULL}
};
+/**
+ * \brief Add a "host_link" to the network element list
+ */
+static void parse_S_host_link(sg_platf_host_link_cbarg_t host)
+{
+ sg_routing_edge_t info = NULL;
+ info = xbt_lib_get_or_null(host_lib, host->id, ROUTING_HOST_LEVEL);
+ xbt_assert(info, "Host '%s' not found!",host->id);
+ xbt_assert(current_routing->model_desc == &routing_models[SURF_MODEL_CLUSTER],
+ "You have to be in model Cluster to use tag host_link!");
+
+ s_surf_parsing_link_up_down_t link_up_down;
+ link_up_down.link_up = xbt_lib_get_or_null(link_lib, host->link_up, SURF_LINK_LEVEL);
+ link_up_down.link_down = xbt_lib_get_or_null(link_lib, host->link_down, SURF_LINK_LEVEL);
+
+ xbt_assert(link_up_down.link_up, "Link '%s' not found!",host->link_up);
+ xbt_assert(link_up_down.link_down, "Link '%s' not found!",host->link_down);
+
+ if(!current_routing->link_up_down_list)
+ current_routing->link_up_down_list = xbt_dynar_new(sizeof(s_surf_parsing_link_up_down_t),NULL);
+
+ // If dynar is is greater than edge id and if the host_link is already defined
+ if(xbt_dynar_length(current_routing->link_up_down_list) > info->id &&
+ xbt_dynar_get_as(current_routing->link_up_down_list,info->id,void*))
+ xbt_die("Host_link for '%s' is already defined!",host->id);
+
+ XBT_INFO("Push Host_link for host '%s' to position %d",info->name,info->id);
+ xbt_dynar_set_as(current_routing->link_up_down_list,info->id,s_surf_parsing_link_up_down_t,link_up_down);
+}
+
/**
* \brief Add a "host" to the network element list
*/
if (src_father == dst_father) { /* SURF_ROUTING_BASE */
route.link_list = *links;
common_father->get_route_and_latency(common_father, src, dst, &route,latency);
+ // if vivaldi latency+=vivaldi(src,dst)
return;
}
/* If source gateway is not our source, we have to recursively find our way up to this point */
if (src != src_gateway_net_elm)
_get_route_and_latency(src, src_gateway_net_elm, links, latency);
-
xbt_dynar_merge(links, &route.link_list);
/* If dest gateway is not our destination, we have to recursively find our way from this point */
if (dst_gateway_net_elm != dst)
_get_route_and_latency(dst_gateway_net_elm, dst, links, latency);
+
+ // if vivaldi latency+=vivaldi(src_gateway,dst_gateway)
}
/**
/* ************************************************************************** */
/* ************************* GENERIC PARSE FUNCTIONS ************************ */
+void routing_cluster_add_backbone(void* bb) {
+ xbt_assert(current_routing->model_desc == &routing_models[SURF_MODEL_CLUSTER],
+ "You have to be in model Cluster to use tag backbone!");
+ xbt_assert(!((as_cluster_t)current_routing)->backbone,"The backbone link is already defined!");
+ ((as_cluster_t)current_routing)->backbone = bb;
+ XBT_DEBUG("Add a backbone to AS '%s'",current_routing->name);
+}
+
static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
{
char *host_id, *groups, *link_id = NULL;
sg_platf_new_link(&link);
- surf_routing_cluster_add_backbone(current_routing, xbt_lib_get_or_null(link_lib, link_backbone, SURF_LINK_LEVEL));
+ routing_cluster_add_backbone(xbt_lib_get_or_null(link_lib, link_backbone, SURF_LINK_LEVEL));
free(link_backbone);
}
{
sg_platf_host_add_cb(parse_S_host);
sg_platf_router_add_cb(parse_S_router);
+ sg_platf_host_link_add_cb(parse_S_host_link);
surfxml_add_callback(STag_surfxml_random_cb_list, &routing_parse_Srandom);