CreateSliver/create_slice also honor call_id
[sfa.git] / sfa / managers / aggregate_manager_vini.py
index e16d201..f5d598f 100644 (file)
@@ -47,11 +47,13 @@ def delete_slice(api, xrn, creds):
     api.plshell.DeleteSliceFromNodes(api.plauth, slicename, slice['node_ids'])
     return 1
 
-def create_slice(api, xrn, creds, xml, users):
+def create_slice(api, xrn, creds, xml, users, call_id):
     """
     Verify HRN and initialize the slice record in PLC if necessary.
     """
 
+    if Callids().already_handled(call_id): return False
+
     hrn, type = urn_to_hrn(xrn)
     peer = None
     reg_objects = __get_registry_objects(xrn, creds, users)
@@ -90,7 +92,7 @@ def create_slice(api, xrn, creds, xml, users):
     return True
 
 def get_rspec(api, creds, options,call_id):
-    if not Callids().should_handle_call_id(call_id): return ""
+    if Callids().already_handled(call_id): return ""
     # get slice's hrn from options
     xrn = options.get('geni_slice_urn', '')
     hrn, type = urn_to_hrn(xrn)
@@ -124,7 +126,7 @@ def main():
     f = open(sys.argv[1])
     xml = f.read()
     f.close()
-    create_slice(api, "plc.princeton.iias", xml)
+    create_slice(api, "plc.princeton.iias", xml, 'call-id-iias')
 
 if __name__ == "__main__":
     main()