PlDriver no longer inherits PlShell and uses composition
Thierry Parmentelat [Thu, 15 Dec 2011 16:52:34 +0000 (17:52 +0100)]
so PLCAPI calls go to driver.shell as advertised

sfa/managers/registry_manager.py
sfa/plc/peers.py
sfa/plc/plaggregate.py
sfa/plc/pldriver.py
sfa/plc/plslices.py

index d29aafe..1c66e53 100644 (file)
@@ -390,10 +390,10 @@ class RegistryManager:
         # verify that the callers's ip address exist in the db and is an interface
         # for a node in the db
         (ip, port) = api.remote_addr
-        interfaces = self.driver.GetInterfaces({'ip': ip}, ['node_id'])
+        interfaces = self.driver.shell.GetInterfaces({'ip': ip}, ['node_id'])
         if not interfaces:
             raise NonExistingRecord("no such ip %(ip)s" % locals())
-        nodes = self.driver.GetNodes([interfaces[0]['node_id']], ['node_id', 'hostname'])
+        nodes = self.driver.shell.GetNodes([interfaces[0]['node_id']], ['node_id', 'hostname'])
         if not nodes:
             raise NonExistingRecord("no such node using ip %(ip)s" % locals())
         node = nodes[0]
index c256c7b..63c9f7f 100644 (file)
@@ -13,7 +13,7 @@ def get_peer(pldriver, hrn):
     # get this site's authority (sfa root authority or sub authority)
     site_authority = get_authority(slice_authority).lower()
     # check if we are already peered with this site_authority, if so
-    peers = pldriver.GetPeers( {}, ['peer_id', 'peername', 'shortname', 'hrn_root'])
+    peers = pldriver.shell.GetPeers( {}, ['peer_id', 'peername', 'shortname', 'hrn_root'])
     for peer_record in peers:
         names = [name.lower() for name in peer_record.values() if isinstance(name, StringTypes)]
         if site_authority in names:
index 4cc2c55..3919f7c 100644 (file)
@@ -27,13 +27,13 @@ class PlAggregate:
  
     def get_sites(self, filter={}):
         sites = {}
-        for site in self.driver.GetSites(filter):
+        for site in self.driver.shell.GetSites(filter):
             sites[site['site_id']] = site
         return sites
 
     def get_interfaces(self, filter={}):
         interfaces = {}
-        for interface in self.driver.GetInterfaces(filter):
+        for interface in self.driver.shell.GetInterfaces(filter):
             iface = Interface()
             if interface['bwlimit']:
                 interface['bwlimit'] = str(int(interface['bwlimit'])/1000)
@@ -85,14 +85,14 @@ class PlAggregate:
 
     def get_node_tags(self, filter={}):
         node_tags = {}
-        for node_tag in self.driver.GetNodeTags(filter):
+        for node_tag in self.driver.shell.GetNodeTags(filter):
             node_tags[node_tag['node_tag_id']] = node_tag
         return node_tags
 
     def get_pl_initscripts(self, filter={}):
         pl_initscripts = {}
         filter.update({'enabled': True})
-        for initscript in self.driver.GetInitScripts(filter):
+        for initscript in self.driver.shell.GetInitScripts(filter):
             pl_initscripts[initscript['initscript_id']] = initscript
         return pl_initscripts
 
@@ -108,7 +108,7 @@ class PlAggregate:
         slice_urn = hrn_to_urn(slice_xrn, 'slice')
         slice_hrn, _ = urn_to_hrn(slice_xrn)
         slice_name = hrn_to_pl_slicename(slice_hrn)
-        slices = self.driver.GetSlices(slice_name)
+        slices = self.driver.shell.GetSlices(slice_name)
         if not slices:
             return (slice, slivers)
         slice = slices[0]
@@ -122,7 +122,7 @@ class PlAggregate:
             slivers[node_id]= sliver
 
         # sort sliver attributes by node id    
-        tags = self.driver.GetSliceTags({'slice_tag_id': slice['slice_tag_ids']})
+        tags = self.driver.shell.GetSliceTags({'slice_tag_id': slice['slice_tag_ids']})
         for tag in tags:
             # most likely a default/global sliver attribute (node_id == None)
             if tag['node_id'] not in slivers:
@@ -146,7 +146,7 @@ class PlAggregate:
             filter['boot_state'] = 'boot'     
         
         filter.update({'peer_id': None})
-        nodes = self.driver.GetNodes(filter)
+        nodes = self.driver.shell.GetNodes(filter)
        
         site_ids = []
         interface_ids = []
index 5ce3b71..fa97183 100644 (file)
@@ -41,19 +41,14 @@ def list_to_dict(recs, key):
 # can be sent as-is; it takes care of authentication
 # from the global config
 # 
-# so we inherit PlShell just so one can do driver.GetNodes
-# which would not make much sense in the context of other testbeds
-# so ultimately PlDriver should drop the PlShell inheritance
-# and would have a driver.shell reference to a PlShell instead
-# 
-class PlDriver (Driver, PlShell):
+class PlDriver (Driver):
 
     # the cache instance is a class member so it survives across incoming requests
     cache = None
 
     def __init__ (self, config):
