code: def set_driver(self, resource):
          
          try:
              resource_id = resource['id']
              hosting_device = resource['hosting_device']
              hd_id = hosting_device['id']
              if hd_id in self._hosting_device_routing_drivers_binding:
                  driver = self._hosting_device_routing_drivers_binding[hd_id]
                  self._drivers[resource_id] = driver
              else:
                  driver_class = resource['router_type']['cfg_agent_driver']
                  # save a copy of the obfuscated credentials
                  obfusc_creds = dict(hosting_device.get('credentials'))
                  if obfusc_creds:
                      # get un-obfuscated password
                      real_pw = self._cfg_agent.get_hosting_device_password(
                          obfusc_creds.get('credentials_id'))
                      hosting_device['credentials']['password'] = real_pw
                  driver = importutils.import_object(driver_class,
                                                     **hosting_device)
                  self._hosting_device_routing_drivers_binding[hd_id] = driver
                  if obfusc_creds:
                      hosting_device['credentials'] = obfusc_creds
                  self._drivers[resource_id] = driver
              return driver
          except ImportError:
              with excutils.save_and_reraise_exception(reraise=False):
                  LOG.exception("Error loading cfg agent driver %(driver)s "
                                "for hosting device template %(t_name)s"
                                "(%(t_id)s)",
                                {'driver': driver_class, 't_id': hd_id,
                                 't_name': resource['name']})
                  raise cfg_exceptions.DriverNotExist(driver=driver_class)
          except KeyError as e:
              with excutils.save_and_reraise_exception(reraise=False):
                  raise cfg_exceptions.DriverNotSetForMissingParameter(e)
docs: Set the driver for a neutron resource.
  
          :param resource: Neutron resource in dict format.
              Expected keys::
  
                  {
                      'id': <value>,
                      'hosting_device': { 'id': <value>, },
                      'router_type': {'cfg_agent_driver': <value>,  }
                  }
  
          :returns: driver object