aboutsummaryrefslogtreecommitdiff
path: root/rumba/testbeds/qemu.py
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2017-04-11 13:08:30 +0200
committerMarco Capitani <m.capitani@nextworks.it>2017-04-11 13:08:30 +0200
commita7fbb7237f63c4c0d09cfd35c93fbe2e126bc471 (patch)
treea8838f0bfac8bd6854568b880443e031bb07600c /rumba/testbeds/qemu.py
parent8797eff49aede4ad06ba668e4cee59accc12d1af (diff)
downloadrumba-a7fbb7237f63c4c0d09cfd35c93fbe2e126bc471.tar.gz
rumba-a7fbb7237f63c4c0d09cfd35c93fbe2e126bc471.zip
IRATI config file generation
Diffstat (limited to 'rumba/testbeds/qemu.py')
-rw-r--r--rumba/testbeds/qemu.py20
1 files changed, 14 insertions, 6 deletions
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