-c sfadebug on the command line to increment API_LOGLEVEL
[tests.git] / system / config_default.py
index 24c84e7..288b613 100644 (file)
@@ -14,16 +14,16 @@ domain="onelab.eu"
 
 ### for the sfa dual setup
 def login_base (index): 
-    if index==1: return 'inria'
-    elif index==2: return 'princeton'
+    if index==1: return 'inri'
+    elif index==2: return 'princ'
     # index=3=>'sitea'  4=>'siteb' 
     else: return 'site%s'%chr(index+94)
 
 def sfa_root (index):
-    if index==1: return 'ple'
-    elif index==2: return 'plc'
-    else: return 'plx%s'%chr(index+94)
-    
+    # use plt (planetlab test) instead of pl
+    # otherwise a triangular test ends up with 'plc'
+    # plta, pltb, ...
+    return 'plt%s'%chr(index+96)
 
 def nodes(options,index):
     return [{'name':'node%d'%index,
@@ -144,14 +144,52 @@ BO+VyPNWF+kDNI8mSUwi7jLW6liMdhNOmDaSX0+0X8CHtK898xM=
 -----END RSA PRIVATE KEY-----
 """
 
+### another keypair for the SFA user
+public_key2="""ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQLvh5LkrjyLIr9UJznTJHMnqjdqzRdc9ekVmI9bx/5X4flnGtPBsr6bK/CPXmWjS2Vw0QOxi1NM45qkQJZXxroS0aehCCrvJRHgp/LOZykWCyNKqVopq9w0kH4jw1KFGIuwWROpOcMq2d/kAwyr6RV/W66KNVqu2XDiNOPJLcuZCuKrH++q3fPyP2zHSJ/irew7vwqIXbDSnVvvyRXYgc9KlR57L4BWthXcUofHlje8wKq7nWBQIUslYtJDryJg5tBvJIFfCFGmWZy0WJlGJd+yppI5jRvt9c6n9HyJKN22lUBTaTaDFvo+Xu5GEazLKG/v8h/o5WpxrrE6Y3TKeX user@test.onelab.eu
+"""
+
+private_key2="""
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEA0C74eS5K48iyK/VCc50yRzJ6o3as0XXPXpFZiPW8f+V+H5Zx
+rTwbK+myvwj15lo0tlcNEDsYtTTOOapECWV8a6EtGnoQgq7yUR4KfyzmcpFgsjSq
+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Lr3kC/JfO4SEF3A8BeTZNEUH6Ub+exluzuxHucV34lZ/VVKI/5Azbksxje
+0vv5hMj22ybcjR542h5iAJkCgYAsFw8HrPk+l2wanXNbC1j/y/whx8wiITdCuBd2
+oTw3HRGX9GYhiGAbvFA0hfPb038LkPffW3CQDufFStZ40ycSAyua/Tm1Q2wI428K
+ezY12IwEr3dTbX3v25iI5nCWVyDC3Ve42jStzjmHwL+G54zGpl6/q9THcrT+37im
+26QiuQKBgQCTUDGKLqQ+QM8dAl6IZpz+oExdDCWwCNjTMH83tz1Rwoc+npW7z2ZC
+D/FseVOmS9MqJkgCap5pr4m1Qj5YciZNteIHdkIbD1yDoPaW1NvlOnxzVBQXK3HD
+rUck4dxa0t30wUFK0XVQjNEArXqvU23EB8Z7bQQMRx0yhd4pF5k29Q==
+-----END RSA PRIVATE KEY-----
+"""
+
 def keys (options,index):
     return [ {'name': 'key1',
               'private' : private_key,
               'key_fields' : {'key_type':'ssh',
-                              'key': public_key}}
+                              'key': public_key}},
+             {'name': 'key2',
+              'private' : private_key2,
+              'key_fields' : {'key_type':'ssh',
+                              'key': public_key2}}
+            
              ]
 
-
 ############################## initscripts
 initscript_by_name="""#!/bin/bash
 command=$1; shift
@@ -196,7 +234,7 @@ def initscripts(options,index):
 # one has an initscript code, the other one an initscript name
 def slices (options,index):
     def theslice (i):
-        slice_spec = { 'slice_fields': {'name':'%s_slcpl%d'%(login_base(index),i),
+        slice_spec = { 'slice_fields': {'name':'%s_slpl%d'%(login_base(index),i),
                                         'instantiation':'plc-instantiated',
                                         'url':'http://foo%d.com'%index,
                                         'description':'testslice number %d'%i,
@@ -226,18 +264,18 @@ def tcp_tests (options,index):
         return [
             # local test
             { 'server_node': 'node1',
-              'server_slice' : '%s_slcpl1'%login_base(index),
+              'server_slice' : '%s_slpl1'%login_base(index),
               'client_node' : 'node1',
-              'client_slice' : '%s_slcpl1'%login_base(index),
+              'client_slice' : '%s_slpl1'%login_base(index),
               'port' : 2000,
               }]
     elif index == 2:
         return [
             # remote test
             { 'server_node': 'node2',
-              'server_slice' : '%s_slcpl3'%login_base(index),
+              'server_slice' : '%s_slpl3'%login_base(index),
               'client_node' : 'node2',
-              'client_slice' : '%s_slcpl4'%login_base(index),
+              'client_slice' : '%s_slpl4'%login_base(index),
               'port' : 4000,
               },
             ]
@@ -276,7 +314,7 @@ def plc (options,index) :
         'PLC_MAIL_ENABLED':'false',
         'PLC_MAIL_SUPPORT_ADDRESS' : 'thierry.parmentelat@inria.fr',
         'PLC_DB_HOST' : 'deferred-myplc-hostname',
-        'PLC_DB_PASSWORD' : 'mnbvcxzlkjhgfdsapoiuytrewq',
+#        'PLC_DB_PASSWORD' : 'mnbvcxzlkjhgfdsapoiuytrewq',
         'PLC_API_HOST' : 'deferred-myplc-hostname',
         'PLC_WWW_HOST' : 'deferred-myplc-hostname',
         'PLC_BOOT_HOST' : 'deferred-myplc-hostname',
@@ -295,80 +333,72 @@ def plc (options,index) :
         'leases' : leases (options, index),
     }
 
+# NOTE: SFA currently has SFA_AGGREGATE_API_VERSION=2 baked into the code
 def sfa (options,index) :
-    piuser='fake-pi%d'%index
-    regularuser='sfafakeuser%d'%index
     return { 
+        # the default is to use AMs in the various aggregates.xml
+        # stack config_sfamesh to point to SMs instead
+        'neighbours-port':12346,
+        ## global sfa-config-tty stuff
         'SFA_REGISTRY_ROOT_AUTH' : sfa_root(index),
         'SFA_INTERFACE_HRN' : sfa_root(index),
-#        'SFA_REGISTRY_LEVEL1_AUTH' : '',
        'SFA_REGISTRY_HOST' : 'deferred-myplc-hostname',
        'SFA_AGGREGATE_HOST': 'deferred-myplc-hostname',
        'SFA_SM_HOST': 'deferred-myplc-hostname',
+       'SFA_PLC_URL' : 'deferred-myplc-api-url',
         'SFA_PLC_USER' : 'root@test.onelab.eu',
         'SFA_PLC_PASSWORD' : 'test++',
-        'SFA_PLC_DB_HOST':'deferred-myplc-hostname',
-        'SFA_PLC_DB_USER' : 'pgsqluser',
-        'SFA_PLC_DB_PASSWORD' : 'mnbvcxzlkjhgfdsapoiuytrewq',
-       'SFA_PLC_URL' : 'deferred-myplc-api-url',
-        'SFA_API_DEBUG': True,
-        'sfa_slice_specs' : [ sfa_slice_spec(options,index,piuser,regularuser,i) for i in [0,1]],
-       'sfa_slice_rspec' : sfa_slice_rspec(options,index),
-        'login_base' : login_base(index),
-        'piuser' : piuser,
-        'regularuser':regularuser,
-        'domain':domain,
-        # the default is to use AMs in the various aggregates.xml
-        # stack config_sfamesh to point to SMs instead
-        'neighbours-port':12346,
+# use -c sfadebug to increment this one
+        'SFA_API_LOGLEVEL': 1,
+        # details of the slices to create
+        'sfa_slice_specs' : [ sfa_slice_spec(options,index,rspec_style) 
+                              for rspec_style in options.rspec_styles ]
     }
 
 # subindex is 0 (pl slice) or 1 (pg slice)
-def sfa_slice_spec (options,index,piuser,regularuser,subindex):
-    if subindex==0:
-        mode='pl'
-    else:
-        mode='pg'
-    slicename='slcsfa%d%s'%(index,mode)
-    prefix='%s.%s'%(sfa_root(index),login_base(index))
+def sfa_slice_spec (options,index,rspec_style):
+    the_login_base=login_base(index)
+    piuser='fake-pi%d'%index
+    regularuser='sfauser%d%s'%(index,rspec_style)
+    slicename='slsfa%d%s'%(index,rspec_style)
+    prefix='%s.%s'%(sfa_root(index),the_login_base)
     hrn=prefix+'.'+slicename
-    researcher=prefix+'.'+piuser
-    slice_add_xml = '''<record hrn="%s" type="slice" description="SFA-testing" url="http://test.onelab.eu/">
-<researcher>%s</researcher></record>'''%(hrn, researcher)
-
+    user_hrn=prefix+'.'+regularuser
+    pi_hrn=prefix+'.'+piuser
+    key=public_key2
     mail="%s@%s"%(regularuser,domain)
-    key=public_key
-    slice_person_xml ='''<record email="%(mail)s" enabled="True" first_name="Fake" hrn="%(hrn)s" 
-last_name="Sfa" name="%(hrn)s" type="user">
-<keys>%(key)s</keys><role_ids>20</role_ids><role_ids>10</role_ids>
-<site_ids>1</site_ids><roles>pi</roles><roles>admin</roles><sites>%(prefix)s</sites></record>'''%locals()
+    person_record_xml =\
+'''<record hrn="%(user_hrn)s" type="user" email="%(mail)s" enabled="True" 
+first_name="Fake" last_name="Sfa style=%(rspec_style)s" >
+<keys>%(key)s</keys>
+<roles>user</roles>
+<roles>tech</roles>
+</record>'''%locals()
+    slice_record_xml =\
+'''<record hrn="%s" type="slice" description="SFA-testing" url="http://test.onelab.eu/">
+<researcher>%s</researcher>
+</record>'''%(hrn, user_hrn)
+
 
-    return { 'slice_fields': {'name':'%s_%s'%(login_base(index),slicename),
+    return { 'slice_fields': {'name':'%s_%s'%(the_login_base,slicename),
                               'url':'http://foo%d@foo.com'%index,
                               'description':'SFA-testing',
                               'max_nodes':2,
                               },
-             'usernames' : [ (regularuser,'key1') ],
+             'login_base' : the_login_base,
+             'piuser' : piuser,
+             'regularuser':regularuser,
+             'domain':domain,
+             'usernames' : [ (regularuser,'key2') ],
              'nodenames' : all_nodenames(options,index),
-             'sitename' : login_base(index),
+             'sitename' : the_login_base,
              'slicename' : slicename,
-             'slice_add_xml' : slice_add_xml,
-             'slice_person_xml' : slice_person_xml,
-             'mode':mode,
+             'slice_record' : slice_record_xml,
+             'person_record' : person_record_xml,
+             'rspec_style':rspec_style,
              } 
 
 
-def sfa_slice_rspec(options,index):
-    node_name='deferred'
-
-    return { 
-        'part1' : '<?xml version="1.0" ?><Rspec><networks><NetSpec name=',
-        'part2' : '%s'%sfa_root(index),
-        '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):
     result=plc_specs
     for i in range (options.size):