Пример #1
0
 def __init__(self):
     self.stub = resources_rpc.ResourcesPullRpcApi()
     target = oslo_messaging.Target(
         topic=trunk_consts.TRUNK_BASE_TOPIC,
         version=self.VERSION,
         namespace=trunk_consts.TRUNK_BASE_NAMESPACE)
     self.rpc_client = n_rpc.get_client(target)
Пример #2
0
    def __init__(self, topic, host):
        # NOTE(annp): Mixin class should call super
        super(FWaaSPluginApiMixin, self).__init__()

        self.host = host
        target = oslo_messaging.Target(topic=topic, version='1.0')
        self.client = n_rpc.get_client(target)
Пример #3
0
    def __init__(self):

        target = oslo_messaging.Target(
            topic=log_const.LOGGING_PLUGIN,
            version='1.0',
            namespace=log_const.RPC_NAMESPACE_LOGGING)
        self.rpc_client = n_rpc.get_client(target)
Пример #4
0
    def __init__(self):

        target = oslo_messaging.Target(
            topic=log_const.LOGGING_PLUGIN,
            version='1.0',
            namespace=log_const.RPC_NAMESPACE_LOGGING)
        self.rpc_client = n_rpc.get_client(target)
Пример #5
0
 def __init__(self, topic, host):
     self.host = host
     target = oslo_messaging.Target(
             topic=topic,
             namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
             version='1.0')
     self.client = n_rpc.get_client(target)
Пример #6
0
    def __init__(self, topic, host):
        # NOTE(annp): Mixin class should call super
        super(FWaaSPluginApiMixin, self).__init__()

        self.host = host
        target = oslo_messaging.Target(topic=topic, version='1.0')
        self.client = n_rpc.get_client(target)
Пример #7
0
 def __init__(self, topic, host):
     self.host = host
     target = oslo_messaging.Target(
             topic=topic,
             namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
             version='1.0')
     self.client = n_rpc.get_client(target)
Пример #8
0
 def __init__(self):
     self.stub = resources_rpc.ResourcesPullRpcApi()
     target = oslo_messaging.Target(
         topic=trunk_consts.TRUNK_BASE_TOPIC,
         version=self.VERSION,
         namespace=trunk_consts.TRUNK_BASE_NAMESPACE)
     self.rpc_client = n_rpc.get_client(target)
Пример #9
0
 def __init__(self, topic=topics.DHCP_AGENT, plugin=None):
     self._unsubscribed_resources = []
     self._plugin = plugin
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
     # register callbacks for router interface changes
     registry.subscribe(self._after_router_interface_created,
                        resources.ROUTER_INTERFACE, events.AFTER_CREATE)
     registry.subscribe(self._after_router_interface_deleted,
                        resources.ROUTER_INTERFACE, events.AFTER_DELETE)
     # register callbacks for events pertaining resources affecting DHCP
     callback_resources = (
         resources.NETWORK,
         resources.NETWORKS,
         resources.PORT,
         resources.PORTS,
         resources.SUBNET,
         resources.SUBNETS,
     )
     if not cfg.CONF.dhcp_agent_notification:
         return
     for resource in callback_resources:
         registry.subscribe(self._send_dhcp_notification,
                            resource, events.BEFORE_RESPONSE)
     self.uses_native_notifications = {}
     for resource in (resources.NETWORK, resources.PORT, resources.SUBNET):
         self.uses_native_notifications[resource] = {'create': False,
                                                     'update': False,
                                                     'delete': False}
         registry.subscribe(self._native_event_send_dhcp_notification,
                            resource, events.AFTER_CREATE)
         registry.subscribe(self._native_event_send_dhcp_notification,
                            resource, events.AFTER_UPDATE)
         registry.subscribe(self._native_event_send_dhcp_notification,
                            resource, events.AFTER_DELETE)
Пример #10
0
 def __init__(self, topic=topics.DHCP_AGENT, plugin=None):
     self._unsubscribed_resources = []
     self._plugin = plugin
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
     # register callbacks for router interface changes
     registry.subscribe(self._after_router_interface_created,
                        resources.ROUTER_INTERFACE, events.AFTER_CREATE)
     registry.subscribe(self._after_router_interface_deleted,
                        resources.ROUTER_INTERFACE, events.AFTER_DELETE)
     # register callbacks for events pertaining resources affecting DHCP
     callback_resources = (
         resources.NETWORK,
         resources.NETWORKS,
         resources.PORT,
         resources.PORTS,
         resources.SUBNET,
         resources.SUBNETS,
     )
     if not cfg.CONF.dhcp_agent_notification:
         return
     for resource in callback_resources:
         registry.subscribe(self._send_dhcp_notification,
                            resource, events.BEFORE_RESPONSE)
     self.uses_native_notifications = {}
     for resource in (resources.NETWORK, resources.PORT, resources.SUBNET):
         self.uses_native_notifications[resource] = {'create': False,
                                                     'update': False,
                                                     'delete': False}
         registry.subscribe(self._native_event_send_dhcp_notification,
                            resource, events.AFTER_CREATE)
         registry.subscribe(self._native_event_send_dhcp_notification,
                            resource, events.AFTER_UPDATE)
         registry.subscribe(self._native_event_send_dhcp_notification,
                            resource, events.AFTER_DELETE)
