Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Single way to create links in NetZone
authorBruno Donassolo <bruno.donassolo@inria.fr>
Tue, 6 Apr 2021 09:30:04 +0000 (11:30 +0200)
committerBruno Donassolo <bruno.donassolo@inria.fr>
Tue, 6 Apr 2021 09:30:04 +0000 (11:30 +0200)
With the refactoring, we don't need 2 methods in NetZoneImpl to create
new links.
The link type (wifi or wired) is determined by the NetZone type
(WifiZone).

include/simgrid/kernel/routing/NetZoneImpl.hpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/WifiZone.cpp

index ae410c5..6246bf4 100644 (file)
@@ -134,7 +134,6 @@ public:
   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);
-  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 1db3805..4df1cef 100644 (file)
@@ -152,11 +152,6 @@ s4u::Link* NetZoneImpl::create_link(const std::string& name, const std::vector<d
   return network_model_->create_link(name, bandwidths)->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)
 {
   auto* res = (new surf::HostImpl(name))->get_iface();
index 91ea761..f6693e0 100644 (file)
@@ -57,9 +57,9 @@ s4u::Link* WifiZone::create_link(const std::string& name, const std::vector<doub
   xbt_assert(wifi_link_ == nullptr,
              "WIFI netzone %s contains more than one link. Please only declare one, the wifi link.", get_cname());
 
-  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;
+  wifi_link_ = get_network_model()->create_wifi_link(name, bandwidths);
+  wifi_link_->set_sharing_policy(s4u::Link::SharingPolicy::WIFI);
+  return wifi_link_->get_iface();
 }
 } // namespace routing
 } // namespace kernel