+ sg_platf_begin();
+}
+void ETag_surfxml_platform(void){
+ sg_platf_end();
+}
+
+void STag_surfxml_host(void){
+ xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
+}
+
+void ETag_surfxml_host(void) {
+ s_sg_platf_host_cbarg_t host;
+ memset(&host,0,sizeof(host));
+
+ host.properties = current_property_set;
+
+ host.id = A_surfxml_host_id;
+ host.power_peak = get_cpu_power(A_surfxml_host_power);
+ host.power_scale = surf_parse_get_double( A_surfxml_host_availability);
+ host.core_amount = surf_parse_get_int(A_surfxml_host_core);
+ host.power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
+ host.state_trace = tmgr_trace_new(A_surfxml_host_state_file);
+ xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) ||
+ (A_surfxml_host_state == A_surfxml_host_state_OFF), "Invalid state");
+ if (A_surfxml_host_state == A_surfxml_host_state_ON)
+ host.initial_state = SURF_RESOURCE_ON;
+ if (A_surfxml_host_state == A_surfxml_host_state_OFF)
+ host.initial_state = SURF_RESOURCE_OFF;
+ host.coord = A_surfxml_host_coordinates;
+
+ sg_platf_new_host(&host);
+ current_property_set = NULL;
+}
+
+void STag_surfxml_router(void){
+ s_sg_platf_router_cbarg_t router;
+ memset(&router, 0, sizeof(router));
+
+ router.id = A_surfxml_router_id;
+ router.coord = A_surfxml_router_coordinates;
+
+ sg_platf_new_router(&router);
+}
+
+void STag_surfxml_cluster(void){
+ s_sg_platf_cluster_cbarg_t cluster;
+ memset(&cluster,0,sizeof(cluster));
+ cluster.id = A_surfxml_cluster_id;
+ cluster.prefix = A_surfxml_cluster_prefix;
+ cluster.suffix = A_surfxml_cluster_suffix;
+ cluster.radical = A_surfxml_cluster_radical;
+ cluster.power= surf_parse_get_double(A_surfxml_cluster_power);
+ cluster.core_amount = surf_parse_get_int(A_surfxml_cluster_core);
+ cluster.bw = surf_parse_get_double(A_surfxml_cluster_bw);
+ cluster.lat = surf_parse_get_double(A_surfxml_cluster_lat);
+ if(strcmp(A_surfxml_cluster_bb_bw,""))
+ cluster.bb_bw = surf_parse_get_double(A_surfxml_cluster_bb_bw);
+ if(strcmp(A_surfxml_cluster_bb_lat,""))
+ cluster.bb_lat = surf_parse_get_double(A_surfxml_cluster_bb_lat);
+ cluster.router_id = A_surfxml_cluster_router_id;
+
+ switch (AX_surfxml_cluster_sharing_policy) {
+ case A_surfxml_cluster_sharing_policy_SHARED:
+ cluster.sharing_policy = SURF_LINK_SHARED;
+ break;
+ case A_surfxml_cluster_sharing_policy_FULLDUPLEX:
+ cluster.sharing_policy = SURF_LINK_FULLDUPLEX;
+ break;
+ case A_surfxml_cluster_sharing_policy_FATPIPE:
+ cluster.sharing_policy = SURF_LINK_FATPIPE;
+ break;
+ default:
+ surf_parse_error("Invalid cluster sharing policy for cluster %s",
+ cluster.id);
+ break;
+ }
+ switch (AX_surfxml_cluster_bb_sharing_policy) {
+ case A_surfxml_cluster_bb_sharing_policy_FATPIPE:
+ cluster.bb_sharing_policy = SURF_LINK_FATPIPE;
+ break;
+ case A_surfxml_cluster_bb_sharing_policy_SHARED:
+ cluster.bb_sharing_policy = SURF_LINK_SHARED;
+ break;
+ default:
+ surf_parse_error("Invalid bb sharing policy in cluster %s",
+ cluster.id);
+ break;
+ }
+
+ cluster.availability_trace = A_surfxml_cluster_availability_file;
+ cluster.state_trace = A_surfxml_cluster_state_file;
+ sg_platf_new_cluster(&cluster);
+}
+void ETag_surfxml_cluster(void){
+ /* nothing I can think of */
+}
+
+void STag_surfxml_peer(void){
+ s_sg_platf_peer_cbarg_t peer;
+ memset(&peer,0,sizeof(peer));
+ peer.id = A_surfxml_peer_id;
+ peer.power = surf_parse_get_double(A_surfxml_peer_power);
+ peer.bw_in = surf_parse_get_double(A_surfxml_peer_bw_in);
+ peer.bw_out = surf_parse_get_double(A_surfxml_peer_bw_out);
+ peer.lat = surf_parse_get_double(A_surfxml_peer_lat);
+ peer.coord = A_surfxml_peer_coordinates;
+ peer.availability_trace = tmgr_trace_new(A_surfxml_peer_availability_file);
+ peer.state_trace = tmgr_trace_new(A_surfxml_peer_state_file);
+
+ surfxml_call_cb_functions(STag_surfxml_peer_cb_list);
+ sg_platf_new_peer(&peer);
+}
+void ETag_surfxml_peer(void){
+ /* nothing to do here */
+}
+void STag_surfxml_link(void){
+ xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
+}
+void ETag_surfxml_link(void){
+ s_sg_platf_link_cbarg_t link;
+ memset(&link,0,sizeof(link));
+
+ link.properties = current_property_set;
+
+ link.id = A_surfxml_link_id;
+ link.bandwidth = surf_parse_get_double(A_surfxml_link_bandwidth);
+ link.bandwidth_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
+ link.latency = surf_parse_get_double(A_surfxml_link_latency);
+ link.latency_trace = tmgr_trace_new(A_surfxml_link_latency_file);
+
+ switch (A_surfxml_link_state) {
+ case A_surfxml_link_state_ON:
+ link.state = SURF_RESOURCE_ON;
+ break;
+ case A_surfxml_link_state_OFF:
+ link.state = SURF_RESOURCE_OFF;
+ break;
+ default:
+ surf_parse_error("invalid state for link %s", link.id);
+ break;
+ }
+ link.state_trace = tmgr_trace_new(A_surfxml_link_state_file);
+
+ switch (A_surfxml_link_sharing_policy) {
+ case A_surfxml_link_sharing_policy_SHARED:
+ link.policy = SURF_LINK_SHARED;
+ break;
+ case A_surfxml_link_sharing_policy_FATPIPE:
+ link.policy = SURF_LINK_FATPIPE;
+ break;
+ case A_surfxml_link_sharing_policy_FULLDUPLEX:
+ link.policy = SURF_LINK_FULLDUPLEX;
+ break;
+ default:
+ surf_parse_error("Invalid sharing policy in link %s", link.id);
+ break;
+ }
+
+ sg_platf_new_link(&link);