aboutsummaryrefslogtreecommitdiff
path: root/rumba/prototypes/ouroboros.py
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2017-04-21 15:58:56 +0200
committerMarco Capitani <m.capitani@nextworks.it>2017-04-21 15:58:56 +0200
commit26e3e22cd6ca6676b7b99624764f8e6f1ae1479d (patch)
tree65764b5ce423dc88a318e3b7325281bf3a094070 /rumba/prototypes/ouroboros.py
parentee2f6e5c21c0ba94048dbf1c86024e3181718fc2 (diff)
downloadrumba-26e3e22cd6ca6676b7b99624764f8e6f1ae1479d.tar.gz
rumba-26e3e22cd6ca6676b7b99624764f8e6f1ae1479d.zip
rumba: log: Added logging support, migrated from print to logging.
+ Added logging, migrated, default logging configuration is to stdout. + Minor PEP8 adjustments all-around
Diffstat (limited to 'rumba/prototypes/ouroboros.py')
-rw-r--r--rumba/prototypes/ouroboros.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py
index 4fdacd6..9776c5e 100644
--- a/rumba/prototypes/ouroboros.py
+++ b/rumba/prototypes/ouroboros.py
@@ -21,6 +21,11 @@
import rumba.ssh_support as ssh
import rumba.model as mod
import time
+import rumba.log as log
+
+
+logger = log.get_logger(__name__)
+
# An experiment over the Ouroboros implementation
class Experiment(mod.Experiment):
@@ -48,7 +53,7 @@ class Experiment(mod.Experiment):
cmds.append("irm b ap " + ap + " n " + name)
ssh.execute_commands(self.testbed, node.ssh_config,
- cmds, time_out = None)
+ cmds, time_out=None)
def reg_names(self):
for node in self.nodes:
@@ -60,14 +65,14 @@ class Experiment(mod.Experiment):
cmds.append(cmd)
ssh.execute_commands(self.testbed, node.ssh_config, cmds,
- time_out = None)
+ time_out=None)
def create_ipcps(self):
for node in self.nodes:
cmds = list()
for ipcp in node.ipcps:
cmds2 = list()
- if ipcp.dif_bootstrapper == True:
+ if ipcp.dif_bootstrapper:
cmd = "irm i b n " + ipcp.name
else:
cmd = "irm i c n " + ipcp.name
@@ -80,7 +85,7 @@ class Experiment(mod.Experiment):
cmd += " dif " + ipcp.dif.name
elif type(ipcp.dif) is mod.NormalDIF:
cmd += " type normal"
- if ipcp.dif_bootstrapper == True:
+ if ipcp.dif_bootstrapper:
cmd += " dif " + ipcp.dif.name
cmd2 = "irm b i " + ipcp.name + " name " + ipcp.dif.name
cmds2.append(cmd2)
@@ -97,7 +102,7 @@ class Experiment(mod.Experiment):
cmd += " type shim-udp"
cmd += " dif " + ipcp.dif.name
else:
- print("Unsupported IPCP type")
+ logger.error("Unsupported IPCP type")
continue
cmds.append(cmd)
@@ -105,7 +110,7 @@ class Experiment(mod.Experiment):
cmds.append(cmd)
ssh.execute_commands(self.testbed, node.ssh_config, cmds,
- time_out = None)
+ time_out=None)
def enroll_ipcps(self):
for el in self.enrollments:
@@ -128,18 +133,18 @@ class Experiment(mod.Experiment):
ssh.execute_commands(self.testbed,
e['enrollee'].ssh_config,
- cmds, time_out = None)
+ cmds, time_out=None)
time.sleep(2)
def run_prototype(self):
- print("Setting up Ouroboros...")
+ logger.info("Setting up Ouroboros...")
self.setup_ouroboros()
- print("Binding names...")
+ logger.info("Binding names...")
self.bind_names()
- print("Creating IPCPs")
+ logger.info("Creating IPCPs")
self.create_ipcps()
- print("Enrolling IPCPs...")
+ logger.info("Enrolling IPCPs...")
self.enroll_ipcps()
- print("Registering names...")
+ logger.info("Registering names...")
self.reg_names()
- print("All done, have fun!")
+ logger.info("All done, have fun!")