aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2017-02-09 14:56:32 +0100
committerSander Vrijders <sander.vrijders@intec.ugent.be>2017-02-09 14:56:32 +0100
commit53a11eac43187ff12d82605cf8379803697db7b7 (patch)
tree9e83d743b7178b10d901e42df2b3de421320230c
parent22b3218c951ebfc0bd2b2bdb89adb59b8a3e5ee7 (diff)
downloadrumba-53a11eac43187ff12d82605cf8379803697db7b7.tar.gz
rumba-53a11eac43187ff12d82605cf8379803697db7b7.zip
rhumba: Create Python package
This transforms the repository into a real Python package.
-rw-r--r--AUTHORS.txt2
-rw-r--r--LICENSE.txt (renamed from LICENSE)0
-rw-r--r--MANIFEST.in3
-rw-r--r--README (renamed from README.md)0
-rwxr-xr-xexamples/example.py (renamed from example.py)24
-rw-r--r--rhumba/__init__.py0
-rw-r--r--[-rwxr-xr-x]rhumba/model.py (renamed from rhumba.py)0
-rw-r--r--rhumba/prototypes/__init__.py0
-rw-r--r--rhumba/prototypes/irati.py (renamed from rhumba_irati.py)10
-rw-r--r--rhumba/prototypes/ouroboros.py (renamed from rhumba_ouroboros.py)10
-rw-r--r--rhumba/prototypes/rlite.py (renamed from rhumba_rlite.py)10
-rw-r--r--rhumba/ssh_support.py (renamed from ssh_support.py)0
-rw-r--r--rhumba/testbeds/__init__.py0
-rw-r--r--rhumba/testbeds/emulab.py (renamed from rhumba_emulab.py)30
-rw-r--r--rhumba/testbeds/faketestbed.py (renamed from rhumba_faketestbed.py)7
-rw-r--r--rhumba/testbeds/jfed.py (renamed from rhumba_jfed.py)7
-rw-r--r--setup.py22
17 files changed, 71 insertions, 54 deletions
diff --git a/AUTHORS.txt b/AUTHORS.txt
new file mode 100644
index 0000000..69f35a1
--- /dev/null
+++ b/AUTHORS.txt
@@ -0,0 +1,2 @@
+Vincenzo Maffione <v.maffione@nextworks.it>
+Sander Vrijders <sander.vrijders@intec.ugent.be>
diff --git a/LICENSE b/LICENSE.txt
index 19e3071..19e3071 100644
--- a/LICENSE
+++ b/LICENSE.txt
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..21ede48
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,3 @@
+include AUTHORS.txt
+include LICENSE.txt
+include README \ No newline at end of file
diff --git a/README.md b/README
index 04b2623..04b2623 100644
--- a/README.md
+++ b/README
diff --git a/example.py b/examples/example.py
index b13f0ce..ad4116e 100755
--- a/example.py
+++ b/examples/example.py
@@ -2,17 +2,17 @@
# An example script using rhumba.py
-from rhumba import *
+from rhumba.model import *
# import testbed plugins
-import rhumba_emulab as emulab
-import rhumba_jfed as jfed
-import rhumba_faketestbed as fake
+import rhumba.testbeds.emulab as emulab
+import rhumba.testbeds.jfed as jfed
+import rhumba.testbeds.faketestbed as fake
# import prototype plugins
-import rhumba_ouroboros as our
-import rhumba_rlite as rl
-import rhumba_irati as irati
+import rhumba.prototypes.ouroboros as our
+import rhumba.prototypes.rlite as rl
+import rhumba.prototypes.irati as irati
n1 = NormalDIF("n1", policies = {"rmt.pff": "lfa",
"security-manager": "passwd"})
@@ -29,11 +29,11 @@ b = Node("b",
difs = [e1, n1],
dif_registrations = {n1 : [e1]})
-tb = jfed.jFedTestbed(exp_name = "letest",
- username = "sander",
- cert_file = "cert.pem",
- jfed_jar = "jfed_cli/experimenter-cli.jar")
-#tb = fake.FakeTestbed(exp_name = "x", username = "yy")
+#tb = jfed.jFedTestbed(exp_name = "letest",
+ # username = "sander",
+ # cert_file = "cert.pem",
+ # jfed_jar = "jfed_cli/experimenter-cli.jar")
+tb = fake.FakeTestbed(exp_name = "x", username = "yy")
exp = irati.IRATIExperiment(tb, nodes = [a, b])
diff --git a/rhumba/__init__.py b/rhumba/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/rhumba/__init__.py
diff --git a/rhumba.py b/rhumba/model.py
index 0346a8c..0346a8c 100755..100644
--- a/rhumba.py
+++ b/rhumba/model.py
diff --git a/rhumba/prototypes/__init__.py b/rhumba/prototypes/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/rhumba/prototypes/__init__.py
diff --git a/rhumba_irati.py b/rhumba/prototypes/irati.py
index d5c66d2..beb266f 100644
--- a/rhumba_irati.py
+++ b/rhumba/prototypes/irati.py
@@ -18,14 +18,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA
-import ssh_support as ssh
-import rhumba
-
+import rhumba.ssh_support as ssh
+from rhumba.model import Experiment
# An experiment over the IRATI implementation
-class IRATIExperiment(rhumba.Experiment):
+class IRATIExperiment(Experiment):
def __init__(self, testbed, nodes = list()):
- rhumba.Experiment.__init__(self, testbed, nodes)
+ Experiment.__init__(self, testbed, nodes)
def setup(self):
cmds = list()
@@ -47,4 +46,3 @@ class IRATIExperiment(rhumba.Experiment):
print("Setting up IRATI on the nodes...")
self.setup()
print("[IRATI experiment] end")
-
diff --git a/rhumba_ouroboros.py b/rhumba/prototypes/ouroboros.py
index aca1f5f..eb1f824 100644
--- a/rhumba_ouroboros.py
+++ b/rhumba/prototypes/ouroboros.py
@@ -18,14 +18,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA
-import ssh_support as ssh
-import rhumba
-
+import rhumba.ssh_support as ssh
+from rhumba.model import Experiment
# An experiment over the Ouroboros implementation
-class OuroborosExperiment(rhumba.Experiment):
+class OuroborosExperiment(Experiment):
def __init__(self, testbed, nodes = list()):
- rhumba.Experiment.__init__(self, testbed, nodes)
+ Experiment.__init__(self, testbed, nodes)
def setup_ouroboros(self):
cmds = list()
@@ -57,4 +56,3 @@ class OuroborosExperiment(rhumba.Experiment):
print("Binding names...")
self.bind_names()
print("[Ouroboros experiment] end")
-
diff --git a/rhumba_rlite.py b/rhumba/prototypes/rlite.py
index ac1f081..e68377c 100644
--- a/rhumba_rlite.py
+++ b/rhumba/prototypes/rlite.py
@@ -18,14 +18,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA
-import ssh_support as ssh
-import rhumba
-
+import rhumba.ssh_support as ssh
+from rhumba.model import Experiment
# An experiment over the RLITE implementation
-class RLITEExperiment(rhumba.Experiment):
+class RLITEExperiment(Experiment):
def __init__(self, testbed, nodes = list()):
- rhumba.Experiment.__init__(self, testbed, nodes)
+ Experiment.__init__(self, testbed, nodes)
def setup(self):
cmds = list()
@@ -48,4 +47,3 @@ class RLITEExperiment(rhumba.Experiment):
print("Setting up rlite on the nodes...")
self.setup()
print("[RLITE experiment] end")
-
diff --git a/ssh_support.py b/rhumba/ssh_support.py
index 6bc892f..6bc892f 100644
--- a/ssh_support.py
+++ b/rhumba/ssh_support.py
diff --git a/rhumba/testbeds/__init__.py b/rhumba/testbeds/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/rhumba/testbeds/__init__.py
diff --git a/rhumba_emulab.py b/rhumba/testbeds/emulab.py
index db1c299..ec8e6d9 100644
--- a/rhumba_emulab.py
+++ b/rhumba/testbeds/emulab.py
@@ -23,24 +23,23 @@ import os
import time
import re
from ast import literal_eval
-from ssh_support import *
-import rhumba
+
+import rhumba.ssh_support as ssh
+from rhumba.model import Testbed
import warnings
warnings.filterwarnings("ignore")
-
-
# Represents an emulab testbed info
#
# @url [string] URL of the testbed
# @image [string] specific image to use
#
-class EmulabTestbed(rhumba.Testbed):
+class EmulabTestbed(Testbed):
def __init__(self, exp_name, username, password = "",
proj_name = "ARCFIRE", url = "wall1.ilabt.iminds.be",
image = "UBUNTU14-64-STD"):
- rhumba.Testbed.__init__(self, exp_name, username, password, proj_name)
+ Testbed.__init__(self, exp_name, username, password, proj_name)
self.url = url
self.image = image
@@ -76,7 +75,7 @@ class EmulabTestbed(rhumba.Testbed):
@return: list of created experiments (strings)
'''
cmd = '/usr/testbed/bin/sslxmlrpc_client.py -m experiment getlist'
- out = execute_command(self, self.ops_server(), cmd)
+ out = ssh.execute_command(self, self.ops_server(), cmd)
try:
if project_name != None:
@@ -98,7 +97,7 @@ class EmulabTestbed(rhumba.Testbed):
self.exp_name + \
' direction=in'
- output = execute_command(self, self.ops_server(), cmd)
+ output = ssh.execute_command(self, self.ops_server(), cmd)
return output
@@ -125,15 +124,15 @@ class EmulabTestbed(rhumba.Testbed):
ns = self.generate_ns_script(nodes, links)
dest_file_name = '/users/'+ self.username + \
'/temp_ns_file.%s.ns' % os.getpid()
- copy_file_to_testbed(self, self.ops_server(), ns, dest_file_name)
+ ssh.copy_file_to_testbed(self, self.ops_server(), ns, dest_file_name)
cmd = '/usr/testbed/bin/sslxmlrpc_client.py startexp ' + \
'batch=false wait=true proj="' + proj_name + \
'" exp="' + exp_name + '" noswapin=true ' + \
'nsfilepath="' + dest_file_name + '"'
- execute_command(self, self.ops_server(), cmd, time_out = None)
- execute_command(self, self.ops_server(),'rm ' + dest_file_name)
+ ssh.execute_command(self, self.ops_server(), cmd, time_out = None)
+ ssh.execute_command(self, self.ops_server(),'rm ' + dest_file_name)
print("New experiment succesfully created.")
def generate_ns_script(self, nodes, p2plinks):
@@ -181,12 +180,12 @@ class EmulabTestbed(rhumba.Testbed):
self.exp_name + \
' -a | grep State | cut -f2,2 -d " "'
- res = execute_command(self, self.ops_server(), cmd)
+ res = ssh.execute_command(self, self.ops_server(), cmd)
active = False
if res == "active":
active = True
while active != True:
- res = execute_command(self, self.ops_server(), cmd)
+ res = ssh.execute_command(self, self.ops_server(), cmd)
if res == "active":
active = True
print("Still waiting")
@@ -203,7 +202,7 @@ class EmulabTestbed(rhumba.Testbed):
node_full_name = full_name(self, nodes[0].name)
cmd = 'cat /var/emulab/boot/topomap'
- topomap = execute_command(self, node_full_name, cmd)
+ topomap = ssh.execute_command(self, node_full_name, cmd)
# Almost as ugly as yo momma
index = topomap.rfind("# lans")
topo_array = topomap[:index].split('\\n')[1:-1]
@@ -225,7 +224,7 @@ class EmulabTestbed(rhumba.Testbed):
for node in nodes:
cmd = 'cat /var/emulab/boot/ifmap'
node_full_name = full_name(self, node.name)
- output = execute_command(self, node_full_name, cmd)
+ output = ssh.execute_command(self, node_full_name, cmd)
output = re.split('\\\\n', output)
for item in output:
item = item.split()
@@ -243,4 +242,3 @@ class EmulabTestbed(rhumba.Testbed):
self.swap_exp_in()
self.wait_until_nodes_up()
es.complete_experiment_graph(nodes, links)
-
diff --git a/rhumba_faketestbed.py b/rhumba/testbeds/faketestbed.py
index 61e9070..14ce2b3 100644
--- a/rhumba_faketestbed.py
+++ b/rhumba/testbeds/faketestbed.py
@@ -18,14 +18,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA
-import rhumba
+from rhumba.model import Testbed
# Fake testbed, useful for testing
-class FakeTestbed(rhumba.Testbed):
+class FakeTestbed(Testbed):
def __init__(self, exp_name, username, proj_name = "ARCFIRE",
password = ""):
- rhumba.Testbed.__init__(self, exp_name, username, password, proj_name)
+ Testbed.__init__(self, exp_name, username, password, proj_name)
def create_experiment(self, nodes, links):
print("[Fake testbed] experiment swapped in")
-
diff --git a/rhumba_jfed.py b/rhumba/testbeds/jfed.py
index 67012fa..7a504cd 100644
--- a/rhumba_jfed.py
+++ b/rhumba/testbeds/jfed.py
@@ -18,17 +18,17 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA
-import rhumba
import subprocess
import getpass
import xml.dom.minidom as xml
+from rhumba.model import Testbed
-class jFedTestbed(rhumba.Testbed):
+class jFedTestbed(Testbed):
def __init__(self, exp_name, username, cert_file, jfed_jar, exp_hours = "2",
proj_name = "ARCFIRE", authority = "wall2.ilabt.iminds.be"):
passwd = getpass.getpass(prompt = "Password for certificate file: ")
- rhumba.Testbed.__init__(self, exp_name, username, passwd, proj_name)
+ Testbed.__init__(self, exp_name, username, passwd, proj_name)
self.authority = "urn:publicid:IDN+" + authority + "+authority+cm"
self.auth_name = authority
self.cert_file = cert_file
@@ -146,4 +146,3 @@ class jFedTestbed(rhumba.Testbed):
interface.name = comp_arr[-1]
xml_ip = intf.getElementsByTagName("ip")
interface.ip = xml_ip[0].getAttribute("address")
-
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..d09f64f
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,22 @@
+from setuptools import setup
+from codecs import open
+from os import path
+
+here = path.abspath(path.dirname(__file__))
+
+with open(path.join(here, 'README'), encoding='utf-8') as f:
+ long_description = f.read()
+
+setup(
+ name = "Rhumba",
+ version = "0.1",
+ url = "https://gitlab.com/arcfire/rhumba",
+ keywords = "rina measurement testbed",
+ author = "Sander Vrijders",
+ author_email = "sander.vrijders@intec.ugent.be",
+ license = "LGPL",
+ description = "Rhumba measurement framework for RINA",
+ long_description = long_description,
+ packages = ["rhumba", "rhumba.testbeds", "rhumba.prototypes"],
+ install_requires = ["paramiko", "wheel"]
+)