From b15b09cce8fa5870650d03c5087d9e0df29c24dc Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 14 Apr 2017 11:11:14 +0200 Subject: testbeds: jfed: Download jFed CLI if not found If the jFed CLI was not found, then Rumba will download it in the current directory. --- rumba/testbeds/jfed.py | 19 +++++++++++++++++-- setup.py | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py index 0dfc904..33d89f8 100644 --- a/rumba/testbeds/jfed.py +++ b/rumba/testbeds/jfed.py @@ -21,22 +21,37 @@ import subprocess import getpass import xml.dom.minidom as xml +import os.path +import wget +import tarfile import rumba.model as mod class Testbed(mod.Testbed): - def __init__(self, exp_name, username, cert_file, jfed_jar, exp_hours="2", + def __init__(self, exp_name, username, cert_file, exp_hours="2", proj_name="ARCFIRE", authority="wall2.ilabt.iminds.be"): passwd = getpass.getpass(prompt="Password for certificate file: ") mod.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 - self.jfed_jar = jfed_jar self.exp_hours = exp_hours self.if_id = dict() self.rspec = self.exp_name + ".rspec" self.manifest = self.exp_name + ".rrspec" + self.jfed_jar = "jfed_cli/experimenter-cli.jar" + + if os.path.exists(self.jfed_jar) == False: + print("Couldn't find jFed CLI. Downloading.") + tarball = "jfed_cli.tar.gz" + url = "http://jfed.iminds.be/downloads/stable/jar/" + tarball + wget.download(url) + tar = tarfile.open(tarball) + tar.extractall() + tar.close() + print("Extracted in current directory") + os.remove(tarball) + def create_rspec(self, experiment): impl = xml.getDOMImplementation() diff --git a/setup.py b/setup.py index 4b8afae..e294437 100644 --- a/setup.py +++ b/setup.py @@ -18,5 +18,5 @@ setup( description = "Rumba measurement framework for RINA", long_description = long_description, packages = ["rumba", "rumba.testbeds", "rumba.prototypes"], - install_requires = ["paramiko", "wheel"] + install_requires = ["paramiko", "wheel", "wget"] ) -- cgit v1.2.3