review uses of strftime to use a common central date format sfatime.SFATIME_FORMAT
[sfa.git] / sfa / managers / aggregate_manager_max.py
index b7cdffb..88df708 100644 (file)
@@ -4,6 +4,7 @@ import re
 
 #from sfa.util.faults import *
 from sfa.util.sfalogging import logger
+from sfa.util.sfatime import SFATIME_FORMAT
 from sfa.util.config import Config
 from sfa.util.callids import Callids
 from sfa.util.version import version_core
@@ -14,10 +15,13 @@ from sfa.util.xrn import urn_to_hrn, hrn_to_urn, Xrn
 
 from sfa.managers.aggregate_manager import AggregateManager
 
-from sfa.plc.plslices import PlSlices
+from sfa.planetlab.plslices import PlSlices
 
 class AggregateManagerMax (AggregateManager):
 
+    def __init__ (self, config):
+        pass
+
     RSPEC_TMP_FILE_PREFIX = "/tmp/max_rspec"
     
     # execute shell command and return both exit code and text output
@@ -53,7 +57,7 @@ class AggregateManagerMax (AggregateManager):
     # save request RSpec xml content to a tmp file
     def save_rspec_to_file(self, rspec):
         path = AggregateManagerMax.RSPEC_TMP_FILE_PREFIX + "_" + \
-            time.strftime('%Y%m%dT%H:%M:%S', time.gmtime(time.time())) +".xml"
+            time.strftime(SFATIME_FORMAT, time.gmtime(time.time())) +".xml"
         file = open(path, "w")
         file.write(rspec)
         file.close()
@@ -145,7 +149,7 @@ class AggregateManagerMax (AggregateManager):
     def prepare_slice(self, api, slice_xrn, creds, users):
         reg_objects = self._get_registry_objects(slice_xrn, creds, users)
         (hrn, type) = urn_to_hrn(slice_xrn)
-        slices = PlSlices(api)
+        slices = PlSlices(self.driver)
         peer = slices.get_peer(hrn)
         sfa_peer = slices.get_sfa_peer(hrn)
         slice_record=None
@@ -274,12 +278,12 @@ class AggregateManagerMax (AggregateManager):
     
     ### GENI AM API Methods
     
-    def SliverStatus(self, api, slice_xrn, creds, options={}):
+    def SliverStatus(self, api, slice_xrn, creds, options):
         call_id = options.get('call_id')
         if Callids().already_handled(call_id): return {}
         return self.slice_status(api, slice_xrn, creds)
     
-    def CreateSliver(self, api, slice_xrn, creds, rspec_string, users, options={}):
+    def CreateSliver(self, api, slice_xrn, creds, rspec_string, users, options):
         call_id = options.get('call_id')
         if Callids().already_handled(call_id): return ""
         #TODO: create real CreateSliver response rspec
@@ -289,13 +293,13 @@ class AggregateManagerMax (AggregateManager):
         else:
             return "<?xml version=\"1.0\" ?> <RSpec type=\"SFA\"> Error! </RSpec>"
     
-    def DeleteSliver(self, api, xrn, creds, options={}):
+    def DeleteSliver(self, api, xrn, creds, options):
         call_id = options.get('call_id')
         if Callids().already_handled(call_id): return ""
         return self.delete_slice(api, xrn, creds)
     
     # no caching
-    def ListResources(self, api, creds, options={}):
+    def ListResources(self, api, creds, options):
         call_id = options.get('call_id')
         if Callids().already_handled(call_id): return ""
         # version_string = "rspec_%s" % (rspec_version.get_version_name())