-        PlShell.__init__ (self, config)
         Driver.__init__ (self, config)
+        self.shell = PlShell (config)
         self.cache=None
         if config.SFA_AGGREGATE_CACHING:
             if PlDriver.cache is None:
@@ -81,9 +76,9 @@ class PlDriver (Driver, PlShell):
         pl_record = self.sfa_fields_to_pl_fields(type, hrn, sfa_record)
 
         if type == 'authority':
-            sites = self.GetSites([pl_record['login_base']])
+            sites = self.shell.GetSites([pl_record['login_base']])
             if not sites:
-                pointer = self.AddSite(pl_record)
+                pointer = self.shell.AddSite(pl_record)
             else:
                 pointer = sites[0]['site_id']
 
@@ -92,38 +87,38 @@ class PlDriver (Driver, PlShell):
             for key in pl_record.keys():
                 if key not in acceptable_fields:
                     pl_record.pop(key)
-            slices = self.GetSlices([pl_record['name']])
+            slices = self.shell.GetSlices([pl_record['name']])
             if not slices:
-                 pointer = self.AddSlice(pl_record)
+                 pointer = self.shell.AddSlice(pl_record)
             else:
                  pointer = slices[0]['slice_id']
 
         elif type == 'user':
-            persons = self.GetPersons([sfa_record['email']])
+            persons = self.shell.GetPersons([sfa_record['email']])
             if not persons:
-                pointer = self.AddPerson(dict(sfa_record))
+                pointer = self.shell.AddPerson(dict(sfa_record))
             else:
                 pointer = persons[0]['person_id']
     
             if 'enabled' in sfa_record and sfa_record['enabled']:
-                self.UpdatePerson(pointer, {'enabled': sfa_record['enabled']})
+                self.shell.UpdatePerson(pointer, {'enabled': sfa_record['enabled']})
             # add this person to the site only if she is being added for the first
             # time by sfa and doesont already exist in plc
             if not persons or not persons[0]['site_ids']:
                 login_base = get_leaf(sfa_record['authority'])
-                self.AddPersonToSite(pointer, login_base)
+                self.shell.AddPersonToSite(pointer, login_base)
     
             # What roles should this user have?
-            self.AddRoleToPerson('user', pointer)
+            self.shell.AddRoleToPerson('user', pointer)
             # Add the user's key
             if pub_key:
-                self.AddPersonKey(pointer, {'key_type' : 'ssh', 'key' : pub_key})
+                self.shell.AddPersonKey(pointer, {'key_type' : 'ssh', 'key' : pub_key})
 
         elif type == 'node':
             login_base = hrn_to_pl_login_base(sfa_record['authority'])
-            nodes = self.GetNodes([pl_record['hostname']])
+            nodes = self.shell.GetNodes([pl_record['hostname']])
             if not nodes:
-                pointer = self.AddNode(login_base, pl_record)
+                pointer = self.shell.AddNode(login_base, pl_record)
             else:
                 pointer = nodes[0]['node_id']
     
@@ -140,13 +135,13 @@ class PlDriver (Driver, PlShell):
             raise UnknownSfaType(type)
 
         if (type == "authority"):
-            self.UpdateSite(pointer, new_sfa_record)
+            self.shell.UpdateSite(pointer, new_sfa_record)
     
         elif type == "slice":
             pl_record=self.sfa_fields_to_pl_fields(type, hrn, new_sfa_record)
             if 'name' in pl_record:
                 pl_record.pop('name')
-                self.UpdateSlice(pointer, pl_record)
+                self.shell.UpdateSlice(pointer, pl_record)
     
         elif type == "user":
             # SMBAKER: UpdatePerson only allows a limited set of fields to be
@@ -159,27 +154,27 @@ class PlDriver (Driver, PlShell):
                            'password', 'phone', 'url', 'bio', 'accepted_aup',
                            'enabled']:
                     update_fields[key] = all_fields[key]
-            self.UpdatePerson(pointer, update_fields)
+            self.shell.UpdatePerson(pointer, update_fields)
     
             if new_key:
                 # must check this key against the previous one if it exists
-                persons = self.GetPersons([pointer], ['key_ids'])
+                persons = self.shell.GetPersons([pointer], ['key_ids'])
                 person = persons[0]
                 keys = person['key_ids']
-                keys = self.GetKeys(person['key_ids'])
+                keys = self.shell.GetKeys(person['key_ids'])
                 
                 # Delete all stale keys
                 key_exists = False
                 for key in keys:
                     if new_key != key['key']:
-                        self.DeleteKey(key['key_id'])
+                        self.shell.DeleteKey(key['key_id'])
                     else:
                         key_exists = True
                 if not key_exists:
-                    self.AddPersonKey(pointer, {'key_type': 'ssh', 'key': new_key})
+                    self.shell.AddPersonKey(pointer, {'key_type': 'ssh', 'key': new_key})
     
         elif type == "node":
