+ py::class_<Link, std::unique_ptr<Link, py::nodelete>> link(m, "Link",
+ "Network link. See the C++ documentation for details.");
+ link.def("set_latency", py::overload_cast<const std::string&>(&Link::set_latency),
+ py::call_guard<py::gil_scoped_release>(),
+ "Set the latency as a string. Accepts values with units, such as ‘1s’ or ‘7ms’.\nFull list of accepted "
+ "units: w (week), d (day), h, s, ms, us, ns, ps.")
+ .def("set_latency", py::overload_cast<double>(&Link::set_latency), py::call_guard<py::gil_scoped_release>(),
+ "Set the latency as a float (in seconds).")
+ .def("set_bandwidth", &Link::set_bandwidth, py::call_guard<py::gil_scoped_release>(),
+ "Set the bandwidth (in byte per second).")
+ .def(
+ "set_bandwidth_profile",
+ [](Link* l, const std::string& profile, double period) {
+ l->set_bandwidth_profile(simgrid::kernel::profile::ProfileBuilder::from_string("", profile, period));
+ },
+ py::call_guard<py::gil_scoped_release>(),
+ "Specify a profile modeling the external load according to an exhaustive list. "
+ "Each line of the profile describes timed events as ``date bandwidth`` (in bytes per second). "
+ "For example, the following content describes a link which bandwidth changes to 40 Mb/s at t=4, and to 6 "
+ "Mb/s at t=8:\n\n"
+ ".. code-block:: python\n\n"
+ " \"\"\"\n"
+ " 4.0 40000000\n"
+ " 8.0 60000000\n"
+ " \"\"\"\n\n"
+ ".. warning:: Don't get fooled: bandwidth and latency profiles of links contain absolute values,"
+ " while speed profiles of hosts contain ratios.\n\n"
+ "The second function parameter is the periodicity: the time to wait after the last event to start again over "
+ "the list. Set it to -1 to not loop over.")
+ .def(
+ "set_latency_profile",
+ [](Link* l, const std::string& profile, double period) {
+ l->set_latency_profile(simgrid::kernel::profile::ProfileBuilder::from_string("", profile, period));
+ },
+ py::call_guard<py::gil_scoped_release>(),
+ "Specify a profile modeling the external load according to an exhaustive list. "
+ "Each line of the profile describes timed events as ``date latency`` (in seconds). "
+ "For example, the following content describes a link which latency changes to 1ms (0.001s) at t=1, and to 2s "
+ "at t=2:\n\n"
+ ".. code-block:: python\n\n"
+ " \"\"\"\n"
+ " 1.0 0.001\n"
+ " 2.0 2\n"
+ " \"\"\"\n\n"
+ ".. warning:: Don't get fooled: bandwidth and latency profiles of links contain absolute values,"
+ " while speed profiles of hosts contain ratios.\n\n"
+ "The second function parameter is the periodicity: the time to wait after the last event to start again over "
+ "the list. Set it to -1 to not loop over.")
+ .def(
+ "set_state_profile",
+ [](Link* l, const std::string& profile, double period) {
+ l->set_state_profile(simgrid::kernel::profile::ProfileBuilder::from_string("", profile, period));
+ },
+ "Specify a profile modeling the churn. "
+ "Each line of the profile describes timed events as ``date boolean``, where the boolean (0 or 1) tells "
+ "whether the link is on. "
+ "For example, the following content describes a link which turns off at t=1 and back on at t=2:\n\n"
+ ".. code-block:: python\n\n"
+ " \"\"\"\n"
+ " 1.0 0\n"
+ " 2.0 1\n"
+ " \"\"\"\n\n"
+ "The second function parameter is the periodicity: the time to wait after the last event to start again over "
+ "the list. Set it to -1 to not loop over.")
+
+ .def("turn_on", &Link::turn_on, py::call_guard<py::gil_scoped_release>(), "Turns the link on.")
+ .def("turn_off", &Link::turn_off, py::call_guard<py::gil_scoped_release>(), "Turns the link off.")
+ .def("is_on", &Link::is_on, "Check whether the link is on.")
+
+ .def("set_sharing_policy", &Link::set_sharing_policy, py::call_guard<py::gil_scoped_release>(),
+ "Set sharing policy for this link")
+ .def("set_concurrency_limit", &Link::set_concurrency_limit, py::call_guard<py::gil_scoped_release>(),
+ "Set concurrency limit for this link")
+ .def("set_host_wifi_rate", &Link::set_host_wifi_rate, py::call_guard<py::gil_scoped_release>(),