Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change way WIFI are create + make sharing_policy optional
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Fri, 2 Apr 2021 21:38:48 +0000 (23:38 +0200)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Fri, 2 Apr 2021 21:43:35 +0000 (23:43 +0200)
21 files changed:
include/simgrid/kernel/routing/NetZoneImpl.hpp
include/simgrid/kernel/routing/WifiZone.hpp
include/simgrid/s4u/Link.hpp
include/simgrid/s4u/NetZone.hpp
src/kernel/lmm/maxmin.hpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/VivaldiZone.cpp
src/kernel/routing/WifiZone.cpp
src/s4u/s4u_Link.cpp
src/s4u/s4u_Netzone.cpp
src/surf/network_cm02.cpp
src/surf/network_cm02.hpp
src/surf/network_constant.cpp
src/surf/network_constant.hpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/surf/sg_platf.cpp

index 2e9b75b..c1bf111 100644 (file)
@@ -143,8 +143,8 @@ public:
   /** @brief Create a disk with the disk model from this NetZone */
   s4u::Disk* create_disk(const std::string& name, double read_bandwidth, double write_bandwidth);
   /** @brief Make a link within that NetZone */
-  virtual s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                 s4u::Link::SharingPolicy policy);
+  virtual s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths);
+  virtual s4u::Link* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths);
   /** @brief Creates a new route in this NetZone */
   virtual void add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                                 std::vector<resource::LinkImpl*>& link_list, bool symmetrical);
index 381a7ba..1c45b4f 100644 (file)
@@ -30,8 +30,7 @@ public:
   WifiZone& operator=(const WifiZone) = delete;
 
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
-  s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                         s4u::Link::SharingPolicy policy) override;
+  s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths) override;
   NetPoint* get_access_point() const { return access_point_; }
 };
 } // namespace routing
index 8ee0cf9..284f82c 100644 (file)
@@ -72,6 +72,7 @@ public:
   Link* set_latency(const std::string& value);
 
   /** @brief Describes how the link is shared between flows */
+  Link* set_sharing_policy(SharingPolicy policy);
   SharingPolicy get_sharing_policy() const;
 
   /** Setup the profile with states events (ON or OFF). The profile must contain boolean values. */
index a21b78d..72922ec 100644 (file)
@@ -130,16 +130,12 @@ public:
    * @param policy Link sharing policy
    * @throw std::invalid_argument if bandwidth format is incorrect.
    */
-  s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                         Link::SharingPolicy policy = Link::SharingPolicy::SHARED);
+  s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths);
 
   /** @brief Create a link (string version) */
-  s4u::Link* create_link(const std::string& name, const std::vector<std::string>& bandwidths,
-                         Link::SharingPolicy policy = Link::SharingPolicy::SHARED);
+  s4u::Link* create_link(const std::string& name, const std::vector<std::string>& bandwidths);
 
-  /**
-   * @brief Seal this netzone configuration
-   */
+  /** @brief Seal this netzone configuration */
   void seal();
 
 private:
index b820202..d2dae46 100644 (file)
@@ -187,6 +187,8 @@ public:
   /** @brief Unshare a constraint. */
   void unshare() { sharing_policy_ = s4u::Link::SharingPolicy::FATPIPE; }
 
+  /** @brief Set how a constraint is shared  */
+  void set_sharing_policy(s4u::Link::SharingPolicy policy) { sharing_policy_ = policy; }
   /** @brief Check how a constraint is shared  */
   s4u::Link::SharingPolicy get_sharing_policy() const { return sharing_policy_; }
 
index 0365866..11c3363 100644 (file)
@@ -145,12 +145,14 @@ s4u::Disk* NetZoneImpl::create_disk(const std::string& name, double read_bandwid
   return l->get_iface();
 }
 
-s4u::Link* NetZoneImpl::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                    s4u::Link::SharingPolicy policy)
+s4u::Link* NetZoneImpl::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
-  auto* l = network_model_->create_link(name, bandwidths, policy);
+  return network_model_->create_link(name, bandwidths)->get_iface();
+}
 
-  return l->get_iface();
+s4u::Link* NetZoneImpl::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+{
+  return network_model_->create_wifi_link(name, bandwidths)->get_iface();
 }
 
 s4u::Host* NetZoneImpl::create_host(const std::string& name, const std::vector<double>& speed_per_pstate)
