xbt_dynar_foreach(tab_elements_num,cpt,elmts) {
    host_id   = bprintf("%s%d%s", cluster->prefix, elmts, cluster->suffix);
    router_id = bprintf("ns3_%s%d%s", cluster->prefix, elmts, cluster->suffix);
    XBT_DEBUG("Create link from '%s' to '%s'",host_id,router_id);

    ns3_node_t host_src = ns3_find_host(host_id);
    ns3_node_t host_dst = ns3_find_host(router_id);

    xbt_assert(host_src && host_dst, "\tns3_add_link from %d to %d",host_src->node_num,host_dst->node_num);

    ns3_add_link(host_src->node_num, host_dst->node_num, bw,lat);

    free(router_id);
    free(host_id);
  }
Exemple #2
0
  xbt_dynar_foreach(tab_elements_num,cpt,elmts)
  {
    host_id   = bprintf("%s%d%s", cluster_prefix, elmts, cluster_suffix);
    router_id = bprintf("ns3_%s%d%s", cluster_prefix, elmts, cluster_suffix);
    XBT_DEBUG("Create link from '%s' to '%s'",host_id,router_id);

    ns3_nodes_t host_src = xbt_lib_get_or_null(host_lib,host_id,  NS3_HOST_LEVEL);
    ns3_nodes_t host_dst = xbt_lib_get_or_null(host_lib,router_id,NS3_HOST_LEVEL);

    if(host_src && host_dst){}
    else xbt_die("\tns3_add_link from %d to %d",host_src->node_num,host_dst->node_num);

    ns3_add_link(host_src->node_num,host_src->type,
                 host_dst->node_num,host_dst->type,
                 bw,lat);

    free(router_id);
    free(host_id);
  }