X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a0c5b1ab11469128ad826610f54b1f0f332bd172..c3119f83962a5b1ef7bc8f79011698c83ce21cda:/src/surf/network_ns3.cpp diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index d78948ce89..9404d6bc43 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -57,7 +57,7 @@ NetPointNs3::NetPointNs3() static void clusterCreation_cb(sg_platf_cluster_cbarg_t cluster) { char* lat = bprintf("%fs", cluster->lat); - char* bw = bprintf("%fBps", cluster->bw); + char* bw = bprintf("%fbps", cluster->bw * 8); for (int i : *cluster->radicals) { // Routers don't create a router on the other end of the private link by themselves. @@ -69,6 +69,7 @@ static void clusterCreation_cb(sg_platf_cluster_cbarg_t cluster) NetPointNs3* host_src = sg_host_by_name(host_id)->pimpl_netpoint->extension(); xbt_assert(host_src, "Cannot find a NS3 host of name %s", host_id); + // Any NS3 route is symmetrical ns3_add_link(host_src, host_dst, bw, lat); delete host_dst; @@ -95,7 +96,7 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->cname(), dst->cname(), link->cname(), (symmetrical ? "(symmetrical)" : "(not symmetrical)")); - char* link_bdw = bprintf("%fBps", link->bandwidth()); + char* link_bdw = bprintf("%fbps", link->bandwidth() * 8); char* link_lat = bprintf("%fs", link->latency()); // XBT_DEBUG("src (%s), dst (%s), src_id = %d, dst_id = %d",src,dst, src_id, dst_id); @@ -108,9 +109,8 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin xbt_assert(host_src != nullptr, "Network element %s does not seem to be NS3-ready", src->cname()); xbt_assert(host_dst != nullptr, "Network element %s does not seem to be NS3-ready", dst->cname()); + // Any NS3 route is symmetrical ns3_add_link(host_src, host_dst, link_bdw, link_lat); - if (symmetrical) - ns3_add_link(host_dst, host_src, link_bdw, link_lat); xbt_free(link_bdw); xbt_free(link_lat); @@ -320,7 +320,6 @@ void NetworkNS3Action::resume() { std::list NetworkNS3Action::links() { THROW_UNIMPLEMENTED; - return nullptr; } /* Test whether a flow is suspended */ @@ -467,7 +466,6 @@ void ns3_add_link(NetPointNs3* src, NetPointNs3* dst, char* bw, char* lat) { ns3::PointToPointHelper pointToPoint; - ns3::NetDeviceContainer netA; ns3::Ipv4AddressHelper address; int srcNum = src->node_num; @@ -480,6 +478,7 @@ void ns3_add_link(NetPointNs3* src, NetPointNs3* dst, char* bw, char* lat) pointToPoint.SetDeviceAttribute ("DataRate", ns3::StringValue (bw)); pointToPoint.SetChannelAttribute ("Delay", ns3::StringValue (lat)); + ns3::NetDeviceContainer netA; netA.Add(pointToPoint.Install (a, b)); char * adr = bprintf("%d.%d.0.0",number_of_networks,number_of_links);