typo
[sfa.git] / sfa / managers / aggregate_manager_pl.py
index 5791bfa..97fa73c 100644 (file)
@@ -26,7 +26,7 @@ def delete_slice(api, hrn):
     slice = slices[0]
 
     # determine if this is a peer slice
-    peer = peers.get_peer(hrn)
+    peer = peers.get_peer(api, hrn)
     if peer:
         api.plshell.UnBindObjectFromPeer(api.plauth, 'slice', slice['slice_id'], peer)
     api.plshell.DeleteSliceFromNodes(api.plauth, slicename, slice['node_ids'])
@@ -76,4 +76,32 @@ def get_slices(api):
     slices.refresh()
     return slices['hrn']
      
-    
+def get_rspec(api, hrn=None, caller_cred=None):
+    from sfa.plc.nodes import Nodes
+    nodes = Nodes(api, caller_cred=caller_cred)
+    if hrn:
+        rspec = nodes.get_rspec(hrn)
+    else:
+        nodes.refresh()
+        rspec = nodes['rspec'] 
+
+    return rspec
+
+"""
+Returns the request context required by sfatables. At some point, this mechanism should be changed
+to refer to "contexts", which is the information that sfatables is requesting. But for now, we just
+return the basic information needed in a dict.
+"""
+def fetch_context(slice_hrn, user_hrn, contexts):
+    base_context = {'sfa':{'user':{'hrn':user_hrn}}}
+    return base_context
+
+def main():
+    r = RSpec()
+    r.parseFile(sys.argv[1])
+    rspec = r.toDict()
+    create_slice(None,'plc.princeton.tmacktestslice',rspec)
+
+if __name__ == "__main__":
+    main()