Пример #11
0
 def __init__(self, topic=topics.AGENT):
     self.topic = topic
     self.topic_l2pop_update = topics.get_topic_name(topic,
                                                     topics.L2POPULATION,
                                                     topics.UPDATE)
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
Пример #12
0
    def __init__(self, topic=topics.AGENT):
        self.topic = topic

        self.topic_bgpvpn_update = topics.get_topic_name(
            self.topic, topics_BAGPIPE_BGPVPN, topics.UPDATE)

        target = oslo_messaging.Target(topic=topic, version='1.0')
        self.client = n_rpc.get_client(target)
Пример #13
0
    def __init__(self, context):
        target = oslo_messaging.Target(
            topic=nsxv3_constants.NSXV3,
            version=self.version
        )

        self.context = context
        self.rpc = rpc.get_client(target)
Пример #14
0
 def __new__(cls):
     # make it a singleton
     if not hasattr(cls, '_instance'):
         cls._instance = super(ResourcesPullRpcApi, cls).__new__(cls)
         target = oslo_messaging.Target(
             topic=topics.PLUGIN, version='1.1',
             namespace=constants.RPC_NAMESPACE_RESOURCES)
         cls._instance.client = n_rpc.get_client(target)
     return cls._instance
Пример #15
0
 def __init__(self, host):
     # NOTE(yamamoto): super.__init__() call here is not only for
     # aesthetics.  Because of multiple inheritances in MeteringAgent,
     # it's actually necessary to initialize parent classes of
     # manager.Manager correctly.
     super(MeteringPluginRpc, self).__init__(host)
     target = oslo_messaging.Target(topic=topics.METERING_PLUGIN,
                                    version='1.0')
     self.client = n_rpc.get_client(target)
Пример #16
0
 def __new__(cls):
     # make it a singleton
     if not hasattr(cls, '_instance'):
         cls._instance = super(ResourcesPullRpcApi, cls).__new__(cls)
         target = oslo_messaging.Target(
             topic=topics.PLUGIN,
             version='1.1',
             namespace=constants.RPC_NAMESPACE_RESOURCES)
         cls._instance.client = n_rpc.get_client(target)
     return cls._instance
Пример #17
0
 def __init__(self, topic):
     self.topic_encap_delete = topics.get_topic_name(
         topic, TOPICS_ENCAP, topics.DELETE)
     self.topic_encap_update = topics.get_topic_name(
         topic, TOPICS_ENCAP, topics.UPDATE)
     self.topic_encap_rule_update = topics.get_topic_name(
         topic, TOPICS_ENCAP_RULE, topics.UPDATE)
     self.topic_vrf_delete = topics.get_topic_name(topic, TOPICS_VRF,
                                                   topics.DELETE)
     target = oslo_messaging.Target(topic=topic, version='1.1')
     self.client = n_rpc.get_client(target)
Пример #18
0
    def test_get_client(self, mock_client, mock_ser):
        rpc.TRANSPORT = mock.Mock()
        tgt = mock.Mock()
        ser = mock.Mock()
        mock_client.return_value = 'client'
        mock_ser.return_value = ser

        client = rpc.get_client(tgt, version_cap='1.0', serializer='foo')

        mock_ser.assert_called_once_with('foo')
        mock_client.assert_called_once_with(rpc.TRANSPORT,
                                            tgt, version_cap='1.0',
                                            serializer=ser)
        self.assertEqual('client', client)
Пример #19
0
    def setUp(self):
        super(CastExceptionTestCase, self).setUp()

        self.messaging_conf = messaging_conffixture.ConfFixture(CONF)
        self.messaging_conf.transport_url = 'fake://'
        self.messaging_conf.response_timeout = 0
        self.useFixture(self.messaging_conf)

        self.addCleanup(rpc.cleanup)
        rpc.init(CONF)
        rpc.TRANSPORT = mock.MagicMock()
        rpc.TRANSPORT._send.side_effect = Exception
        target = messaging.Target(version='1.0', topic='testing')
        self.client = rpc.get_client(target)
        self.cast_context = mock.Mock()
