initial checkin of rspec elements
[sfa.git] / sfa / managers / aggregate_manager_pl.py
index c916c51..a2449b2 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+
 
 import datetime
 import time
@@ -195,22 +195,25 @@ 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_sliver_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 slice_attributes:
+            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:
             api.plshell.BindObjectToPeer(api.plauth, 'slice', slice.id, peer, 
                                          slice.peer_id)
 
-    return aggregate.get_rspec(slice_xrn=slice_xrn, version=rspec.version, type='advertisement')
+    return aggregate.get_rspec(slice_xrn=slice_xrn, version=rspec.version)
 
 
 def RenewSliver(api, xrn, creds, expiration_time, call_id):
@@ -316,10 +319,8 @@ def ListResources(api, creds, options,call_id):
 
     #panos adding the info option to the caching key (can be improved)
     if options.get('info'):
-       version_string = version_string + "_"+options.get('info')
+       version_string = version_string + "_"+options.get('info', 'default')
 
-    print "[aggregate] version string = ",version_string
-    
     # look in cache first
     if caching and api.cache and not xrn:
         rspec = api.cache.get(version_string)