-            self.UpdateNode(pointer, new_sfa_record)
+            self.shell.UpdateNode(pointer, new_sfa_record)
 
         return True
         
@@ -189,20 +184,20 @@ class PlDriver (Driver, PlShell):
         type=sfa_record['type']
         pointer=sfa_record['pointer']
         if type == 'user':
-            persons = self.GetPersons(pointer)
+            persons = self.shell.GetPersons(pointer)
             # only delete this person if he has site ids. if he doesnt, it probably means
             # he was just removed from a site, not actually deleted
             if persons and persons[0]['site_ids']:
-                self.DeletePerson(pointer)
+                self.shell.DeletePerson(pointer)
         elif type == 'slice':
-            if self.GetSlices(pointer):
-                self.DeleteSlice(pointer)
+            if self.shell.GetSlices(pointer):
+                self.shell.DeleteSlice(pointer)
         elif type == 'node':
-            if self.GetNodes(pointer):
-                self.DeleteNode(pointer)
+            if self.shell.GetNodes(pointer):
+                self.shell.DeleteNode(pointer)
         elif type == 'authority':
-            if self.GetSites(pointer):
-                self.DeleteSite(pointer)
+            if self.shell.GetSites(pointer):
+                self.shell.DeleteSite(pointer)
 
         return True
 
@@ -292,16 +287,16 @@ class PlDriver (Driver, PlShell):
         # get pl records
         nodes, sites, slices, persons, keys = {}, {}, {}, {}, {}
         if node_ids:
-            node_list = self.GetNodes(node_ids)
+            node_list = self.shell.GetNodes(node_ids)
             nodes = list_to_dict(node_list, 'node_id')
         if site_ids:
-            site_list = self.GetSites(site_ids)
+            site_list = self.shell.GetSites(site_ids)
             sites = list_to_dict(site_list, 'site_id')
         if slice_ids:
-            slice_list = self.GetSlices(slice_ids)
+            slice_list = self.shell.GetSlices(slice_ids)
             slices = list_to_dict(slice_list, 'slice_id')
         if person_ids:
-            person_list = self.GetPersons(person_ids)
+            person_list = self.shell.GetPersons(person_ids)
             persons = list_to_dict(person_list, 'person_id')
             for person in persons:
                 key_ids.extend(persons[person]['key_ids'])
@@ -310,7 +305,7 @@ class PlDriver (Driver, PlShell):
                       'slice': slices, 'user': persons}
 
         if key_ids:
-            key_list = self.GetKeys(key_ids)
+            key_list = self.shell.GetKeys(key_ids)
             keys = list_to_dict(key_list, 'key_id')
 
         # fill record info
@@ -358,16 +353,16 @@ class PlDriver (Driver, PlShell):
         # get pl records
         slices, persons, sites, nodes = {}, {}, {}, {}
         if site_ids:
-            site_list = self.GetSites(site_ids, ['site_id', 'login_base'])
+            site_list = self.shell.GetSites(site_ids, ['site_id', 'login_base'])
             sites = list_to_dict(site_list, 'site_id')
         if person_ids:
-            person_list = self.GetPersons(person_ids, ['person_id', 'email'])
+            person_list = self.shell.GetPersons(person_ids, ['person_id', 'email'])
             persons = list_to_dict(person_list, 'person_id')
         if slice_ids:
-            slice_list = self.GetSlices(slice_ids, ['slice_id', 'name'])
+            slice_list = self.shell.GetSlices(slice_ids, ['slice_id', 'name'])
             slices = list_to_dict(slice_list, 'slice_id')       
         if node_ids:
-            node_list = self.GetNodes(node_ids, ['node_id', 'hostname'])
+            node_list = self.shell.GetNodes(node_ids, ['node_id', 'hostname'])
             nodes = list_to_dict(node_list, 'node_id')
        
         # convert ids to hrns
@@ -427,7 +422,7 @@ class PlDriver (Driver, PlShell):
         site_pis = {}
         if site_ids:
             pi_filter = {'|roles': ['pi'], '|site_ids': site_ids} 
-            pi_list = self.GetPersons(pi_filter, ['person_id', 'site_ids'])
+            pi_list = self.shell.GetPersons(pi_filter, ['person_id', 'site_ids'])
             for pi in pi_list:
                 # we will need the pi's hrns also
                 person_ids.append(pi['person_id'])
@@ -457,7 +452,7 @@ class PlDriver (Driver, PlShell):
 
         # get the pl records
         pl_person_list, pl_persons = [], {}
-        pl_person_list = self.GetPersons(person_ids, ['person_id', 'roles'])
+        pl_person_list = self.shell.GetPersons(person_ids, ['person_id', 'roles'])
         pl_persons = list_to_dict(pl_person_list, 'person_id')
 
         # fill sfa info
