def __init__(self, notifier=None, ovsvapp_sg_server_rpc=None): self.type_manager = managers.TypeManager() self.agent_notifier = plugin_rpc.AgentNotifierApi(topics.AGENT) self.notifier = notifier self.sg_rpc = ovsvapp_sg_server_rpc super(OVSvAppServerRpcCallback, self).__init__(self.agent_notifier, self.type_manager)
def setUp(self): # Enable the test mechanism driver to ensure that # we can successfully call through to all mechanism # driver apis. config.cfg.CONF.set_override( 'mechanism_drivers', ['openvswitch', 'linuxbridge', 'ofagent', 'l2population'], 'ml2') config.cfg.CONF.set_override('network_vlan_ranges', ['phys1:1:100'], 'ml2_type_vlan') super(TestL2PopulationRpcTestCase, self).setUp(PLUGIN_NAME) self.adminContext = context.get_admin_context() self.type_manager = managers.TypeManager() self.notifier = rpc.AgentNotifierApi(topics.AGENT) self.callbacks = rpc.RpcCallbacks(self.notifier, self.type_manager) net_arg = {pnet.NETWORK_TYPE: 'vxlan', pnet.SEGMENTATION_ID: '1'} self._network = self._make_network(self.fmt, 'net1', True, arg_list=( pnet.NETWORK_TYPE, pnet.SEGMENTATION_ID, ), **net_arg) net_arg = { pnet.NETWORK_TYPE: 'vlan', pnet.PHYSICAL_NETWORK: 'phys1', pnet.SEGMENTATION_ID: '2' } self._network2 = self._make_network(self.fmt, 'net2', True, arg_list=( pnet.NETWORK_TYPE, pnet.PHYSICAL_NETWORK, pnet.SEGMENTATION_ID, ), **net_arg) notifier_patch = mock.patch(NOTIFIER) notifier_patch.start() self.fanout_topic = topics.get_topic_name(topics.AGENT, topics.L2POPULATION, topics.UPDATE) fanout = ('neutron.common.rpc.RpcProxy.fanout_cast') fanout_patch = mock.patch(fanout) self.mock_fanout = fanout_patch.start() cast = ('neutron.common.rpc.RpcProxy.cast') cast_patch = mock.patch(cast) self.mock_cast = cast_patch.start() uptime = ('neutron.plugins.ml2.drivers.l2pop.db.L2populationDbMixin.' 'get_agent_uptime') uptime_patch = mock.patch(uptime, return_value=190) uptime_patch.start()
def __init__(self): LOG.info("Ml2Plus initializing") registry._get_callback_manager()._notify_loop = ( patch_neutron._notify_loop) # First load drivers, then initialize DB, then initialize drivers self.type_manager = ml2_managers.TypeManager() self.extension_manager = managers.ExtensionManager() self.mechanism_manager = managers.MechanismManager() super(ml2_plugin.Ml2Plugin, self).__init__() self.type_manager.initialize() self.extension_manager.initialize() self.mechanism_manager.initialize() registry.subscribe(self._port_provisioned, resources.PORT, provisioning_blocks.PROVISIONING_COMPLETE) registry.subscribe(self._handle_segment_change, resources.SEGMENT, events.PRECOMMIT_CREATE) registry.subscribe(self._handle_segment_change, resources.SEGMENT, events.PRECOMMIT_DELETE) registry.subscribe(self._handle_segment_change, resources.SEGMENT, events.AFTER_CREATE) registry.subscribe(self._handle_segment_change, resources.SEGMENT, events.AFTER_DELETE) # REVISIT(kent): All the postcommit calls for SG and SG rules are not # currently implemented as they are not needed at this moment. registry.subscribe(self._handle_security_group_change, resources.SECURITY_GROUP, events.PRECOMMIT_CREATE) registry.subscribe(self._handle_security_group_change, resources.SECURITY_GROUP, events.PRECOMMIT_DELETE) registry.subscribe(self._handle_security_group_change, resources.SECURITY_GROUP, events.PRECOMMIT_UPDATE) # There is no update event to the security_group_rule registry.subscribe(self._handle_security_group_rule_change, resources.SECURITY_GROUP_RULE, events.PRECOMMIT_CREATE) registry.subscribe(self._handle_security_group_rule_change, resources.SECURITY_GROUP_RULE, events.PRECOMMIT_DELETE) try: registry.subscribe(self._subnet_delete_precommit_handler, resources.SUBNET, events.PRECOMMIT_DELETE) registry.subscribe(self._subnet_delete_after_delete_handler, resources.SUBNET, events.AFTER_DELETE) except AttributeError: LOG.info("Detected older version of Neutron, ML2Plus plugin " "is not subscribed to subnet_precommit_delete and " "subnet_after_delete events") self._setup_dhcp() self._start_rpc_notifiers() self.add_agent_status_check_worker(self.agent_health_check) self._verify_service_plugins_requirements() self.refresh_network_db_obj = cfg.CONF.ml2plus.refresh_network_db_obj self.refresh_port_db_obj = cfg.CONF.ml2plus.refresh_port_db_obj self.refresh_subnet_db_obj = cfg.CONF.ml2plus.refresh_subnet_db_obj self.refresh_subnetpool_db_obj = ( cfg.CONF.ml2plus.refresh_subnetpool_db_obj) self.refresh_address_scope_db_obj = ( cfg.CONF.ml2plus.refresh_address_scope_db_obj) LOG.info("Modular L2 Plugin (extended) initialization complete")
def setUp(self): super(RpcCallbacksTestCase, self).setUp() self.type_manager = managers.TypeManager() self.notifier = plugin_rpc.AgentNotifierApi(topics.AGENT) self.callbacks = plugin_rpc.RpcCallbacks(self.notifier, self.type_manager) self.plugin = mock.MagicMock() directory.add_plugin(plugin_constants.CORE, self.plugin)
def setUp(self): super(TypeManagerTestCase, self).setUp() self.type_manager = managers.TypeManager() self.ctx = mock.Mock() self.network = { 'id': uuidutils.generate_uuid(), 'project_id': uuidutils.generate_uuid() }
def setUp(self): super(RpcCallbacksTestCase, self).setUp() self.type_manager = managers.TypeManager() self.notifier = plugin_rpc.AgentNotifierApi(topics.AGENT) self.callbacks = plugin_rpc.RpcCallbacks(self.notifier, self.type_manager) self.manager = mock.patch.object(plugin_rpc.manager, 'NeutronManager').start() self.plugin = self.manager.get_plugin()
def setUp(self): super(TestL2PopulationRpcTestCase, self).setUp() self.adminContext = context.get_admin_context() self.type_manager = managers.TypeManager() self.notifier = rpc.AgentNotifierApi(topics.AGENT) self.callbacks = rpc.RpcCallbacks(self.notifier, self.type_manager) net_arg = {pnet.NETWORK_TYPE: 'vxlan', pnet.SEGMENTATION_ID: '1'} self._network = self._make_network(self.fmt, 'net1', True, arg_list=( pnet.NETWORK_TYPE, pnet.SEGMENTATION_ID, ), **net_arg) net_arg = { pnet.NETWORK_TYPE: 'vlan', pnet.PHYSICAL_NETWORK: 'physnet1', pnet.SEGMENTATION_ID: '2' } self._network2 = self._make_network(self.fmt, 'net2', True, arg_list=( pnet.NETWORK_TYPE, pnet.PHYSICAL_NETWORK, pnet.SEGMENTATION_ID, ), **net_arg) notifier_patch = mock.patch(NOTIFIER) notifier_patch.start() self.fanout_topic = topics.get_topic_name(topics.AGENT, topics.L2POPULATION, topics.UPDATE) fanout = ('neutron.plugins.ml2.drivers.l2pop.rpc.' 'L2populationAgentNotifyAPI._notification_fanout') fanout_patch = mock.patch(fanout) self.mock_fanout = fanout_patch.start() cast = ('neutron.plugins.ml2.drivers.l2pop.rpc.' 'L2populationAgentNotifyAPI._notification_host') cast_patch = mock.patch(cast) self.mock_cast = cast_patch.start() uptime = ('neutron.plugins.ml2.drivers.l2pop.db.L2populationDbMixin.' 'get_agent_uptime') uptime_patch = mock.patch(uptime, return_value=190) uptime_patch.start()
def setUp(self): super(RpcCallbacksTestCase, self).setUp() self.type_manager = managers.TypeManager() self.notifier = plugin_rpc.AgentNotifierApi(topics.AGENT) self.callbacks = plugin_rpc.RpcCallbacks(self.notifier, self.type_manager) self.manager = mock.patch.object( plugin_rpc.manager, 'NeutronManager').start() self.l3plugin = mock.Mock() self.manager.get_service_plugins.return_value = { 'L3_ROUTER_NAT': self.l3plugin } self.plugin = self.manager.get_plugin()
def setUp(self): # Enable the test mechanism driver to ensure that # we can successfully call through to all mechanism # driver apis. config.cfg.CONF.set_override( 'mechanism_drivers', ['openvswitch', 'linuxbridge', 'l2population'], 'ml2') super(TestL2PopulationRpcTestCase, self).setUp(PLUGIN_NAME) self.addCleanup(config.cfg.CONF.reset) self.port_create_status = 'DOWN' self.adminContext = context.get_admin_context() self.type_manager = managers.TypeManager() self.notifier = rpc.AgentNotifierApi(topics.AGENT) self.callbacks = rpc.RpcCallbacks(self.notifier, self.type_manager) self.orig_supported_agents = l2_consts.SUPPORTED_AGENT_TYPES l2_consts.SUPPORTED_AGENT_TYPES = [constants.AGENT_TYPE_OVS] net_arg = {pnet.NETWORK_TYPE: 'vxlan', pnet.SEGMENTATION_ID: '1'} self._network = self._make_network(self.fmt, 'net1', True, arg_list=( pnet.NETWORK_TYPE, pnet.SEGMENTATION_ID, ), **net_arg) notifier_patch = mock.patch(NOTIFIER) notifier_patch.start() self.fanout_topic = topics.get_topic_name(topics.AGENT, topics.L2POPULATION, topics.UPDATE) fanout = ('neutron.openstack.common.rpc.proxy.RpcProxy.fanout_cast') fanout_patch = mock.patch(fanout) self.mock_fanout = fanout_patch.start() cast = ('neutron.openstack.common.rpc.proxy.RpcProxy.cast') cast_patch = mock.patch(cast) self.mock_cast = cast_patch.start() uptime = ('neutron.plugins.ml2.drivers.l2pop.db.L2populationDbMixin.' 'get_agent_uptime') uptime_patch = mock.patch(uptime, return_value=190) uptime_patch.start() self.addCleanup(mock.patch.stopall) self.addCleanup(db_api.clear_db)
def setUp(self): config.cfg.CONF.set_override('type_drivers', TYPE_ROUTE_TARGET, 'ml2') config.cfg.CONF.set_override('tenant_network_types', TYPE_ROUTE_TARGET, 'ml2', enforce_type=True) super(TestBaGpipeRpcTestCase, self).setUp() self.adminContext = context.get_admin_context() self.type_manager = managers.TypeManager() self.notifier = bagpipe_rpc.BaGPipeAgentNotifyAPI() self.callbacks = rpc.RpcCallbacks(self.notifier, self.type_manager) net_arg = { pnet.NETWORK_TYPE: TYPE_ROUTE_TARGET, pnet.SEGMENTATION_ID: '101' } self._network = self._make_network(self.fmt, 'net1', True, arg_list=( pnet.NETWORK_TYPE, pnet.SEGMENTATION_ID, ), **net_arg) net_arg = { pnet.NETWORK_TYPE: TYPE_ROUTE_TARGET, pnet.SEGMENTATION_ID: '102' } self._network2 = self._make_network(self.fmt, 'net2', True, arg_list=( pnet.NETWORK_TYPE, pnet.SEGMENTATION_ID, ), **net_arg) cast = ('networking_bagpipe.rpc.client.BaGPipeAgentNotifyAPI.' '_notification_host') cast_patch = mock.patch(cast) self.mock_cast = cast_patch.start() # don't wait for DHCP provisioning block to clear mock.patch('neutron.plugins.ml2.db.is_dhcp_active_on_any_subnet', return_value=False).start()
def __init__(self): # First load drivers, then initialize DB, then initialize drivers self.type_manager = managers.TypeManager() self.mechanism_manager = managers.MechanismManager() db.initialize() self.type_manager.initialize() self.mechanism_manager.initialize() self._setup_rpc() # REVISIT(rkukura): Use stevedore for these? self.network_scheduler = importutils.import_object( cfg.CONF.network_scheduler_driver) LOG.info(_("Modular L2 Plugin initialization complete"))
def __init__(self): LOG.info(_LI("Ml2Plus initializing")) # First load drivers, then initialize DB, then initialize drivers self.type_manager = ml2_managers.TypeManager() self.extension_manager = managers.ExtensionManager() self.mechanism_manager = managers.MechanismManager() super(ml2_plugin.Ml2Plugin, self).__init__() self.type_manager.initialize() self.extension_manager.initialize() self.mechanism_manager.initialize() self._setup_dhcp() self._start_rpc_notifiers() self.add_agent_status_check(self.agent_health_check) self._verify_service_plugins_requirements() LOG.info(_LI("Modular L2 Plugin (extended) initialization complete"))
def __init__(self): # First load drivers, then initialize DB, then initialize drivers self.type_manager = managers.TypeManager() self.mechanism_manager = managers.MechanismManager() super(Ml2Plugin, self).__init__() self.type_manager.initialize() self.mechanism_manager.initialize() # bulk support depends on the underlying drivers self.__native_bulk_support = self.mechanism_manager.native_bulk_support self._setup_rpc() # REVISIT(rkukura): Use stevedore for these? self.network_scheduler = importutils.import_object( cfg.CONF.network_scheduler_driver) LOG.info(_("Modular L2 Plugin initialization complete"))
def __init__(self, service_plugin, validator=None): super(L2gwRpcDriver, self).__init__(service_plugin, validator) self.ovsdb_callback = importutils.import_object(L2GW_CALLBACK, self) self.endpoints = ([ self.ovsdb_callback, agents_db.AgentExtRpcCallback() ]) self.conn = n_rpc.Connection() self.conn.create_consumer(topics.L2GATEWAY_PLUGIN, self.endpoints, fanout=False) self.conn.consume_in_threads() self.create_rpc_conn() LOG.debug("starting l2gateway agent scheduler") self.start_l2gateway_agent_scheduler() self.gateway_resource = constants.GATEWAY_RESOURCE_NAME self.l2gateway_db = l2_gw_db.L2GatewayMixin() self.type_manager = managers.TypeManager() self.port_dict_before_update = []
def _construct_rpc_stuff(self): self.notifier = rpc.AgentNotifierApi(topics.AGENT) self.type_manager = managers.TypeManager() self.tunnel_rpc_obj = rpc.RpcCallbacks(self.notifier, self.type_manager)
def _type_manager(self): if not Action._type_manager_property: Action._type_manager_property = managers.TypeManager() return Action._type_manager_property