index bc963e1..f073f37 100644 (file)
@@ -70,11 +70,9 @@ void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out,
 
   std::string link_up   = "link_" + netpoint->get_name() + "_UP";
   std::string link_down = "link_" + netpoint->get_name() + "_DOWN";
-  resource::LinkImpl* linkUp =
-      get_network_model()->create_link(link_up, std::vector<double>(1, bw_out), s4u::Link::SharingPolicy::SHARED);
+  resource::LinkImpl* linkUp = get_network_model()->create_link(link_up, std::vector<double>(1, bw_out));
   linkUp->seal();
-  resource::LinkImpl* linkDown =
-      get_network_model()->create_link(link_down, std::vector<double>(1, bw_in), s4u::Link::SharingPolicy::SHARED);
+  resource::LinkImpl* linkDown = get_network_model()->create_link(link_down, std::vector<double>(1, bw_in));
   linkDown->seal();
   add_private_link_at(netpoint->id(), {linkUp, linkDown});
 }
index 720b748..91ea761 100644 (file)
@@ -52,15 +52,12 @@ void WifiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
   }
 }
 
-s4u::Link* WifiZone::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                 s4u::Link::SharingPolicy policy)
+s4u::Link* WifiZone::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
   xbt_assert(wifi_link_ == nullptr,
              "WIFI netzone %s contains more than one link. Please only declare one, the wifi link.", get_cname());
-  xbt_assert(policy == s4u::Link::SharingPolicy::WIFI, "Link %s in WIFI zone %s must follow the WIFI sharing policy.",
-             name.c_str(), get_cname());
 
-  auto s4u_link = NetZoneImpl::create_link(name, bandwidths, policy);
+  auto s4u_link = NetZoneImpl::create_wifi_link(name, bandwidths)->set_sharing_policy(s4u::Link::SharingPolicy::WIFI);
   wifi_link_    = s4u_link->get_impl();
   return s4u_link;
 }
index 011917a..231b05d 100644 (file)
@@ -92,6 +92,11 @@ Link* Link::set_bandwidth(double value)
   return this;
 }
 
+Link* Link::set_sharing_policy(Link::SharingPolicy policy)
+{
+  kernel::actor::simcall([this, policy] { pimpl_->set_sharing_policy(policy); });
+  return this;
+}
 Link::SharingPolicy Link::get_sharing_policy() const
 {
   return this->pimpl_->get_sharing_policy();
index 287d9e8..4111435 100644 (file)
@@ -158,15 +158,12 @@ s4u::Host* NetZone::create_host(const std::string& name, const std::vector<std::
   return create_host(name, Host::convert_pstate_speed_vector(speed_per_pstate));
 }
 
-s4u::Link* NetZone::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                s4u::Link::SharingPolicy policy)
+s4u::Link* NetZone::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
-  return kernel::actor::simcall(
-      [this, &name, &bandwidths, &policy] { return pimpl_->create_link(name, bandwidths, policy); });
+  return kernel::actor::simcall([this, &name, &bandwidths] { return pimpl_->create_link(name, bandwidths); });
 }
 
-s4u::Link* NetZone::create_link(const std::string& name, const std::vector<std::string>& bandwidths,
-                                s4u::Link::SharingPolicy policy)
+s4u::Link* NetZone::create_link(const std::string& name, const std::vector<std::string>& bandwidths)
 {
   std::vector<double> bw;
   bw.reserve(bandwidths.size());
@@ -179,7 +176,7 @@ s4u::Link* NetZone::create_link(const std::string& name, const std::vector<std::
                                   std::string(". Invalid bandwidth: ") + speed_str);
     }
   }
-  return create_link(name, bw, policy);
+  return create_link(name, bw);
 }
 
 } // namespace s4u
index 0f6dcb5..3ddb8ce 100644 (file)
@@ -87,26 +87,21 @@ NetworkCm02Model::NetworkCm02Model(const std::string& name) : NetworkModel(name)
   }
 
   set_maxmin_system(new lmm::System(select));
