From: Bruno Donassolo Date: Fri, 7 May 2021 09:33:26 +0000 (+0200) Subject: Checks concerning StarZone and NS3 X-Git-Tag: v3.28~317 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/da82494b57755f7709200dec34441cad787ddde2?hp=35e66f1b2c4ea53b8d44b527e27cdd10e16b3d55 Checks concerning StarZone and NS3 --- diff --git a/src/kernel/routing/StarZone.cpp b/src/kernel/routing/StarZone.cpp index ac88fd2fa6..b87c24831b 100644 --- a/src/kernel/routing/StarZone.cpp +++ b/src/kernel/routing/StarZone.cpp @@ -7,6 +7,9 @@ #include "simgrid/kernel/routing/NetPoint.hpp" #include "simgrid/kernel/routing/RoutedZone.hpp" #include "src/surf/network_interface.hpp" +#if SIMGRID_HAVE_NS3 +#include "src/surf/network_ns3.hpp" +#endif #include "xbt/string.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_star, surf, "Routing part of surf"); @@ -129,7 +132,7 @@ void StarZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoin { check_add_route_param(src, dst, gw_src, gw_dst, symmetrical); - s4u::NetZone::on_route_creation(symmetrical, gw_src, gw_dst, gw_src, gw_dst, link_list_); + s4u::NetZone::on_route_creation(symmetrical, src, dst, gw_src, gw_dst, link_list_); /* loopback */ if (src == dst) { @@ -159,6 +162,10 @@ void StarZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoin void StarZone::do_seal() { +#if SIMGRID_HAVE_NS3 + xbt_assert(not dynamic_cast(get_network_model().get()), + "StarZone are not supported by NS-3 right now"); +#endif /* add default empty links if nothing was configured by user */ for (auto const& node : get_vertices()) { auto route = routes_.emplace(node->id(), StarRoute()); diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 7868a63259..f51fd2568c 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -185,6 +185,9 @@ static void clusterCreation_cb(simgrid::kernel::routing::ClusterCreationArgs con { ns3::NodeContainer Nodes; + xbt_assert(cluster.topology == simgrid::kernel::routing::ClusterTopology::FLAT, + "NS-3 is supported only by flat clusters. Do not use with other topologies"); + for (int const& i : cluster.radicals) { // Create private link std::string host_id = cluster.prefix + std::to_string(i) + cluster.suffix; @@ -229,6 +232,7 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin simgrid::kernel::routing::NetPoint* /*gw_dst*/, std::vector const& link_list) { + xbt_assert(src && dst, "NS-3: add_route, invalid src or destination"); if (link_list.size() == 1) { auto const* link = static_cast(link_list[0]); diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index e63fc05bc0..6b162892d8 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -345,6 +345,7 @@ static void sg_platf_new_cluster_flat(simgrid::kernel::routing::ClusterCreationA XBT_DEBUG(""); sg_platf_new_Zone_seal(); + simgrid::kernel::routing::on_cluster_creation(*cluster); } void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster) @@ -359,8 +360,6 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster sg_platf_new_cluster_flat(cluster); break; } - - simgrid::kernel::routing::on_cluster_creation(*cluster); } void routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl* bb)