From 67a78828c3166be7fe2cfaa4aad58a9ce8c37376 Mon Sep 17 00:00:00 2001 From: stuartmarsden Date: Sun, 20 May 2018 22:21:19 +0400 Subject: [PATCH 1/2] update_link had wrong arg order --- daemon/core/emulator/coreemu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/core/emulator/coreemu.py b/daemon/core/emulator/coreemu.py index 6712227c..8fa6ffb9 100644 --- a/daemon/core/emulator/coreemu.py +++ b/daemon/core/emulator/coreemu.py @@ -378,7 +378,7 @@ class EmuSession(Session): if node_two: node_two.lock.release() - def update_link(self, node_one_id, node_two_id, link_options, interface_one_id=None, interface_two_id=None): + def update_link(self, node_one_id, node_two_id, interface_one_id=None, interface_two_id=None, link_options=LinkOptions()): """ Update link information between nodes. From aa6b83f29bc51c6740947c0b7d7393ec8e0712c5 Mon Sep 17 00:00:00 2001 From: stuartmarsden Date: Sun, 20 May 2018 23:14:29 +0400 Subject: [PATCH 2/2] fix netem 0% loss and duplicate issue --- daemon/core/netns/openvswitch.py | 4 ++-- daemon/core/netns/vnet.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/daemon/core/netns/openvswitch.py b/daemon/core/netns/openvswitch.py index 341ab92a..46ba2f2c 100644 --- a/daemon/core/netns/openvswitch.py +++ b/daemon/core/netns/openvswitch.py @@ -248,10 +248,10 @@ class OvsNet(PyCoreNet): if jitter is not None: netem += ["%sus" % jitter, "25%"] - if loss is not None: + if loss is not None and loss > 0: netem += ["loss", "%s%%" % min(loss, 100)] - if duplicate is not None: + if duplicate is not None and duplicate > 0: netem += ["duplicate", "%s%%" % min(duplicate, 100)] if delay <= 0 and jitter <= 0 and loss <= 0 and duplicate <= 0: diff --git a/daemon/core/netns/vnet.py b/daemon/core/netns/vnet.py index 545ca648..7a517d08 100644 --- a/daemon/core/netns/vnet.py +++ b/daemon/core/netns/vnet.py @@ -475,9 +475,9 @@ class LxBrNet(PyCoreNet): else: netem += ["%sus" % jitter, "25%"] - if loss is not None: + if loss is not None and loss > 0: netem += ["loss", "%s%%" % min(loss, 100)] - if duplicate is not None: + if duplicate is not None and duplicate > 0: netem += ["duplicate", "%s%%" % min(duplicate, 100)] if delay <= 0 and jitter <= 0 and loss <= 0 and duplicate <= 0: # possibly remove netem if it exists and parent queue wasn't removed