aboutsummaryrefslogtreecommitdiff
path: root/rumba/model.py
diff options
context:
space:
mode:
Diffstat (limited to 'rumba/model.py')
-rw-r--r--rumba/model.py11
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
#