Пример #20
0
 def __init__(self, topic):
     target = oslo_messaging.Target(topic=topic,
                                    version=self.BASE_RPC_API_VERSION)
     self.client = n_rpc.get_client(target)
     self.topic_port_update = topics.get_topic_name(topic, topics.PORT,
                                                    topics.UPDATE)
     self.topic_port_delete = topics.get_topic_name(topic, topics.PORT,
                                                    topics.DELETE)
     self.topic_subnet_update = topics.get_topic_name(
         topic, topics.SUBNET, topics.UPDATE)
     self.topic_opflex_notify_vrf = topics.get_topic_name(
         topic, TOPIC_OPFLEX, NOTIFY_VRF, topics.UPDATE)
     self.topic_opflex_endpoint_update = topics.get_topic_name(
         topic, TOPIC_OPFLEX, ENDPOINT, topics.UPDATE)
     self.topic_opflex_vrf_update = topics.get_topic_name(
         topic, TOPIC_OPFLEX, VRF, topics.UPDATE)
Пример #21
0
    def __init__(self, topic):
        self.topic = topic
        self.topic_network_delete = topics.get_topic_name(
            topic, topics.NETWORK, topics.DELETE)
        self.topic_port_update = topics.get_topic_name(topic, topics.PORT,
                                                       topics.UPDATE)
        self.topic_port_delete = topics.get_topic_name(topic, topics.PORT,
                                                       topics.DELETE)
        self.topic_network_update = topics.get_topic_name(
            topic, topics.NETWORK, topics.UPDATE)
        self.topic_port_binding_deactivate = topics.get_topic_name(
            topic, topics.PORT_BINDING, topics.DEACTIVATE)
        self.topic_port_binding_activate = topics.get_topic_name(
            topic, topics.PORT_BINDING, topics.ACTIVATE)

        target = oslo_messaging.Target(topic=topic, version='1.0')
        self.client = n_rpc.get_client(target)
Пример #22
0
    def setUp(self):
        super(TimeoutTestCase, self).setUp()

        self.messaging_conf = messaging_conffixture.ConfFixture(CONF)
        self.messaging_conf.transport_url = 'fake://'
        self.messaging_conf.response_timeout = 0
        self.useFixture(self.messaging_conf)

        self.addCleanup(rpc.cleanup)
        rpc.init(CONF)
        rpc.TRANSPORT = mock.MagicMock()
        rpc.TRANSPORT._send.side_effect = messaging.MessagingTimeout
        target = messaging.Target(version='1.0', topic='testing')
        self.client = rpc.get_client(target)
        self.call_context = mock.Mock()
        self.sleep = mock.patch('time.sleep').start()
        rpc.TRANSPORT.conf.rpc_response_timeout = 10
Пример #23
0
    def __init__(self, topic):
        self.topic = topic
        self.topic_network_delete = topics.get_topic_name(topic,
                                                          topics.NETWORK,
                                                          topics.DELETE)
        self.topic_port_update = topics.get_topic_name(topic,
                                                       topics.PORT,
                                                       topics.UPDATE)
        self.topic_port_delete = topics.get_topic_name(topic,
                                                       topics.PORT,
                                                       topics.DELETE)
        self.topic_network_update = topics.get_topic_name(topic,
                                                          topics.NETWORK,
                                                          topics.UPDATE)
        self.topic_port_binding_deactivate = topics.get_topic_name(
            topic, topics.PORT_BINDING, topics.DEACTIVATE)
        self.topic_port_binding_activate = topics.get_topic_name(
            topic, topics.PORT_BINDING, topics.ACTIVATE)

        target = oslo_messaging.Target(topic=topic, version='1.0')
        self.client = n_rpc.get_client(target)
Пример #24
0
    def _setup_rpc(self):
        """Setup the RPC client for the current agent."""
        self._plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
        self._state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
        self._client = n_rpc.get_client(self.target)

        self._consumers.extend([[topics.PORT, topics.UPDATE],
                                [topics.NETWORK, topics.DELETE],
                                [topics.PORT, topics.DELETE]])

        self._connection = agent_rpc.create_consumers(self._endpoints,
                                                      self._topic,
                                                      self._consumers,
                                                      start_listening=False)
        self._setup_qos_extension()
        self._connection.consume_in_threads()

        report_interval = CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)
Пример #25
0
 def __init__(self, topic, host):
     self.host = host
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
 def __init__(self, topic=bgp_consts.BGP_DRAGENT):
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
     self.topic = topic
