#ifndef SIMGRID_S4U_NETZONE_HPP
#define SIMGRID_S4U_NETZONE_HPP
+#include "simgrid/s4u/Host.hpp"
#include <simgrid/forward.h>
#include <simgrid/s4u/Link.hpp>
#include <xbt/graph.h>
/** @brief Get the gateway associated to this netzone */
kernel::routing::NetPoint* get_gateway() const;
kernel::routing::NetPoint* get_gateway(const std::string& name) const;
+ void set_gateway(s4u::Host* router) { set_gateway(router->get_netpoint()); }
void set_gateway(kernel::routing::NetPoint* router);
void set_gateway(const std::string& name, kernel::routing::NetPoint* router);
.def("add_route",
py::overload_cast<const simgrid::s4u::Host*, const simgrid::s4u::Host*,
const std::vector<simgrid::s4u::LinkInRoute>&, bool>(&simgrid::s4u::NetZone::add_route),
- "Add a route between 2 netpoints")
+ "Add a route between 2 hosts")
.def("add_route",
py::overload_cast<const simgrid::s4u::Host*, const simgrid::s4u::Host*,
const std::vector<const simgrid::s4u::Link*>&>(&simgrid::s4u::NetZone::add_route),
- "Add a route between 2 netpoints")
+ "Add a route between 2 hosts")
+ .def("add_route",
+ py::overload_cast<const simgrid::s4u::NetZone*, const simgrid::s4u::NetZone*,
+ const std::vector<simgrid::s4u::LinkInRoute>&, bool>(&simgrid::s4u::NetZone::add_route),
+ "Add a route between 2 netzones. The gateway of each zone gets used.")
+ .def("add_route",
+ py::overload_cast<const simgrid::s4u::NetZone*, const simgrid::s4u::NetZone*,
+ const std::vector<const simgrid::s4u::Link*>&>(&simgrid::s4u::NetZone::add_route),
+ "Add a route between 2 netzones. The gateway of each zone gets used.")
.def("create_host", py::overload_cast<const std::string&, double>(&simgrid::s4u::NetZone::create_host),
"Creates a host")
.def("create_host",
.def("create_router", &simgrid::s4u::NetZone::create_router, "Create a router")
.def("set_parent", &simgrid::s4u::NetZone::set_parent, "Set the parent of this zone")
.def("set_property", &simgrid::s4u::NetZone::set_property, "Add a property to this zone")
+ .def("set_gateway", py::overload_cast<simgrid::s4u::Host*>(&simgrid::s4u::NetZone::set_gateway),
+ "Specify the gateway of this zone, to be used for inter-zone routes")
+ .def("set_gateway", py::overload_cast<simgrid::kernel::routing::NetPoint*>(&simgrid::s4u::NetZone::set_gateway),
+ "Specify the gateway of this zone, to be used for inter-zone routes")
.def_property_readonly("netpoint", &simgrid::s4u::NetZone::get_netpoint,
"Retrieve the netpoint associated to this zone")
.def("seal", &simgrid::s4u::NetZone::seal, "Seal this NetZone")
host1.create_disk("disk1", 1e5, 1e4).seal()
host1.create_disk("disk2", "1MBps", "1Mbps").seal()
host1.seal()
+ dijkstra.set_gateway(host1)
host2 = dijkstra.create_host("host2", ["1Gf", "1Mf"]).seal()
hosts.append(host2)
link1 = dijkstra.create_link("link1_up", [1e9]).set_latency(1e-3).set_concurrency_limit(10).seal()
this_actor.info(msg_base + vivaldi.name)
vivaldi.set_parent(root)
host3 = vivaldi.create_host("host3", 1e9).set_coordinates("1 1 1").seal()
+ vivaldi.set_gateway(host3)
host4 = vivaldi.create_host("host4", "1Gf").set_coordinates("2 2 2").seal()
hosts.append(host3)
hosts.append(host4)
this_actor.info(msg_base + empty.name)
empty.set_parent(root)
host5 = empty.create_host("host5", 1e9)
+ empty.set_gateway(host5)
hosts.append(host5)
empty.seal()
this_actor.info(msg_base + wifi.name)
wifi.set_parent(root)
router = wifi.create_router("wifi_router")
+ wifi.set_gateway(router)
wifi.set_property("access_point", "wifi_router")
host6 = wifi.create_host(
"host6", ["100.0Mf", "50.0Mf", "20.0Mf"]).seal()
link_a = vivaldi.create_link("linkA", 1e9).seal()
link_b = vivaldi.create_link("linkB", "1GBps").seal()
link_c = vivaldi.create_link("linkC", "1GBps").seal()
- root.add_route(dijkstra.netpoint, vivaldi.netpoint, host1.netpoint, host3.netpoint, [LinkInRoute(link_a)], True)
- root.add_route(vivaldi.netpoint, empty.netpoint, host3.netpoint, host5.netpoint, [LinkInRoute(link_b)], True)
- root.add_route(empty.netpoint, wifi.netpoint, host5.netpoint, router, [LinkInRoute(link_c)], True)
+ root.add_route(dijkstra, vivaldi, [link_a])
+ root.add_route(vivaldi, empty, [link_b])
+ root.add_route(empty, wifi, [link_c])
# create actors Sender/Receiver
Actor.create("sender", hosts[0], Sender(hosts))