first draft
[tests.git] / system / config_ptestqemus.py
1 import sys
2
3 from TestMapper import TestMapper
4 from TestPool import TestPoolQemu
5
6 princeton_qemus_pool = [  ( 'testqemu1.test.planet-lab.org', None, None ) ]
7     
8 def config (plcs, options):
9
10     # all plcs on the same vserver box
11     plc_box   ='testbox.test.planet-lab.org'
12     # informative
13     label=options.personality.replace("linux","")
14
15     # all qemus on a unique pool of 64bits boxes
16     node_map = []
17     qemu_pool = TestPoolQemu (princeton_qemus_pool,options)
18     for index in range(options.size):
19         index += 1
20         if options.ips_qemu:
21             ip_or_hostname=options.ips_qemu.pop()
22             (hostname,ip,unused)=qemu_pool.locate_entry(ip_or_hostname)
23         else:
24             (hostname,ip,unused) = qemu_pool.next_free()
25         node_map += [ ('node%d'%index, {'host_box':hostname},) ]
26
27     mapper = {'plc': [ ('*' , {'hostname':plc_box,
28                                'PLC_DB_HOST':plc_box,
29                                'PLC_API_HOST':plc_box,
30                                'PLC_BOOT_HOST':plc_box,
31                                'PLC_WWW_HOST':plc_box,
32                                'name':'%s-'+label } ) 
33                        ],
34               'node': node_map,
35               }
36     
37     return TestMapper(plcs,options).map(mapper)