From c807556fcd39085c66136a8a628c60ea67f5d852 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Thu, 13 Apr 2017 23:05:56 +0200 Subject: prototype: rlite: add execute_commands() method to reuse code --- rumba/prototypes/rlite.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'rumba/prototypes/rlite.py') diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index e1e3729..25ae943 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -1,7 +1,7 @@ # # Commands to setup and instruct rlite # -# Vincenzo Maffione +# Author: Vincenzo Maffione # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -22,11 +22,16 @@ import rumba.ssh_support as ssh import rumba.model as mod import time -# An experiment over the RLITE implementation +# An experiment over the rlite implementation class Experiment(mod.Experiment): + def __init__(self, testbed, nodes=None): mod.Experiment.__init__(self, testbed, nodes) + def execute_commands(self, node, cmds): + ssh.execute_commands(self.testbed, node.ssh_config, + cmds, time_out=None) + def init(self): cmds = [] @@ -50,8 +55,7 @@ class Experiment(mod.Experiment): cmds.append("rlite-uipcps -v DBG -k 0 &> uipcp.log &") for node in self.nodes: - ssh.execute_commands(self.testbed, node.ssh_config, - cmds, time_out=None) + self.execute_commands(node, cmds) def create_ipcps(self): for node in self.nodes: @@ -79,8 +83,7 @@ class Experiment(mod.Experiment): cmds.append("rlite-ctl ipcp-config %s netdev %s" \ % (ipcp.name, ipcp.ifname)) - ssh.execute_commands(self.testbed, node.ssh_config, cmds, - time_out = None) + self.execute_commands(node, cmds) def register_ipcps(self): for node in self.nodes: @@ -91,8 +94,7 @@ class Experiment(mod.Experiment): cmds.append("rlite-ctl ipcp-register %s %s" \ % (ipcp.name, lower.name)) - ssh.execute_commands(self.testbed, node.ssh_config, cmds, - time_out = None) + self.execute_commands(node, cmds) def run_prototype(self): print("rlite: setting up") -- cgit v1.2.3