Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill dead code and plug leak
[simgrid.git] / src / surf / network_ns3.cpp
index 7803f6d..2cf77d2 100644 (file)
@@ -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<NetPointNs3>();
     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;
@@ -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);
@@ -129,7 +129,7 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin
 }
 
 /* Create the ns3 topology based on routing strategy */
-static void postparse_cb(void)
+static void postparse_cb()
 {
   IPV4addr.shrink_to_fit();
 
@@ -163,7 +163,7 @@ NetworkNS3Model::NetworkNS3Model() : NetworkModel() {
 
   simgrid::kernel::routing::NetPoint::onCreation.connect([](simgrid::kernel::routing::NetPoint* pt) {
     pt->extension_set<NetPointNs3>(new NetPointNs3());
-
+    XBT_VERB("SimGrid's %s is known as node %d within NS3", pt->cname(), pt->extension<NetPointNs3>()->node_num);
   });
   simgrid::surf::on_cluster.connect(&clusterCreation_cb);
   simgrid::s4u::onPlatformCreated.connect(&postparse_cb);
@@ -317,7 +317,12 @@ void NetworkNS3Action::resume() {
   THROW_UNIMPLEMENTED;
 }
 
-  /* Test whether a flow is suspended */
+std::list<LinkImpl*> NetworkNS3Action::links()
+{
+  THROW_UNIMPLEMENTED;
+}
+
+/* Test whether a flow is suspended */
 bool NetworkNS3Action::isSuspended()
 {
   return false;
@@ -461,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;
@@ -474,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);