Пример #27
0
 def __init__(self, topic=sfc_topics.SFC_AGENT):
     self.topic = topic
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
Пример #28
0
 def __init__(self, topic=topics.METERING_AGENT):
     self.topic = topic
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
 def __init__(self, topic):
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
 def __init__(self, context):
     target = oslo_messaging.Target(topic=dvs_const.DVS, version='1.0')
     self.client = n_rpc.get_client(target)
     self.context = context
Пример #31
0
 def __init__(self):
     target = oslo_messaging.Target(
         topic=topics.SERVER_RESOURCE_VERSIONS, version='1.0',
         namespace=constants.RPC_NAMESPACE_RESOURCES)
     self.client = n_rpc.get_client(target)
Пример #32
0
 def __init__(self, topic):
     target = oslo_messaging.Target(
         topic=topic,
         namespace=n_const.RPC_NAMESPACE_METADATA,
         version='1.0')
     self.client = n_rpc.get_client(target)
Пример #33
0
 def __init__(self, topic):
     target = messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target,
                                    serializer=DataModelSerializer())
Пример #34
0
 def __init__(self):
     target = oslo_messaging.Target(topic=TOPIC_APIC_SERVICE,
                                    version=VERSION)
     self.client = rpc.get_client(target)
Пример #35
0
 def __init__(self, topic=topics.AGENT):
     self.topic = topic
     self.topic_l2pop_update = topics.get_topic_name(
         topic, topics.L2POPULATION, topics.UPDATE)
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
Пример #36
0
 def __init__(self, topic):
     target = oslo_messaging.Target(
         topic=topic,
         namespace=constants.RPC_NAMESPACE_METADATA,
         version='1.0')
     self.client = n_rpc.get_client(target)
Пример #37
0
 def __init__(self, topic, host):
     super(TaasPluginApi, self).__init__(topic, host)
     target = messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
     return
Пример #38
0
 def __init__(self):
     target = oslo_messaging.Target(
         namespace=constants.RPC_NAMESPACE_RESOURCES)
     self.client = n_rpc.get_client(target)
Пример #39
0
 def __init__(self, topic):
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = lib_rpc.get_client(target)
Пример #40
0
 def __init__(self, topic=bgp_consts.BGP_DRAGENT):
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
     self.topic = topic
Пример #41
0
 def __init__(self, topic):
     target = oslo_messaging.Target(topic=topic,
                                    version='1.2',
                                    namespace=n_const.RPC_NAMESPACE_STATE)
     self.client = lib_rpc.get_client(target)
Пример #42
0
 def __init__(self, topic, default_version, driver):
     self.topic = topic
     self.driver = driver
     target = oslo_messaging.Target(topic=topic, version=default_version)
     self.client = n_rpc.get_client(target)
 def __init__(self, topic, context, host):
     self.context = context
     self.host = host
     target = oslo_messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
Пример #44
0
 def __init__(self, topic, host):
     super(TaasPluginApi, self).__init__(topic, host)
     target = messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
     return
Пример #45
0
 def __init__(self, topic, host):
     self.host = host
     target = messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target)
     return
Пример #46
0
 def __init__(self):
     target = oslo_messaging.Target(topic=nsxv3_constants.NSXV3_SERVER_RPC_TOPIC,
                                    version=self.rpc_version)
     self.context = neutron_context.get_admin_context()
     self.client = rpc.get_client(target)
     self.host = cfg.CONF.host
Пример #47
0
 def __init__(self, topic, host):
     self.host = host
     target = messaging.Target(topic=topic, version=self.API_VERSION)
     self.client = n_rpc.get_client(target)
Пример #48
0
 def __init__(self, context):
     target = oslo_messaging.Target(topic=dvs_const.DVS, version='1.0')
     self.client = n_rpc.get_client(target)
     self.context = context
Пример #49
0
 def __init__(self, topic):
     target = oslo_messaging.Target(
         topic=topic,
         version='1.0',
         namespace=constants.RPC_NAMESPACE_SECGROUP)
     self.client = n_rpc.get_client(target)
Пример #50
0
 def __init__(self, topic):
     target = oslo_messaging.Target(topic=topic, version='1.2',
                                    namespace=n_const.RPC_NAMESPACE_STATE)
     self.client = lib_rpc.get_client(target)
Пример #51
0
 def __init__(self, topic):
     target = messaging.Target(topic=topic, version='1.0')
     self.client = n_rpc.get_client(target,
                                    serializer=DataModelSerializer())
Пример #52
0
 def __init__(self, topic, host):
     """Initialize L2gateway plugin."""
     self.host = host
     target = messaging.Target(topic=topic, version=self.API_VERSION)
     self.client = n_rpc.get_client(target)