Setting for Thierry's test environment
[tests.git] / system / config_1vnodes.py
index 48862a4..f47ff89 100644 (file)
@@ -1,10 +1,14 @@
 # map all nodes onto the avail. pool
 
+import utils
 from TestMapper import TestMapper
-from TestPool import TestPool
+from TestPool import TestPoolIP
+
+onelab_nodes_ip_pool = [ 
+    ( 'vnode%02d.inria.fr'%i, 
+      '138.96.255.%d'%(220+i), 
+      '02:34:56:00:00:%02d'%i) for i in range(1,10) ]
 
-onelab_plcs_pool = [ 
-    ( 'vnode%02d.inria.fr'%i, '138.96.255.%d'%(220+i), '02:34:56:00:00:%02d'%i) for i in range(1,10) ]
 site_dict = {
     'interface_fields:gateway':'138.96.248.250',
     'interface_fields:network':'138.96.0.0',
@@ -16,18 +20,18 @@ site_dict = {
 
 def config (plcs, options):
     
-    test_pool = TestPool (onelab_plcs_pool,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 len(options.ips_node) != 0:
-            ip=options.ips_node[0]
-            options.ips_node=options.ips_node[1:]
-            (hostname,ip,mac)=test_pool.locate(ip)
+        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) = test_pool.next_free()
+            (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,