# Thierry Parmentelat # Copyright (C) 2010 INRIA # # a configuration module is expected: # (*) to define a config method # (*) that takes two arguments # (**) the current set of plc_specs as output by the preceding config modules # (**) TestMain options field # (*) and that returns the new set of plc_specs # values like 'hostname', 'ip' and the like are rewritten later with a TestPool object # so that sfa users get different mails whether they are based on pl or pg pldomain="onelab.eu" pgdomain="emulab.eu" ### for the sfa dual setup def login_base (index): if index==1: return 'inri' elif index==2: return 'princ' # index=3=>'sitea' 4=>'siteb' else: return 'site%s'%chr(index+94) def sfa_login_base (index, rspec_style): return "sfa%s"%(rspec_style) def sfa_root (index): # 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, 'node_fields': {'hostname': 'deferred-nodename%d'%index, 'model':'qemu/minhw', } , 'host_box': 'deferred-node-hostbox-%d'%index, 'owner' : 'pi', 'nodegroups' : 'mynodegroup', 'interface_fields': { 'method':'static', 'type':'ipv4', 'ip':'xxx-deferred-xxx', 'gateway':'xxx-deferred-xxx', 'network':'xxx-deferred-xxx', 'broadcast':'xxx-deferred-xxx', 'netmask':'xxx-deferred-xxx', 'dns1': 'xxx-deferred-xxx', 'dns2': 'xxx-deferred-xxx', }, ######## how to deal with the new plcapi way of modeling interfaces # this pertains to the node as per the new interface - using UpdateNode # after node_fields above is used to create the Node 'node_fields_nint' : { 'dns':'xxx-deferred-xxx', }, # used in replacement of interface_fields above 'interface_fields_nint' : { 'is_primary' : True, 'method' : 'static', }, # used to create an IpAddress 'ipaddress_fields' : { 'type' : 'ipv4', 'ip_addr' : 'xxx-deferred-xxx', 'netmask' : 'xxx-deferred-xxx', } , # used to create a Route 'route_fields' : { 'subnet' : '0.0.0.0/0', 'next_hop' : 'xxx-deferred-xxx', }, # boot cd settings # we should have tags here instead of the hard-wired # options set for GetBootMedium in TestNode.py }] def all_nodenames (options,index): return [ node['name'] for node in nodes(options,index)] def users (options) : return [ {'name':'admin', 'key_names' : [ 'key_admin' ], 'user_fields' : {'first_name':'Admin', 'last_name':'Admin', 'enabled':'true', 'email':'admin@%s'%pldomain, 'password':'testuseradmin'}, 'roles':['admin']}, {'name' : 'pi', 'key_names' : [ 'key_pi' ], 'user_fields' : {'first_name':'PI', 'last_name':'PI', 'enabled':'True', 'email':'fake-pi1@%s'%pldomain, 'password':'testpi'}, 'roles':['pi']}, {'name':'pitech', 'key_names' : [ 'key_pi' ], 'user_fields' : {'first_name':'PiTech', 'last_name':'PiTech', 'enabled':'true', 'email':'fake-pi2@%s'%pldomain, 'password':'testusertech'}, 'roles':['pi','tech']}, {'name' : 'tech', 'key_names' : [ 'key_user' ], 'user_fields' : {'first_name':'Tech', 'last_name':'Tech', 'enabled':'true', 'email':'fake-tech1@%s'%pldomain, 'password':'testtech'}, 'roles':['tech']}, {'name':'user', 'key_names' : [ 'key_user' ], 'user_fields' : {'first_name':'User', 'last_name':'User', 'enabled':'true', 'email':'fake-user1@%s'%pldomain, 'password':'testuser'}, 'roles':['user']}, {'name':'techuser', 'key_names' : [ 'key_user' ], 'user_fields' : {'first_name':'UserTech', 'last_name':'UserTech', 'enabled':'true', 'email':'fake-tech2@%s'%pldomain, 'password':'testusertech'}, 'roles':['tech','user']}, ] 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.%s'%pldomain, 'latitude':float(latitude), 'longitude':float(longitude), }, 'address_fields' : {'line1':'route des lucioles', 'city':'sophia', 'state':'fr', 'postalcode':'06600', 'country':'France', }, 'users' : users(options), 'nodes': nodes(options,index), }] ########## # key0 -> planetlab admin # key1 -> planetlab PI # key2 -> planetlab user # key3 -> sfa PI # key4 -> sfa user public_key0="""ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3okOugCBs2j/uur/lBdNUqWG0VdLdrEL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97gDdq3tH0j95Mo0F00LWq2+vp7U4DTQsiddepzNdbcvSrzT NVZ2cnOAlKTHO4hGggShm04n/M5LOzkHtI5TLcIJjw4b5iiIw9EtAoGBAOhjLTds Zz8UbXVTeGv8yBGhnjAeHQ5WISN6V5KenB4GIyaYCCcQUOUGqc5nCttlnPLv/GHp 4DOJ2/0KbwDEwk7HbAtXG2Tv1OkmfcOq9RH19V9lyqynA+zvI6taisCEaMvBlafd k+RgXsR+NdLs96RakKt4BtgpuuADoSIryQ+LAoGBAKremNSzpq0Z4tiMjxc3Ssiz scc7lnxTnmZQkkWq6C+3xmZpqdaYYByra3ahNlxblTK2IcgroozPLM8I/4KCNnwG dmC3VB9eOZF8B3SsXOfLEj+i1GBa8WuJg6kAw4JmzFO70Qz9JfSMErk//c9Jh7IT 6YYqaIUN3nATIXrhcFTrAoGAVlC5BfUQZ+MEFaKpEiqwthd1RRJ/0h/9rhd/nNvT lh+JZhs2OmUlXGGPhy2WUX2DcC1AfCOrC9Qego7YxcVsvizQW/vIWLDaDXSyXp6V ilQKrmejDO2Tvmdzpguv4Rs83fdyGcdUMEENQas4kCwhd49aTlEnHRbQYdV2XSY0 vKECgYEAlhYzfSswIF2h5/hGDLETxgNJ2kD0HIZYh7aud6X6aEYNdJopbfbEhifU vTbf8GtvERDoxWEsk9Qp7km8xXfKWdcZtqIwsSmn/ri5d7iyvpIk591YIHSY0dr2 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/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o7ub 2U5cIWCaZ8+3QIFOo6TZ8kyfeEpxbVqbEcezuF8s+nTl4tndmq8U5cOA/bA+zNAR UgQcTehuf3KizMERe2IL3F/Ex7689XwgViFpAoGAelhtJGPEefBfixumPaBCtTbb cgQS7qg5uRR+xQlzL0JXim/D8i7txhEozv8hupsK9C1TPo24SXbeq2EjUMCs8ueJ uzbwUxWAstOp3Q2obTeAd3y3phw9kdV/Oj7F9+yAJu1BGI4Xwvi4qAUOSUkVlVwC OxkpSVMjhsxMz0G/7AMCgYAcbP5rrDszO9uw/IKU44xHfIY/YWiWVBN7PDipqZtz QfzAAZLU2BabjwIfmWetj55ZKiFXRQLkYkz1GPXr2m3FopZb+6apq9M7tTERq1J9 ORxipg3+uy/eYngUAmNmzOnK/9zklEPjNm9Nw3xHnZO+SyQLNI421KkdHOja/GGd awKBgQCLtk0+RpswH451PWyAJ6F+U4YDVaHR0s6pwp4TJAkDVlFBiRO28jEb5y0N bI1R7vrRdq07SgI3USLXqDokQ/pXJhC03w2r7W7niAkNaUll3YtJ2DZVSvuQguR9 xwRNsuo0x60e7bivU+kNZtLn5FqWuGoBONZnbhgP6y7jPsNrig== -----END RSA PRIVATE KEY----- """ public_key4="""ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIim+K+tfwI7KcfbtX/FB1DQCWU1RY8eH4b18KywxI3DDuHa4jGvPjeU5WPwfOsUFpWcWMXCmA26TSOmeT2HiiSJNLUKB0keu/PtHAGnn6rFv5YjCF2fa65wZVkEy6eb8buBny+2L5jhFPW0KE4JNTCiueAEbWZInTWmdA1WB8QeTV3USi33NTtYE05I2/x4G2BtFmmzWzCuyRVjkWZQPJY6wIyM1+qGixpbacScxYYDBGA0I9N9VSN9OS2BN3GY8xFJjFSD2+GxsUhDUmUw2bO8ppn2OSl8NUW/U4EQzUTP8VhebI6UqjfIGAv5qHPpe0Yrcrd/QlbWvj2zpqvVtX sfa-user@test.onelab.eu """ private_key4=""" -----BEGIN RSA PRIVATE KEY-----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vLznwjh5SPBVYMD pT97l+CCAvEnGfSeihCbLqIoplhWtwENK3u/JYXYi3N6j+T6MZAeLMWB0K0z1/h+ K3fHTJSztCA51HMgr/6wTQ9DpYkfrvR0QR/ItmLJxw+FzsyddQUZLXiSOwqosJLr Q/0Y23qoQJQiBTUHQPQ14GOVAoGBAL2T5uStgJJzp1BBl860nfQZa+umn4xIrjJn BtXnw56c7NJh02y8RnswWMeOMBzYol9NmxlxdG0FGrngbZAO/vrqLe93gmi9skvp gjzQaDSKdpm3j4uz4AfW7WSJ0azCbxxXDiiBYM5jCvIFt8yTXypvqi9XWb9XqfIl DVI0vsevAoGAb0SgdcyRcIrozl7Rky1GUTcCPXGMCCts9kMWNucWq6jvkCo8YdH1 b+fHzZFpKJNbpROjJ1er3U5jg6qtA32mbuQ9IhoYqtLISJqV+MO36pDFmjPng0+D NhwboXV6u+hSpUHGK+MmqGgKkkZI6KRwTT+NWZY2FTX3UOl8IMymTBk= -----END RSA PRIVATE KEY----- """ master_key_index = { 'key_admin': {'private':private_key0, 'public':public_key0}, 'key_pi': {'private':private_key1, 'public':public_key1}, 'key_user': {'private':private_key2, 'public':public_key2}, 'key_sfapi': {'private':private_key3, 'public':public_key3}, 'key_sfauser': {'private':private_key4, 'public':public_key4}, } plc_key_names = [ 'key_admin', 'key_pi', 'key_tech' ] # expose a list of key_specs # { 'key_name':<>, 'private':<>, 'public':<>, 'in_plc':, key_fields: , } def keys (options,index): result = [] for (key_name, priv_pub) in master_key_index.items(): private=priv_pub['private'] public=priv_pub['public'] result.append( { 'key_name': key_name, 'private':private, 'public':public, 'in_plc': key_name in plc_key_names, 'key_fields' : {'key_type':'ssh', 'key': public}, } ) return result ############################## initscripts initscript_by_name="""#!/bin/bash command=$1; shift slicename=$1; shift stamp="initscript_by_name" stampfile=/var/tmp/$stamp.stamp date=$(date) echo $date "Running initscript with command=$command and slicename=$slicename" function start () { (echo $date Starting test initscript: $stamp on slicename $slicename ; date) >> $stampfile echo $date "This is the stdout of the sliver $slicename initscript $command (exp. start) pid=$$" echo $date "This is the stderr of the sliver $slicename initscript $command (exp. start) pid=$$" 1>&2 } function stop () { echo $date "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_code=initscript_by_name.replace("initscript_by_name","initscript_by_code") # one single initscript in the InitScripts table def initscripts(options,index): return [ { 'initscript_fields' : { 'enabled' : True, 'name':'initscript_by_name', 'script' : initscript_by_name, }}, ] # returns 3 slices # 1 has an initscript code # 2 has an initscript name # 3 is an omf-friendly slice def slices (options,index): def theslice (i): slice_spec = { 'slice_fields': {'name':'%s_sl%d'%(login_base(index),i), 'instantiation':'plc-instantiated', 'url':'http://foo%d.com'%index, 'description':'testslice number %d'%i, 'max_nodes':2, }, 'usernames' : [ 'pi','user','techuser' ], 'nodenames' : all_nodenames(options,index), 'sitename' : login_base(index), 'owner' : 'pi', } # 1st one has an initscript by code if i%3==1: slice_spec['initscriptcode']=initscript_by_code slice_spec['initscriptstamp']='initscript_by_code' # 2nd one has an initscript by name elif i%3==2: slice_spec['initscriptname']='initscript_by_name' slice_spec['initscriptstamp']='initscript_by_name' # 3rd one is omf-friendly else: # potentially turned off with config_no_omf slice_spec ['omf-friendly'] = True return slice_spec # usual index is 1, additional plc's then get 2... # so index=1 -> 1 - 2 - 3 # index=2 -> 4 - 5 - 6 # 3 * (index-1) + 1 = 3*index-2 .. same+3 = 3*index+1 return [ theslice(i) for i in range (3*index-2,3*index+1) ] def all_slicenames (options,index): return [ slice['slice_fields']['name'] for slice in slices(options,index)] # the logic here is to try: # . client and server on the same slice/node # . client and server on the same node but 2 different slices # if at least 2 plcs, we have 2 nodes, so again on diff. nodes def tcp_specs (options,index): # only run the test on the first plc if index != 1: return None # slice1='%s_sl1'%login_base(1) slice2='%s_sl2'%login_base(1) # with the addition of omf-friendly slices.. slice3='%s_sl4'%login_base(2) slice4='%s_sl5'%login_base(2) # NOTE: port 9999 is hard-wired in the code to be used for checking network readiness # so it is not to be used here # bind on 0.0.0.0 and try to reach this on localhost # not expected to work same_node_same_slice_lo = { 'server_node': 'node1', 'server_slice': slice1, 'client_node': 'node1', 'client_slice': slice1, 'client_connect' : 'localhost', 'port': 10000} same_node_same_slice = { 'server_node': 'node1', 'server_slice': slice1, 'client_node': 'node1', 'client_slice': slice1, 'port': 10001} # this does not work on vs-nodes.... same_node_2_slices = { 'server_node': 'node1', 'server_slice': slice1, 'client_node': 'node1', 'client_slice': slice2, 'port': 10002} two_nodes_same_slice = { 'server_node': 'node1', 'server_slice': slice1, 'client_node': 'node2', 'client_slice': slice3, 'port': 10003} two_nodes_2_slices = { 'server_node': 'node1', 'server_slice': slice1, 'client_node': 'node2', 'client_slice': slice4, 'port': 10004} specs = [] # specs += [ same_node_same_slice_lo ] specs += [ same_node_same_slice ] # worth another try specs += [ same_node_2_slices ] if options.size > 1: specs += [ two_nodes_same_slice, two_nodes_2_slices ] return specs # the semantic for 't_from' and 't_until' here is: # 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=[] counter=0 slices=all_slicenames(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+1} ) counter += 1 return leases def plc (options,index) : return { 'index' : 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 'vservername': 'deferred-vservername', 'vserverip': 'deferred-vserverip', 'role' : 'root', # these go to plc-config-tty 'settings': { 'PLC_NAME' : 'Regression TestLab', 'PLC_ROOT_USER' : 'root@test.onelab.eu', 'PLC_ROOT_PASSWORD' : 'test++', 'PLC_SLICE_PREFIX' : 'auto', 'PLC_HRN_ROOT': sfa_root(index), 'PLC_SHORTNAME' : 'Rlab', 'PLC_MAIL_ENABLED':'false', 'PLC_MAIL_SUPPORT_ADDRESS' : 'thierry.parmentelat@inria.fr', 'PLC_DB_HOST' : 'deferred-myplc-hostname', # 'PLC_DB_PASSWORD' : 'mnbvcxzlkjhgfdsapoiuytrewq', 'PLC_API_HOST' : 'deferred-myplc-hostname', 'PLC_WWW_HOST' : 'deferred-myplc-hostname', 'PLC_BOOT_HOST' : 'deferred-myplc-hostname', 'PLC_NET_DNS1' : 'deferred-dns-1', 'PLC_NET_DNS2' : 'deferred-dns-2', 'PLC_RESERVATION_GRANULARITY':1800, 'PLC_VSYS_DEFAULTS':' , vif_up, vif_down, fd_tuntap, promisc, ', 'PLC_OMF_ENABLED' : 'true', 'PLC_OMF_XMPP_SERVER': 'deferred-myplc-hostname', }, 'expected_vsys_tags': [ 'vif_up', 'vif_down', 'fd_tuntap', 'promisc', ], # minimal config so the omf plugins actually trigger 'sites' : sites(options,index), 'keys' : keys(options,index), 'initscripts': initscripts(options,index), 'slices' : slices(options,index), 'tcp_specs' : tcp_specs(options,index), 'sfa' : sfa(options,index), 'leases' : leases (options, index), # big distros need more time to install nodes 'ssh_node_boot_timers': (40,38), 'ssh_node_debug_timers': (10,8), } def sfa (options,index) : return { # the port used to generate the various aggregates.xml # stack config_sfamesh to point to SMs instead 'neighbours-port':12346, # the port that sfi connects to - used to be 12347 when the SM was still running # but now the SM is just turned off for these tests 'sfi-connects-to-port' : 12346, ## global sfa-config-tty stuff 'settings': { 'SFA_REGISTRY_ROOT_AUTH' : sfa_root(index), 'SFA_INTERFACE_HRN' : sfa_root(index), 'SFA_REGISTRY_HOST' : 'deferred-myplc-hostname', 'SFA_AGGREGATE_HOST': 'deferred-myplc-hostname', 'SFA_SM_HOST': 'deferred-myplc-hostname', # turning off SM and using only AM; be explicit on this as the default has changed in the code 'SFA_SM_ENABLED' : 'false', 'SFA_PLC_URL' : 'deferred-myplc-api-url', 'SFA_PLC_USER' : 'root@test.onelab.eu', 'SFA_PLC_PASSWORD' : 'test++', # use -c sfadebug to increment this one 'SFA_API_LOGLEVEL': 1, # use -c sfavoid to set this to 'void' 'SFA_GENERIC_FLAVOUR' : 'pl', 'SFA_AGGREGATE_ENABLED' : 'true', }, # details of the slices to create 'auth_sfa_specs' : [ test_auth_sfa_spec(options,index,rspec_style) for rspec_style in options.rspec_styles ] } # rspec_style is 'pl' for sfav1 or 'pg' for pgv2 def test_auth_sfa_spec (options,index,rspec_style): domain=pldomain if rspec_style=='pl' else pgdomain # the auth/site part per se login_base=sfa_login_base(index,rspec_style) hrn_prefix='%s.%s'%(sfa_root(index),login_base) def full_hrn(x): return "%s.%s"%(hrn_prefix,x) def full_mail(x): return "%s@test.%s"%(x,domain) # 2 users; we use dashes on purpose, as it might show up in email addresses pi_alias = 'pi-user' user_alias = 'regular-user' # pi_alias = 'pi' # user_alias = 'user' # pi_spec = { 'name': pi_alias, 'email': full_mail (pi_alias), 'key_name': 'key_sfapi', } user_spec = { 'name': user_alias, 'email': full_mail (user_alias), 'key_name': 'key_sfauser', 'register_options': [ '--extra',"first_name=Fake", '--extra',"last_name=SFA-style-%s"%rspec_style, ], 'update_options': [ '--extra',"enabled=true", ], } slice_spec = { 'name': 'sl', 'register_options': [ '--researchers', full_hrn (user_alias), # xxx '--extra', "description=SFA-testing-%s"%rspec_style, '--extra', "url=http://slice%d.test.onelab.eu/"%index, '--extra', "max_nodes=2", ], 'key_name': 'key_sfauser', 'nodenames': all_nodenames(options,index), } # we're already in a dedicated site/authority so no need to encumber with odd names return { #'hrn_prefix': hrn_prefix, 'login_base' : login_base, 'domain':domain, 'rspec_style':rspec_style, 'pi_spec': pi_spec, 'user_spec': user_spec, 'slice_spec': slice_spec, } def config (plc_specs, options): result = plc_specs # plc 'index' starts with 1 for i in range(options.size): result.append(plc(options, i+1)) return result ### for creating a sample config interactively def sample_test_plc_spec (): class Void: pass options = Void() options.size = 1 options.rspec_styles = ['pg'] return config([], options)[0] if __name__ == '__main__': s = sample_test_plc_spec() print('Sample plc_spec has the following keys') for k in sorted(s.keys()): print(k)