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']
                driver = importutils.import_object(driver_class,
                                                   **hosting_device)
                self._hosting_device_routing_drivers_binding[hd_id] = driver
                self._drivers[resource_id] = driver
            return driver
        except ImportError:
            with excutils.save_and_reraise_exception(reraise=False):
                LOG.exception(_LE("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)
Set the driver for a neutron resource.
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/cisco/cfg_agent/device_drivers/driver_mgr.py/DeviceDriverManager.set_driver