@@ -521,17 +516,17 @@ class PlDriver (Driver, PlShell):
     def update_relation (self, subject_type, target_type, subject_id, target_ids):
         # hard-wire the code for slice/user for now, could be smarter if needed
         if subject_type =='slice' and target_type == 'user':
-            subject=self.GetSlices (subject_id)[0]
+            subject=self.shell.GetSlices (subject_id)[0]
             current_target_ids = subject['person_ids']
             add_target_ids = list ( set (target_ids).difference(current_target_ids))
             del_target_ids = list ( set (current_target_ids).difference(target_ids))
             logger.debug ("subject_id = %s (type=%s)"%(subject_id,type(subject_id)))
             for target_id in add_target_ids:
-                self.AddPersonToSlice (target_id,subject_id)
+                self.shell.AddPersonToSlice (target_id,subject_id)
                 logger.debug ("add_target_id = %s (type=%s)"%(target_id,type(target_id)))
             for target_id in del_target_ids:
                 logger.debug ("del_target_id = %s (type=%s)"%(target_id,type(target_id)))
-                self.DeletePersonFromSlice (target_id, subject_id)
+                self.shell.DeletePersonFromSlice (target_id, subject_id)
         else:
             logger.info('unexpected relation to maintain, %s -> %s'%(subject_type,target_type))
 
@@ -567,7 +562,7 @@ class PlDriver (Driver, PlShell):
                 return slices
     
         # get data from db 
-        slices = self.GetSlices({'peer_id': None}, ['name'])
+        slices = self.shell.GetSlices({'peer_id': None}, ['name'])
         slice_hrns = [slicename_to_hrn(self.hrn, slice['name']) for slice in slices]
         slice_urns = [hrn_to_urn(slice_hrn, 'slice') for slice_hrn in slice_hrns]
     
@@ -615,13 +610,13 @@ class PlDriver (Driver, PlShell):
         # find out where this slice is currently running
         slicename = hrn_to_pl_slicename(slice_hrn)
         
-        slices = self.GetSlices([slicename], ['slice_id', 'node_ids','person_ids','name','expires'])
+        slices = self.shell.GetSlices([slicename], ['slice_id', 'node_ids','person_ids','name','expires'])
         if len(slices) == 0:        
             raise SliverDoesNotExist("%s (used %s as slicename internally)" % (slice_hrn, slicename))
         slice = slices[0]
         
         # report about the local nodes only
