diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2018-03-16 16:53:45 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-03-19 13:07:53 +0100 |
commit | 24bed306b5a67fc682b04cae017b0d0f3ac55a00 (patch) | |
tree | e019f5aff6238dceb430511da4670c6440bba6f3 /rumba/model.py | |
parent | 7b1c1726fe77c307ce51be1860d5c598e2287606 (diff) | |
download | rumba-24bed306b5a67fc682b04cae017b0d0f3ac55a00.tar.gz rumba-24bed306b5a67fc682b04cae017b0d0f3ac55a00.zip |
storyboard: Add link and node up and down events
This adds link and node up and down events to the storyboard, which
can be called by a user on a specific time. The user needs to pass the
time and the shim Ethernet for a link up or down event and a time and
a node for the node up or down event. The interfaces in that layer or
on that node will then be brought down.
Implements #31
Diffstat (limited to 'rumba/model.py')
-rw-r--r-- | rumba/model.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/rumba/model.py b/rumba/model.py index 1f47861..39528be 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -346,9 +346,14 @@ class Node(object): time_out ) - def execute_command(self, command, time_out=3, use_proxy=False): + def execute_command(self, command, time_out=3, + use_proxy=False, as_root=False): # Ssh_config is used twice since it doubles as testbed info # (it holds fields username and password) + if as_root: + if self.ssh_config.username != 'root': + command = "sudo %s" % command + if use_proxy: return ssh_support.execute_proxy_command( self.ssh_config, @@ -406,6 +411,10 @@ class Node(object): sudo=sudo ) + def set_link_state(self, ipcp, state): + self.execute_command('ip link set dev ' + ipcp.ifname + ' ' + state, + as_root=True) + # Base class representing an IPC Process to be created in the experiment # |