-  loopback_ = NetworkCm02Model::create_link("__loopback__",
-                                            std::vector<double>{config::get_value<double>("network/loopback-bw")},
-                                            s4u::Link::SharingPolicy::FATPIPE)
+  loopback_ = create_link("__loopback__", std::vector<double>{config::get_value<double>("network/loopback-bw")})
+                  ->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE)
                   ->set_latency(config::get_value<double>("network/loopback-lat"));
   loopback_->seal();
 }
 
-LinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                        s4u::Link::SharingPolicy policy)
+LinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
-  LinkImpl* link;
-  if (policy == s4u::Link::SharingPolicy::WIFI) {
-    link = new NetworkWifiLink(name, bandwidths, get_maxmin_system());
-  } else {
-    xbt_assert(bandwidths.size() == 1, "Non-WIFI links must use only 1 bandwidth.");
-    link = new NetworkCm02Link(name, bandwidths[0], policy, get_maxmin_system());
-  }
+  xbt_assert(bandwidths.size() == 1, "Non-WIFI links must use only 1 bandwidth.");
+  return (new NetworkCm02Link(name, bandwidths[0], get_maxmin_system()))->set_model(this);
+}
 
-  link->set_model(this);
-  return link;
+LinkImpl* NetworkCm02Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+{
+  return (new NetworkWifiLink(name, bandwidths, get_maxmin_system()))->set_model(this);
 }
 
 void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
@@ -314,16 +309,12 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
 /************
  * Resource *
  ************/
-NetworkCm02Link::NetworkCm02Link(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy,
-                                 kernel::lmm::System* system)
+NetworkCm02Link::NetworkCm02Link(const std::string& name, double bandwidth, kernel::lmm::System* system)
     : LinkImpl(name)
 {
   bandwidth_.scale = 1.0;
   bandwidth_.peak  = bandwidth;
   this->set_constraint(system->constraint_new(this, sg_bandwidth_factor * bandwidth));
-
-  if (policy == s4u::Link::SharingPolicy::FATPIPE)
-    get_constraint()->unshare();
 }
 
 void NetworkCm02Link::apply_event(kernel::profile::Event* triggered, double value)
index 3cdf433..da0d5cd 100644 (file)
@@ -31,8 +31,8 @@ class XBT_PRIVATE NetworkSmpiModel;
 class NetworkCm02Model : public NetworkModel {
 public:
   explicit NetworkCm02Model(const std::string& name);
-  LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                        s4u::Link::SharingPolicy policy) override;
+  LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) override;
+  LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
   void update_actions_state_lazy(double now, double delta) override;
   void update_actions_state_full(double now, double delta) override;
   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
@@ -44,7 +44,7 @@ public:
 
 class NetworkCm02Link : public LinkImpl {
 public:
-  NetworkCm02Link(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy, lmm::System* system);
+  NetworkCm02Link(const std::string& name, double bandwidth, lmm::System* system);
   void apply_event(kernel::profile::Event* event, double value) override;
   void set_bandwidth(double value) override;
   LinkImpl* set_latency(double value) override;
index 9394505..e24ea76 100644 (file)
@@ -26,8 +26,7 @@ namespace simgrid {
 namespace kernel {
 namespace resource {
 
-LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::vector<double>& /*bandwidth*/,
-                                            s4u::Link::SharingPolicy /*policy*/)
+LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::vector<double>& /*bandwidth*/)
 {
   xbt_die("Refusing to create the link %s: there is no link in the Constant network model. "
           "Please remove any link from your platform (and switch to routing='None')",
@@ -35,6 +34,11 @@ LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::
   return nullptr;
 }
 
+LinkImpl* NetworkConstantModel::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+{
+  return create_link(name, bandwidths);
+}
+
 double NetworkConstantModel::next_occurring_event(double /*now*/)
 {
   double min = -1.0;
index fefadd8..c570741 100644 (file)
@@ -19,8 +19,8 @@ public:
   double next_occurring_event(double now) override;
   void update_actions_state(double now, double delta) override;
 
-  LinkImpl* create_link(const std::string& name, const std::vector<double>& bws,
-                        s4u::Link::SharingPolicy policy) override;
+  LinkImpl* create_link(const std::string& name, const std::vector<double>& bws) override;
+  LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bws) override;
 };
 
 class NetworkConstantAction : public NetworkAction {
index c08c283..4ffd1df 100644 (file)
@@ -108,6 +108,11 @@ double LinkImpl::get_bandwidth() const
   return bandwidth_.peak * bandwidth_.scale;
 }
 
+LinkImpl* LinkImpl::set_sharing_policy(s4u::Link::SharingPolicy policy)
+{
+  get_constraint()->set_sharing_policy(policy);
+  return this;
+}
 s4u::Link::SharingPolicy LinkImpl::get_sharing_policy() const
 {
   return get_constraint()->get_sharing_policy();
index 5cbb9c4..e03a73d 100644 (file)
@@ -47,8 +47,9 @@ public:
    * @param bandwidth The initial bandwidth of the Link in bytes per second
    * @param policy The sharing policy of the Link
    */
-  virtual LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                s4u::Link::SharingPolicy policy) = 0;
+  virtual LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) = 0;
+
+  virtual LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) = 0;
 
   /**
    * @brief Create a communication between two hosts.
@@ -137,6 +138,7 @@ public:
   virtual LinkImpl* set_latency(double value) = 0;
 
   /** @brief The sharing policy */
