From: Martin Quinson Date: Tue, 31 Jan 2017 08:33:30 +0000 (+0100) Subject: finish the transition netcards->netpoints in the code X-Git-Tag: v3_15~502 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7b260a6cdc16e5fe788e15f4f4fb2412c9605263?hp=c1103c3a2b794d6f7e4599cf0182d72937b9a021 finish the transition netcards->netpoints in the code --- diff --git a/include/simgrid/forward.h b/include/simgrid/forward.h index 610f34fe5c..3459fd6ccd 100644 --- a/include/simgrid/forward.h +++ b/include/simgrid/forward.h @@ -72,7 +72,7 @@ typedef simgrid_Host* sg_host_t; typedef kernel_Activity *smx_activity_t; typedef surf_Cpu *surf_cpu_t; -typedef routing_NetPoint* sg_netcard_t; +typedef routing_NetPoint* sg_netpoint_t; typedef surf_Resource *sg_resource_t; // Types which are in fact dictelmt: diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index bdcfef6ce2..c8434e3658 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -320,7 +320,7 @@ int console_add_route(lua_State *L) { type = lua_gettable(L,-2); lua_ensure(type == LUA_TSTRING, "Attribute 'src' must be specified for any route and must be a string."); const char *srcName = lua_tostring(L, -1); - route.src = sg_netcard_by_name_or_null(srcName); + route.src = sg_netpoint_by_name_or_null(srcName); lua_ensure(route.src != nullptr, "Attribute 'src=%s' of route does not name a node.", srcName); lua_pop(L,1); @@ -328,7 +328,7 @@ int console_add_route(lua_State *L) { type = lua_gettable(L,-2); lua_ensure(type == LUA_TSTRING, "Attribute 'dest' must be specified for any route and must be a string."); const char *dstName = lua_tostring(L, -1); - route.dst = sg_netcard_by_name_or_null(dstName); + route.dst = sg_netpoint_by_name_or_null(dstName); lua_ensure(route.dst != nullptr, "Attribute 'dst=%s' of route does not name a node.", dstName); lua_pop(L,1); @@ -389,28 +389,28 @@ int console_add_ASroute(lua_State *L) { lua_pushstring(L, "src"); lua_gettable(L, -2); const char *srcName = lua_tostring(L, -1); - ASroute.src = sg_netcard_by_name_or_null(srcName); + ASroute.src = sg_netpoint_by_name_or_null(srcName); lua_ensure(ASroute.src != nullptr, "Attribute 'src=%s' of AS route does not name a node.", srcName); lua_pop(L, 1); lua_pushstring(L, "dst"); lua_gettable(L, -2); const char *dstName = lua_tostring(L, -1); - ASroute.dst = sg_netcard_by_name_or_null(dstName); + ASroute.dst = sg_netpoint_by_name_or_null(dstName); lua_ensure(ASroute.dst != nullptr, "Attribute 'dst=%s' of AS route does not name a node.", dstName); lua_pop(L, 1); lua_pushstring(L, "gw_src"); lua_gettable(L, -2); const char *name = lua_tostring(L, -1); - ASroute.gw_src = sg_netcard_by_name_or_null(name); + ASroute.gw_src = sg_netpoint_by_name_or_null(name); lua_ensure(ASroute.gw_src, "Attribute 'gw_src=%s' of AS route does not name a valid node", name); lua_pop(L, 1); lua_pushstring(L, "gw_dst"); lua_gettable(L, -2); name = lua_tostring(L, -1); - ASroute.gw_dst = sg_netcard_by_name_or_null(name); + ASroute.gw_dst = sg_netpoint_by_name_or_null(name); lua_ensure(ASroute.gw_dst, "Attribute 'gw_dst=%s' of AS route does not name a valid node", name); lua_pop(L, 1); diff --git a/src/instr/instr_interface.cpp b/src/instr/instr_interface.cpp index da48497150..74ee42b4f2 100644 --- a/src/instr/instr_interface.cpp +++ b/src/instr/instr_interface.cpp @@ -308,11 +308,11 @@ static void instr_user_variable(double time, const char *resource, const char *v static void instr_user_srcdst_variable(double time, const char *src, const char *dst, const char *variable, const char *father_type, double value, InstrUserVariable what) { - sg_netcard_t src_elm = sg_netcard_by_name_or_null(src); + sg_netpoint_t src_elm = sg_netpoint_by_name_or_null(src); if(!src_elm) xbt_die("Element '%s' not found!",src); - sg_netcard_t dst_elm = sg_netcard_by_name_or_null(dst); + sg_netpoint_t dst_elm = sg_netpoint_by_name_or_null(dst); if(!dst_elm) xbt_die("Element '%s' not found!",dst); diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index f172f91a99..87edfbe8e0 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -68,19 +68,19 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe //Search for network_element_t switch (kind){ case INSTR_HOST: - newContainer->netcard = sg_host->pimpl_netpoint; - xbt_assert(newContainer->netcard, "Element '%s' not found",name); + newContainer->netpoint = sg_host->pimpl_netpoint; + xbt_assert(newContainer->netpoint, "Element '%s' not found", name); break; case INSTR_ROUTER: - newContainer->netcard = simgrid::s4u::Engine::instance()->netpointByNameOrNull(name); - xbt_assert(newContainer->netcard, "Element '%s' not found",name); + newContainer->netpoint = simgrid::s4u::Engine::instance()->netpointByNameOrNull(name); + xbt_assert(newContainer->netpoint, "Element '%s' not found", name); break; case INSTR_AS: - newContainer->netcard = simgrid::s4u::Engine::instance()->netpointByNameOrNull(name); - xbt_assert(newContainer->netcard, "Element '%s' not found",name); + newContainer->netpoint = simgrid::s4u::Engine::instance()->netpointByNameOrNull(name); + xbt_assert(newContainer->netpoint, "Element '%s' not found", name); break; default: - newContainer->netcard = nullptr; + newContainer->netpoint = nullptr; break; } diff --git a/src/instr/instr_private.h b/src/instr/instr_private.h index de371d1bf0..dd0e1c30c5 100644 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@ -88,7 +88,7 @@ typedef enum { typedef struct s_container *container_t; typedef struct s_container { - sg_netcard_t netcard; + sg_netpoint_t netpoint; char *name; /* Unique name of this container */ char *id; /* Unique id of this container */ type_t type; /* Type of this container */ diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index 1c20629d16..e88464b49b 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -65,7 +65,7 @@ void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg route->gw_dst = route_stack.front()->gw_dst; } - sg_netcard_t prev_dst_gw = nullptr; + sg_netpoint_t prev_dst_gw = nullptr; while (!route_stack.empty()) { sg_platf_route_cbarg_t e_route = route_stack.back(); route_stack.pop_back(); diff --git a/src/kernel/routing/NetPoint.cpp b/src/kernel/routing/NetPoint.cpp index 49c517f780..d1f353c93a 100644 --- a/src/kernel/routing/NetPoint.cpp +++ b/src/kernel/routing/NetPoint.cpp @@ -30,11 +30,11 @@ NetPoint::NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl* } } // namespace simgrid::kernel::routing -/** @brief Retrieve a netcard from its name +/** @brief Retrieve a netpoint from its name * - * Netcards are the thing that connect host or routers to the network + * Netpoints denote the location of host or routers in the network, to compute routes */ -simgrid::kernel::routing::NetPoint* sg_netcard_by_name_or_null(const char* name) +simgrid::kernel::routing::NetPoint* sg_netpoint_by_name_or_null(const char* name) { return simgrid::s4u::Engine::instance()->netpointByNameOrNull(name); } diff --git a/src/kernel/routing/NetPoint.hpp b/src/kernel/routing/NetPoint.hpp index b077a37c79..285ef6ac53 100644 --- a/src/kernel/routing/NetPoint.hpp +++ b/src/kernel/routing/NetPoint.hpp @@ -3,8 +3,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#ifndef KERNEL_ROUTING_NETCARD_HPP_ -#define KERNEL_ROUTING_NETCARD_HPP_ +#ifndef KERNEL_ROUTING_NETPOINT_HPP_ +#define KERNEL_ROUTING_NETPOINT_HPP_ #include #include @@ -36,7 +36,7 @@ public: unsigned int id() { return id_; } std::string name() { return name_; } const char* cname() { return name_.c_str(); } - /** @brief the NetZone in which this netcard is included */ + /** @brief the NetZone in which this NetPoint is included */ NetZoneImpl* netzone() { return netzone_; } bool isNetZone() { return componentType_ == Type::NetZone; } @@ -57,6 +57,6 @@ private: } } -XBT_PUBLIC(sg_netcard_t) sg_netcard_by_name_or_null(const char* name); +XBT_PUBLIC(sg_netpoint_t) sg_netpoint_by_name_or_null(const char* name); -#endif /* KERNEL_ROUTING_NETCARD_HPP_ */ +#endif /* KERNEL_ROUTING_NETPOINT_HPP_ */ diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index b312eb36d0..a2cd1a895b 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -31,15 +31,15 @@ NetZoneImpl::NetZoneImpl(NetZone* father, const char* name) : NetZone(father, na xbt_assert(nullptr == simgrid::s4u::Engine::instance()->netpointByNameOrNull(name), "Refusing to create a second NetZone called '%s'.", name); - netcard_ = new NetPoint(name, NetPoint::Type::NetZone, static_cast(father)); - XBT_DEBUG("NetZone '%s' created with the id '%d'", name, netcard_->id()); + netpoint_ = new NetPoint(name, NetPoint::Type::NetZone, static_cast(father)); + XBT_DEBUG("NetZone '%s' created with the id '%d'", name, netpoint_->id()); } NetZoneImpl::~NetZoneImpl() { for (auto& kv : bypassRoutes_) delete kv.second; - simgrid::s4u::Engine::instance()->netpointUnregister(netcard_); + simgrid::s4u::Engine::instance()->netpointUnregister(netpoint_); } simgrid::s4u::Host* NetZoneImpl::createHost(const char* name, std::vector* speedPerPstate, int coreAmount, @@ -259,14 +259,14 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst, for (int max = 0; max <= max_index; max++) { for (int i = 0; i < max; i++) { if (i <= max_index_src && max <= max_index_dst) { - key = {path_src.at(i)->netcard_, path_dst.at(max)->netcard_}; + key = {path_src.at(i)->netpoint_, path_dst.at(max)->netpoint_}; if (bypassRoutes_.find(key) != bypassRoutes_.end()) { bypassedRoute = bypassRoutes_.at(key); break; } } if (max <= max_index_src && i <= max_index_dst) { - key = {path_src.at(max)->netcard_, path_dst.at(i)->netcard_}; + key = {path_src.at(max)->netpoint_, path_dst.at(i)->netpoint_}; if (bypassRoutes_.find(key) != bypassRoutes_.end()) { bypassedRoute = bypassRoutes_.at(key); break; @@ -278,7 +278,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst, break; if (max <= max_index_src && max <= max_index_dst) { - key = {path_src.at(max)->netcard_, path_dst.at(max)->netcard_}; + key = {path_src.at(max)->netpoint_, path_dst.at(max)->netpoint_}; if (bypassRoutes_.find(key) != bypassRoutes_.end()) { bypassedRoute = bypassRoutes_.at(key); break; @@ -335,7 +335,7 @@ void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst, route.link_list = new std::vector(); - common_ancestor->getLocalRoute(src_ancestor->netcard_, dst_ancestor->netcard_, &route, latency); + common_ancestor->getLocalRoute(src_ancestor->netpoint_, dst_ancestor->netpoint_, &route, latency); xbt_assert((route.gw_src != nullptr) && (route.gw_dst != nullptr), "bad gateways for route from \"%s\" to \"%s\"", src->cname(), dst->cname()); diff --git a/src/kernel/routing/NetZoneImpl.hpp b/src/kernel/routing/NetZoneImpl.hpp index bc922794db..75636ad375 100644 --- a/src/kernel/routing/NetZoneImpl.hpp +++ b/src/kernel/routing/NetZoneImpl.hpp @@ -100,7 +100,7 @@ public: private: std::map, BypassRoute*> bypassRoutes_; // src x dst -> route - routing::NetPoint* netcard_ = nullptr; // Our representative in the father NetZone + routing::NetPoint* netpoint_ = nullptr; // Our representative in the father NetZone }; } } diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index 7832bed6b3..85b34ac76a 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -20,21 +20,21 @@ namespace routing { namespace vivaldi { simgrid::xbt::Extension Coords::EXTENSION_ID; -Coords::Coords(NetPoint* netcard, const char* coordStr) +Coords::Coords(NetPoint* netpoint, const char* coordStr) { if (!Coords::EXTENSION_ID.valid()) Coords::EXTENSION_ID = NetPoint::extension_create(); std::vector string_values; boost::split(string_values, coordStr, boost::is_any_of(" ")); - xbt_assert(string_values.size() == 3, "Coordinates of %s must have 3 dimensions", netcard->cname()); + xbt_assert(string_values.size() == 3, "Coordinates of %s must have 3 dimensions", netpoint->cname()); for (auto str : string_values) coords.push_back(xbt_str_parse_double(str.c_str(), "Invalid coordinate: %s")); coords.shrink_to_fit(); - netcard->extension_set(this); - XBT_DEBUG("Coords of %s %p: %s", netcard->cname(), netcard, coordStr); + netpoint->extension_set(this); + XBT_DEBUG("Coords of %s %p: %s", netpoint->cname(), netpoint, coordStr); } Coords::~Coords() = default; }; // namespace vivaldi @@ -47,28 +47,28 @@ static inline double euclidean_dist_comp(int index, std::vector* src, st return (src_coord - dst_coord) * (src_coord - dst_coord); } -static std::vector* getCoordsFromNetcard(NetPoint* nc) +static std::vector* getCoordsFromNetpoint(NetPoint* np) { - simgrid::kernel::routing::vivaldi::Coords* coords = nc->extension(); + simgrid::kernel::routing::vivaldi::Coords* coords = np->extension(); xbt_assert(coords, "Please specify the Vivaldi coordinates of %s %s (%p)", - (nc->isNetZone() ? "Netzone" : (nc->isHost() ? "Host" : "Router")), nc->cname(), nc); + (np->isNetZone() ? "Netzone" : (np->isHost() ? "Host" : "Router")), np->cname(), np); return &coords->coords; } VivaldiZone::VivaldiZone(NetZone* father, const char* name) : ClusterZone(father, name) { } -void VivaldiZone::setPeerLink(NetPoint* netcard, double bw_in, double bw_out, const char* coord) +void VivaldiZone::setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, const char* coord) { - xbt_assert(netcard->netzone() == this, "Cannot add a peer link to a netcard that is not in this netzone"); + xbt_assert(netpoint->netzone() == this, "Cannot add a peer link to a netpoint that is not in this netzone"); - new simgrid::kernel::routing::vivaldi::Coords(netcard, coord); + new simgrid::kernel::routing::vivaldi::Coords(netpoint, coord); - std::string link_up = "link_" + netcard->name() + "_UP"; - std::string link_down = "link_" + netcard->name() + "_DOWN"; + std::string link_up = "link_" + netpoint->name() + "_UP"; + std::string link_down = "link_" + netpoint->name() + "_DOWN"; Link* linkUp = surf_network_model->createLink(link_up.c_str(), bw_out, 0, SURF_LINK_SHARED); Link* linkDown = surf_network_model->createLink(link_down.c_str(), bw_in, 0, SURF_LINK_SHARED); - privateLinks_.insert({netcard->id(), {linkUp, linkDown}}); + privateLinks_.insert({netpoint->id(), {linkUp, linkDown}}); } void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) @@ -102,8 +102,8 @@ void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba /* Compute the extra latency due to the euclidean distance if needed */ if (lat) { - std::vector* srcCoords = getCoordsFromNetcard(src); - std::vector* dstCoords = getCoordsFromNetcard(dst); + std::vector* srcCoords = getCoordsFromNetpoint(src); + std::vector* dstCoords = getCoordsFromNetpoint(dst); double euclidean_dist = sqrt(euclidean_dist_comp(0, srcCoords, dstCoords) + euclidean_dist_comp(1, srcCoords, dstCoords)) + diff --git a/src/kernel/routing/VivaldiZone.hpp b/src/kernel/routing/VivaldiZone.hpp index e2a6e62104..9b7c9ffb00 100644 --- a/src/kernel/routing/VivaldiZone.hpp +++ b/src/kernel/routing/VivaldiZone.hpp @@ -47,7 +47,7 @@ class XBT_PRIVATE VivaldiZone : public ClusterZone { public: explicit VivaldiZone(NetZone* father, const char* name); - void setPeerLink(NetPoint* netcard, double bw_in, double bw_out, const char* coord); + void setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, const char* coord); void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; }; diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index c354669848..422fea8f65 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -44,9 +44,9 @@ static int number_of_links = 1; static int number_of_networks = 1; static int port_number = 1025; //Port number is limited from 1025 to 65 000 -simgrid::xbt::Extension NetCardNs3::EXTENSION_ID; +simgrid::xbt::Extension NetPointNs3::EXTENSION_ID; -NetCardNs3::NetCardNs3() +NetPointNs3::NetPointNs3() { ns3::Ptr node = ns3::CreateObject(0); stack.Install(node); @@ -58,11 +58,6 @@ NetCardNs3::NetCardNs3() * Callbacks * *************/ -static void netcardCreation_cb(simgrid::kernel::routing::NetPoint* netcard) -{ - netcard->extension_set(new NetCardNs3()); -} - static void clusterCreation_cb(sg_platf_cluster_cbarg_t cluster) { char* lat = bprintf("%fs", cluster->lat); @@ -70,12 +65,12 @@ static void clusterCreation_cb(sg_platf_cluster_cbarg_t cluster) for (int i : *cluster->radicals) { // Routers don't create a router on the other end of the private link by themselves. - // We just need this router to be given an ID so we create a temporary NetCardNS3 so that it gets one - NetCardNs3* host_dst = new NetCardNs3(); + // We just need this router to be given an ID so we create a temporary NetPointNS3 so that it gets one + NetPointNs3* host_dst = new NetPointNs3(); // Create private link char* host_id = bprintf("%s%d%s", cluster->prefix, i, cluster->suffix); - NetCardNs3* host_src = sg_host_by_name(host_id)->pimpl_netpoint->extension(); + 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); ns3_add_link(host_src->node_num, host_dst->node_num, bw,lat); @@ -110,8 +105,8 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin XBT_DEBUG("\tLink (%s) bdw:%s lat:%s", link->getName(), link_bdw, link_lat); // create link ns3 - NetCardNs3* host_src = src->extension(); - NetCardNs3* host_dst = dst->extension(); + NetPointNs3* host_src = src->extension(); + NetPointNs3* host_dst = dst->extension(); 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()); @@ -154,11 +149,14 @@ namespace simgrid { namespace surf { NetworkNS3Model::NetworkNS3Model() : NetworkModel() { - NetCardNs3::EXTENSION_ID = simgrid::kernel::routing::NetPoint::extension_create(); + NetPointNs3::EXTENSION_ID = simgrid::kernel::routing::NetPoint::extension_create(); ns3_initialize(ns3_tcp_model.get().c_str()); - simgrid::kernel::routing::NetPoint::onCreation.connect(&netcardCreation_cb); + simgrid::kernel::routing::NetPoint::onCreation.connect([](simgrid::kernel::routing::NetPoint pt) { + pt->extension_set(new NetPointNs3()); + + }); simgrid::surf::on_cluster.connect(&clusterCreation_cb); simgrid::surf::on_postparse.connect(&postparse_cb); simgrid::s4u::NetZone::onRouteCreation.connect(&routeCreation_cb); @@ -343,8 +341,8 @@ void ns3_simulator(double maxSeconds) void ns3_create_flow(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double startTime, u_int32_t TotalBytes, simgrid::surf::NetworkNS3Action* action) { - int node1 = src->pimpl_netpoint->extension()->node_num; - int node2 = dst->pimpl_netpoint->extension()->node_num; + int node1 = src->pimpl_netpoint->extension()->node_num; + int node2 = dst->pimpl_netpoint->extension()->node_num; ns3::Ptr src_node = nodes.Get(node1); ns3::Ptr dst_node = nodes.Get(node2); diff --git a/src/surf/ns3/ns3_interface.h b/src/surf/ns3/ns3_interface.h index 3a92354b5a..4603ebc373 100644 --- a/src/surf/ns3/ns3_interface.h +++ b/src/surf/ns3/ns3_interface.h @@ -14,11 +14,11 @@ class NetworkNS3Action; } } -class NetCardNs3 { +class NetPointNs3 { public: - static simgrid::xbt::Extension EXTENSION_ID; + static simgrid::xbt::Extension EXTENSION_ID; - explicit NetCardNs3(); + explicit NetPointNs3(); int node_num; }; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 58fbe8cb69..e0bd47a860 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -105,16 +105,16 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(const char* name, const xbt_assert(nullptr == simgrid::s4u::Engine::instance()->netpointByNameOrNull(name), "Refusing to create a router named '%s': this name already describes a node.", name); - simgrid::kernel::routing::NetPoint* netcard = + simgrid::kernel::routing::NetPoint* netpoint = new simgrid::kernel::routing::NetPoint(name, simgrid::kernel::routing::NetPoint::Type::Router, current_routing); - XBT_DEBUG("Router '%s' has the id %d", name, netcard->id()); + XBT_DEBUG("Router '%s' has the id %d", name, netpoint->id()); if (coords && strcmp(coords, "")) - new simgrid::kernel::routing::vivaldi::Coords(netcard, coords); + new simgrid::kernel::routing::vivaldi::Coords(netpoint, coords); sg_instr_new_router(name); - return netcard; + return netpoint; } void sg_platf_new_link(sg_platf_link_cbarg_t link){ @@ -720,8 +720,8 @@ void sg_platf_new_AS_seal() /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */ void sg_platf_new_hostlink(sg_platf_host_link_cbarg_t hostlink) { - simgrid::kernel::routing::NetPoint* netcard = sg_host_by_name(hostlink->id)->pimpl_netpoint; - xbt_assert(netcard, "Host '%s' not found!", hostlink->id); + simgrid::kernel::routing::NetPoint* netpoint = sg_host_by_name(hostlink->id)->pimpl_netpoint; + xbt_assert(netpoint, "Host '%s' not found!", hostlink->id); xbt_assert(dynamic_cast(current_routing), "Only hosts from Cluster and Vivaldi ASes can get an host_link."); @@ -733,11 +733,11 @@ void sg_platf_new_hostlink(sg_platf_host_link_cbarg_t hostlink) auto as_cluster = static_cast(current_routing); - if (as_cluster->privateLinks_.find(netcard->id()) != as_cluster->privateLinks_.end()) + if (as_cluster->privateLinks_.find(netpoint->id()) != as_cluster->privateLinks_.end()) surf_parse_error("Host_link for '%s' is already defined!",hostlink->id); - XBT_DEBUG("Push Host_link for host '%s' to position %d", netcard->cname(), netcard->id()); - as_cluster->privateLinks_.insert({netcard->id(), {linkUp, linkDown}}); + XBT_DEBUG("Push Host_link for host '%s' to position %d", netpoint->cname(), netpoint->id()); + as_cluster->privateLinks_.insert({netpoint->id(), {linkUp, linkDown}}); } void sg_platf_new_trace(sg_platf_trace_cbarg_t trace) diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 6644b52a4b..6cfdd6907a 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -42,7 +42,7 @@ static void check_disk_attachment() if (xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) { simgrid::surf::Storage* storage = static_cast(xbt_lib_get_or_null(storage_lib, key, SURF_STORAGE_LEVEL)); - simgrid::kernel::routing::NetPoint* host_elm = sg_netcard_by_name_or_null(storage->attach_); + simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(storage->attach_); if (!host_elm) surf_parse_error("Unable to attach storage %s: host %s does not exist.", storage->getName(), storage->attach_); } diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index 017ce0809d..379c8f4360 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -81,10 +81,10 @@ typedef struct s_sg_platf_peer_cbarg { typedef struct s_sg_platf_route_cbarg *sg_platf_route_cbarg_t; typedef struct s_sg_platf_route_cbarg { bool symmetrical; - sg_netcard_t src; - sg_netcard_t dst; - sg_netcard_t gw_src; - sg_netcard_t gw_dst; + sg_netpoint_t src; + sg_netpoint_t dst; + sg_netpoint_t gw_src; + sg_netpoint_t gw_dst; std::vector *link_list; } s_sg_platf_route_cbarg_t; diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 47cf277f5e..e4df5695af 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -723,48 +723,48 @@ void ETag_surfxml_backbone(){ } void STag_surfxml_route(){ - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_route_src), - "Route src='%s' does name a node.", A_surfxml_route_src); - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_route_dst), - "Route dst='%s' does name a node.", A_surfxml_route_dst); + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_route_src), "Route src='%s' does name a node.", + A_surfxml_route_src); + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_route_dst), "Route dst='%s' does name a node.", + A_surfxml_route_dst); } void STag_surfxml_ASroute(){ - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_ASroute_src), - "ASroute src='%s' does name a node.", A_surfxml_route_src); - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_ASroute_dst), - "ASroute dst='%s' does name a node.", A_surfxml_route_dst); - - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_ASroute_gw___src), - "ASroute gw_src='%s' does name a node.", A_surfxml_ASroute_gw___src); - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_ASroute_gw___dst), - "ASroute gw_dst='%s' does name a node.", A_surfxml_ASroute_gw___dst); + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_ASroute_src), "ASroute src='%s' does name a node.", + A_surfxml_route_src); + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_ASroute_dst), "ASroute dst='%s' does name a node.", + A_surfxml_route_dst); + + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_ASroute_gw___src), "ASroute gw_src='%s' does name a node.", + A_surfxml_ASroute_gw___src); + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_ASroute_gw___dst), "ASroute gw_dst='%s' does name a node.", + A_surfxml_ASroute_gw___dst); } void STag_surfxml_bypassRoute(){ - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_bypassRoute_src), - "bypassRoute src='%s' does name a node.", A_surfxml_bypassRoute_src); - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_bypassRoute_dst), - "bypassRoute dst='%s' does name a node.", A_surfxml_bypassRoute_dst); + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_src), "bypassRoute src='%s' does name a node.", + A_surfxml_bypassRoute_src); + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_dst), "bypassRoute dst='%s' does name a node.", + A_surfxml_bypassRoute_dst); } void STag_surfxml_bypassASroute(){ - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_bypassASroute_src), - "bypassASroute src='%s' does name a node.", A_surfxml_bypassASroute_src); - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_bypassASroute_dst), - "bypassASroute dst='%s' does name a node.", A_surfxml_bypassASroute_dst); - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_bypassASroute_gw___src), - "bypassASroute gw_src='%s' does name a node.", A_surfxml_bypassASroute_gw___src); - surf_parse_assert(sg_netcard_by_name_or_null(A_surfxml_bypassASroute_gw___dst), - "bypassASroute gw_dst='%s' does name a node.", A_surfxml_bypassASroute_gw___dst); + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_bypassASroute_src), + "bypassASroute src='%s' does name a node.", A_surfxml_bypassASroute_src); + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_bypassASroute_dst), + "bypassASroute dst='%s' does name a node.", A_surfxml_bypassASroute_dst); + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_bypassASroute_gw___src), + "bypassASroute gw_src='%s' does name a node.", A_surfxml_bypassASroute_gw___src); + surf_parse_assert(sg_netpoint_by_name_or_null(A_surfxml_bypassASroute_gw___dst), + "bypassASroute gw_dst='%s' does name a node.", A_surfxml_bypassASroute_gw___dst); } void ETag_surfxml_route(){ s_sg_platf_route_cbarg_t route; memset(&route,0,sizeof(route)); - route.src = sg_netcard_by_name_or_null(A_surfxml_route_src); // tested to not be nullptr in start tag - route.dst = sg_netcard_by_name_or_null(A_surfxml_route_dst); // tested to not be nullptr in start tag + route.src = sg_netpoint_by_name_or_null(A_surfxml_route_src); // tested to not be nullptr in start tag + route.dst = sg_netpoint_by_name_or_null(A_surfxml_route_dst); // tested to not be nullptr in start tag route.gw_src = nullptr; route.gw_dst = nullptr; route.link_list = new std::vector(); @@ -782,11 +782,11 @@ void ETag_surfxml_ASroute(){ s_sg_platf_route_cbarg_t ASroute; memset(&ASroute,0,sizeof(ASroute)); - ASroute.src = sg_netcard_by_name_or_null(A_surfxml_ASroute_src); // tested to not be nullptr in start tag - ASroute.dst = sg_netcard_by_name_or_null(A_surfxml_ASroute_dst); // tested to not be nullptr in start tag + ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_ASroute_src); // tested to not be nullptr in start tag + ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_ASroute_dst); // tested to not be nullptr in start tag - ASroute.gw_src = sg_netcard_by_name_or_null(A_surfxml_ASroute_gw___src); // tested to not be nullptr in start tag - ASroute.gw_dst = sg_netcard_by_name_or_null(A_surfxml_ASroute_gw___dst); // tested to not be nullptr in start tag + ASroute.gw_src = sg_netpoint_by_name_or_null(A_surfxml_ASroute_gw___src); // tested to not be nullptr in start tag + ASroute.gw_dst = sg_netpoint_by_name_or_null(A_surfxml_ASroute_gw___dst); // tested to not be nullptr in start tag ASroute.link_list = new std::vector(); @@ -812,8 +812,8 @@ void ETag_surfxml_bypassRoute(){ s_sg_platf_route_cbarg_t route; memset(&route,0,sizeof(route)); - route.src = sg_netcard_by_name_or_null(A_surfxml_bypassRoute_src); // tested to not be nullptr in start tag - route.dst = sg_netcard_by_name_or_null(A_surfxml_bypassRoute_dst); // tested to not be nullptr in start tag + route.src = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_src); // tested to not be nullptr in start tag + route.dst = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_dst); // tested to not be nullptr in start tag route.gw_src = nullptr; route.gw_dst = nullptr; route.symmetrical = false; @@ -830,8 +830,8 @@ void ETag_surfxml_bypassASroute(){ s_sg_platf_route_cbarg_t ASroute; memset(&ASroute,0,sizeof(ASroute)); - ASroute.src = sg_netcard_by_name_or_null(A_surfxml_bypassASroute_src); - ASroute.dst = sg_netcard_by_name_or_null(A_surfxml_bypassASroute_dst); + ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_bypassASroute_src); + ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_bypassASroute_dst); ASroute.link_list = new std::vector(); for (auto link: parsed_link_list) ASroute.link_list->push_back(link); @@ -839,8 +839,8 @@ void ETag_surfxml_bypassASroute(){ ASroute.symmetrical = false; - ASroute.gw_src = sg_netcard_by_name_or_null(A_surfxml_bypassASroute_gw___src); - ASroute.gw_dst = sg_netcard_by_name_or_null(A_surfxml_bypassASroute_gw___dst); + ASroute.gw_src = sg_netpoint_by_name_or_null(A_surfxml_bypassASroute_gw___src); + ASroute.gw_dst = sg_netpoint_by_name_or_null(A_surfxml_bypassASroute_gw___dst); sg_platf_new_bypassRoute(&ASroute); }