Index: utils/link_jitter_update.py |
diff --git a/utils/link_jitter_update.py b/utils/link_jitter_update.py |
index d96e83e11b3987bc44cf9a4801be33585071e797..8aa548cbad5dad074c7c4c817766a37c8aae24a4 100644 |
--- a/utils/link_jitter_update.py |
+++ b/utils/link_jitter_update.py |
@@ -1,24 +1,24 @@ |
-def _notify_cassandra( |
- latency_notifier_path, net, node_a, node_b, value, ycsb_node, mode |
-): |
+def _notify_cassandra(latency_notifier_path, net, node_a, node_b, value, |
+ ycsb_node, mode): |
hosts = net.hosts |
node_a_ip = net.getNodeByName(node_a).IP() |
node_b_ip = net.getNodeByName(node_b).IP() |
for host in hosts: |
if host.name != ycsb_node: # YCSB node does not run a Cassandra instance |
value_changed_cmd = "python {} {} {} {} {} {} {} {}".format( |
- latency_notifier_path, mode, host.name, |
- node_a, node_a_ip, node_b, node_b_ip, value |
- ) |
+ latency_notifier_path, mode, host.name, node_a, node_a_ip, |
+ node_b, node_b_ip, value) |
host.sendCmd(value_changed_cmd) |
host.waiting = False |
print("Notifications have been sent") |
-def change_link_jitter( |
- net, conf, jitter_value=0, distribution='normal', latency=None |
-): |
+def change_link_jitter(net, |
+ conf, |
+ jitter_value=0, |
+ distribution='normal', |
+ latency=None): |
# WARNING: OmnipotentSnitch only supports normal distribution |
# The conf is a list, so we have to iterate through its elements |
# Update this for every entry |
@@ -30,27 +30,32 @@ def change_link_jitter( |
not link.intf2.node.name == ycsb_node: |
# Found the link, now add jitter |
- new_delay = 70 if not latency else latency# FIXME: shouldn't be hard-coded |
+ new_delay = 70 if not latency else latency # FIXME: shouldn't be hard-coded |
link.intf1.reconfig( |
- jitter=jitter_value, delay=new_delay, distribution=distribution |
- ) |
+ jitter=jitter_value, |
+ delay=new_delay, |
+ distribution=distribution) |
link.intf2.reconfig( |
- jitter=jitter_value, delay=new_delay, distribution=distribution |
- ) |
+ jitter=jitter_value, |
+ delay=new_delay, |
+ distribution=distribution) |
if conf['notify_cassandra']: |
_notify_cassandra( |
- notifier_path, net=net, node_a=link.intf1.node.name, |
- node_b=link.intf2.node.name, value=jitter_value, |
- ycsb_node=ycsb_node, mode="jitter" |
- ) |
+ notifier_path, |
+ net=net, |
+ node_a=link.intf1.node.name, |
+ node_b=link.intf2.node.name, |
+ value=jitter_value, |
+ ycsb_node=ycsb_node, |
+ mode="jitter") |
_notify_cassandra( |
- notifier_path, net=net, node_a=link.intf1.node.name, |
- node_b=link.intf2.node.name, value=new_delay, |
- ycsb_node=ycsb_node, mode="latency" |
- ) |
- print( |
- 'Jitter set to: {0}; latency to: {1} for link: {2}'.format( |
- jitter_value, latency, link |
- ) |
- ) |
+ notifier_path, |
+ net=net, |
+ node_a=link.intf1.node.name, |
+ node_b=link.intf2.node.name, |
+ value=new_delay, |
+ ycsb_node=ycsb_node, |
+ mode="latency") |
+ print('Jitter set to: {0}; latency to: {1} for link: {2}'.format( |
+ jitter_value, latency, link)) |
return |