def __init__(self):
     # TODO(thorst) these need to be evaluated for entry into Neutron core
     super(PvmSEAMechanismDriver,
           self).__init__(pconst.AGENT_TYPE_PVM_SEA,
                          pconst.VIF_TYPE_PVM_SEA,
                          {portbindings.CAP_PORT_FILTER: False})
     self.rpc_publisher = rpc.AgentNotifierApi(topics.AGENT)
Exemple #2
0
 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)
Exemple #3
0
    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 test_tunnel_update(self):
     rpcapi = plugin_rpc.AgentNotifierApi(topics.AGENT)
     self._test_rpc_api(rpcapi,
                        topics.get_topic_name(topics.AGENT,
                                              type_tunnel.TUNNEL,
                                              topics.UPDATE),
                        'tunnel_update', rpc_method='fanout_cast',
                        tunnel_ip='fake_ip', tunnel_type='gre')
Exemple #5
0
 def test_delete_network(self):
     rpcapi = plugin_rpc.AgentNotifierApi(topics.AGENT)
     self._test_rpc_api(rpcapi,
                        topics.get_topic_name(topics.AGENT, topics.NETWORK,
                                              topics.DELETE),
                        'network_delete',
                        rpc_method='fanout_cast',
                        network_id='fake_request_spec')
Exemple #6
0
 def __init__(self):
     super(evsMechanismDriver, self).__init__(
         agent_type = constants.AGENT_TYPE_EVS,
         vif_type = portbindings.VIF_TYPE_VHOSTUSER,
         vif_details = {EVS_BRIDGE : False},
         supported_vnic_types = [portbindings.VNIC_VHOSTUSER]
         )
     self.notifier = rpc.AgentNotifierApi(topics.AGENT)
Exemple #7
0
 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)
Exemple #8
0
 def test_port_delete(self):
     rpcapi = plugin_rpc.AgentNotifierApi(topics.AGENT)
     self._test_rpc_api(rpcapi,
                        topics.get_topic_name(topics.AGENT, topics.PORT,
                                              topics.DELETE),
                        'port_delete',
                        rpc_method='cast',
                        fanout=True,
                        port_id='fake_port')
Exemple #9
0
 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()
Exemple #10
0
 def _setup_rpc(self):
     self.notifier = rpc.AgentNotifierApi(topics.AGENT)
     self.agent_notifiers[const.AGENT_TYPE_DHCP] = (
         dhcp_rpc_agent_api.DhcpAgentNotifyAPI())
     self.callbacks = rpc.RpcCallbacks(self.notifier, self.type_manager)
     self.topic = topics.PLUGIN
     self.conn = c_rpc.create_connection(new=True)
     self.dispatcher = self.callbacks.create_rpc_dispatcher()
     self.conn.create_consumer(self.topic, self.dispatcher, fanout=False)
     self.conn.consume_in_thread()
 def __init__(self):
     sg_enabled = securitygroups_rpc.is_firewall_enabled()
     vif_details = {
         portbindings.CAP_PORT_FILTER: sg_enabled,
         portbindings.OVS_HYBRID_PLUG: sg_enabled
     }
     super(OpenvswitchMechanismDriver,
           self).__init__(constants.AGENT_TYPE_OVS,
                          portbindings.VIF_TYPE_OVS, vif_details)
     self.notifier = rpc.AgentNotifierApi(topics.AGENT)
Exemple #12
0
    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()
Exemple #13
0
 def test_port_update(self):
     rpcapi = plugin_rpc.AgentNotifierApi(topics.AGENT)
     self._test_rpc_api(rpcapi,
                        topics.get_topic_name(topics.AGENT, topics.PORT,
                                              topics.UPDATE),
                        'port_update',
                        rpc_method='fanout_cast',
                        port='fake_port',
                        network_type='fake_network_type',
                        segmentation_id='fake_segmentation_id',
                        physical_network='fake_physical_network')
Exemple #14
0
 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()
Exemple #15
0
    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)
Exemple #16
0
 def _setup_rpc(self):
     self.notifier = rpc.AgentNotifierApi(topics.AGENT)
     self.agent_notifiers[const.AGENT_TYPE_DHCP] = (
         dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
     )
 def __init__(self, agent_type, vif_type, **kwargs):
     super(PvmMechanismDriverBase,
           self).__init__(agent_type, vif_type,
                          {portbindings.CAP_PORT_FILTER: False}, **kwargs)
     self.rpc_publisher = rpc.AgentNotifierApi(topics.AGENT)
 def _start_rpc_notifiers(self):
     """Initialize RPC notifiers for agents."""
     self.notifier = rpc.AgentNotifierApi(topics.AGENT)
     self.agent_notifiers[bc.constants.AGENT_TYPE_DHCP] = (
         dhcp_rpc_agent_api.DhcpAgentNotifyAPI())
 def _setup_rpc(self):
     self.notifier = rpc.AgentNotifierApi(topics.AGENT)
Exemple #20
0
 def __init__(self):
     self.notifier = rpc.AgentNotifierApi(topics.AGENT)
 def _notifier(self):
     if not Action._notifier_property:
         Action._notifier_property = rpc.AgentNotifierApi(topics.AGENT)
     return Action._notifier_property
 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)