review management of relationships - allow to update them with sfaadmin
[sfa.git] / sfa / plc / plaggregate.py
index 1cace7a..04fdca4 100644 (file)
@@ -115,7 +115,7 @@ class PlAggregate:
 
         # sort slivers by node id    
         for node_id in slice['node_ids']:
-            sliver = Sliver({'sliver_id': urn_to_sliver_id(slice_urn, slice['slice_id'], node_id),
+            sliver = Sliver({'sliver_id': urn_to_sliver_id(slice_urn, slice['slice_id'], node_id, authority=self.driver.hrn),
                              'name': slice['name'],
                              'type': 'plab-vserver', 
                              'tags': []})
@@ -135,7 +135,13 @@ class PlAggregate:
         
         return (slice, slivers)
 
-    def get_nodes_and_links(self, slice=None,slivers=[], options={}):
+    def get_nodes_and_links(self, slice_xrn, slice=None,slivers=[], options={}):
+        # if we are dealing with a slice that has no node just return 
+        # and empty list    
+        if slice_xrn:
+            if not slice or not slice['node_ids']:
+                return ([],[])
+
         filter = {}
         tags_filter = {}
         if slice and 'node_ids' in slice and slice['node_ids']:
@@ -243,7 +249,7 @@ class PlAggregate:
         if slice and 'expires' in slice:
             rspec.xml.set('expires',  datetime_to_string(utcparse(slice['expires'])))
 
-        nodes, links = self.get_nodes_and_links(slice, slivers)
+        nodes, links = self.get_nodes_and_links(slice_xrn, slice, slivers)
         rspec.version.add_nodes(nodes)
         rspec.version.add_links(links)