+  virtual LinkImpl* set_sharing_policy(s4u::Link::SharingPolicy policy);
   virtual s4u::Link::SharingPolicy get_sharing_policy() const;
 
   /** @brief Check if the Link is used */
index 1195cc7..6e4a467 100644 (file)
@@ -327,13 +327,15 @@ NetworkNS3Model::NetworkNS3Model(const std::string& name) : NetworkModel(name)
   s4u::NetZone::on_seal.connect(&zoneCreation_cb);
 }
 
-LinkImpl* NetworkNS3Model::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                       s4u::Link::SharingPolicy policy)
+LinkImpl* NetworkNS3Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
   xbt_assert(bandwidths.size() == 1, "ns-3 links must use only 1 bandwidth.");
-  auto link = new LinkNS3(name, bandwidths[0], policy);
-  link->set_model(this);
-  return link;
+  return (new LinkNS3(name, bandwidths[0]))->set_model(this);
+}
+
+LinkImpl* NetworkNS3Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+{
+  return create_link(name, bandwidths)->set_sharing_policy(s4u::Link::SharingPolicy::WIFI);
 }
 
 Action* NetworkNS3Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
@@ -434,8 +436,7 @@ void NetworkNS3Model::update_actions_state(double now, double delta)
  * Resource *
  ************/
 
-LinkNS3::LinkNS3(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy)
-    : LinkImpl(name), sharing_policy_(policy)
+LinkNS3::LinkNS3(const std::string& name, double bandwidth) : LinkImpl(name)
 {
   bandwidth_.peak = bandwidth;
 }
@@ -464,6 +465,12 @@ LinkImpl* LinkNS3::set_latency(double latency)
   latency_.peak = latency;
   return this;
 }
+
+LinkImpl* LinkNS3::set_sharing_policy(s4u::Link::SharingPolicy policy)
+{
+  sharing_policy_ = policy;
+  return this;
+}
 /**********
  * Action *
  **********/
index 1e4dbc5..7db4a38 100644 (file)
@@ -17,8 +17,8 @@ namespace resource {
 class NetworkNS3Model : public NetworkModel {
 public:
   explicit NetworkNS3Model(const std::string& name);
-  LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidth,
-                        s4u::Link::SharingPolicy policy) override;
+  LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidth) override;
+  LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidth) override;
   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
   double next_occurring_event(double now) override;
   bool next_occurring_event_is_idempotent() override { return false; }
@@ -30,15 +30,16 @@ public:
  ************/
 class LinkNS3 : public LinkImpl {
 public:
-  explicit LinkNS3(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy);
+  explicit LinkNS3(const std::string& name, double bandwidth);
   ~LinkNS3() override;
-  s4u::Link::SharingPolicy sharing_policy_;
+  s4u::Link::SharingPolicy sharing_policy_ = s4u::Link::SharingPolicy::SHARED;
 
   void apply_event(profile::Event* event, double value) override;
   void set_bandwidth(double) override { THROW_UNIMPLEMENTED; }
   LinkImpl* set_latency(double) override;
   LinkImpl* set_bandwidth_profile(profile::Profile* profile) override;
   LinkImpl* set_latency_profile(profile::Profile* profile) override;
+  LinkImpl* set_sharing_policy(s4u::Link::SharingPolicy policy) override;
   s4u::Link::SharingPolicy get_sharing_policy() const override { return sharing_policy_; }
 };
 
