3 from TestPool import TestPool
5 # the pool of IP addresses available - from 01 to 09
7 ( 'vplc%02d.inria.fr'%i, '138.96.250.13%d'%i, '02:34:56:00:ee:%02d'%i) for i in range(1,10) ]
9 def config (plcs,options):
11 utils.header ("Turning configuration into a vserver-based one for onelab")
13 test_pool = TestPool (onelab_plcs_pool,options)
15 if len(options.ips) != 0:
16 utils.header('Using user-provided IPS:\nips=%r'%options.ips)
22 if len(options.ips) != 0:
24 options.ips=options.ips[1:]
25 (hostname,ip,mac)=test_pool.locate(ip)
26 utils.header("Using user-provided %s %s for plc %s"%(
27 hostname,ip,plc['name']))
29 (hostname,ip,mac)=test_pool.next_free()
30 utils.header("Using auto-allocated %s %s for plc %s"%(
31 hostname,ip,plc['name']))
33 ### rewrite fields in plc
34 # compute a helpful vserver name - remove domain in hostname
35 simplehostname=hostname.split('.')[0]
36 vservername = options.buildname
38 vservername = "%s-%s" % (vservername,simplehostname)
41 vservername = "%s-%d-%s" % (vservername,plc_counter,simplehostname)
43 plc['vservername']=vservername
45 plc['name'] = "%s_%s"%(plc['name'],simplehostname)
46 utils.header("Attaching plc %s to vserver %s (%s)"%(
47 plc['name'],plc['vservername'],plc['vserverip']))
48 for key in [ 'PLC_DB_HOST', 'PLC_API_HOST', 'PLC_WWW_HOST', 'PLC_BOOT_HOST',]:
52 raise Exception('Cannot find an available IP for %s - exiting'%plc['name'])