from sfa.dummy.dummyxrn import DummyXrn, hostname_to_urn, hrn_to_dummy_slicename, slicename_to_hrn
-from sfa.storage.alchemy import dbsession
from sfa.storage.model import SliverAllocation
import time
geni_urn = urns[0]
sliver_ids = [sliver['sliver_id'] for sliver in slivers]
constraint = SliverAllocation.sliver_id.in_(sliver_ids)
- sliver_allocations = dbsession.query(SliverAllocation).filter(constraint)
+ sliver_allocations = self.driver.api.dbsession().query(SliverAllocation).filter(constraint)
sliver_allocation_dict = {}
for sliver_allocation in sliver_allocations:
geni_urn = sliver_allocation.slice_urn
from sfa.util.cache import Cache
# one would think the driver should not need to mess with the SFA db, but..
-from sfa.storage.alchemy import dbsession
from sfa.storage.model import RegRecord, SliverAllocation
from sfa.trust.credential import Credential
# the cache instance is a class member so it survives across incoming requests
cache = None
- def __init__ (self, config):
- Driver.__init__ (self, config)
- self.config = config
+ def __init__ (self, api):
+ Driver.__init__ (self, api)
+ config = api.config
self.hrn = config.SFA_INTERFACE_HRN
self.root_auth = config.SFA_REGISTRY_ROOT_AUTH
self.shell = DummyShell (config)
# get the registry records
user_list, users = [], {}
- user_list = dbsession.query (RegRecord).filter(RegRecord.pointer.in_(user_ids))
+ user_list = self.api.dbsession().query (RegRecord).filter(RegRecord.pointer.in_(user_ids))
# create a hrns keyed on the sfa record's pointer.
# Its possible for multiple records to have the same pointer so
# the dict's value will be a list of hrns.
#users = slices.verify_users(None, slice, geni_users, options=options)
# update sliver allocation states and set them to geni_provisioned
sliver_ids = [sliver['sliver_id'] for sliver in slivers]
- SliverAllocation.set_allocations(sliver_ids, 'geni_provisioned')
+ dbsession=self.api.dbsession()
+ SliverAllocation.set_allocations(sliver_ids, 'geni_provisioned',dbsession)
version_manager = VersionManager()
rspec_version = version_manager.get_version(options['geni_rspec_version'])
return self.describe(urns, rspec_version, options=options)
try:
self.shell.DeleteSliceFromNodes({'slice_id': slice_id, 'node_ids': node_ids})
# delete sliver allocation states
- SliverAllocation.delete_allocations(sliver_ids)
+ dbsession=self.api.dbsession()
+ SliverAllocation.delete_allocations(sliver_ids,dbsession)
finally:
pass