# XX remove me
return result
-def create_slice(api, slice_xrn, creds, rspec, users):
+def CreateSliver(api, slice_xrn, creds, rspec, users, call_id):
"""
Create the sliver[s] (slice) at this aggregate.
Verify HRN and initialize the slice record in PLC if necessary.
"""
+ if Callids().already_handled(call_id): return False
reg_objects = __get_registry_objects(slice_xrn, creds, users)
# xxx Thierry : caching at the aggregate level sounds wrong...
caching=True
#caching=False
-def get_rspec(api, creds, options,call_id):
+def ListResources(api, creds, options,call_id):
if Callids().already_handled(call_id): return ""
# get slice's hrn from options
xrn = options.get('geni_slice_urn', '')
if caching and api.cache and not xrn:
rspec = api.cache.get('nodes')
if rspec:
- api.logger.info("aggregate.get_rspec: returning cached value for hrn %s"%hrn)
+ api.logger.info("aggregate.ListResources: returning cached value for hrn %s"%hrn)
return rspec
network = Network(api)
credential = api.getCredential()
records = registry.Resolve(xrn, credential)
- # similar to create_slice, we must verify that the required records exist
+ # similar to CreateSliver, we must verify that the required records exist
# at this aggregate before we can issue a ticket
site_id, remote_site_id = slices.verify_site(registry, credential, slice_hrn,
peer, sfa_peer, reg_objects)
def main():
api = SfaAPI()
"""
- rspec = get_rspec(api, "plc.princeton.sapan", None, 'pl_test_sapan')
- #rspec = get_rspec(api, "plc.princeton.coblitz", None, 'pl_test_coblitz')
- #rspec = get_rspec(api, "plc.pl.sirius", None, 'pl_test_sirius')
+ rspec = ListResources(api, "plc.princeton.sapan", None, 'pl_test_sapan')
+ #rspec = ListResources(api, "plc.princeton.coblitz", None, 'pl_test_coblitz')
+ #rspec = ListResources(api, "plc.pl.sirius", None, 'pl_test_sirius')
print rspec
"""
f = open(sys.argv[1])
xml = f.read()
f.close()
- create_slice(api, "plc.princeton.sapan", xml)
+ CreateSliver(api, "plc.princeton.sapan", xml, 'CreateSliver_sapan')
if __name__ == "__main__":
main()