Emulating some network conditions#
Website: https://discovery.gitlabpages.inria.fr/enoslib/index.html
Instant chat: https://framateam.org/enoslib
Source code: https://gitlab.inria.fr/discovery/enoslib
Prerequisites#
⚠️ Make sure you’ve run the one time setup for your environment
⚠️ Make sure you’re running this notebook under the right kernel
[ ]:
import enoslib as en
en.check()
First example: a star topology#
Reservation#
[ ]:
import enoslib as en
_ = en.init_logging()
conf = (
en.G5kConf.from_settings(job_type=[], walltime="01:00:00", job_name="labs_netem")
.add_machine(
roles=["city", "paris"],
cluster="paravance",
nodes=1,
)
.add_machine(
roles=["city", "berlin"],
cluster="paravance",
nodes=1,
)
.add_machine(
roles=["city", "londres"],
cluster="paravance",
nodes=1,
)
.finalize()
)
provider = en.G5k(conf)
roles, networks = provider.init()
[ ]:
roles
[ ]:
networks
Applying the network constraints#
[ ]:
roles = en.sync_info(roles, networks)
netem = en.Netem()
(
netem
.add_constraints("delay 5ms", roles["paris"], symmetric=True)
.add_constraints("delay 10ms", roles["londres"], symmetric=True)
.add_constraints("delay 15ms", roles["berlin"], symmetric=True)
)
netem.deploy()
Checking the network constraints#
[ ]:
netem.validate(output_dir="star_topology")
[ ]:
import pandas as pd
stats = en.Netem.fping_stats("star_topology")
pd.DataFrame(stats, columns=["src", "dest", "ping values"])
[ ]:
roles
[ ]:
netem.destroy()
Second example: a more flexible topology#
[ ]:
roles = en.sync_info(roles, networks)
[ ]:
netem = en.NetemHTB()
(
netem.add_constraints(
src=roles["paris"],
dest=roles["londres"],
delay="5ms",
rate="1gbit",
symetric=True,
)
.add_constraints(
src=roles["paris"],
dest=roles["berlin"],
delay="10ms",
rate="1gbit",
symetric=True,
)
.add_constraints(
src=roles["londres"],
dest=roles["berlin"],
delay="15ms",
rate="1gbit",
symetric=True,
)
)
[ ]:
_ = netem.deploy()
[ ]:
netem.validate(output_dir="custom_topology")
[ ]:
import enoslib as en
import pandas as pd
stats = en.Netem.fping_stats("custom_topology")
pd.DataFrame(stats, columns=["src", "dest", "ping values"])
[ ]:
netem.destroy()
Filter on specific network#
[ ]:
# enable ipv6
en.run_command("dhclient -6 br0", roles=roles)
# sync the info
roles = en.sync_info(roles, networks)
[ ]:
networks
[ ]:
ipv6_network = networks["prod"][1]
ipv6_network
[ ]:
netem = en.NetemHTB()
(
netem.add_constraints(
src=roles["paris"],
dest=roles["londres"],
delay="5ms",
rate="1gbit",
symmetric=True,
networks=[ipv6_network]
)
.add_constraints(
src=roles["paris"],
dest=roles["berlin"],
delay="10ms",
rate="1gbit",
symmetric=True,
networks=[ipv6_network]
)
.add_constraints(
src=roles["londres"],
dest=roles["berlin"],
delay="15ms",
rate="1gbit",
symmetric=True,
networks=[ipv6_network]
)
)
[ ]:
netem.deploy()
[ ]:
netem.validate(output_dir="custom_topology_ipv6")
[ ]:
import enoslib as en
import pandas as pd
stats = en.Netem.fping_stats("custom_topology_ipv6")
pd.DataFrame(stats, columns=["src", "dest", "ping values"])
[ ]:
provider.destroy()
Scaling#
With this we can emulate a multiple Datacenter topology. Intra datacenter link are subject to LAN links while inter-datacenter topology are subject to WAN links.
[ ]:
conf = (
en.VMonG5kConf
.from_settings(job_name="labs_netem")
.add_machine(
roles=["city", "paris"],
cluster="paravance",
number=5,
flavour="tiny"
)
.add_machine(
roles=["city", "londres"],
cluster="paravance",
number=5,
flavour="tiny"
)
.add_machine(
roles=["city", "berlin"],
cluster="paravance",
number=5,
flavour="tiny"
)
.finalize()
)
conf
[ ]:
vmon5k = en.VMonG5k(conf)
[ ]:
[ ]:
vm_roles, vm_networks = vmon5k.init()
[ ]:
vm_roles = en.sync_info(vm_roles, vm_networks)
[ ]:
netem = en.NetemHTB()
(
netem.add_constraints(
src=vm_roles["paris"],
dest=vm_roles["londres"],
delay="5ms",
rate="1gbit",
symmetric=True,
)
.add_constraints(
src=vm_roles["paris"],
dest=vm_roles["berlin"],
delay="10ms",
rate="1gbit",
symmetric=True,
)
.add_constraints(
src=vm_roles["londres"],
dest=vm_roles["berlin"],
delay="15ms",
rate="1gbit",
symmetric=True,
)
)
netem
[ ]:
_ = netem.deploy()
[ ]:
netem.validate(output_dir="scaling_topology")
[ ]:
import enoslib as en
import pandas as pd
stats = en.Netem.fping_stats("scaling_topology")
pd.DataFrame(stats, columns=["src", "dest", "ping values"])
[ ]:
netem.destroy()
[ ]:
provider.destroy()
[ ]: