The later is a public header, that our users can load.
#include <xbt/base.h>
#include <xbt/graph.h>
+#include <xbt/signal.hpp>
#include <simgrid/s4u/forward.hpp>
-#include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include
-
namespace simgrid {
namespace kernel {
namespace routing {
class NetZoneImpl;
+class NetPoint;
+}
}
+namespace surf {
+class LinkImpl;
}
namespace s4u {
/* Add content to the netzone, at parsing time. It should be sealed afterward. */
virtual int addComponent(kernel::routing::NetPoint * elm); /* A host, a router or a netzone, whatever */
- virtual void addRoute(sg_platf_route_cbarg_t route);
- virtual void addBypassRoute(sg_platf_route_cbarg_t e_route) = 0;
+ virtual void addRoute(kernel::routing::NetPoint * src, kernel::routing::NetPoint * dst,
+ kernel::routing::NetPoint * gw_src, kernel::routing::NetPoint * gw_dst,
+ std::vector<simgrid::surf::LinkImpl*> & link_list, bool symmetrical);
+ virtual void addBypassRoute(kernel::routing::NetPoint * src, kernel::routing::NetPoint * dst,
+ kernel::routing::NetPoint * gw_src, kernel::routing::NetPoint * gw_dst,
+ std::vector<simgrid::surf::LinkImpl*> & link_list, bool symmetrical) = 0;
/*** Called on each newly created regular route (not on bypass routes) */
static simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "simgrid/jedule/jedule.hpp"
+#include "simgrid/host.h"
#include "simgrid/s4u/NetZone.hpp"
#include "xbt/asserts.h"
#include <algorithm>
{
}
-void DijkstraZone::addRoute(sg_platf_route_cbarg_t route)
+void DijkstraZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
{
- NetPoint* src = route->src;
- NetPoint* dst = route->dst;
const char* srcName = src->getCname();
const char* dstName = dst->getCname();
- addRouteCheckParams(route);
+ addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
/* Create the topology graph */
if (not routeGraph_)
* nodes */
/* Add the route to the base */
- sg_platf_route_cbarg_t e_route = newExtendedRoute(hierarchy_, route, 1);
+ sg_platf_route_cbarg_t e_route = newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1);
newRoute(src->id(), dst->id(), e_route);
// Symmetrical YES
- if (route->symmetrical == true) {
+ if (symmetrical == true) {
xbt_dynar_t nodes = xbt_graph_get_nodes(routeGraph_);
xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src->id(), xbt_node_t);
xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst->id(), xbt_node_t);
xbt_edge_t edge = xbt_graph_get_edge(routeGraph_, node_e_v, node_s_v);
- if (not route->gw_dst || not route->gw_src){
+ if (not gw_dst || not gw_src) {
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dstName, srcName);
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->getCname(), srcName,
- route->gw_src->getCname());
+ XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, gw_dst->getCname(), srcName, gw_src->getCname());
if (edge)
- THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, route->gw_dst->getCname(), srcName,
- route->gw_src->getCname());
+ THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, gw_dst->getCname(), srcName,
+ gw_src->getCname());
}
- if (route->gw_dst && route->gw_src) {
- NetPoint* gw_tmp = route->gw_src;
- route->gw_src = route->gw_dst;
- route->gw_dst = gw_tmp;
+ if (gw_dst && gw_src) {
+ NetPoint* gw_tmp = gw_src;
+ gw_src = gw_dst;
+ gw_dst = gw_tmp;
}
- sg_platf_route_cbarg_t link_route_back = newExtendedRoute(hierarchy_, route, 0);
+ sg_platf_route_cbarg_t link_route_back =
+ newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 0);
newRoute(dst->id(), src->id(), link_route_back);
}
}
* will have a loopback attached to it.
*/
void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) override;
- void addRoute(sg_platf_route_cbarg_t route) override;
+ void addRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) override;
xbt_graph_t routeGraph_ = nullptr; /* xbt_graph */
std::map<int, xbt_node_t> graphNodeMap_; /* map */
}
}
-void FloydZone::addRoute(sg_platf_route_cbarg_t route)
+void FloydZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
{
/* set the size of table routing */
unsigned int table_size = getTableSize();
- addRouteCheckParams(route);
+ addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
if (not linkTable_) {
/* Create Cost, Predecessor and Link tables */
}
/* Check that the route does not already exist */
- 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()),
+ if (gw_dst) // netzone route (to adapt the error message, if any)
+ xbt_assert(nullptr == TO_FLOYD_LINK(src->id(), dst->id()),
"The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).",
- route->src->getCname(), route->gw_src->getCname(), route->dst->getCname(), route->gw_dst->getCname());
+ src->getCname(), gw_src->getCname(), dst->getCname(), 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->getCname(), route->dst->getCname());
+ xbt_assert(nullptr == TO_FLOYD_LINK(src->id(), dst->id()),
+ "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->getCname(),
+ 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();
- TO_FLOYD_COST(route->src->id(), route->dst->id()) =
- (TO_FLOYD_LINK(route->src->id(), route->dst->id()))->link_list.size();
+ TO_FLOYD_LINK(src->id(), dst->id()) =
+ newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1);
+ TO_FLOYD_PRED(src->id(), dst->id()) = src->id();
+ TO_FLOYD_COST(src->id(), dst->id()) = (TO_FLOYD_LINK(src->id(), dst->id()))->link_list.size();
- if (route->symmetrical == true) {
- if (route->gw_dst) // netzone route (to adapt the error message, if any)
+ if (symmetrical == true) {
+ if (gw_dst) // netzone route (to adapt the error message, if any)
xbt_assert(
- nullptr == TO_FLOYD_LINK(route->dst->id(), route->src->id()),
+ nullptr == TO_FLOYD_LINK(dst->id(), src->id()),
"The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.",
- route->dst->getCname(), route->gw_dst->getCname(), route->src->getCname(), route->gw_src->getCname());
+ dst->getCname(), gw_dst->getCname(), src->getCname(), gw_src->getCname());
else
- xbt_assert(nullptr == TO_FLOYD_LINK(route->dst->id(), route->src->id()),
+ xbt_assert(nullptr == TO_FLOYD_LINK(dst->id(), src->id()),
"The route between %s and %s already exists. You should not declare the reverse path as symmetrical.",
- route->dst->getCname(), route->src->getCname());
+ dst->getCname(), src->getCname());
- if (route->gw_dst && route->gw_src) {
- NetPoint* gw_tmp = route->gw_src;
- route->gw_src = route->gw_dst;
- route->gw_dst = gw_tmp;
+ if (gw_dst && gw_src) {
+ NetPoint* gw_tmp = gw_src;
+ gw_src = gw_dst;
+ gw_dst = gw_tmp;
}
- if (not route->gw_src || not route->gw_dst)
- XBT_DEBUG("Load Route from \"%s\" to \"%s\"", route->dst->getCname(), route->src->getCname());
+ if (not gw_src || not gw_dst)
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst->getCname(), src->getCname());
else
- 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();
- TO_FLOYD_COST(route->dst->id(), route->src->id()) =
- (TO_FLOYD_LINK(route->dst->id(), route->src->id()))->link_list.size(); /* count of links, old model assume 1 */
+ XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", dst->getCname(), gw_src->getCname(), src->getCname(),
+ gw_dst->getCname());
+
+ TO_FLOYD_LINK(dst->id(), src->id()) =
+ newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 0);
+ TO_FLOYD_PRED(dst->id(), src->id()) = dst->id();
+ TO_FLOYD_COST(dst->id(), src->id()) =
+ (TO_FLOYD_LINK(dst->id(), src->id()))->link_list.size(); /* count of links, old model assume 1 */
}
}
~FloydZone() override;
void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
- void addRoute(sg_platf_route_cbarg_t route) override;
+ void addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
+ kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+ bool symmetrical) override;
void seal() override;
private:
}
}
-void FullZone::addRoute(sg_platf_route_cbarg_t route)
+void FullZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
{
- NetPoint* src = route->src;
- NetPoint* dst = route->dst;
- addRouteCheckParams(route);
+ addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
unsigned int table_size = getTableSize();
routingTable_ = new sg_platf_route_cbarg_t[table_size * table_size]();
/* Check that the route does not already exist */
- if (route->gw_dst) // inter-zone route (to adapt the error message, if any)
+ if (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->getCname(), route->gw_src->getCname(), dst->getCname(), route->gw_dst->getCname());
+ src->getCname(), gw_src->getCname(), dst->getCname(), 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->getCname(),
dst->getCname());
/* Add the route to the base */
- TO_ROUTE_FULL(src->id(), dst->id()) = newExtendedRoute(hierarchy_, route, true);
-
- if (route->symmetrical == true && src != dst) {
- if (route->gw_dst && route->gw_src) {
- NetPoint* gw_tmp = route->gw_src;
- route->gw_src = route->gw_dst;
- route->gw_dst = gw_tmp;
+ TO_ROUTE_FULL(src->id(), dst->id()) =
+ newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, true);
+
+ if (symmetrical == true && src != dst) {
+ if (gw_dst && gw_src) {
+ NetPoint* gw_tmp = gw_src;
+ gw_src = gw_dst;
+ gw_dst = gw_tmp;
}
- if (route->gw_dst && route->gw_src) // inter-zone route (to adapt the error message, if any)
+ if (gw_dst && gw_src) // inter-zone route (to adapt the error message, if any)
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->getCname(), route->gw_dst->getCname(), src->getCname(), route->gw_src->getCname());
+ dst->getCname(), gw_dst->getCname(), src->getCname(), 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->getCname(), src->getCname());
- TO_ROUTE_FULL(dst->id(), src->id()) = newExtendedRoute(hierarchy_, route, false);
+ TO_ROUTE_FULL(dst->id(), src->id()) =
+ newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, false);
}
}
}
~FullZone() override;
void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
- void addRoute(sg_platf_route_cbarg_t route) override;
+ void addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
+ kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+ bool symmetrical) override;
sg_platf_route_cbarg_t* routingTable_ = nullptr;
};
return res;
}
-void NetZoneImpl::addBypassRoute(sg_platf_route_cbarg_t e_route)
+void NetZoneImpl::addBypassRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
{
/* Argument validity checks */
- if (e_route->gw_dst) {
- 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->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->getCname(),
- e_route->gw_src->getCname(), e_route->dst->getCname(), e_route->gw_dst->getCname());
+ if (gw_dst) {
+ XBT_DEBUG("Load bypassNetzoneRoute from %s@%s to %s@%s", src->getCname(), gw_src->getCname(), dst->getCname(),
+ gw_dst->getCname());
+ xbt_assert(not link_list.empty(), "Bypass route between %s@%s and %s@%s cannot be empty.", src->getCname(),
+ gw_src->getCname(), dst->getCname(), gw_dst->getCname());
+ xbt_assert(bypassRoutes_.find({src, dst}) == bypassRoutes_.end(),
+ "The bypass route between %s@%s and %s@%s already exists.", src->getCname(), gw_src->getCname(),
+ dst->getCname(), gw_dst->getCname());
} else {
- 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->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->getCname(),
- e_route->dst->getCname());
+ XBT_DEBUG("Load bypassRoute from %s to %s", src->getCname(), dst->getCname());
+ xbt_assert(not link_list.empty(), "Bypass route between %s and %s cannot be empty.", src->getCname(),
+ dst->getCname());
+ xbt_assert(bypassRoutes_.find({src, dst}) == bypassRoutes_.end(),
+ "The bypass route between %s and %s already exists.", src->getCname(), dst->getCname());
}
/* Build a copy that will be stored in the dict */
- kernel::routing::BypassRoute* newRoute = new kernel::routing::BypassRoute(e_route->gw_src, e_route->gw_dst);
- for (auto const& link : e_route->link_list)
+ kernel::routing::BypassRoute* newRoute = new kernel::routing::BypassRoute(gw_src, gw_dst);
+ for (auto const& link : link_list)
newRoute->links.push_back(link);
/* Store it */
- bypassRoutes_.insert({{e_route->src, e_route->dst}, newRoute});
+ bypassRoutes_.insert({{src, dst}, newRoute});
}
/** @brief Get the common ancestor and its first children in each line leading to src and dst
#include "simgrid/s4u/NetZone.hpp"
#include "simgrid/s4u/forward.hpp"
+#include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include
namespace simgrid {
namespace kernel {
simgrid::s4u::Host* createHost(const char* name, std::vector<double>* speedPerPstate, int coreAmount,
std::map<std::string, std::string>* props);
/** @brief Creates a new route in this NetZone */
- void addBypassRoute(sg_platf_route_cbarg_t e_route) override;
+ void addBypassRoute(NetPoint * src, NetPoint * dst, NetPoint * gw_src, NetPoint * gw_dst,
+ std::vector<simgrid::surf::LinkImpl*> & link_list, bool symmetrical) override;
protected:
/**
/* ************************************************************************** */
/* ************************* GENERIC AUX FUNCTIONS ************************** */
/* change a route containing link names into a route containing link entities */
-sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg,
+sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst,
+ NetPoint* gw_src, NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical,
bool change_order)
{
- sg_platf_route_cbarg_t result;
-
- result = new s_sg_platf_route_cbarg_t;
+ sg_platf_route_cbarg_t result = new s_sg_platf_route_cbarg_t;
xbt_assert(hierarchy == RoutingMode::base || hierarchy == RoutingMode::recursive,
"The hierarchy of this netzone is neither BASIC nor RECURSIVE, I'm lost here.");
if (hierarchy == RoutingMode::recursive) {
- xbt_assert(routearg->gw_src && routearg->gw_dst, "nullptr is obviously a deficient gateway");
+ xbt_assert(gw_src && gw_dst, "nullptr is obviously a deficient gateway");
- result->gw_src = routearg->gw_src;
- result->gw_dst = routearg->gw_dst;
+ result->gw_src = gw_src;
+ result->gw_dst = gw_dst;
}
- for (auto const& link : routearg->link_list) {
+ for (auto const& link : link_list) {
if (change_order)
result->link_list.push_back(link);
else
"%s@%s). Please report that bug.",
src->getCname(), dst->getCname(), src_as->getCname(), dst_as->getCname(), getCname());
}
-void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route)
+void RoutedZone::addRouteCheckParams(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
{
- NetPoint* src = route->src;
- NetPoint* dst = route->dst;
const char* srcName = src->getCname();
const char* dstName = dst->getCname();
- if (not route->gw_dst || not route->gw_src) {
+ if (not gw_dst || not gw_src) {
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", srcName, dstName);
xbt_assert(src, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, srcName);
xbt_assert(dst, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, dstName);
- xbt_assert(not route->link_list.empty(), "Empty route (between %s and %s) forbidden.", srcName, dstName);
+ xbt_assert(not link_list.empty(), "Empty route (between %s and %s) forbidden.", srcName, dstName);
xbt_assert(not src->isNetZone(),
"When defining a route, src cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?",
srcName);
"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->getCname(), dstName,
- route->gw_dst->getCname());
+ XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, gw_src->getCname(), dstName, 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_src->isHost() || route->gw_src->isRouter(),
+ xbt_assert(gw_src->isHost() || gw_src->isRouter(),
"When defining a NetzoneRoute, gw_src must be an host or a router but '%s' is not.", srcName);
- xbt_assert(route->gw_dst->isHost() || route->gw_dst->isRouter(),
+ xbt_assert(gw_dst->isHost() || 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->getCname());
+ xbt_assert(gw_src != gw_dst, "Cannot define an NetzoneRoute from '%s' to itself", gw_src->getCname());
- 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->getCname(), dstName, route->gw_dst->getCname());
+ xbt_assert(src, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, gw_src->getCname(), dstName,
+ gw_dst->getCname(), srcName);
+ xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, gw_src->getCname(), dstName,
+ gw_dst->getCname(), dstName);
+ xbt_assert(not link_list.empty(), "Empty route (between %s@%s and %s@%s) forbidden.", srcName, gw_src->getCname(),
+ dstName, gw_dst->getCname());
}
- onRouteCreation(route->symmetrical, route->src, route->dst, route->gw_src, route->gw_dst, route->link_list);
+ onRouteCreation(symmetrical, src, dst, gw_src, gw_dst, link_list);
}
}
}
void getGraph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges) override;
- virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg,
- bool change_order);
+ virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src,
+ NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+ bool symmetrical, bool change_order);
protected:
void getRouteCheckParams(NetPoint* src, NetPoint* dst);
- void addRouteCheckParams(sg_platf_route_cbarg_t route);
+ void addRouteCheckParams(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical);
};
}
}
return vertices_.size() - 1; // The rank of the newly created object
}
-void NetZone::addRoute(sg_platf_route_cbarg_t /*route*/)
+void NetZone::addRoute(sg_netpoint_t /*src*/, sg_netpoint_t /*dst*/, sg_netpoint_t /*gw_src*/, sg_netpoint_t /*gw_dst*/,
+ std::vector<simgrid::surf::LinkImpl*>& /*link_list*/, bool /*symmetrical*/)
{
xbt_die("NetZone '%s' does not accept new routes (wrong class).", name_.c_str());
}
void sg_platf_new_route(sg_platf_route_cbarg_t route)
{
- routing_get_current()->addRoute(route);
+ routing_get_current()->addRoute(route->src, route->dst, route->gw_src, route->gw_dst, route->link_list,
+ route->symmetrical);
}
void sg_platf_new_bypassRoute(sg_platf_route_cbarg_t bypassRoute)
{
- routing_get_current()->addBypassRoute(bypassRoute);
+ routing_get_current()->addBypassRoute(bypassRoute->src, bypassRoute->dst, bypassRoute->gw_src, bypassRoute->gw_dst,
+ bypassRoute->link_list, bypassRoute->symmetrical);
}
void sg_platf_new_process(sg_platf_process_cbarg_t process)