-        nodes = self.GetNodes({'node_id':slice['node_ids'],'peer_id':None},
+        nodes = self.shell.GetNodes({'node_id':slice['node_ids'],'peer_id':None},
                               ['node_id', 'hostname', 'site_id', 'boot_state', 'last_contact'])
         site_ids = [node['site_id'] for node in nodes]
     
@@ -695,7 +690,7 @@ class PlDriver (Driver, PlShell):
 
     def delete_sliver (self, slice_urn, slice_hrn, creds, options):
         slicename = hrn_to_pl_slicename(slice_hrn)
-        slices = self.GetSlices({'name': slicename})
+        slices = self.shell.GetSlices({'name': slicename})
         if not slices:
             return 1
         slice = slices[0]
@@ -707,23 +702,23 @@ class PlDriver (Driver, PlShell):
         peer = peers.get_peer(self, slice_hrn)
         try:
             if peer:
-                self.UnBindObjectFromPeer('slice', slice['slice_id'], peer)
-            self.DeleteSliceFromNodes(slicename, slice['node_ids'])
+                self.shell.UnBindObjectFromPeer('slice', slice['slice_id'], peer)
+            self.shell.DeleteSliceFromNodes(slicename, slice['node_ids'])
         finally:
             if peer:
-                self.BindObjectToPeer('slice', slice['slice_id'], peer, slice['peer_slice_id'])
+                self.shell.BindObjectToPeer('slice', slice['slice_id'], peer, slice['peer_slice_id'])
         return 1
     
     def renew_sliver (self, slice_urn, slice_hrn, creds, expiration_time, options):
         slicename = hrn_to_pl_slicename(slice_hrn)
-        slices = self.GetSlices({'name': slicename}, ['slice_id'])
+        slices = self.shell.GetSlices({'name': slicename}, ['slice_id'])
         if not slices:
             raise RecordNotFound(slice_hrn)
         slice = slices[0]
         requested_time = utcparse(expiration_time)
         record = {'expires': int(time.mktime(requested_time.timetuple()))}
         try:
-            self.UpdateSlice(slice['slice_id'], record)
+            self.shell.UpdateSlice(slice['slice_id'], record)
             return True
         except:
             return False
@@ -731,29 +726,29 @@ class PlDriver (Driver, PlShell):
     # remove the 'enabled' tag 
     def start_slice (self, slice_urn, slice_hrn, creds):
         slicename = hrn_to_pl_slicename(slice_hrn)
-        slices = self.GetSlices({'name': slicename}, ['slice_id'])
+        slices = self.shell.GetSlices({'name': slicename}, ['slice_id'])
         if not slices:
             raise RecordNotFound(slice_hrn)
         slice_id = slices[0]['slice_id']
-        slice_tags = self.GetSliceTags({'slice_id': slice_id, 'tagname': 'enabled'}, ['slice_tag_id'])
+        slice_tags = self.shell.GetSliceTags({'slice_id': slice_id, 'tagname': 'enabled'}, ['slice_tag_id'])
         # just remove the tag if it exists
         if slice_tags:
-            self.DeleteSliceTag(slice_tags[0]['slice_tag_id'])
+            self.shell.DeleteSliceTag(slice_tags[0]['slice_tag_id'])
         return 1
 
     # set the 'enabled' tag to 0
     def stop_slice (self, slice_urn, slice_hrn, creds):
         slicename = hrn_to_pl_slicename(slice_hrn)
-        slices = self.GetSlices({'name': slicename}, ['slice_id'])
+        slices = self.shell.GetSlices({'name': slicename}, ['slice_id'])
         if not slices:
             raise RecordNotFound(slice_hrn)
         slice_id = slices[0]['slice_id']
-        slice_tags = self.GetSliceTags({'slice_id': slice_id, 'tagname': 'enabled'})
+        slice_tags = self.shell.GetSliceTags({'slice_id': slice_id, 'tagname': 'enabled'})
         if not slice_tags:
-            self.AddSliceTag(slice_id, 'enabled', '0')
+            self.shell.AddSliceTag(slice_id, 'enabled', '0')
         elif slice_tags[0]['value'] != "0":
             tag_id = slice_tags[0]['slice_tag_id']
-            self.UpdateSliceTag(tag_id, '0')
+            self.shell.UpdateSliceTag(tag_id, '0')
         return 1
     
     def reset_slice (self, slice_urn, slice_hrn, creds):
index db27f3b..6f2c57e 100644 (file)
@@ -26,11 +26,11 @@ class PlSlices:
         slice_name = hrn_to_pl_slicename(hrn)
         # XX Should we just call PLCAPI.GetSliceTicket(slice_name) instead
         # of doing all of this?
-        #return self.driver.GetSliceTicket(self.auth, slice_name) 
+        #return self.driver.shell.GetSliceTicket(self.auth, slice_name) 
         
         # from PLCAPI.GetSlivers.get_slivers()
         slice_fields = ['slice_id', 'name', 'instantiation', 'expires', 'person_ids', 'slice_tag_ids']
-        slices = self.driver.GetSlices(slice_name, slice_fields)
+        slices = self.driver.shell.GetSlices(slice_name, slice_fields)
         # Build up list of users and slice attributes
         person_ids = set()
         all_slice_tag_ids = set()
@@ -40,7 +40,7 @@ class PlSlices:
         person_ids = list(person_ids)
         all_slice_tag_ids = list(all_slice_tag_ids)
         # Get user information
-        all_persons_list = self.driver.GetPersons({'person_id':person_ids,'enabled':True}, ['person_id', 'enabled', 'key_ids'])
+        all_persons_list = self.driver.shell.GetPersons({'person_id':person_ids,'enabled':True}, ['person_id', 'enabled', 'key_ids'])
         all_persons = {}
         for person in all_persons_list:
             all_persons[person['person_id']] = person        
@@ -51,12 +51,12 @@ class PlSlices:
             key_ids.update(person['key_ids'])
         key_ids = list(key_ids)
         # Get user account keys
-        all_keys_list = self.driver.GetKeys(key_ids, ['key_id', 'key', 'key_type'])
+        all_keys_list = self.driver.shell.GetKeys(key_ids, ['key_id', 'key', 'key_type'])
         all_keys = {}
         for key in all_keys_list:
             all_keys[key['key_id']] = key
         # Get slice attributes
-        all_slice_tags_list = self.driver.GetSliceTags(all_slice_tag_ids)
+        all_slice_tags_list = self.driver.shell.GetSliceTags(all_slice_tag_ids)
         all_slice_tags = {}
         for slice_tag in all_slice_tags_list:
             all_slice_tags[slice_tag['slice_tag_id']] = slice_tag
@@ -139,7 +139,7 @@ class PlSlices:
         site_authority = get_authority(slice_authority).lower()
 
         # check if we are already peered with this site_authority, if so
-        peers = self.driver.GetPeers({}, ['peer_id', 'peername', 'shortname', 'hrn_root'])
+        peers = self.driver.shell.GetPeers({}, ['peer_id', 'peername', 'shortname', 'hrn_root'])
         for peer_record in peers:
             names = [name.lower() for name in peer_record.values() if isinstance(name, StringTypes)]
             if site_authority in names:
@@ -162,7 +162,7 @@ class PlSlices:
 
     def verify_slice_nodes(self, slice, requested_slivers, peer):
         
-        nodes = self.driver.GetNodes(slice['node_ids'], ['node_id', 'hostname', 'interface_ids'])
+        nodes = self.driver.shell.GetNodes(slice['node_ids'], ['node_id', 'hostname', 'interface_ids'])
         current_slivers = [node['hostname'] for node in nodes]
 
         # remove nodes not in rspec
@@ -173,9 +173,9 @@ class PlSlices:
 
         try:
             if peer:
-                self.driver.UnBindObjectFromPeer('slice', slice['slice_id'], peer['shortname'])
-            self.driver.AddSliceToNodes(slice['name'], added_nodes)
-            self.driver.DeleteSliceFromNodes(slice['name'], deleted_nodes)
+                self.driver.shell.UnBindObjectFromPeer('slice', slice['slice_id'], peer['shortname'])
+            self.driver.shell.AddSliceToNodes(slice['name'], added_nodes)
+            self.driver.shell.DeleteSliceFromNodes(slice['name'], deleted_nodes)
 
         except: 
             logger.log_exc('Failed to add/remove slice from nodes')
@@ -183,7 +183,7 @@ class PlSlices:
 
     def free_egre_key(self):
         used = set()
-        for tag in self.driver.GetSliceTags({'tagname': 'egre_key'}):
+        for tag in self.driver.shell.GetSliceTags({'tagname': 'egre_key'}):
                 used.add(int(tag['value']))
 
         for i in range(1, 256):
@@ -207,7 +207,7 @@ class PlSlices:
             nodes_dict[node['node_id']] = node
             interface_ids.extend(node['interface_ids'])
         # build dict of interfaces
-        interfaces = self.driver.GetInterfaces(interface_ids)
+        interfaces = self.driver.shell.GetInterfaces(interface_ids)
         interfaces_dict = {}
         for interface in interfaces:
             interfaces_dict[interface['interface_id']] = interface 
@@ -237,7 +237,7 @@ class PlSlices:
             slice_tags.append({'name': 'topo_rspec', 'value': str([topo_rspec]), 'node_id': node_id})
             # set vini_topo tag
             slice_tags.append({'name': 'vini_topo', 'value': 'manual', 'node_id': node_id})
-            #self.driver.AddSliceTag(slice['name'], 'topo_rspec', str([topo_rspec]), node_id) 
+            #self.driver.shell.AddSliceTag(slice['name'], 'topo_rspec', str([topo_rspec]), node_id) 
 
         self.verify_slice_attributes(slice, slice_tags, {'append': True}, admin=True)
                         
@@ -248,33 +248,33 @@ class PlSlices:
             # bind site
             try:
                 if site:
-                    self.driver.BindObjectToPeer('site', site['site_id'], peer['shortname'], slice['site_id'])
+                    self.driver.shell.BindObjectToPeer('site', site['site_id'], peer['shortname'], slice['site_id'])
             except Exception,e:
-                self.driver.DeleteSite(site['site_id'])
+                self.driver.shell.DeleteSite(site['site_id'])
                 raise e
             
             # bind slice
             try:
                 if slice:
-                    self.driver.BindObjectToPeer('slice', slice['slice_id'], peer['shortname'], slice['slice_id'])
+                    self.driver.shell.BindObjectToPeer('slice', slice['slice_id'], peer['shortname'], slice['slice_id'])
             except Exception,e:
-                self.driver.DeleteSlice(slice['slice_id'])
+                self.driver.shell.DeleteSlice(slice['slice_id'])
                 raise e 
 
             # bind persons
             for person in persons:
                 try:
-                    self.driver.BindObjectToPeer('person', 
+                    self.driver.shell.BindObjectToPeer('person', 
                                                      person['person_id'], peer['shortname'], person['peer_person_id'])
 
                     for (key, remote_key_id) in zip(person['keys'], person['key_ids']):
                         try:
-                            self.driver.BindObjectToPeer( 'key', key['key_id'], peer['shortname'], remote_key_id)
+                            self.driver.shell.BindObjectToPeer( 'key', key['key_id'], peer['shortname'], remote_key_id)
                         except:
-                            self.driver.DeleteKey(key['key_id'])
+                            self.driver.shell.DeleteKey(key['key_id'])
                             logger("failed to bind key: %s to peer: %s " % (key['key_id'], peer['shortname']))
                 except Exception,e:
-                    self.driver.DeletePerson(person['person_id'])
+                    self.driver.shell.DeletePerson(person['person_id'])
                     raise e       
 
         return slice
@@ -286,7 +286,7 @@ class PlSlices:
         slicename = hrn_to_pl_slicename(slice_hrn)
         authority_name = slicename.split('_')[0]
         login_base = authority_name[:20]
-        sites = self.driver.GetSites(login_base)
+        sites = self.driver.shell.GetSites(login_base)
         if not sites:
             # create new site record
             site = {'name': 'geni.%s' % authority_name,
@@ -298,9 +298,9 @@ class PlSlices:
                     'peer_site_id': None}
             if peer:
                 site['peer_site_id'] = slice_record.get('site_id', None)
-            site['site_id'] = self.driver.AddSite(site)
+            site['site_id'] = self.driver.shell.AddSite(site)
             # exempt federated sites from monitor policies
-            self.driver.AddSiteTag(site['site_id'], 'exempt_site_until', "20200101")
+            self.driver.shell.AddSiteTag(site['site_id'], 'exempt_site_until', "20200101")
             
 #            # is this still necessary?
 #            # add record to the local registry 
@@ -312,7 +312,7 @@ class PlSlices:
             site =  sites[0]
             if peer:
                 # unbind from peer so we can modify if necessary. Will bind back later
-                self.driver.UnBindObjectFromPeer('site', site['site_id'], peer['shortname']) 
+                self.driver.shell.UnBindObjectFromPeer('site', site['site_id'], peer['shortname']) 
         
         return site        
 
@@ -320,13 +320,13 @@ class PlSlices:
         slicename = hrn_to_pl_slicename(slice_hrn)
         parts = slicename.split("_")
         login_base = parts[0]
-        slices = self.driver.GetSlices([slicename]) 
+        slices = self.driver.shell.GetSlices([slicename]) 
         if not slices:
             slice = {'name': slicename,
                      'url': slice_record.get('url', slice_hrn), 
                      'description': slice_record.get('description', slice_hrn)}
             # add the slice                          
-            slice['slice_id'] = self.driver.AddSlice(slice)
+            slice['slice_id'] = self.driver.shell.AddSlice(slice)
             slice['node_ids'] = []
             slice['person_ids'] = []
             if peer:
@@ -341,10 +341,10 @@ class PlSlices:
             if peer:
                 slice['peer_slice_id'] = slice_record.get('slice_id', None)
                 # unbind from peer so we can modify if necessary. Will bind back later
-                self.driver.UnBindObjectFromPeer('slice', slice['slice_id'], peer['shortname'])
+                self.driver.shell.UnBindObjectFromPeer('slice', slice['slice_id'], peer['shortname'])
                #Update existing record (e.g. expires field) it with the latest info.
             if slice_record and slice['expires'] != slice_record['expires']:
-                self.driver.UpdateSlice( slice['slice_id'], {'expires' : slice_record['expires']})
+                self.driver.shell.UpdateSlice( slice['slice_id'], {'expires' : slice_record['expires']})
        
         return slice
 
@@ -378,13 +378,13 @@ class PlSlices:
                     existing_user_ids_filter.append(user['username']+'@geni.net')              
         if existing_user_ids_filter:                   
             # get existing users by email 
-            existing_users = self.driver.GetPersons({'email': existing_user_ids_filter}, 
+            existing_users = self.driver.shell.GetPersons({'email': existing_user_ids_filter}, 
                                                         ['person_id', 'key_ids', 'email'])
             existing_user_ids.extend([user['email'] for user in existing_users])
        
         if users_by_site:
             # get a list of user sites (based on requeste user urns
-            site_list = self.driver.GetSites(users_by_site.keys(), \
+            site_list = self.driver.shell.GetSites(users_by_site.keys(), \
                 ['site_id', 'login_base', 'person_ids'])
             # get all existing users at these sites
             sites = {}
@@ -393,7 +393,7 @@ class PlSlices:
                 sites[site['site_id']] = site
                 site_user_ids.extend(site['person_ids'])
 
-            existing_site_persons_list = self.driver.GetPersons(site_user_ids,  
+            existing_site_persons_list = self.driver.shell.GetPersons(site_user_ids,  
                                                                     ['person_id', 'key_ids', 'email', 'site_ids'])
 
             # all requested users are either existing users or new (added) users      
@@ -422,7 +422,7 @@ class PlSlices:
         requested_user_ids = users_dict.keys()
         # existing slice users
         existing_slice_users_filter = {'person_id': slice_record.get('person_ids', [])}
-        existing_slice_users = self.driver.GetPersons(existing_slice_users_filter,
+        existing_slice_users = self.driver.shell.GetPersons(existing_slice_users_filter,
                                                           ['person_id', 'key_ids', 'email'])
         existing_slice_user_ids = [user['email'] for user in existing_slice_users]
         
@@ -437,7 +437,7 @@ class PlSlices:
         append = options.get('append', True)
         if append == False:
             for removed_user_id in removed_user_ids:
-                self.driver.DeletePersonFromSlice(removed_user_id, slice_record['name'])
+                self.driver.shell.DeletePersonFromSlice(removed_user_id, slice_record['name'])
         # update_existing users
         updated_users_list = [user for user in existing_slice_users if user['email'] in \
           updated_user_ids]
@@ -456,20 +456,20 @@ class PlSlices:
                 'keys': [],
                 'key_ids': added_user.get('key_ids', []),
             }
-            person['person_id'] = self.driver.AddPerson(person)
+            person['person_id'] = self.driver.shell.AddPerson(person)
             if peer:
                 person['peer_person_id'] = added_user['person_id']
             added_persons.append(person)
            
             # enable the account 
-            self.driver.UpdatePerson(person['person_id'], {'enabled': True})
+            self.driver.shell.UpdatePerson(person['person_id'], {'enabled': True})
             
             # add person to site
-            self.driver.AddPersonToSite(added_user_id, added_user['site'])
+            self.driver.shell.AddPersonToSite(added_user_id, added_user['site'])
 
             for key_string in added_user.get('keys', []):
                 key = {'key':key_string, 'key_type':'ssh'}
-                key['key_id'] = self.driver.AddPersonKey(person['person_id'], key)
+                key['key_id'] = self.driver.shell.AddPersonKey(person['person_id'], key)
                 person['keys'].append(key)
 
             # add the registry record
@@ -480,7 +480,7 @@ class PlSlices:
     
         for added_slice_user_id in added_slice_user_ids.union(added_user_ids):
             # add person to the slice 
-            self.driver.AddPersonToSlice(added_slice_user_id, slice_record['name'])
+            self.driver.shell.AddPersonToSlice(added_slice_user_id, slice_record['name'])
             # if this is a peer record then it should already be bound to a peer.
             # no need to return worry about it getting bound later 
 
@@ -492,7 +492,7 @@ class PlSlices:
         key_ids = []
         for person in persons:
             key_ids.extend(person['key_ids'])
-        keylist = self.driver.GetKeys(key_ids, ['key_id', 'key'])
+        keylist = self.driver.shell.GetKeys(key_ids, ['key_id', 'key'])
         keydict = {}
         for key in keylist:
             keydict[key['key']] = key['key_id']     
@@ -514,16 +514,16 @@ class PlSlices:
                     try:
                         if peer:
                             person = persondict[user['email']]
-                            self.driver.UnBindObjectFromPeer('person', person['person_id'], peer['shortname'])
-                        key['key_id'] = self.driver.AddPersonKey(user['email'], key)
+                            self.driver.shell.UnBindObjectFromPeer('person', person['person_id'], peer['shortname'])
+                        key['key_id'] = self.driver.shell.AddPersonKey(user['email'], key)
                         if peer:
                             key_index = user_keys.index(key['key'])
                             remote_key_id = user['key_ids'][key_index]
-                            self.driver.BindObjectToPeer('key', key['key_id'], peer['shortname'], remote_key_id)
+                            self.driver.shell.BindObjectToPeer('key', key['key_id'], peer['shortname'], remote_key_id)
                             
                     finally:
                         if peer:
-                            self.driver.BindObjectToPeer('person', person['person_id'], peer['shortname'], user['person_id'])
+                            self.driver.shell.BindObjectToPeer('person', person['person_id'], peer['shortname'], user['person_id'])
         
         # remove old keys (only if we are not appending)
         append = options.get('append', True)
@@ -533,8 +533,8 @@ class PlSlices:
                 if keydict[existing_key_id] in removed_keys:
                     try:
                         if peer:
-                            self.driver.UnBindObjectFromPeer('key', existing_key_id, peer['shortname'])
-                        self.driver.DeleteKey(existing_key_id)
+                            self.driver.shell.UnBindObjectFromPeer('key', existing_key_id, peer['shortname'])
+                        self.driver.shell.DeleteKey(existing_key_id)
                     except:
                         pass   
 
@@ -544,14 +544,14 @@ class PlSlices:
         filter = {'category': '*slice*'}
         if not admin:
             filter['|roles'] = ['user']
-        slice_attributes = self.driver.GetTagTypes(filter)
+        slice_attributes = self.driver.shell.GetTagTypes(filter)
         valid_slice_attribute_names = [attribute['tagname'] for attribute in slice_attributes]
 
         # get sliver attributes
         added_slice_attributes = []
         removed_slice_attributes = []
         ignored_slice_attribute_names = []
-        existing_slice_attributes = self.driver.GetSliceTags({'slice_id': slice['slice_id']})
+        existing_slice_attributes = self.driver.shell.GetSliceTags({'slice_id': slice['slice_id']})
         
         # get attributes that should be removed
         for slice_tag in existing_slice_attributes:
@@ -589,7 +589,7 @@ class PlSlices:
         # remove stale attributes
         for attribute in removed_slice_attributes:
             try:
-                self.driver.DeleteSliceTag(attribute['slice_tag_id'])
+                self.driver.shell.DeleteSliceTag(attribute['slice_tag_id'])
             except Exception, e:
                 logger.warn('Failed to remove sliver attribute. name: %s, value: %s, node_id: %s\nCause:%s'\
                                 % (name, value,  node_id, str(e)))
@@ -597,7 +597,7 @@ class PlSlices:
         # add requested_attributes
         for attribute in added_slice_attributes:
             try:
-                self.driver.AddSliceTag(slice['name'], attribute['name'], attribute['value'], attribute.get('node_id', None))
+                self.driver.shell.AddSliceTag(slice['name'], attribute['name'], attribute['value'], attribute.get('node_id', None))
             except Exception, e:
                 logger.warn('Failed to add sliver attribute. name: %s, value: %s, node_id: %s\nCause:%s'\
                                 % (name, value,  node_id, str(e)))