From 9d07466cd0388ddece61d15f0abff5b89add5929 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sat, 24 Jul 2021 18:43:05 +0200 Subject: prototypes: Fix experiment without influxDB This fixes creating an experiment without influxDB defined (check for None before iterating). Also fixes setting link rates to 1GbE, as this requires link negotiation to be enabled. --- rumba/prototypes/ouroboros.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'rumba/prototypes/ouroboros.py') diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index c8d286f..2c16ea5 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -130,10 +130,11 @@ class Experiment(mod.Experiment): server_decorator=OurServer ) - _required = ['ip', 'port', 'org', 'token'] - for field in _required: - if field not in influxdb: - raise(Exception("Missing field %s in influx_db: %s" % field)) + if influxdb is not None: + _required = ['ip', 'port', 'org', 'token'] + for field in _required: + if field not in influxdb: + raise (Exception("Missing field %s in influx_db: %s" % field)) self.r_ipcps = dict() self.irmd = None @@ -303,9 +304,14 @@ class Experiment(mod.Experiment): def _set_phy_link_rate_to(self, src, dst, megabit): + autoneg = 'off' + + if megabit == 1000: + autoneg = 'on' + commands = ["route | grep $(ping server -c 1 | head -n1 | cut -f3 -d' ' | head -c -3 | tail -c +2) | " "grep -o '[^ ]*$' > iface ".format(dst), - "sudo ethtool -s $(cat iface) speed {} duplex full autoneg off".format(megabit), + "sudo ethtool -s $(cat iface) speed {} duplex full autoneg {}".format(megabit, autoneg), "sudo ip link set $(cat iface) down", "sudo ip link set $(cat iface) up && sleep 10", "sudo ethtool $(cat iface) | grep '{}Mb/s'".format(megabit), -- cgit v1.2.3