4 from StringIO import StringIO
5 from types import StringTypes
6 from copy import deepcopy
10 from sfa.util.sfalogging import logger
11 #from sfa.util.sfalogging import sfa_logger
12 #from sfa.util.rspecHelper import merge_rspecs
13 from sfa.util.xrn import Xrn, urn_to_hrn, hrn_to_urn
14 from sfa.util.plxrn import hrn_to_pl_slicename
15 #from sfa.util.rspec import *
16 #from sfa.util.specdict import *
17 from sfa.util.faults import *
18 from sfa.util.record import SfaRecord
19 #from sfa.rspecs.pg_rspec import PGRSpec
20 #from sfa.rspecs.sfa_rspec import SfaRSpec
21 from sfa.rspecs.rspec_converter import RSpecConverter
22 #from sfa.rspecs.rspec_parser import parse_rspec
23 #from sfa.rspecs.rspec_version import RSpecVersion
24 #from sfa.rspecs.sfa_rspec import sfa_rspec_version
25 #from sfa.rspecs.pg_rspec import pg_rspec_ad_version, pg_rspec_request_version
26 from sfa.client.client_helper import sfa_to_pg_users_arg
27 from sfa.rspecs.version_manager import VersionManager
29 #from sfa.rspecs.rspec import RSpec
30 from sfa.util.policy import Policy
31 from sfa.util.prefixTree import prefixTree
32 #from sfa.util.sfaticket import *
33 from sfa.trust.credential import Credential
34 #from sfa.util.threadmanager import ThreadManager
35 #import sfa.util.xmlrpcprotocol as xmlrpcprotocol
36 #import sfa.plc.peers as peers
37 from sfa.util.version import version_core
38 from sfa.util.callids import Callids
39 #from sfa.senslab.api import *
42 #api=SfaAPI(interface='slicemgr')
44 def _call_id_supported(api, server):
46 Returns true if server support the optional call_id arg, false otherwise.
48 server_version = api.get_cached_server_version(server)
50 if 'sfa' in server_version:
51 code_tag = server_version['code_tag']
52 code_tag_parts = code_tag.split("-")
54 version_parts = code_tag_parts[0].split(".")
55 major, minor = version_parts[0:2]
56 rev = code_tag_parts[1]
58 if int(minor) > 0 or int(rev) > 20:
62 # we have specialized xmlrpclib.ServerProxy to remember the input url
63 # OTOH it's not clear if we're only dealing with XMLRPCServerProxy instances
64 def get_serverproxy_url (server):
66 return server.get_url()
68 logger.warning("GetVersion, falling back to xmlrpclib.ServerProxy internals")
69 return server._ServerProxy__host + server._ServerProxy__handler
72 # peers explicitly in aggregates.xml
73 peers =dict ([ (peername,get_serverproxy_url(v)) for (peername,v) in api.aggregates.iteritems()
74 if peername != api.hrn])
75 version_manager = VersionManager()
76 ad_rspec_versions = []
77 request_rspec_versions = []
78 for rspec_version in version_manager.versions:
79 if rspec_version.content_type in ['*', 'ad']:
80 ad_rspec_versions.append(rspec_version.to_dict())
81 if rspec_version.content_type in ['*', 'request']:
82 request_rspec_versions.append(rspec_version.to_dict())
83 default_rspec_version = version_manager.get_version("sfa 1").to_dict()
84 xrn=Xrn(api.hrn, 'authority+sa')
85 version_more = {'interface':'slicemgr',
86 'hrn' : xrn.get_hrn(),
87 'urn' : xrn.get_urn(),
89 'request_rspec_versions': request_rspec_versions,
90 'ad_rspec_versions': ad_rspec_versions,
91 'default_ad_rspec': default_rspec_version
93 sm_version=version_core(version_more)
94 # local aggregate if present needs to have localhost resolved
95 if api.hrn in api.aggregates:
96 local_am_url=get_serverproxy_url(api.aggregates[api.hrn])
97 sm_version['peers'][api.hrn]=local_am_url.replace('localhost',sm_version['hostname'])
101 #def GetVersion(api):
102 ## peers explicitly in aggregates.xml
103 #peers =dict ([ (peername,get_serverproxy_url(v)) for (peername,v) in api.aggregates.iteritems()
104 #if peername != api.hrn])
106 #request_rspec_versions = [dict(pg_rspec_request_version), dict(sfa_rspec_version)]
107 #ad_rspec_versions = [dict(pg_rspec_ad_version), dict(sfa_rspec_version)]
108 #version_more = {'interface':'slicemgr',
109 #'hrn' : xrn.get_hrn(),
110 #'urn' : xrn.get_urn(),
112 #'request_rspec_versions': request_rspec_versions,
113 #'ad_rspec_versions': ad_rspec_versions,
114 #'default_ad_rspec': dict(sfa_rspec_version)
116 #sm_version=version_core(version_more)
117 ## local aggregate if present needs to have localhost resolved
118 #if api.hrn in api.aggregates:
119 #local_am_url=get_serverproxy_url(api.aggregates[api.hrn])
120 #sm_version['peers'][api.hrn]=local_am_url.replace('localhost',sm_version['hostname'])
124 def drop_slicemgr_stats(api,rspec):
126 stats_elements = rspec.xml.xpath('//statistics')
127 for node in stats_elements:
128 node.getparent().remove(node)
130 api.logger.warn("drop_slicemgr_stats failed: %s " % (str(e)))
135 def CreateSliver(api, xrn, creds, rspec_str, users, call_id):
137 version_manager = VersionManager()
138 def _CreateSliver(aggregate, server, xrn, credential, rspec, users, call_id):
142 # Need to call GetVersion at an aggregate to determine the supported
143 # rspec type/format beofre calling CreateSliver at an Aggregate.
144 print>>sys.stderr, " \r\n SLICE MANAGERSLAB _CreateSliver server "
145 server_version = api.get_cached_server_version(server)
146 requested_users = users
147 if 'sfa' not in server_version and 'geni_api' in server_version:
148 # sfa aggregtes support both sfa and pg rspecs, no need to convert
149 # if aggregate supports sfa rspecs. otherwise convert to pg rspec
150 rspec = RSpec(RSpecConverter.to_pg_rspec(rspec, 'request'))
151 filter = {'component_manager_id': server_version['urn']}
153 rspec = rspec.toxml()
154 requested_users = sfa_to_pg_users_arg(users)
155 args = [xrn, credential, rspec, requested_users]
156 if _call_id_supported(api, server):
158 rspec = server.CreateSliver(*args)
159 return {"aggregate": aggregate, "rspec": rspec, "elapsed": time.time()-tStart, "status": "success"}
161 logger.log_exc('Something wrong in _CreateSliver with URL %s'%server.url)
162 return {"aggregate": aggregate, "elapsed": time.time()-tStart, "status": "exception"}
165 if Callids().already_handled(call_id): return ""
167 # Validate the RSpec against PlanetLab's schema --disabled for now
168 # The schema used here needs to aggregate the PL and VINI schemas
169 # schema = "/var/www/html/schemas/pl.rng"
170 rspec = RSpec(rspec_str)
173 rspec.validate(schema)
175 print>>sys.stderr, " \r\n \r\n \t\t =======SLICE MANAGER _CreateSliver api %s" %(api)
176 # if there is a <statistics> section, the aggregates don't care about it,
178 drop_slicemgr_stats(api,rspec)
180 # attempt to use delegated credential first
181 credential = api.getDelegatedCredential(creds)
183 credential = api.getCredential()
185 # get the callers hrn
186 hrn, type = urn_to_hrn(xrn)
187 valid_cred = api.auth.checkCredentials(creds, 'createsliver', hrn)[0]
188 caller_hrn = Credential(string=valid_cred).get_gid_caller().get_hrn()
189 threads = ThreadManager()
190 print>>sys.stderr, " \r\n \r\n \t\t =======SLICE MANAGER _CreateSliver api aggregates %s \t caller_hrn %s api.hrn %s" %(api.aggregates, caller_hrn, api.hrn)
191 for aggregate in api.aggregates:
192 # prevent infinite loop. Dont send request back to caller
193 # unless the caller is the aggregate's SM
194 if caller_hrn == aggregate and aggregate != api.hrn:
196 interface = api.aggregates[aggregate]
197 print>>sys.stderr, " \r\n \r\n \t\t =======SLICE MANAGER _CreateSliver aggregate %s interface %s" %(api.aggregates[aggregate],interface)
198 server = api.get_server(interface, credential)
200 print>>sys.stderr, " \r\n \r\n \t\t =======SLICE MANAGER _CreateSliver NOSERVERS "
201 # Just send entire RSpec to each aggregate
202 #threads.run(_CreateSliver, aggregate, xrn, [credential], rspec.toxml(), users, call_id)
203 threads.run(_CreateSliver, aggregate, server, xrn, [credential], rspec.toxml(), users, call_id)
204 results = threads.get_results()
205 manifest_version = version_manager._get_version(rspec.version.type, rspec.version.version, 'manifest')
206 result_rspec = RSpec(version=manifest_version)
208 for result in results:
209 add_slicemgr_stat(result_rspec, "CreateSliver", result["aggregate"], result["elapsed"], result["status"])
210 if result["status"]=="success":
212 result_rspec.version.merge(result["rspec"])
214 api.logger.log_exc("SM.CreateSliver: Failed to merge aggregate rspec")
215 return result_rspec.toxml()
217 #return rspec.toxml()
219 def RenewSliver(api, xrn, creds, expiration_time, call_id):
220 if Callids().already_handled(call_id): return True
222 (hrn, type) = urn_to_hrn(xrn)
223 # get the callers hrn
224 valid_cred = api.auth.checkCredentials(creds, 'renewsliver', hrn)[0]
225 caller_hrn = Credential(string=valid_cred).get_gid_caller().get_hrn()
227 # attempt to use delegated credential first
228 credential = api.getDelegatedCredential(creds)
230 credential = api.getCredential()
231 threads = ThreadManager()
232 for aggregate in api.aggregates:
233 # prevent infinite loop. Dont send request back to caller
234 # unless the caller is the aggregate's SM
235 if caller_hrn == aggregate and aggregate != api.hrn:
238 server = api.aggregates[aggregate]
239 threads.run(server.RenewSliver, xrn, [credential], expiration_time, call_id)
241 return reduce (lambda x,y: x and y, threads.get_results() , True)
243 def get_ticket(api, xrn, creds, rspec, users):
244 slice_hrn, type = urn_to_hrn(xrn)
245 # get the netspecs contained within the clients rspec
246 aggregate_rspecs = {}
247 tree= etree.parse(StringIO(rspec))
248 elements = tree.findall('./network')
249 for element in elements:
250 aggregate_hrn = element.values()[0]
251 aggregate_rspecs[aggregate_hrn] = rspec
253 # get the callers hrn
254 valid_cred = api.auth.checkCredentials(creds, 'getticket', slice_hrn)[0]
255 caller_hrn = Credential(string=valid_cred).get_gid_caller().get_hrn()
257 # attempt to use delegated credential first
258 credential = api.getDelegatedCredential(creds)
260 credential = api.getCredential()
261 threads = ThreadManager()
262 for (aggregate, aggregate_rspec) in aggregate_rspecs.iteritems():
263 # prevent infinite loop. Dont send request back to caller
264 # unless the caller is the aggregate's SM
265 if caller_hrn == aggregate and aggregate != api.hrn:
268 if aggregate in api.aggregates:
269 server = api.aggregates[aggregate]
271 net_urn = hrn_to_urn(aggregate, 'authority')
272 # we may have a peer that knows about this aggregate
273 for agg in api.aggregates:
274 target_aggs = api.aggregates[agg].get_aggregates(credential, net_urn)
275 if not target_aggs or not 'hrn' in target_aggs[0]:
277 # send the request to this address
278 url = target_aggs[0]['url']
279 server = xmlrpcprotocol.get_server(url, api.key_file, api.cert_file)
280 # aggregate found, no need to keep looping
284 threads.run(server.ParseTicket, xrn, credential, aggregate_rspec, users)
286 results = threads.get_results()
288 # gather information from each ticket
293 for result in results:
294 agg_ticket = SfaTicket(string=result)
295 attrs = agg_ticket.get_attributes()
297 object_gid = agg_ticket.get_gid_object()
298 rspecs.append(agg_ticket.get_rspec())
299 initscripts.extend(attrs.get('initscripts', []))
300 slivers.extend(attrs.get('slivers', []))
303 attributes = {'initscripts': initscripts,
305 merged_rspec = merge_rspecs(rspecs)
307 # create a new ticket
308 ticket = SfaTicket(subject = slice_hrn)
309 ticket.set_gid_caller(api.auth.client_gid)
310 ticket.set_issuer(key=api.key, subject=api.hrn)
311 ticket.set_gid_object(object_gid)
312 ticket.set_pubkey(object_gid.get_pubkey())
313 #new_ticket.set_parent(api.auth.hierarchy.get_auth_ticket(auth_hrn))
314 ticket.set_attributes(attributes)
315 ticket.set_rspec(merged_rspec)
318 return ticket.save_to_string(save_parents=True)
321 def DeleteSliver(api, xrn, creds, call_id):
322 if Callids().already_handled(call_id): return ""
323 (hrn, type) = urn_to_hrn(xrn)
324 # get the callers hrn
325 valid_cred = api.auth.checkCredentials(creds, 'deletesliver', hrn)[0]
326 caller_hrn = Credential(string=valid_cred).get_gid_caller().get_hrn()
328 # attempt to use delegated credential first
329 credential = api.getDelegatedCredential(creds)
331 credential = api.getCredential()
332 threads = ThreadManager()
333 for aggregate in api.aggregates:
334 # prevent infinite loop. Dont send request back to caller
335 # unless the caller is the aggregate's SM
336 if caller_hrn == aggregate and aggregate != api.hrn:
338 server = api.aggregates[aggregate]
339 threads.run(server.DeleteSliver, xrn, credential, call_id)
340 threads.get_results()
343 def start_slice(api, xrn, creds):
344 hrn, type = urn_to_hrn(xrn)
346 # get the callers hrn
347 valid_cred = api.auth.checkCredentials(creds, 'startslice', hrn)[0]
348 caller_hrn = Credential(string=valid_cred).get_gid_caller().get_hrn()
350 # attempt to use delegated credential first
351 credential = api.getDelegatedCredential(creds)
353 credential = api.getCredential()
354 threads = ThreadManager()
355 for aggregate in api.aggregates:
356 # prevent infinite loop. Dont send request back to caller
357 # unless the caller is the aggregate's SM
358 if caller_hrn == aggregate and aggregate != api.hrn:
360 server = api.aggregates[aggregate]
361 threads.run(server.Start, xrn, credential)
362 threads.get_results()
365 def stop_slice(api, xrn, creds):
366 hrn, type = urn_to_hrn(xrn)
368 # get the callers hrn
369 valid_cred = api.auth.checkCredentials(creds, 'stopslice', hrn)[0]
370 caller_hrn = Credential(string=valid_cred).get_gid_caller().get_hrn()
372 # attempt to use delegated credential first
373 credential = api.getDelegatedCredential(creds)
375 credential = api.getCredential()
376 threads = ThreadManager()
377 for aggregate in api.aggregates:
378 # prevent infinite loop. Dont send request back to caller
379 # unless the caller is the aggregate's SM
380 if caller_hrn == aggregate and aggregate != api.hrn:
382 server = api.aggregates[aggregate]
383 threads.run(server.Stop, xrn, credential)
384 threads.get_results()
387 def reset_slice(api, xrn):
393 def shutdown(api, xrn, creds):
399 def status(api, xrn, creds):
405 # Thierry : caching at the slicemgr level makes sense to some extent
408 def ListSlices(api, creds, call_id):
410 if Callids().already_handled(call_id): return []
412 # look in cache first
413 if caching and api.cache:
414 slices = api.cache.get('slices')
418 # get the callers hrn
419 valid_cred = api.auth.checkCredentials(creds, 'listslices', None)[0]
420 caller_hrn = Credential(string=valid_cred).get_gid_caller().get_hrn()
422 # attempt to use delegated credential first
423 credential = api.getDelegatedCredential(creds)
425 credential = api.getCredential()
426 threads = ThreadManager()
427 # fetch from aggregates
428 for aggregate in api.aggregates:
429 # prevent infinite loop. Dont send request back to caller
430 # unless the caller is the aggregate's SM
431 if caller_hrn == aggregate and aggregate != api.hrn:
433 server = api.aggregates[aggregate]
434 threads.run(server.ListSlices, credential, call_id)
437 results = threads.get_results()
439 for result in results:
440 slices.extend(result)
443 if caching and api.cache:
444 api.cache.add('slices', slices)
448 def add_slicemgr_stat(rspec, callname, aggname, elapsed, status):
450 stats_tags = rspec.xml.xpath('//statistics[@call="%s"]' % callname)
452 stats_tag = stats_tags[0]
454 stats_tag = etree.SubElement(rspec.xml.root, "statistics", call=callname)
456 etree.SubElement(stats_tag, "aggregate", name=str(aggname), elapsed=str(elapsed), status=str(status))
458 api.logger.warn("add_slicemgr_stat failed on %s: %s" %(aggname, str(e)))
463 def ListResources(api, creds, options, call_id):
464 version_manager = VersionManager()
465 def _ListResources(aggregate, server, credential, opts, call_id):
468 args = [credential, my_opts]
471 if _call_id_supported(api, server):
473 version = api.get_cached_server_version(server)
474 # force ProtoGENI aggregates to give us a v2 RSpec
475 if 'sfa' not in version.keys():
476 my_opts['rspec_version'] = version_manager.get_version('ProtoGENI 2').to_dict()
477 rspec = server.ListResources(*args)
478 return {"aggregate": aggregate, "rspec": rspec, "elapsed": time.time()-tStart, "status": "success"}
480 api.logger.log_exc("ListResources failed at %s" %(server.url))
481 return {"aggregate": aggregate, "elapsed": time.time()-tStart, "status": "exception"}
483 if Callids().already_handled(call_id): return ""
485 # get slice's hrn from options
486 xrn = options.get('geni_slice_urn', '')
487 (hrn, type) = urn_to_hrn(xrn)
488 if 'geni_compressed' in options:
489 del(options['geni_compressed'])
491 # get the rspec's return format from options
492 rspec_version = version_manager.get_version(options.get('rspec_version'))
493 version_string = "rspec_%s" % (rspec_version.to_string())
495 # look in cache first
496 if caching and api.cache and not xrn:
497 rspec = api.cache.get(version_string)
501 # get the callers hrn
502 valid_cred = api.auth.checkCredentials(creds, 'listnodes', hrn)[0]
503 caller_hrn = Credential(string=valid_cred).get_gid_caller().get_hrn()
505 # attempt to use delegated credential first
506 cred = api.getDelegatedCredential(creds)
508 cred = api.getCredential()
509 threads = ThreadManager()
510 for aggregate in api.aggregates:
511 # prevent infinite loop. Dont send request back to caller
512 # unless the caller is the aggregate's SM
513 if caller_hrn == aggregate and aggregate != api.hrn:
516 # get the rspec from the aggregate
517 interface = api.aggregates[aggregate]
518 server = api.get_server(interface, cred)
519 threads.run(_ListResources, aggregate, server, [cred], options, call_id)
522 results = threads.get_results()
523 rspec_version = version_manager.get_version(options.get('rspec_version'))
525 result_version = version_manager._get_version(rspec_version.type, rspec_version.version, 'manifest')
527 result_version = version_manager._get_version(rspec_version.type, rspec_version.version, 'ad')
528 rspec = RSpec(version=result_version)
529 for result in results:
530 add_slicemgr_stat(rspec, "ListResources", result["aggregate"], result["elapsed"], result["status"])
531 if result["status"]=="success":
533 rspec.version.merge(result["rspec"])
535 api.logger.log_exc("SM.ListResources: Failed to merge aggregate rspec")
538 if caching and api.cache and not xrn:
539 api.cache.add(version_string, rspec.toxml())
541 print >>sys.stderr, "\r\n slice_manager \r\n" , rspec
544 #def ListResources(api, creds, options, call_id):
546 #if Callids().already_handled(call_id): return ""
548 ## get slice's hrn from options
549 #xrn = options.get('geni_slice_urn', '')
550 #(hrn, type) = urn_to_hrn(xrn)
551 #print >>sys.stderr, " SM_ListResources xrn " , xrn
552 ##print >>sys.stderr, " SM ListResources api.__dict__ " , api.__dict__.keys()
553 ##print >>sys.stderr, " SM ListResources dir(api)" , dir(api)
554 #print >>sys.stderr, " \r\n avant RspecVersion \r\n \r\n"
555 ## get the rspec's return format from options
556 #rspec_version = RSpecVersion(options.get('rspec_version'))
557 #print >>sys.stderr, " \r\n \r\n ListResources RSpecVersion ", rspec_version
558 #version_string = "rspec_%s" % (rspec_version.get_version_name())
560 ##panos adding the info option to the caching key (can be improved)
561 #if options.get('info'):
562 #version_string = version_string + "_"+options.get('info')
564 #print>>sys.stderr,"version string = ",version_string
566 ## look in cache first
567 #if caching and api.cache and not xrn:
568 #print>>sys.stderr," \r\n caching %s and api.cache %s and not xrn %s"%(caching , api.cache,xrn)
569 #rspec = api.cache.get(version_string)
573 ## get the callers hrn
574 #print >>sys.stderr, " SM ListResources get the callers hrn "
575 #valid_cred = api.auth.checkCredentials(creds, 'listnodes', hrn)[0]
576 #caller_hrn = Credential(string=valid_cred).get_gid_caller().get_hrn()
577 #print >>sys.stderr, " \r\n SM ListResources get the callers caller_hrn hrn %s "%(caller_hrn)
578 ## attempt to use delegated credential first
579 #credential = api.getDelegatedCredential(creds)
580 #print >>sys.stderr, " \r\n SM ListResources get the callers credential %s "%(credential)
582 #credential = api.getCredential()
583 #threads = ThreadManager()
584 #print >>sys.stderr, " \r\n SM ListResources get the callers api.aggregates %s "%(api.aggregates)
585 #for aggregate in api.aggregates:
586 ## prevent infinite loop. Dont send request back to caller
587 ## unless the caller is the aggregate's SM
588 #if caller_hrn == aggregate and aggregate != api.hrn:
590 ## get the rspec from the aggregate
591 #server = api.aggregates[aggregate]
592 #print >>sys.stderr, " Slice Mgr ListResources, server" ,server
593 #my_opts = copy(options)
594 #my_opts['geni_compressed'] = False
595 #threads.run(server.ListResources, credential, my_opts, call_id)
596 #print >>sys.stderr, "\r\n !!!!!!!!!!!!!!!! \r\n"
597 #results = threads.get_results()
598 ##results.append(open('/root/protogeni.rspec', 'r').read())
599 #rspec_version = RSpecVersion(my_opts.get('rspec_version'))
600 #if rspec_version['type'].lower() == 'protogeni':
605 #for result in results:
606 #print >>sys.stderr, "\r\n slice_manager result" , result
608 #print >>sys.stderr, "avant merge" , rspec
610 #print >>sys.stderr, "AFTERMERGE" , rspec
613 #api.logger.info("SM.ListResources: Failed to merge aggregate rspec")
616 #if caching and api.cache and not xrn:
617 #api.cache.add(version_string, rspec.toxml())
619 #print >>sys.stderr, "\r\n slice_manager \r\n" , rspec
620 #return rspec.toxml()
622 # first draft at a merging SliverStatus
623 def SliverStatus(api, slice_xrn, creds, call_id):
624 if Callids().already_handled(call_id): return {}
625 # attempt to use delegated credential first
626 credential = api.getDelegatedCredential(creds)
628 credential = api.getCredential()
629 threads = ThreadManager()
630 for aggregate in api.aggregates:
631 server = api.aggregates[aggregate]
632 threads.run (server.SliverStatus, slice_xrn, credential, call_id)
633 results = threads.get_results()
635 # get rid of any void result - e.g. when call_id was hit where by convention we return {}
636 results = [ result for result in results if result and result['geni_resources']]
638 # do not try to combine if there's no result
639 if not results : return {}
641 # otherwise let's merge stuff
644 # mmh, it is expected that all results carry the same urn
645 overall['geni_urn'] = results[0]['geni_urn']
647 # consolidate geni_status - simple model using max on a total order
648 states = [ 'ready', 'configuring', 'failed', 'unknown' ]
650 shash = dict ( zip ( states, range(len(states)) ) )
651 def combine_status (x,y):
652 return shash [ max (shash(x),shash(y)) ]
653 overall['geni_status'] = reduce (combine_status, [ result['geni_status'] for result in results], 'ready' )
655 # {'ready':0,'configuring':1,'failed':2,'unknown':3}
656 # append all geni_resources
657 overall['geni_resources'] = \
658 reduce (lambda x,y: x+y, [ result['geni_resources'] for result in results] , [])
664 r.parseFile(sys.argv[1])
666 CreateSliver(None,'plc.princeton.tmacktestslice',rspec,'create-slice-tmacktestslice')
668 if __name__ == "__main__":