index 5e24970..58184ed 100644 (file)
@@ -61,10 +61,10 @@ NetworkL07Model::NetworkL07Model(const std::string& name, HostL07Model* hmodel,
     : NetworkModel(name), hostModel_(hmodel)
 {
   set_maxmin_system(sys);
-  loopback_ = NetworkL07Model::create_link(
-                  "__loopback__", std::vector<double>{simgrid::config::get_value<double>("network/loopback-bw")},
-                  s4u::Link::SharingPolicy::FATPIPE)
-                  ->set_latency(simgrid::config::get_value<double>("network/loopback-lat"));
+  loopback_ =
+      create_link("__loopback__", std::vector<double>{simgrid::config::get_value<double>("network/loopback-bw")})
+          ->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE)
+          ->set_latency(simgrid::config::get_value<double>("network/loopback-lat"));
   loopback_->seal();
 }
 
@@ -239,13 +239,16 @@ kernel::resource::Cpu* CpuL07Model::create_cpu(s4u::Host* host, const std::vecto
   return (new CpuL07(host, speed_per_pstate))->set_model(this);
 }
 
-kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                                         s4u::Link::SharingPolicy policy)
+kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
   xbt_assert(bandwidths.size() == 1, "Non WIFI link must have only 1 bandwidth.");
-  auto link = new LinkL07(name, bandwidths[0], policy, get_maxmin_system());
-  link->set_model(this);
-  return link;
+  return (new LinkL07(name, bandwidths[0], get_maxmin_system()))->set_model(this);
+}
+
+kernel::resource::LinkImpl* NetworkL07Model::create_wifi_link(const std::string& name,
+                                                              const std::vector<double>& bandwidths)
+{
+  THROW_UNIMPLEMENTED;
 }
 
 /************
@@ -295,15 +298,10 @@ void CpuL07::on_speed_change()
   Cpu::on_speed_change();
 }
 
-LinkL07::LinkL07(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy,
-                 kernel::lmm::System* system)
-    : LinkImpl(name)
+LinkL07::LinkL07(const std::string& name, double bandwidth, kernel::lmm::System* system) : LinkImpl(name)
 {
   this->set_constraint(system->constraint_new(this, bandwidth));
   bandwidth_.peak = bandwidth;
-
-  if (policy == s4u::Link::SharingPolicy::FATPIPE)
-    get_constraint()->unshare();
 }
 
 bool LinkL07::is_used() const
index cc4e370..6c7db7a 100644 (file)
@@ -67,8 +67,8 @@ public:
   NetworkL07Model(const NetworkL07Model&) = delete;
   NetworkL07Model& operator=(const NetworkL07Model&) = delete;
   ~NetworkL07Model() override;
-  kernel::resource::LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                          s4u::Link::SharingPolicy policy) override;
+  kernel::resource::LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) override;
+  kernel::resource::LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
 
   kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
   void update_actions_state(double /*now*/, double /*delta*/) override{
@@ -106,7 +106,7 @@ protected:
 
 class LinkL07 : public kernel::resource::LinkImpl {
 public:
-  LinkL07(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy, kernel::lmm::System* system);
+  LinkL07(const std::string& name, double bandwidth, kernel::lmm::System* system);
   LinkL07(const LinkL07&) = delete;
   LinkL07& operator=(const LinkL07&) = delete;
   ~LinkL07() override;
index 0d06ac2..154b2b8 100644 (file)
@@ -108,11 +108,12 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(const std::string& name,
 
 static void sg_platf_new_link(const simgrid::kernel::routing::LinkCreationArgs* args, const std::string& link_name)
 {
-  simgrid::s4u::Link* link = routing_get_current()->create_link(link_name, args->bandwidths, args->policy);
+  simgrid::s4u::Link* link = routing_get_current()->create_link(link_name, args->bandwidths);
   if (args->properties)
     link->set_properties(*args->properties);
 
   link->get_impl() // this call to get_impl saves some simcalls but can be removed
+      ->set_sharing_policy(args->policy)
       ->set_state_profile(args->state_trace)
       ->set_latency_profile(args->latency_trace)
       ->set_bandwidth_profile(args->bandwidth_trace)