Exemplo n.º 1
0
 def driver_manager_context(self, drivers):
     cfg.CONF.register_opts(fc_config.FLOWCLASSIFIER_DRIVER_OPTS,
                            'flowclassifier')
     backup_driver_names = cfg.CONF.flowclassifier.drivers
     driver_names = [driver_name for driver_name in six.iterkeys(drivers)]
     cfg.CONF.set_override('drivers', driver_names, 'flowclassifier')
     iter_entry_points = pkg_resources.iter_entry_points
     find_entry_points = stevedore.ExtensionManager._find_entry_points
     pkg_resources.iter_entry_points = mock.Mock()
     stevedore.ExtensionManager._find_entry_points = mock.Mock()
     driver_entry_points = []
     for driver_name in driver_names:
         driver_class = mock.Mock()
         ep = mock.Mock()
         ep.name = driver_name
         ep.resolve.return_value = driver_class
         driver_class.return_value = drivers[driver_name]
         drivers[driver_name].native_bulk_support = True
         driver_entry_points.append(ep)
     pkg_resources.iter_entry_points.return_value = driver_entry_points
     stevedore.ExtensionManager._find_entry_points.return_value = (
         driver_entry_points)
     yield fc_driver.FlowClassifierDriverManager()
     cfg.CONF.set_override('drivers', backup_driver_names, 'flowclassifier')
     pkg_resources.iter_entry_points = iter_entry_points
     stevedore.ExtensionManager._find_entry_points = find_entry_points
Exemplo n.º 2
0
 def __init__(self):
     self.driver_manager = fc_driver.FlowClassifierDriverManager()
     super(FlowClassifierPlugin, self).__init__()
     self.driver_manager.initialize()