diff options
-rw-r--r-- | AUTHORS.txt | 2 | ||||
-rw-r--r-- | LICENSE.txt (renamed from LICENSE) | 0 | ||||
-rw-r--r-- | MANIFEST.in | 3 | ||||
-rw-r--r-- | README (renamed from README.md) | 0 | ||||
-rwxr-xr-x | examples/example.py (renamed from example.py) | 16 | ||||
-rw-r--r-- | rumba/__init__.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | rumba/model.py (renamed from rhumba.py) | 0 | ||||
-rw-r--r-- | rumba/prototypes/__init__.py | 0 | ||||
-rw-r--r-- | rumba/prototypes/irati.py (renamed from rhumba_irati.py) | 10 | ||||
-rw-r--r-- | rumba/prototypes/ouroboros.py (renamed from rhumba_ouroboros.py) | 10 | ||||
-rw-r--r-- | rumba/prototypes/rlite.py (renamed from rhumba_rlite.py) | 10 | ||||
-rw-r--r-- | rumba/ssh_support.py (renamed from ssh_support.py) | 2 | ||||
-rw-r--r-- | rumba/testbeds/__init__.py | 0 | ||||
-rw-r--r-- | rumba/testbeds/emulab.py (renamed from rhumba_emulab.py) | 34 | ||||
-rw-r--r-- | rumba/testbeds/faketestbed.py (renamed from rhumba_faketestbed.py) | 9 | ||||
-rw-r--r-- | rumba/testbeds/jfed.py (renamed from rhumba_jfed.py) | 41 | ||||
-rw-r--r-- | setup.py | 22 |
17 files changed, 90 insertions, 69 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/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/example.py b/examples/example.py index b13f0ce..4430fb5 100755 --- a/example.py +++ b/examples/example.py @@ -1,18 +1,18 @@ #!/usr/bin/env python -# An example script using rhumba.py +# An example script using the rumba package -from rhumba import * +from rumba.model import * # import testbed plugins -import rhumba_emulab as emulab -import rhumba_jfed as jfed -import rhumba_faketestbed as fake +import rumba.testbeds.emulab as emulab +import rumba.testbeds.jfed as jfed +import rumba.testbeds.faketestbed as fake # import prototype plugins -import rhumba_ouroboros as our -import rhumba_rlite as rl -import rhumba_irati as irati +import rumba.prototypes.ouroboros as our +import rumba.prototypes.rlite as rl +import rumba.prototypes.irati as irati n1 = NormalDIF("n1", policies = {"rmt.pff": "lfa", "security-manager": "passwd"}) diff --git a/rumba/__init__.py b/rumba/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/rumba/__init__.py diff --git a/rhumba.py b/rumba/model.py index 0346a8c..0346a8c 100755..100644 --- a/rhumba.py +++ b/rumba/model.py diff --git a/rumba/prototypes/__init__.py b/rumba/prototypes/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/rumba/prototypes/__init__.py diff --git a/rhumba_irati.py b/rumba/prototypes/irati.py index d5c66d2..af98f2e 100644 --- a/rhumba_irati.py +++ b/rumba/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 rumba.ssh_support as ssh +from rumba.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/rumba/prototypes/ouroboros.py index aca1f5f..0f60ee8 100644 --- a/rhumba_ouroboros.py +++ b/rumba/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 rumba.ssh_support as ssh +from rumba.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/rumba/prototypes/rlite.py index ac1f081..9148bfa 100644 --- a/rhumba_rlite.py +++ b/rumba/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 rumba.ssh_support as ssh +from rumba.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/rumba/ssh_support.py index 6bc892f..552c43f 100644 --- a/ssh_support.py +++ b/rumba/ssh_support.py @@ -1,5 +1,5 @@ # -# SSH support for Rhumba +# SSH support for Rumba # # Sander Vrijders <sander.vrijders@intec.ugent.be> # diff --git a/rumba/testbeds/__init__.py b/rumba/testbeds/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/rumba/testbeds/__init__.py diff --git a/rhumba_emulab.py b/rumba/testbeds/emulab.py index db1c299..735bf3a 100644 --- a/rhumba_emulab.py +++ b/rumba/testbeds/emulab.py @@ -1,5 +1,5 @@ # -# Emulab support for Rhumba +# Emulab support for Rumba # # Sander Vrijders <sander.vrijders@intec.ugent.be> # Wouter Tavernier <wouter.tavernier@intec.ugent.be> @@ -23,24 +23,23 @@ import os import time import re from ast import literal_eval -from ssh_support import * -import rhumba + +import rumba.ssh_support as ssh +from rumba.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): @@ -148,7 +147,7 @@ class EmulabTestbed(rhumba.Testbed): @return: ns2 script for Emulab experiment ''' - ns2_script = "# ns script generated by Rhumba\n" + ns2_script = "# ns script generated by Rumba\n" ns2_script += "set ns [new Simulator]\n" ns2_script += "source tb_compat.tcl\n" @@ -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/rumba/testbeds/faketestbed.py index 61e9070..f163411 100644 --- a/rhumba_faketestbed.py +++ b/rumba/testbeds/faketestbed.py @@ -1,5 +1,5 @@ # -# Fake testbed for Rhumba testing +# Fake testbed for Rumba testing # # Vincenzo Maffione <v.maffione@nextworks.it> # @@ -18,14 +18,13 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA -import rhumba +from rumba.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/rumba/testbeds/jfed.py index 67012fa..5f4d496 100644 --- a/rhumba_jfed.py +++ b/rumba/testbeds/jfed.py @@ -1,5 +1,5 @@ # -# jFed support for Rhumba +# jFed support for Rumba # # Sander Vrijders <sander.vrijders@intec.ugent.be> # @@ -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 rumba.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 @@ -44,19 +44,20 @@ class jFedTestbed(rhumba.Testbed): top_el = doc.documentElement top_el.setAttribute("xmlns", "http://www.geni.net/resources/rspec/3") top_el.setAttribute("type", "request") - top_el.setAttribute("xmlns:emulab", "http://www.protogeni.net/resources/" + - "rspec/ext/emulab/1") - top_el.setAttribute("xmlns:jfedBonfire", "http://jfed.iminds.be/rspec/" + - "ext/jfed-bonfire/1") - top_el.setAttribute("xmlns:delay", "http://www.protogeni.net/resources/" + - "rspec/ext/delay/1") + top_el.setAttribute("xmlns:emulab", "http://www.protogeni.net/" + + "resources/rspec/ext/emulab/1") + top_el.setAttribute("xmlns:jfedBonfire", "http://jfed.iminds.be/" + + "rspec/ext/jfed-bonfire/1") + top_el.setAttribute("xmlns:delay", "http://www.protogeni.net/" + + "resources/rspec/ext/delay/1") top_el.setAttribute("xmlns:jfed-command", "http://jfed.iminds.be/" + "rspec/ext/jfed-command/1") - top_el.setAttribute("xmlns:client", "http://www.protogeni.net/resources/" + - "rspec/ext/client/1") - top_el.setAttribute("xmlns:jfed-ssh-keys", "http://jfed.iminds.be/rspec" + - "/ext/jfed-ssh-keys/1") - top_el.setAttribute("xmlns:jfed", "http://jfed.iminds.be/rspec/ext/jfed/1") + top_el.setAttribute("xmlns:client", "http://www.protogeni.net/" + + "resources/rspec/ext/client/1") + top_el.setAttribute("xmlns:jfed-ssh-keys", "http://jfed.iminds.be/" + + "rspec/ext/jfed-ssh-keys/1") + top_el.setAttribute("xmlns:jfed", "http://jfed.iminds.be/rspec/" + + "ext/jfed/1") top_el.setAttribute("xmlns:sharedvlan", "http://www.protogeni.net/" + "resources/rspec/ext/shared-vlan/1") top_el.setAttribute("xmlns:xsi", "http://www.w3.org/2001/" + @@ -81,9 +82,11 @@ class jFedTestbed(rhumba.Testbed): if link.node_a == node or link.node_b == node: el3 = doc.createElement("interface") if link.node_a == node: - link_id = link.int_a.id = node.name + ":if" + str(node.ifs) + link.int_a.id = node.name + ":if" + str(node.ifs) + link_id = link.int_a.id if link.node_b == node: - link_id = link.int_b.id = node.name + ":if" + str(node.ifs) + link.int_b.id = node.name + ":if" + str(node.ifs) + link_id = link.int_b.id el3.setAttribute("client_id", link_id) node.ifs += 1 @@ -124,7 +127,8 @@ class jFedTestbed(rhumba.Testbed): self.proj_name, "--rspec", \ self.rspec, "-s", \ self.exp_name, "-p", self.cert_file, "-k", \ - "usercert,userkeys,shareduserallkeys", "--create-slice",\ + "usercert,userkeys,shareduserallkeys", \ + "--create-slice",\ "--manifest", self.manifest, "-P", self.password, \ "-e", self.exp_hours]) @@ -146,4 +150,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..4b8afae --- /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 = "Rumba", + version = "0.1", + url = "https://gitlab.com/arcfire/rumba", + keywords = "rina measurement testbed", + author = "Sander Vrijders", + author_email = "sander.vrijders@intec.ugent.be", + license = "LGPL", + description = "Rumba measurement framework for RINA", + long_description = long_description, + packages = ["rumba", "rumba.testbeds", "rumba.prototypes"], + install_requires = ["paramiko", "wheel"] +) |