From a7fbb7237f63c4c0d09cfd35c93fbe2e126bc471 Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Tue, 11 Apr 2017 13:08:30 +0200 Subject: IRATI config file generation --- rumba/testbeds/qemu.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'rumba/testbeds/qemu.py') diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py index 1c5d486..220becc 100644 --- a/rumba/testbeds/qemu.py +++ b/rumba/testbeds/qemu.py @@ -26,7 +26,7 @@ import rumba.model as mod class Testbed(mod.Testbed): - def __init__(self, exp_name, username, bzimage, initramfs, proj_name="ARCFIRE", password="", + def __init__(self, exp_name, bzimage, initramfs, proj_name="ARCFIRE", password="root", username="root", use_vhost=True, qemu_logs_dir=None): mod.Testbed.__init__(self, exp_name, username, password, proj_name) self.vms = {} @@ -88,11 +88,12 @@ class Testbed(mod.Testbed): e_queue = multiprocessing.Queue() print(experiment.dif_ordering) for shim in experiment.dif_ordering: - command_list = [] if not isinstance(shim, mod.ShimEthDIF): # Nothing to do here continue self.shims.append(shim) + ipcps = shim.ipcps + command_list = [] command_list += ('sudo brctl addbr %(br)s\n' 'sudo ip link set %(br)s up' % {'br': shim.name} @@ -123,6 +124,14 @@ class Testbed(mod.Testbed): ).split('\n') vm['ports'].append({'tap_id': tap_id, 'shim': shim, 'port_id': port_id}) + ipcp_set = [x for x in ipcps if x in node.ipcps] + if len(ipcp_set) > 1: + raise Exception("Error: more than one ipcp in common between shim dif %s and node %s" + % (shim.name, node.name)) + ipcp = ipcp_set[0] # type: mod.ShimEthIPCP + assert ipcp.name == '%s.%s' % (shim.name, node.name), \ + 'Incorrect Shim Ipcp found: expected %s.%s, found %s' % (shim.name, node.name, ipcp.name) + ipcp.ifname = tap_id # TODO deal with Ip address (shim UDP DIF). # Avoid stacking processes if one failed before. @@ -164,14 +173,15 @@ class Testbed(mod.Testbed): vmid = 1 - for node in experiment.nodes: - name = node.full_name + for node in experiment.nodes: # type: mod.Node + name = node.name vm = self.vms.setdefault(name, {'vm': node, 'ports': []}) fwdp = base_port + vmid fwdc = fwdp + 10000 mac = '00:0a:0a:0a:%02x:%02x' % (vmid, 99) vm['ssh'] = fwdp vm['id'] = vmid + node.full_name = "127.0.0.1:%s" % fwdp vars_dict = {'fwdp': fwdp, 'id': vmid, 'mac': mac, 'bzimage': self.bzimage, @@ -197,7 +207,6 @@ class Testbed(mod.Testbed): '-device %(frontend)s,mac=%(mac)s,netdev=mgmt ' '-netdev user,id=mgmt,%(hostfwdstr)s ' '-vga std ' - '-pidfile rina-%(id)s.pid ' '-serial file:%(vmname)s.log ' % vars_dict ) @@ -225,7 +234,6 @@ class Testbed(mod.Testbed): with open('%s/qemu_out_%s' % (self.qemu_logs_dir, vmid), 'w') as out_file: print('DEBUG: executing >> %s' % command) self.boot_processes.append(subprocess.Popen(command.split(), stdout=out_file)) - pass vmid += 1 -- cgit v1.2.3