reviewed list options parsing
[tests.git] / system / config_default.py
index 9b358e1..f283b6b 100644 (file)
@@ -1,3 +1,6 @@
+# Thierry Parmentelat <thierry.parmentelat@inria.fr>
+# Copyright (C) 2010 INRIA 
+#
 # a configuration module is expected:
 # (*) to define a config method
 # (*) that takes two arguments
@@ -7,8 +10,6 @@
 
 # values like 'hostname', 'ip' and the like are rewritten later with a TestPool object
 
-reservation_granularity=180
-
 def nodes(options,index):
     return [{'name':'node%d'%index,
              'node_fields': {'hostname': 'deferred-nodename%d'%index,
@@ -206,7 +207,7 @@ def tcp_tests (options,index):
         return []
 
 # the semantic for 't_from' and 't_until' here is:
-# if they are smaller than one year, they are relative to the current time
+# if they are smaller than one year, they are relative to the current time, expressed in grains
 # otherwise they are absolute
 def leases (options, index):
     leases=[]
@@ -215,8 +216,8 @@ def leases (options, index):
     slice_sequence = slices[:1] + slices + [None,]
     for iterator in range(12):
         for slice in slice_sequence:
-            leases.append ( {'slice' : slice, 't_from':counter,'t_until':counter+reservation_granularity} )
-            counter += reservation_granularity
+            leases.append ( {'slice' : slice, 't_from':counter,'t_until':counter+1} )
+            counter += 1
     return leases
 
 def plc (options,index) :
@@ -241,8 +242,8 @@ def plc (options,index) :
         'PLC_BOOT_HOST' : 'deferred-myplc-hostname',
         'PLC_NET_DNS1' : 'deferred-dns-1',
         'PLC_NET_DNS2' : 'deferred-dns-2',
-        'PLC_RESERVATION_GRANULARITY':reservation_granularity,
-        'PLC_OMF_ENABLED' : True,
+        'PLC_RESERVATION_GRANULARITY':1800,
+        'PLC_OMF_ENABLED' : 'false',
         'sites' : sites(options,index),
         'keys' : keys(options,index),
         'initscripts': initscripts(options,index),
@@ -294,7 +295,7 @@ def sfa_slice_xml(options,index):
        hrn='ple.main.fslc1'
        researcher='ple.main.fake-pi1'
 
-    return  ["""<record hrn="%s" type="slice" description="SFA-testing" url="http://anil.onelab.eu/"><researcher>%s</researcher></record>"""%(hrn, researcher)]
+    return  ['<record hrn="%s" type="slice" description="SFA-testing" url="http://test.onelab.eu/"><researcher>%s</researcher></record>'%(hrn, researcher)]
 
 def sfa_person_xml(options,index):
     if index==1:
@@ -302,7 +303,7 @@ def sfa_person_xml(options,index):
     else:
         hrn='ple.main.sfafakeuser1'
 
-    return ["""<record email="sfafakeuser1@onelab.eu" enabled="True" first_name="Anil" hrn="%s" last_name="Kumar" name="%s" type="user"><keys>%s</keys><role_ids>20</role_ids><role_ids>10</role_ids><site_ids>1</site_ids><roles>pi</roles><roles>admin</roles><sites>plc.main</sites></record>"""%(hrn,hrn,public_key)]
+    return ['<record email="sfafakeuser1@onelab.eu" enabled="True" first_name="Fake" hrn="%s" last_name="Sfa" name="%s" type="user"><keys>%s</keys><role_ids>20</role_ids><role_ids>10</role_ids><site_ids>1</site_ids><roles>pi</roles><roles>admin</roles><sites>plc.main</sites></record>'%(hrn,hrn,public_key)]
 
 def sfa_slice_rspec(options,index):
     node_name='deferred'
@@ -311,11 +312,12 @@ def sfa_slice_rspec(options,index):
     else:
        netspec_name='\"ple\"'
 
-    return { 'part1' : """<?xml version="1.0" ?><Rspec><networks><NetSpec name=""",
-             'part2' : "%s"%netspec_name,
-            'part3' : """><nodes><NodeSpec cpu_min="" cpu_pct="" cpu_share="" disk_max="" init_params="" name=\"""",
-            'part4' : "%s"%node_name,
-             'part5' : """\" start_time="" type=""><net_if><IfSpec init_params="" ip_spoof="" max_kbyte="" max_rate="" min_rate="" name="True" type="ipv4"/></net_if></NodeSpec></nodes></NetSpec></networks></Rspec>"""
+    return { 
+        'part1' : '<?xml version="1.0" ?><Rspec><networks><NetSpec name=',
+        'part2' : '%s'%netspec_name,
+        'part3' : '><nodes><NodeSpec cpu_min="" cpu_pct="" cpu_share="" disk_max="" init_params="" name=\"',
+        'part4' : '%s'%node_name,
+        'part5' : '\" start_time="" type=""><net_if><IfSpec init_params="" ip_spoof="" max_kbyte="" max_rate="" min_rate="" name="True" type="ipv4"/></net_if></NodeSpec></nodes></NetSpec></networks></Rspec>',
            }
              
 def config (plc_specs,options):