X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=system%2Fconfig_default.py;h=1f564fcbe454bb2b2de339adf0c4fb8dd0c679e0;hb=c3ac22516b3770b16764a3f7d5b83f73365c7fc7;hp=162a25e83f24320b2c15f7bbb02999c6f00eab6b;hpb=ebe66d736a4375cf0da02b59dbe4e33cebf8f4b5;p=tests.git diff --git a/system/config_default.py b/system/config_default.py index 162a25e..1f564fc 100644 --- a/system/config_default.py +++ b/system/config_default.py @@ -14,16 +14,14 @@ 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) - + # pla, plb, ... + return 'pl%s'%chr(index+96) def nodes(options,index): return [{'name':'node%d'%index, @@ -92,11 +90,15 @@ def all_usernames (options): return [ user['name'] for user in users(options)] def sites (options,index): + latitude= -90 + (index*10) + longitude= -180 + (index*20) return [ {'site_fields' : {'name':'main site for plc number %d'%index, 'login_base':login_base(index), 'abbreviated_name':'PlanetTest%d'%index, 'max_slices':100, 'url':'http://test.onelab.eu', + 'latitude':float(latitude), + 'longitude':float(longitude), }, 'address_fields' : {'line1':'route des lucioles', 'city':'sophia', @@ -149,30 +151,36 @@ def keys (options,index): ############################## initscripts -initscript_by_name="""#! /bin/sh -builtin="the_script_name" -stamp=/tmp/$builtin.stamp +initscript_by_name="""#!/bin/bash command=$1; shift slicename=$1; shift -case $command in -start) - (echo Starting test initscript: $builtin on slicename $slicename ; date) >> $stamp +stamp="the_script_name" +stampfile=/tmp/$stamp.stamp + +echo "Running initscript with command=$command and slicename=$slicename" + +function start () { + (echo Starting test initscript: $stamp on slicename $slicename ; date) >> $stampfile echo "This is the stdout of the sliver $slicename initscript $command (exp. start) pid=$$" echo "This is the stderr of the sliver $slicename initscript $command (exp. start) pid=$$" 1>&2 -;; -stop) - rm $stamp -;; -restart) - echo "Dummy restart" -;; -*) - echo "Unknown command in initscript $command" -;; +} +function stop () { + echo "Removing stamp $stampfile" + rm -f $stampfile +} +function restart () { + stop + start +} +case $command in +start) start ;; +stop) stop ;; +restart) restart ;; +*) echo "Unknown command in initscript $command" ;; esac """ -initscript_by_body=initscript_by_name.replace("the_script_name","the_script_body") +initscript_by_code=initscript_by_name.replace("the_script_name","the_script_code") # one single initscript in the InitScripts table def initscripts(options,index): @@ -183,30 +191,30 @@ def initscripts(options,index): ] # always return 2 slices -# one has an initscript body, the other one an initscript name +# 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, 'max_nodes':2, }, - 'usernames' : [ 'pi','tech','techuser' ], + 'usernames' : [ 'pi','user','techuser' ], 'nodenames' : all_nodenames(options,index), 'sitename' : login_base(index), 'owner' : 'pi', } - # odd one has an initscript_body + # odd one has an initscript_code if i%2==1: - slice_spec['initscriptbody']=initscript_by_body - slice_spec['initscriptstamp']='the_script_body' + slice_spec['initscriptcode']=initscript_by_code + slice_spec['initscriptstamp']='the_script_code' # even one has an initscript (name) else: slice_spec['initscriptname']='the_script_name' slice_spec['initscriptstamp']='the_script_name' return slice_spec - return [ theslice(1) for i in range (2*index-1,2*index+1) ] + return [ theslice(i) for i in range (2*index-1,2*index+1) ] def all_slicenames (options,index): return [ slice['slice_fields']['name'] for slice in slices(options,index)] @@ -216,18 +224,18 @@ def tcp_tests (options,index): 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, }, ] @@ -250,9 +258,10 @@ def leases (options, index): def plc (options,index) : return { - 'name' : 'onetest%d'%index, + 'index' : index, + 'name' : 'plctest%d'%index, # as of yet, not sure we can handle foreign hosts, but this is required though - 'hostname' : 'deferred-myplc-hostbox-%d'%index, + 'host_box' : 'deferred-myplc-hostbox-%d'%index, # set these two items to run within a vserver 'vservername': 'deferred-vservername', 'vserverip': 'deferred-vserverip', @@ -285,13 +294,13 @@ def plc (options,index) : } 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', @@ -302,54 +311,51 @@ def sfa (options,index) : '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, + # 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 = ''' +%s'''%(hrn, researcher) - return ['%s'%(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 =''' +%(key)s2010 +1piadmin%(prefix)s'''%locals() - return ['%(key)s20101piadmin%(prefix)s'%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' : '', - } - def config (plc_specs,options): result=plc_specs for i in range (options.size):