+/**
+ * @ingroup SURF_build_api
+ * @brief A library containing all known workstations
+ */
+xbt_lib_t host_lib;
+
+int ROUTING_HOST_LEVEL; //Routing level
+int SURF_CPU_LEVEL; //Surf cpu level
+int SURF_WKS_LEVEL; //Surf workstation level
+int SIMIX_HOST_LEVEL; //Simix level
+int MSG_HOST_LEVEL; //Msg level
+int SD_HOST_LEVEL; //Simdag level
+int COORD_HOST_LEVEL=0; //Coordinates level
+int NS3_HOST_LEVEL; //host node for ns3
+
+/**
+ * @ingroup SURF_build_api
+ * @brief A library containing all known links
+ */
+xbt_lib_t link_lib;
+int SD_LINK_LEVEL; //Simdag level
+int SURF_LINK_LEVEL; //Surf level
+int NS3_LINK_LEVEL; //link for ns3
+
+xbt_lib_t as_router_lib;
+int ROUTING_ASR_LEVEL; //Routing level
+int COORD_ASR_LEVEL; //Coordinates level
+int NS3_ASR_LEVEL; //host node for ns3
+
+static xbt_dict_t random_value = NULL;
+
+/* Global vars */
+routing_global_t global_routing = NULL;
+AS_t current_routing = NULL;
+
+/* global parse functions */
+xbt_dynar_t parsed_link_list = NULL; /* temporary store of current list link of a route */
+extern xbt_dynar_t mount_list;
+
+static const char *src = NULL; /* temporary store the source name of a route */
+static const char *dst = NULL; /* temporary store the destination name of a route */
+static char *gw_src = NULL; /* temporary store the gateway source name of a route */
+static char *gw_dst = NULL; /* temporary store the gateway destination name of a route */
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
+
+static void routing_parse_peer(sg_platf_peer_cbarg_t peer); /* peer bypass */
+static void routing_parse_Srandom(void); /* random bypass */
+
+static void routing_parse_postparse(void);
+
+/* this lines are only for replace use like index in the model table */
+typedef enum {
+ SURF_MODEL_FULL = 0,
+ SURF_MODEL_FLOYD,
+ SURF_MODEL_DIJKSTRA,
+ SURF_MODEL_DIJKSTRACACHE,
+ SURF_MODEL_NONE,
+ SURF_MODEL_RULEBASED,
+ SURF_MODEL_VIVALDI,
+ SURF_MODEL_CLUSTER
+} e_routing_types;
+
+struct s_model_type routing_models[] = {
+ {"Full",
+ "Full routing data (fast, large memory requirements, fully expressive)",
+ model_full_create, model_full_end},
+ {"Floyd",
+ "Floyd routing data (slow initialization, fast lookup, lesser memory requirements, shortest path routing only)",
+ model_floyd_create, model_floyd_end},
+ {"Dijkstra",
+ "Dijkstra routing data (fast initialization, slow lookup, small memory requirements, shortest path routing only)",
+ model_dijkstra_create, model_dijkstra_both_end},
+ {"DijkstraCache",
+ "Dijkstra routing data (fast initialization, fast lookup, small memory requirements, shortest path routing only)",
+ model_dijkstracache_create, model_dijkstra_both_end},
+ {"none", "No routing (Unless you know what you are doing, avoid using this mode in combination with a non Constant network model).",
+ model_none_create, NULL},
+ {"RuleBased", "Rule-Based routing data (...)",
+ model_rulebased_create, NULL},
+ {"Vivaldi", "Vivaldi routing",
+ model_vivaldi_create, NULL},
+ {"Cluster", "Cluster routing",
+ model_cluster_create, NULL},
+ {NULL, NULL, NULL, NULL}
+};
+
+/**
+ * \brief Add a "host" to the network element list
+ */
+static void parse_S_host(sg_platf_host_cbarg_t host)
+{
+ network_element_t info = NULL;
+ if (current_routing->hierarchy == SURF_ROUTING_NULL)
+ current_routing->hierarchy = SURF_ROUTING_BASE;
+ xbt_assert(!xbt_lib_get_or_null(host_lib, host->id, ROUTING_HOST_LEVEL),
+ "Reading a host, processing unit \"%s\" already exists", host->id);
+
+ info = xbt_new0(s_network_element_t, 1);
+ info->rc_component = current_routing;
+ info->rc_type = SURF_NETWORK_ELEMENT_HOST;
+ info->name = xbt_strdup(host->id);
+ info->id = current_routing->parse_PU(current_routing, (void *) info);
+ xbt_lib_set(host_lib, host->id, ROUTING_HOST_LEVEL, (void *) info);
+ XBT_DEBUG("Having set name '%s' id '%d'",host->id,info->id);
+
+ if(mount_list){
+ xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list);
+ mount_list = NULL;
+ }
+
+ if (host->coord && strcmp(host->coord, "")) {
+ unsigned int cursor;
+ char*str;
+
+ if (!COORD_HOST_LEVEL)
+ xbt_die ("To use host coordinates, please add --cfg=network/coordinates:yes to your command line");
+ /* Pre-parse the host coordinates -- FIXME factorize with routers by overloading the routing->parse_PU function*/
+ xbt_dynar_t ctn_str = xbt_str_split_str(host->coord, " ");
+ xbt_dynar_t ctn = xbt_dynar_new(sizeof(double),NULL);
+ xbt_dynar_foreach(ctn_str,cursor, str) {
+ double val = atof(str);
+ xbt_dynar_push(ctn,&val);