### 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)
-
+ # pla, plb, ...
+ return 'pl%s'%chr(index+96)
def nodes(options,index):
return [{'name':'node%d'%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_pslc%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,
return [
# local test
{ 'server_node': 'node1',
- 'server_slice' : '%s_pslc1'%login_base(index),
+ 'server_slice' : '%s_slpl1'%login_base(index),
'client_node' : 'node1',
- 'client_slice' : '%s_pslc1'%login_base(index),
+ 'client_slice' : '%s_slpl1'%login_base(index),
'port' : 2000,
}]
elif index == 2:
return [
# remote test
{ 'server_node': 'node2',
- 'server_slice' : '%s_pslc3'%login_base(index),
+ 'server_slice' : '%s_slpl3'%login_base(index),
'client_node' : 'node2',
- 'client_slice' : '%s_pslc4'%login_base(index),
+ 'client_slice' : '%s_slpl4'%login_base(index),
'port' : 4000,
},
]
def plc (options,index) :
return {
'index' : index,
- 'name' : 'onetest%d'%index,
+ 'name' : 'plctest%d'%index,
# as of yet, not sure we can handle foreign hosts, but this is required though
'host_box' : 'deferred-myplc-hostbox-%d'%index,
# set these two items to run within a vserver
'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',
}
def sfa (options,index) :
- piuser='fake-pi%d'%index
- regularuser='sfafakeuser%d'%index
- slicename='fslc%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_specs(options,index,slicename,regularuser),
- 'sfa_slice_xml' : sfa_slice_xml(options,index,piuser,slicename),
- 'sfa_person_xml' : sfa_person_xml(options,index,regularuser),
- 'sfa_slice_rspec' : sfa_slice_rspec(options,index),
- 'login_base' : login_base(index),
- 'piuser' : piuser,
- 'regularuser':regularuser,
- 'slicename' : slicename,
- '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 apiv2 to override this one
+# 'SFA_AGGREGATE_API_VERSION' : 1,
+ '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 ]
}
-def sfa_slice_specs (options,index,slicename,regularuser):
- return [ { 'slice_fields': {'name':'%s_%s'%(login_base(index),slicename),
- 'url':'http://foo%d@foo.com'%index,
- 'description':'SFA-testing',
- 'max_nodes':2,
- },
- 'usernames' : [ (regularuser,'key1') ],
- 'nodenames' : all_nodenames(options,index),
- 'sitename' : login_base(index),
- }]
-
-def sfa_slice_xml(options,index,piuser,slicename):
- prefix='%s.%s'%(sfa_root(index),login_base(index))
+# subindex is 0 (pl slice) or 1 (pg slice)
+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
+ person_hrn=prefix+'.'+regularuser
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)
- 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,regularuser):
- prefix='%s.%s'%(sfa_root(index),login_base(index))
- hrn=prefix+'.'+regularuser
mail="%s@%s"%(regularuser,domain)
+ print 'in sfa_slice_spec','slicename',slicename,'hrn',hrn,'mail',mail
key=public_key
+ slice_person_xml ='''<record email="%(mail)s" enabled="True" first_name="Fake" hrn="%(person_hrn)s"
+last_name="Sfa %(rspec_style)s" 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()
- return ['<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()]
+ return { 'slice_fields': {'name':'%s_%s'%(the_login_base,slicename),
+ 'url':'http://foo%d@foo.com'%index,
+ 'description':'SFA-testing',
+ 'max_nodes':2,
+ },
+ 'login_base' : the_login_base,
+ 'piuser' : piuser,
+ 'regularuser':regularuser,
+ 'domain':domain,
+ 'usernames' : [ (regularuser,'key1') ],
+ 'nodenames' : all_nodenames(options,index),
+ 'sitename' : the_login_base,
+ 'slicename' : slicename,
+ 'slice_add_xml' : slice_add_xml,
+ 'slice_person_xml' : slice_person_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):