handle sliver attribtes in the SFA rspec
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Mon, 20 Jun 2011 20:48:33 +0000 (16:48 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Mon, 20 Jun 2011 20:48:33 +0000 (16:48 -0400)
sfa/managers/aggregate_manager_pl.py
sfa/rspecs/pg_rspec.py
sfa/rspecs/sfa_rspec.py

index 894823c..a4e5651 100644 (file)
@@ -195,15 +195,18 @@ def CreateSliver(api, slice_xrn, creds, rspec_string, users, call_id):
     # add nodes from rspec
     added_nodes = list(set(requested_slivers).difference(current_slivers))
 
+    # get sliver attributes
+    slice_attributes = rspec.get_slice_attributes()
+
     try:
         if peer:
             api.plshell.UnBindObjectFromPeer(api.plauth, 'slice', slice['slice_id'], peer)
 
         api.plshell.AddSliceToNodes(api.plauth, slice['name'], added_nodes) 
         api.plshell.DeleteSliceFromNodes(api.plauth, slice['name'], deleted_nodes)
-
-        # TODO: update slice tags
-        #network.updateSliceTags()
+        for attribute in sliver_atrributes:
+            name, value, node_id = attribute['tagname'], attribute['value'], attribute.get('node_id', None)
+            api.plshell.AddSliceTag(api.plauth, slice['name'], name, value, node_id)
 
     finally:
         if peer:
index d481eb7..fb98a9d 100755 (executable)
@@ -90,6 +90,12 @@ class PGRSpec(RSpec):
 
     def get_nodes_without_slivers(self, network=None):
         pass
+   
+    def get_slice_attributes(self, network=None):
+        pass
+
+    def get_default_sliver_attributes(self, network=None):
+        pass 
 
     def add_nodes(self, nodes, check_for_dupes=False):
         if not isinstance(nodes, list):
index 0fce426..10d068a 100755 (executable)
@@ -91,6 +91,10 @@ class SfaRSpec(RSpec):
         sliver = node.find("sliver")
         return self.attributes_list(sliver)
 
+    def get_slice_attributes(self, network=None):
+        # TODO: FINISH
+        return []
+
     def get_site_nodes(self, siteid, network=None):
         if network:
             nodes = self.xml.xpath('//network[@name="%s"]/site[@id="%s"]/node/hostname/text()' % \