# 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'
def nodes(options,index):
return [{'name':'node%d'%index,
- 'node_fields': {'hostname': 'deferred-nodename%d'%index,
- 'model':'qemu/minhw', } ,
+ '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',
- },
+ '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',
+ },
}]
def all_nodenames (options,index):
-----END RSA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private' : private_key,
'private' : private_key2,
'key_fields' : {'key_type':'ssh',
'key': public_key2}}
-
]
############################## initscripts
# one has an initscript code, the other one an initscript name
def slices (options,index):
def theslice (i):
- slice_spec = { 'slice_fields': {'name':'%s_slpl%d'%(login_base(index),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,
return [
# local test
{ 'server_node': 'node1',
- 'server_slice' : '%s_slpl1'%login_base(index),
+ 'server_slice' : '%s_sl1'%login_base(index),
'client_node' : 'node1',
- 'client_slice' : '%s_slpl1'%login_base(index),
+ 'client_slice' : '%s_sl1'%login_base(index),
'port' : 2000,
}]
elif index == 2:
return [
# remote test
{ 'server_node': 'node2',
- 'server_slice' : '%s_slpl3'%login_base(index),
+ 'server_slice' : '%s_sl3'%login_base(index),
'client_node' : 'node2',
- 'client_slice' : '%s_slpl4'%login_base(index),
+ 'client_slice' : '%s_sl4'%login_base(index),
'port' : 4000,
},
]
'leases' : leases (options, index),
}
+# NOTE: SFA currently has SFA_AGGREGATE_API_VERSION=2 baked into the code
def sfa (options,index) :
return {
# the default is to use AMs in the various aggregates.xml
'SFA_PLC_URL' : 'deferred-myplc-api-url',
'SFA_PLC_USER' : 'root@test.onelab.eu',
'SFA_PLC_PASSWORD' : 'test++',
-# use -c apiv2 to override this one
-# 'SFA_AGGREGATE_API_VERSION' : 1,
+# 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
'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)
+# rspecstyle is 'pl' for sfav1 or 'pg' for pgv2
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)
+ the_login_base=sfa_login_base(index,rspec_style)
+ # we're already in a dedicated site/authority so no need to encumber with odd names
+ piuser='pi'
+ pimail=piuser+'@test.onelab.eu'
+ regularuser='us'
+ slicename='sl'
prefix='%s.%s'%(sfa_root(index),the_login_base)
hrn=prefix+'.'+slicename
user_hrn=prefix+'.'+regularuser
pi_hrn=prefix+'.'+piuser
- slice_add_xml = '''<record hrn="%s" type="slice" description="SFA-testing" url="http://test.onelab.eu/">
+ mail="%s@%s"%(regularuser,domain)
+ user_key=public_key2
+ # xxx as compared with the xml-record-based approach
+ # is enabled=True needed here ?
+ # ditto for roles = user+tech
+ person_options = { '-t': 'user',
+ '-x': user_hrn,
+ '-e': mail,
+ '-f': "Fake",
+ '-l': "SFA-style-%s"%rspec_style,
+ }
+
+ person_record_xml =\
+'''<record enabled="True"
+first_name="Fake" last_name="Sfa style=%(rspec_style)s" >
+<keys>%(user_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)
- mail="%s@%s"%(regularuser,domain)
- print 'in sfa_slice_spec','slicename',slicename,'hrn',hrn,'mail',mail
- key=public_key2
- slice_person_xml ='''<record email="%(mail)s" enabled="True" first_name="Fake" hrn="%(user_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 { 'slice_fields': {'name':'%s_%s'%(the_login_base,slicename),
'url':'http://foo%d@foo.com'%index,
},
'login_base' : the_login_base,
'piuser' : piuser,
+ 'pimail' : pimail,
'regularuser':regularuser,
'domain':domain,
'usernames' : [ (regularuser,'key2') ],
'nodenames' : all_nodenames(options,index),
'sitename' : the_login_base,
'slicename' : slicename,
- 'slice_add_xml' : slice_add_xml,
- 'slice_person_xml' : slice_person_xml,
+ # handle key separately because of embedded whitespace
+ 'person_options': person_options,
+ 'person_record' : person_record_xml,
+ 'slice_record' : slice_record_xml,
'rspec_style':rspec_style,
}