DeleteSliver supports call_id
[sfa.git] / sfa / managers / aggregate_manager_vini.py
index 08162c1..d961443 100644 (file)
@@ -36,8 +36,9 @@ def GetVersion(api):
                          'hrn':xrn.get_hrn(),
                          })
 
-def delete_slice(api, xrn, creds):
-    hrn, type = urn_to_hrn(xrn)
+def DeleteSliver(api, xrn, creds, call_id):
+    if Callids().already_handled(call_id): return ""
+    (hrn, type) = urn_to_hrn(xrn)
     slicename = hrn_to_pl_slicename(hrn)
     slices = api.plshell.GetSlices(api.plauth, {'name': slicename})
     if not slices:
@@ -47,12 +48,12 @@ 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, call_id):
+def CreateSliver(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
+    if Callids().already_handled(call_id): return ""
 
     hrn, type = urn_to_hrn(xrn)
     peer = None
@@ -87,9 +88,8 @@ def create_slice(api, xrn, creds, xml, users, call_id):
     api.plshell.DeleteSliceFromNodes(api.plauth, slice.name, deleted_nodes)
     network.updateSliceTags()
 
-    # print network.toxml()
-
-    return True
+    # xxx - check this holds enough data for the client to understand what's happened
+    return network.toxml()
 
 def ListResources(api, creds, options,call_id):
     if Callids().already_handled(call_id): return ""
@@ -126,7 +126,7 @@ def main():
     f = open(sys.argv[1])
     xml = f.read()
     f.close()
-    create_slice(api, "plc.princeton.iias", xml, 'call-id-iias')
+    CreateSliver(api, "plc.princeton.iias", xml, 'call-id-iias')
 
 if __name__ == "__main__":
     main()