void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
{
- XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->cname(), src->id(), dst->cname(), dst->id());
+ XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
xbt_assert(not privateLinks_.empty(),
"Cluster routing: no links attached to the source node - did you use host_link tag?");
"Malformed cluster. This may be because your platform file is a hypergraph while it must be a graph.");
/* create the router */
- xbt_node_t routerNode = new_xbt_graph_node(graph, router_->cname(), nodes);
+ xbt_node_t routerNode = new_xbt_graph_node(graph, router_->getCname(), nodes);
xbt_node_t backboneNode = nullptr;
if (backbone_) {
for (auto const& src : getVertices()) {
if (not src->isRouter()) {
- xbt_node_t previous = new_xbt_graph_node(graph, src->cname(), nodes);
+ xbt_node_t previous = new_xbt_graph_node(graph, src->getCname(), nodes);
std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id());
xbt_edge_t edge = xbt_graph_get_edge(routeGraph_, node_s_v, node_e_v);
if (edge == nullptr)
- THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name().c_str(), dst->name().c_str());
+ THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname());
sg_platf_route_cbarg_t e_route = static_cast<sg_platf_route_cbarg_t>(xbt_graph_edge_get_data(edge));
xbt_edge_t edge = xbt_graph_get_edge(routeGraph_, node_pred_v, node_v);
if (edge == nullptr)
- THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name().c_str(), dst->name().c_str());
+ THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname());
sg_platf_route_cbarg_t e_route = static_cast<sg_platf_route_cbarg_t>(xbt_graph_edge_get_data(edge));
if (v == dst_node_id)
first_gw = gw_dst;
- if (hierarchy_ == RoutingMode::recursive && v != dst_node_id &&
- strcmp(gw_dst->name().c_str(), prev_gw_src->name().c_str())) {
+ if (hierarchy_ == RoutingMode::recursive && v != dst_node_id && gw_dst->getName() != prev_gw_src->getName()) {
std::vector<surf::LinkImpl*> e_route_as_to_as;
NetPoint* gw_dst_net_elm = nullptr;
{
NetPoint* src = route->src;
NetPoint* dst = route->dst;
- const char* srcName = src->name().c_str();
- const char* dstName = dst->name().c_str();
+ const char* srcName = src->getCname();
+ const char* dstName = dst->getCname();
addRouteCheckParams(route);
if (edge)
THROWF(arg_error, 0, "Route from %s to %s already exists", dstName, srcName);
} else {
- XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, route->gw_dst->name().c_str(), srcName,
- route->gw_src->name().c_str());
+ XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, route->gw_dst->getCname(), srcName,
+ route->gw_src->getCname());
if (edge)
- THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, route->gw_dst->name().c_str(), srcName,
- route->gw_src->name().c_str());
+ THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, route->gw_dst->getCname(), srcName,
+ route->gw_src->getCname());
}
if (route->gw_dst && route->gw_src) {
if (dst->isRouter() || src->isRouter())
return;
- XBT_VERB("dragonfly getLocalRout from '%s'[%u] to '%s'[%u]", src->name().c_str(), src->id(), dst->name().c_str(),
- dst->id());
+ XBT_VERB("dragonfly getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
if ((src->id() == dst->id()) && hasLoopback_) {
std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePosition(src->id()));
/* Let's find the source and the destination in our internal structure */
auto searchedNode = this->computeNodes_.find(src->id());
xbt_assert(searchedNode != this->computeNodes_.end(), "Could not find the source %s [%u] in the fat tree",
- src->name().c_str(), src->id());
+ src->getCname(), src->id());
FatTreeNode* source = searchedNode->second;
searchedNode = this->computeNodes_.find(dst->id());
xbt_assert(searchedNode != this->computeNodes_.end(), "Could not find the destination %s [%u] in the fat tree",
- dst->name().c_str(), dst->id());
+ dst->getCname(), dst->id());
FatTreeNode* destination = searchedNode->second;
- XBT_VERB("Get route and latency from '%s' [%u] to '%s' [%u] in a fat tree", src->name().c_str(), src->id(),
- dst->name().c_str(), dst->id());
+ XBT_VERB("Get route and latency from '%s' [%u] to '%s' [%u] in a fat tree", src->getCname(), src->id(),
+ dst->getCname(), dst->id());
/* In case destination is the source, and there is a loopback, let's use it instead of going up to a switch */
if (source->id == destination->id && this->hasLoopback_) {
do {
int pred = TO_FLOYD_PRED(src->id(), cur);
if (pred == -1)
- THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name().c_str(), dst->name().c_str());
+ THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname());
route_stack.push_back(TO_FLOYD_LINK(pred, cur));
cur = pred;
} while (cur != src->id());
sg_platf_route_cbarg_t e_route = route_stack.back();
route_stack.pop_back();
if (hierarchy_ == RoutingMode::recursive && prev_dst_gw != nullptr &&
- strcmp(prev_dst_gw->name().c_str(), e_route->gw_src->name().c_str())) {
+ prev_dst_gw->getCname() != e_route->gw_src->getCname()) {
getGlobalRoute(prev_dst_gw, e_route->gw_src, route->link_list, lat);
}
if (route->gw_dst) // netzone route (to adapt the error message, if any)
xbt_assert(nullptr == TO_FLOYD_LINK(route->src->id(), route->dst->id()),
"The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).",
- route->src->name().c_str(), route->gw_src->name().c_str(), route->dst->name().c_str(),
- route->gw_dst->name().c_str());
+ route->src->getCname(), route->gw_src->getCname(), route->dst->getCname(), route->gw_dst->getCname());
else
xbt_assert(nullptr == TO_FLOYD_LINK(route->src->id(), route->dst->id()),
"The route between %s and %s already exists (Rq: routes are symmetrical by default).",
- route->src->name().c_str(), route->dst->name().c_str());
+ route->src->getCname(), route->dst->getCname());
TO_FLOYD_LINK(route->src->id(), route->dst->id()) = newExtendedRoute(hierarchy_, route, 1);
TO_FLOYD_PRED(route->src->id(), route->dst->id()) = route->src->id();
xbt_assert(
nullptr == TO_FLOYD_LINK(route->dst->id(), route->src->id()),
"The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.",
- route->dst->name().c_str(), route->gw_dst->name().c_str(), route->src->name().c_str(),
- route->gw_src->name().c_str());
+ route->dst->getCname(), route->gw_dst->getCname(), route->src->getCname(), route->gw_src->getCname());
else
xbt_assert(nullptr == TO_FLOYD_LINK(route->dst->id(), route->src->id()),
"The route between %s and %s already exists. You should not declare the reverse path as symmetrical.",
- route->dst->name().c_str(), route->src->name().c_str());
+ route->dst->getCname(), route->src->getCname());
if (route->gw_dst && route->gw_src) {
NetPoint* gw_tmp = route->gw_src;
}
if (not route->gw_src || not route->gw_dst)
- XBT_DEBUG("Load Route from \"%s\" to \"%s\"", route->dst->name().c_str(), route->src->name().c_str());
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", route->dst->getCname(), route->src->getCname());
else
- XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", route->dst->name().c_str(), route->gw_src->name().c_str(),
- route->src->name().c_str(), route->gw_dst->name().c_str());
+ XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", route->dst->getCname(), route->gw_src->getCname(),
+ route->src->getCname(), route->gw_dst->getCname());
TO_FLOYD_LINK(route->dst->id(), route->src->id()) = newExtendedRoute(hierarchy_, route, 0);
TO_FLOYD_PRED(route->dst->id(), route->src->id()) = route->dst->id();
void FullZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t res, double* lat)
{
- XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->cname(), src->id(), dst->cname(), dst->id());
+ XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
unsigned int table_size = getTableSize();
sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(src->id(), dst->id());
if (route->gw_dst) // inter-zone route (to adapt the error message, if any)
xbt_assert(nullptr == TO_ROUTE_FULL(src->id(), dst->id()),
"The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).",
- src->cname(), route->gw_src->cname(), dst->cname(), route->gw_dst->cname());
+ src->getCname(), route->gw_src->getCname(), dst->getCname(), route->gw_dst->getCname());
else
xbt_assert(nullptr == TO_ROUTE_FULL(src->id(), dst->id()),
- "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->cname(),
- dst->cname());
+ "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->getCname(),
+ dst->getCname());
/* Add the route to the base */
TO_ROUTE_FULL(src->id(), dst->id()) = newExtendedRoute(hierarchy_, route, true);
xbt_assert(
nullptr == TO_ROUTE_FULL(dst->id(), src->id()),
"The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.",
- dst->cname(), route->gw_dst->cname(), src->cname(), route->gw_src->cname());
+ dst->getCname(), route->gw_dst->getCname(), src->getCname(), route->gw_src->getCname());
else
xbt_assert(nullptr == TO_ROUTE_FULL(dst->id(), src->id()),
"The route between %s and %s already exists. You should not declare the reverse path as symmetrical.",
- dst->cname(), src->cname());
+ dst->getCname(), src->getCname());
TO_ROUTE_FULL(dst->id(), src->id()) = newExtendedRoute(hierarchy_, route, false);
}
// Our rank in the vertices_ array of the netzone that contains us.
unsigned int id() { return id_; }
- std::string name() { return name_; }
- const char* cname() { return name_.c_str(); }
+ const std::string& getName() const { return name_; }
+ const char* getCname() const { return name_.c_str(); }
/** @brief the NetZone in which this NetPoint is included */
NetZoneImpl* netzone() { return netzone_; }
{
/* Argument validity checks */
if (e_route->gw_dst) {
- XBT_DEBUG("Load bypassNetzoneRoute from %s@%s to %s@%s", e_route->src->cname(), e_route->gw_src->cname(),
- e_route->dst->cname(), e_route->gw_dst->cname());
+ XBT_DEBUG("Load bypassNetzoneRoute from %s@%s to %s@%s", e_route->src->getCname(), e_route->gw_src->getCname(),
+ e_route->dst->getCname(), e_route->gw_dst->getCname());
xbt_assert(not e_route->link_list->empty(), "Bypass route between %s@%s and %s@%s cannot be empty.",
- e_route->src->cname(), e_route->gw_src->cname(), e_route->dst->cname(), e_route->gw_dst->cname());
+ e_route->src->getCname(), e_route->gw_src->getCname(), e_route->dst->getCname(),
+ e_route->gw_dst->getCname());
xbt_assert(bypassRoutes_.find({e_route->src, e_route->dst}) == bypassRoutes_.end(),
- "The bypass route between %s@%s and %s@%s already exists.", e_route->src->cname(),
- e_route->gw_src->cname(), e_route->dst->cname(), e_route->gw_dst->cname());
+ "The bypass route between %s@%s and %s@%s already exists.", e_route->src->getCname(),
+ e_route->gw_src->getCname(), e_route->dst->getCname(), e_route->gw_dst->getCname());
} else {
- XBT_DEBUG("Load bypassRoute from %s to %s", e_route->src->cname(), e_route->dst->cname());
+ XBT_DEBUG("Load bypassRoute from %s to %s", e_route->src->getCname(), e_route->dst->getCname());
xbt_assert(not e_route->link_list->empty(), "Bypass route between %s and %s cannot be empty.",
- e_route->src->cname(), e_route->dst->cname());
+ e_route->src->getCname(), e_route->dst->getCname());
xbt_assert(bypassRoutes_.find({e_route->src, e_route->dst}) == bypassRoutes_.end(),
- "The bypass route between %s and %s already exists.", e_route->src->cname(), e_route->dst->cname());
+ "The bypass route between %s and %s already exists.", e_route->src->getCname(),
+ e_route->dst->getCname());
}
/* Build a copy that will be stored in the dict */
NetZoneImpl* src_as = src->netzone();
NetZoneImpl* dst_as = dst->netzone();
- xbt_assert(src_as, "Host %s must be in a netzone", src->cname());
- xbt_assert(dst_as, "Host %s must be in a netzone", dst->cname());
+ xbt_assert(src_as, "Host %s must be in a netzone", src->getCname());
+ xbt_assert(dst_as, "Host %s must be in a netzone", dst->getCname());
/* (2) find the path to the root routing component */
std::vector<NetZoneImpl*> path_src;
if (latency)
*latency += link->latency();
}
- XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links", src->cname(), dst->cname(),
+ XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links", src->getCname(), dst->getCname(),
bypassedRoute->links.size());
return true;
}
if (bypassedRoute) {
XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links. We may have to complete it with recursive "
"calls to getRoute",
- src->cname(), dst->cname(), bypassedRoute->links.size());
+ src->getCname(), dst->getCname(), bypassedRoute->links.size());
if (src != key.first)
getGlobalRoute(src, bypassedRoute->gw_src, links, latency);
for (surf::LinkImpl* const& link : bypassedRoute->links) {
getGlobalRoute(bypassedRoute->gw_dst, dst, links, latency);
return true;
}
- XBT_DEBUG("No bypass route from '%s' to '%s'.", src->cname(), dst->cname());
+ XBT_DEBUG("No bypass route from '%s' to '%s'.", src->getCname(), dst->getCname());
return false;
}
s_sg_platf_route_cbarg_t route;
memset(&route, 0, sizeof(route));
- XBT_DEBUG("Resolve route from '%s' to '%s'", src->cname(), dst->cname());
+ XBT_DEBUG("Resolve route from '%s' to '%s'", src->getCname(), dst->getCname());
/* Find how src and dst are interconnected */
NetZoneImpl *common_ancestor;
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());
+ src->getCname(), dst->getCname());
/* If source gateway is not our source, we have to recursively find our way up to this point */
if (src != route.gw_src)
getLocalRoute(my_src, my_dst, route, nullptr);
- XBT_DEBUG("get_route_and_latency %s -> %s", my_src->cname(), my_dst->cname());
+ XBT_DEBUG("get_route_and_latency %s -> %s", my_src->getCname(), my_dst->getCname());
xbt_node_t current;
xbt_node_t previous;
const char *current_name;
if (route->gw_src) {
- previous = new_xbt_graph_node(graph, route->gw_src->cname(), nodes);
- previous_name = route->gw_src->cname();
+ previous = new_xbt_graph_node(graph, route->gw_src->getCname(), nodes);
+ previous_name = route->gw_src->getCname();
} else {
- previous = new_xbt_graph_node(graph, my_src->cname(), nodes);
- previous_name = my_src->cname();
+ previous = new_xbt_graph_node(graph, my_src->getCname(), nodes);
+ previous_name = my_src->getCname();
}
for (auto const& link : *route->link_list) {
}
if (route->gw_dst) {
- current = new_xbt_graph_node(graph, route->gw_dst->cname(), nodes);
- current_name = route->gw_dst->cname();
+ current = new_xbt_graph_node(graph, route->gw_dst->getCname(), nodes);
+ current_name = route->gw_dst->getCname();
} else {
- current = new_xbt_graph_node(graph, my_dst->cname(), nodes);
- current_name = my_dst->cname();
+ current = new_xbt_graph_node(graph, my_dst->getCname(), nodes);
+ current_name = my_dst->getCname();
}
new_xbt_graph_edge(graph, previous, current, edges);
XBT_DEBUG(" %s -> %s", previous_name, current_name);
void RoutedZone::getRouteCheckParams(NetPoint* src, NetPoint* dst)
{
- xbt_assert(src, "Cannot find a route from nullptr to %s", dst->cname());
- xbt_assert(dst, "Cannot find a route from %s to nullptr", src->cname());
+ xbt_assert(src, "Cannot find a route from nullptr to %s", dst->getCname());
+ xbt_assert(dst, "Cannot find a route from %s to nullptr", src->getCname());
NetZone* src_as = src->netzone();
NetZone* dst_as = dst->netzone();
xbt_assert(src_as == dst_as,
"Internal error: %s@%s and %s@%s are not in the same netzone as expected. Please report that bug.",
- src->cname(), src_as->getCname(), dst->cname(), dst_as->getCname());
+ src->getCname(), src_as->getCname(), dst->getCname(), dst_as->getCname());
xbt_assert(this == dst_as, "Internal error: route destination %s@%s is not in netzone %s as expected (route source: "
"%s@%s). Please report that bug.",
- src->cname(), dst->cname(), src_as->getCname(), dst_as->getCname(), getCname());
+ src->getCname(), dst->getCname(), src_as->getCname(), dst_as->getCname(), getCname());
}
void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route)
{
NetPoint* src = route->src;
NetPoint* dst = route->dst;
- const char* srcName = src->cname();
- const char* dstName = dst->cname();
+ const char* srcName = src->getCname();
+ const char* dstName = dst->getCname();
if (not route->gw_dst || not route->gw_src) {
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", srcName, dstName);
"When defining a route, dst cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?",
dstName);
} else {
- XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, route->gw_src->cname(), dstName, route->gw_dst->cname());
+ XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, route->gw_src->getCname(), dstName,
+ route->gw_dst->getCname());
xbt_assert(src->isNetZone(), "When defining a NetzoneRoute, src must be a netzone but '%s' is not", srcName);
xbt_assert(dst->isNetZone(), "When defining a NetzoneRoute, dst must be a netzone but '%s' is not", dstName);
xbt_assert(route->gw_dst->isHost() || route->gw_dst->isRouter(),
"When defining a NetzoneRoute, gw_dst must be an host or a router but '%s' is not.", dstName);
- xbt_assert(route->gw_src != route->gw_dst, "Cannot define an NetzoneRoute from '%s' to itself", route->gw_src->cname());
+ xbt_assert(route->gw_src != route->gw_dst, "Cannot define an NetzoneRoute from '%s' to itself",
+ route->gw_src->getCname());
- xbt_assert(src, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, route->gw_src->cname(),
- dstName, route->gw_dst->cname(), srcName);
- xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, route->gw_src->cname(),
- dstName, route->gw_dst->cname(), dstName);
+ xbt_assert(src, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, route->gw_src->getCname(),
+ dstName, route->gw_dst->getCname(), srcName);
+ xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, route->gw_src->getCname(),
+ dstName, route->gw_dst->getCname(), dstName);
xbt_assert(not route->link_list->empty(), "Empty route (between %s@%s and %s@%s) forbidden.", srcName,
- route->gw_src->cname(), dstName, route->gw_dst->cname());
+ route->gw_src->getCname(), dstName, route->gw_dst->getCname());
}
onRouteCreation(route->symmetrical, route->src, route->dst, route->gw_src, route->gw_dst, route->link_list);
void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
{
- XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->name().c_str(), src->id(), dst->name().c_str(),
- dst->id());
+ XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
if (dst->isRouter() || src->isRouter())
return;
std::vector<std::string> string_values;
boost::split(string_values, coordStr, boost::is_any_of(" "));
- xbt_assert(string_values.size() == 3, "Coordinates of %s must have 3 dimensions", netpoint->cname());
+ xbt_assert(string_values.size() == 3, "Coordinates of %s must have 3 dimensions", netpoint->getCname());
for (auto const& str : string_values)
try {
coords.shrink_to_fit();
netpoint->extension_set<Coords>(this);
- XBT_DEBUG("Coords of %s %p: %s", netpoint->cname(), netpoint, coordStr.c_str());
+ XBT_DEBUG("Coords of %s %p: %s", netpoint->getCname(), netpoint, coordStr.c_str());
}
}; // namespace vivaldi
{
simgrid::kernel::routing::vivaldi::Coords* coords = np->extension<simgrid::kernel::routing::vivaldi::Coords>();
xbt_assert(coords, "Please specify the Vivaldi coordinates of %s %s (%p)",
- (np->isNetZone() ? "Netzone" : (np->isHost() ? "Host" : "Router")), np->cname(), np);
+ (np->isNetZone() ? "Netzone" : (np->isHost() ? "Host" : "Router")), np->getCname(), np);
return &coords->coords;
}
new simgrid::kernel::routing::vivaldi::Coords(netpoint, coord);
- std::string link_up = "link_" + netpoint->name() + "_UP";
- std::string link_down = "link_" + netpoint->name() + "_DOWN";
+ std::string link_up = "link_" + netpoint->getName() + "_UP";
+ std::string link_down = "link_" + netpoint->getName() + "_DOWN";
surf::LinkImpl* linkUp = surf_network_model->createLink(link_up, bw_out, 0, SURF_LINK_SHARED);
surf::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, SURF_LINK_SHARED);
privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
{
- XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->cname(), src->id(), dst->cname(), dst->id());
+ XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
if (src->isNetZone()) {
- std::string srcName = "router_" + src->name();
- std::string dstName = "router_" + dst->name();
+ std::string srcName = "router_" + src->getName();
+ std::string dstName = "router_" + dst->getName();
route->gw_src = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(srcName.c_str());
route->gw_dst = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(dstName.c_str());
}
/** @brief Register a new netpoint to the system */
void Engine::netpointRegister(simgrid::kernel::routing::NetPoint* point)
{
-// simgrid::simix::kernelImmediate([&]{ FIXME: this segfaults in set_thread
- pimpl->netpoints_[point->name()] = point;
-// });
+ // simgrid::simix::kernelImmediate([&]{ FIXME: this segfaults in set_thread
+ pimpl->netpoints_[point->getName()] = point;
+ // });
}
/** @brief Unregister a given netpoint */
void Engine::netpointUnregister(simgrid::kernel::routing::NetPoint* point)
{
simgrid::simix::kernelImmediate([this, point] {
- pimpl->netpoints_.erase(point->name());
+ pimpl->netpoints_.erase(point->getName());
delete point;
});
}
void NetZone::getHosts(std::vector<s4u::Host*>* whereto)
{
for (auto const& card : vertices_) {
- s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->name());
+ s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->getName());
if (host != nullptr)
whereto->push_back(host);
}
return;
if (TRACE_is_enabled() && TRACE_needs_platform()) {
container_t father = currentContainer.back();
- new simgrid::instr::Container(netpoint->cname(), simgrid::instr::INSTR_ROUTER, father);
+ new simgrid::instr::Container(netpoint->getCname(), simgrid::instr::INSTR_ROUTER, father);
}
}
if (link_list->size() == 1) {
simgrid::surf::LinkNS3* link = static_cast<simgrid::surf::LinkNS3*>(link_list->at(0));
- XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->cname(), dst->cname(), link->cname(),
+ XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->getCname(), dst->getCname(), link->cname(),
(symmetrical ? "(symmetrical)" : "(not symmetrical)"));
// XBT_DEBUG("src (%s), dst (%s), src_id = %d, dst_id = %d",src,dst, src_id, dst_id);
NetPointNs3* host_src = src->extension<NetPointNs3>();
NetPointNs3* host_dst = dst->extension<NetPointNs3>();
- 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());
+ xbt_assert(host_src != nullptr, "Network element %s does not seem to be NS3-ready", src->getCname());
+ xbt_assert(host_dst != nullptr, "Network element %s does not seem to be NS3-ready", dst->getCname());
ns3_add_link(host_src, host_dst, link->bandwidth(), link->latency());
} else {
"of length 1.\n"
"WARNING: Remove long routes to avoid this harmless message; subsequent long routes will be silently "
"ignored.",
- src->cname(), dst->cname(), link_list->size());
+ src->getCname(), dst->getCname(), link_list->size());
warned_about_long_routes = true;
}
}
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);
+ XBT_VERB("SimGrid's %s is known as node %d within NS3", pt->getCname(), pt->extension<NetPointNs3>()->node_num);
});
simgrid::surf::on_cluster.connect(&clusterCreation_cb);
simgrid::s4u::onPlatformCreated.connect(&postparse_cb);
ns3::Ptr<ns3::Node> dst_node = nodes.Get(node2);
xbt_assert(node2 < IPV4addr.size(), "Element %s is unknown to NS3. Is it connected to any one-hop link?",
- dst->pimpl_netpoint->cname());
+ dst->pimpl_netpoint->getCname());
char* addr = IPV4addr.at(node2);
xbt_assert(addr != nullptr, "Element %s is unknown to NS3. Is it connected to any one-hop link?",
- dst->pimpl_netpoint->cname());
+ dst->pimpl_netpoint->getCname());
XBT_DEBUG("ns3_create_flow %u Bytes from %u to %u with Interface %s", TotalBytes, node1, node2, addr);
ns3::PacketSinkHelper sink("ns3::TcpSocketFactory", ns3::InetSocketAddress (ns3::Ipv4Address::GetAny(), port_number));
if (as_cluster->privateLinks_.find(netpoint->id()) != as_cluster->privateLinks_.end())
surf_parse_error(std::string("Host_link for '") + hostlink->id.c_str() + "' is already defined!");
- XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->cname(), netpoint->id());
+ XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->getCname(), netpoint->id());
as_cluster->privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
}
std::vector<simgrid::kernel::routing::NetPoint*> list;
simgrid::s4u::Engine::getInstance()->getNetpointList(&list);
- std::sort(list.begin(), list.end(),
- [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
- return a->name() < b->name();
+ std::sort(list.begin(), list.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
+ return a->getName() < b->getName();
});
bool first = true;
for (auto const& np : list) {
if (not first)
msg += ",";
first = false;
- msg += "'" + np->name() + "'";
+ msg += "'" + np->getName() + "'";
if (msg.length() > 4096) {
msg.pop_back(); // remove trailing quote
msg += "...(list truncated)......";
simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
std::sort(netcardList.begin(), netcardList.end(),
[](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
- return a->name() < b->name();
+ return a->getName() < b->getName();
});
for (auto const& srcCard : netcardList)
if (srcCard->isRouter())
- std::printf(" <router id=\"%s\"/>\n", srcCard->cname());
+ std::printf(" <router id=\"%s\"/>\n", srcCard->getCname());
// Links
unsigned int totalLinks = sg_link_count();
}
for (auto const& netcardDst : netcardList) { // to router
if (netcardDst->isRouter()) {
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->getCname(), netcardDst->cname());
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->getCname(), netcardDst->getCname());
std::vector<simgrid::surf::LinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr);
for (auto const& link : route)
if (value1->isRouter()) {
for (auto const& value2 : netcardList) { // to router
if (value2->isRouter()) {
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->cname(), value2->cname());
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->getCname(), value2->getCname());
std::vector<simgrid::surf::LinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, &route, nullptr);
for (auto const& link : route)
}
for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
simgrid::s4u::Host* host2 = hosts[it_dst];
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->cname(), host2->getCname());
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->getCname(), host2->getCname());
std::vector<simgrid::surf::LinkImpl*> route;
simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, netcardDst, &route, nullptr);
simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
std::sort(netcardList.begin(), netcardList.end(),
[](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
- return a->name() < b->name();
+ return a->getName() < b->getName();
});
int it;
std::printf("NetCards count: %zu\n", netcardList.size());
for (auto const& nc : netcardList)
- std::printf(" - Seen: \"%s\". Type: %s\n", nc->cname(),
+ std::printf(" - Seen: \"%s\". Type: %s\n", nc->getCname(),
nc->isRouter() ? "router" : (nc->isNetZone() ? "netzone" : (nc->isHost() ? "host" : "buggy")));
return 0;