config_1* is for onelab and config_p* is for princeton
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 17 Apr 2009 07:54:38 +0000 (07:54 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 17 Apr 2009 07:54:38 +0000 (07:54 +0000)
system/config_1default.py [moved from system/config_default.py with 100% similarity]
system/config_pdefault.py [new file with mode: 0644]
system/config_ptestqemus.py [new file with mode: 0644]
system/config_pvnodes.py [new file with mode: 0644]
system/config_pvplcs.py [new file with mode: 0644]

diff --git a/system/config_pdefault.py b/system/config_pdefault.py
new file mode 100644 (file)
index 0000000..3873ffe
--- /dev/null
@@ -0,0 +1,38 @@
+# the defaults
+import utils
+import TestPlc
+
+# this default is for the Princeton test infrastructure
+
+def config (plc_specs, options):
+
+    import config_main
+    plcs = config_main.config([],options)
+    if options.verbose:
+        print '======================================== AFTER main'
+        for plc in plcs: TestPlc.TestPlc.display_mapping_plc(plc)
+        print '========================================'
+
+    import config_ptestqemus
+    plcs = config_ptestqemus.config (plcs,options)
+    if options.verbose:
+        print '======================================== AFTER testqemus'
+        for plc in plcs: TestPlc.TestPlc.display_mapping_plc(plc)
+        print '========================================'
+
+    import config_pvnodes
+    plcs = config_pvnodes.config(plcs,options)
+    if options.verbose:
+        print '======================================== AFTER vnodes'
+        for plc in plcs: TestPlc.TestPlc.display_mapping_plc(plc)
+        print '========================================'
+
+    import config_pvplcs
+    plcs = config_pvplcs.config (plcs,options)
+    if options.verbose:
+        print '======================================== AFTER vservers'
+        for plc in plcs: TestPlc.TestPlc.display_mapping_plc(plc)
+        print '========================================'
+
+    return plcs
+
diff --git a/system/config_ptestqemus.py b/system/config_ptestqemus.py
new file mode 100644 (file)
index 0000000..2249a06
--- /dev/null
@@ -0,0 +1,37 @@
+import sys
+
+from TestMapper import TestMapper
+from TestPool import TestPoolQemu
+
+princeton_qemus_pool = [  ( 'p-testqemu1.onelab.eu', None, None ) ]
+    
+def config (plcs, options):
+
+    # all plcs on the same vserver box
+    plc_box   ='p-testbox-plc.onelab.eu'
+    # informative
+    label=options.personality.replace("linux","")
+
+    # all qemus on a unique pool of 64bits boxes
+    node_map = []
+    qemu_pool = TestPoolQemu (princeton_qemus_pool,options)
+    for index in range(options.size):
+        index += 1
+        if options.ips_qemu:
+            ip_or_hostname=options.ips_qemu.pop()
+            (hostname,ip,unused)=qemu_pool.locate_entry(ip_or_hostname)
+        else:
+            (hostname,ip,unused) = qemu_pool.next_free()
+        node_map += [ ('node%d'%index, {'host_box':hostname},) ]
+
+    mapper = {'plc': [ ('*' , {'hostname':plc_box,
+                               'PLC_DB_HOST':plc_box,
+                               'PLC_API_HOST':plc_box,
+                               'PLC_BOOT_HOST':plc_box,
+                               'PLC_WWW_HOST':plc_box,
+                               'name':'%s-'+label } ) 
+                       ],
+              'node': node_map,
+              }
+    
+    return TestMapper(plcs,options).map(mapper)
diff --git a/system/config_pvnodes.py b/system/config_pvnodes.py
new file mode 100644 (file)
index 0000000..df61a4c
--- /dev/null
@@ -0,0 +1,48 @@
+# map all nodes onto the avail. pool
+
+import utils
+from TestMapper import TestMapper
+from TestPool import TestPoolIP
+
+onelab_nodes_ip_pool = [ 
+    ("p-node-01.onelab.eu","128.112.139.123", "de:ad:be:ef:00:01"),
+    ("p-node-02.onelab.eu","128.112.139.124", "de:ad:be:ef:00:02"),
+    ("p-node-03.onelab.eu","128.112.139.125", "de:ad:be:ef:00:03"),
+    ("p-node-04.onelab.eu","128.112.139.126", "de:ad:be:ef:00:04"),
+]    
+
+site_dict = {
+    'interface_fields:gateway':'128.112.139.1',
+    'interface_fields:network':'128.112.139.0',
+    'interface_fields:broadcast':'128.112.139.127',
+    'interface_fields:netmask':'255.255.25.128',
+    'interface_fields:dns1': '128.112.136.10',
+    'interface_fields:dns2': '128.112.136.12',
+}
+
+def config (plcs, options):
+    
+    ip_pool = TestPoolIP (onelab_nodes_ip_pool,options)
+    test_mapper = TestMapper (plcs, options)
+
+    all_nodenames = test_mapper.node_names()
+    maps = []
+    for nodename in all_nodenames:
+        if options.ips_node:
+            ip_or_hostname=options.ips_node.pop()
+            (hostname,ip,mac)=ip_pool.locate_entry(ip_or_hostname)
+        else:
+            (hostname,ip,mac) = ip_pool.next_free()
+        utils.header('Attaching node %s to %s (%s)'%(nodename,hostname,ip))
+        node_dict= {'node_fields:hostname':hostname,
+                    'interface_fields:ip':ip, 
+                    'interface_fields:mac':mac,
+                    }
+    
+        node_dict.update(site_dict)
+        maps.append ( ( nodename, node_dict) )
+
+    plc_map = [ ( '*' , { 'PLC_NET_DNS1' : site_dict [ 'interface_fields:dns1' ],
+                        'PLC_NET_DNS2' : site_dict [ 'interface_fields:dns2' ], } ) ]
+
+    return test_mapper.map ({'node': maps, 'plc' : plc_map } )
diff --git a/system/config_pvplcs.py b/system/config_pvplcs.py
new file mode 100644 (file)
index 0000000..e450fd1
--- /dev/null
@@ -0,0 +1,59 @@
+import utils
+import os.path
+from TestPool import TestPoolIP
+
+# using vplc01 .. vplc15 - keep [16,17,18] for 4.2 and 19 and 20 for long-haul tests
+princeton_plcs_ip_pool = [ 
+    ("p-plc-01.onelab.eu","128.112.139.99", "de:ad:be:ef:ff:01"),
+    ("p-plc-02.onelab.eu","128.112.139.100","de:ad:be:ef:ff:02"),
+    ("p-plc-03.onelab.eu","128.112.139.103","de:ad:be:ef:ff:03"),
+    ("p-plc-04.onelab.eu","128.112.139.105","de:ad:be:ef:ff:04"),
+    ("p-plc-05.onelab.eu","128.112.139.106","de:ad:be:ef:ff:05"),
+    ("p-plc-06.onelab.eu","128.112.139.109","de:ad:be:ef:ff:06"),
+    ("p-plc-07.onelab.eu","128.112.139.110","de:ad:be:ef:ff:07"),
+    ("p-plc-08.onelab.eu","128.112.139.122","de:ad:be:ef:ff:08"),
+]
+
+def config (plcs,options):
+    
+    utils.header ("Turning configuration into a vserver-based one for princeton")
+
+    ip_pool = TestPoolIP (princeton_plcs_ip_pool,options)
+
+    plc_counter=0
+    for plc in plcs:
+        try:
+            if options.ips_plc :
+                ip_or_hostname=options.ips_plc.pop()
+                (hostname,ip,mac)=ip_pool.locate_entry(ip_or_hostname)
+                if not options.quiet:
+                    utils.header("Using user-provided %s %s for plc %s"%(
+                            hostname,ip_or_hostname,plc['name']))
+            else:
+                (hostname,ip,mac)=ip_pool.next_free()
+                if not options.quiet:
+                    utils.header("Using auto-allocated %s %s for plc %s"%(
+                            hostname,ip,plc['name']))
+
+            ### rewrite fields in plc
+            # compute a helpful vserver name - remove domain in hostname
+            simplehostname=hostname.split('.')[0]
+            vservername = options.buildname
+            if len(plcs) == 1 :
+                vservername = "%s-%s" % (vservername,simplehostname)
+            else:
+                plc_counter += 1
+                vservername = "%s-%d-%s" % (vservername,plc_counter,simplehostname)
+            # apply
+            plc['vservername']=vservername
+            plc['vserverip']=ip
+            plc['name'] = "%s_%s"%(plc['name'],simplehostname)
+            utils.header("Attaching plc %s to vserver %s (%s)"%(
+                    plc['name'],plc['vservername'],plc['vserverip']))
+            for key in [ 'PLC_DB_HOST', 'PLC_API_HOST', 'PLC_WWW_HOST', 'PLC_BOOT_HOST',]:
+                plc[key] = hostname
+                
+        except:
+            raise Exception('Cannot find an available IP for %s - exiting'%plc['name'])
+
+    return plcs