X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fdummy%2Fdummydriver.py;h=a69662e18c9827b1c6389e86ec18ca6b73d89df0;hb=4a2337e7f70cef81a8de37829aa63fc941c4b96e;hp=786ce14524671902a429242bdbd9a19bd1e696a6;hpb=307b25272cc7ed15da0bb3a69606e1d0f6c603b8;p=sfa.git diff --git a/sfa/dummy/dummydriver.py b/sfa/dummy/dummydriver.py index 786ce145..a69662e1 100644 --- a/sfa/dummy/dummydriver.py +++ b/sfa/dummy/dummydriver.py @@ -45,7 +45,7 @@ class DummyDriver (Driver): def __init__ (self, api): Driver.__init__ (self, api) - config = api.config + config = api.config self.hrn = config.SFA_INTERFACE_HRN self.root_auth = config.SFA_REGISTRY_ROOT_AUTH self.shell = DummyShell (config) @@ -255,10 +255,10 @@ class DummyDriver (Driver): # fill in key info if record['type'] == 'user': record['key_ids'] = [] - recors['keys'] = [] + record['keys'] = [] for key in dummy_records['user'][record['pointer']]['keys']: record['key_ids'].append(-1) - recors['keys'].append(key) + record['keys'].append(key) return records @@ -412,16 +412,19 @@ class DummyDriver (Driver): def aggregate_version (self): return {} - def list_resources (self, version=None, options={}): + def list_resources (self, version=None, options=None): + if options is None: options={} aggregate = DummyAggregate(self) rspec = aggregate.list_resources(version=version, options=options) return rspec - def describe(self, urns, version, options={}): + def describe(self, urns, version, options=None): + if options is None: options={} aggregate = DummyAggregate(self) return aggregate.describe(urns, version=version, options=options) - def status (self, urns, options={}): + def status (self, urns, options=None): + if options is None: options={} aggregate = DummyAggregate(self) desc = aggregate.describe(urns, version='GENI 3') status = {'geni_urn': desc['geni_urn'], @@ -429,7 +432,8 @@ class DummyDriver (Driver): return status - def allocate (self, urn, rspec_string, expiration, options={}): + def allocate (self, urn, rspec_string, expiration, options=None): + if options is None: options={} xrn = Xrn(urn) aggregate = DummyAggregate(self) slices = DummySlices(self) @@ -453,7 +457,8 @@ class DummyDriver (Driver): return aggregate.describe([xrn.get_urn()], version=rspec.version) - def provision(self, urns, options={}): + def provision(self, urns, options=None): + if options is None: options={} # update users slices = DummySlices(self) aggregate = DummyAggregate(self) @@ -469,7 +474,8 @@ class DummyDriver (Driver): rspec_version = version_manager.get_version(options['geni_rspec_version']) return self.describe(urns, rspec_version, options=options) - def delete(self, urns, options={}): + def delete(self, urns, options=None): + if options is None: options={} # collect sliver ids so we can update sliver allocation states after # we remove the slivers. aggregate = DummyAggregate(self) @@ -504,7 +510,8 @@ class DummyDriver (Driver): 'geni_expires': datetime_to_string(utcparse(sliver['expires']))}) return geni_slivers - def renew (self, urns, expiration_time, options={}): + def renew (self, urns, expiration_time, options=None): + if options is None: options={} aggregate = DummyAggregate(self) slivers = aggregate.get_slivers(urns) if not slivers: @@ -516,7 +523,8 @@ class DummyDriver (Driver): description = self.describe(urns, 'GENI 3', options) return description['geni_slivers'] - def perform_operational_action (self, urns, action, options={}): + def perform_operational_action (self, urns, action, options=None): + if options is None: options={} # Dummy doesn't support operational actions. Lets pretend like it # supports start, but reject everything else. action = action.lower() @@ -535,7 +543,8 @@ class DummyDriver (Driver): geni_slivers = self.describe(urns, 'GENI 3', options)['geni_slivers'] return geni_slivers - def shutdown (self, xrn, options={}): + def shutdown (self, xrn, options=None): + if options is None: options={} xrn = DummyXrn(xrn=xrn, type='slice') slicename = xrn.pl_slicename() slices = self.shell.GetSlices({'name': slicename}, ['slice_id'])