def __init__(self, topic): self.topic = topic target = oslo_messaging.Target( topic=self.topic, version=self.API_VERSION) self.client = n_rpc.get_client(target)
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)
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)
def __init__(self, topic): self.topic = topic target = oslo_messaging.Target(topic=topic, version=self.BASE_RPC_API_VERSION, namespace=None) self.client = n_rpc.get_client(target)
def __init__(self, topic): self.topic = topic target = messaging.Target(topic=self.topic, version=self.API_VERSION) self.client = n_rpc.get_client(target) self.cctxt = self.client.prepare(version=self.API_VERSION, topic=self.topic)
def __init__(self, topic, host): topic = topic if topic else const.FTNT_AGENT self.host = host fgt_target = oslo_messaging.Target( topic=topic, version='1.0') self.context = n_context.get_admin_context_without_session() self.fgt_client = n_rpc.get_client(fgt_target)
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)
def __init__(self, topic, host): self.host = host target = oslo_messaging.Target( topic=topic, namespace=n_const.RPC_NAMESPACE_DHCP_PLUGIN, version='1.0') self.client = n_rpc.get_client(target)
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)
def _setup_rpc(self): self.agent_id = 'hyperv_%s' % platform.node() self.topic = topics.AGENT self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN) self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN) self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) # RPC network init self.context = context.get_admin_context_without_session() # Handle updates from service self.endpoints = [self] # Define the listening consumers for the agent consumers = [[topics.PORT, topics.UPDATE], [topics.NETWORK, topics.DELETE], [topics.PORT, topics.DELETE], [TUNNEL, topics.UPDATE]] self.connection = agent_rpc.create_consumers(self.endpoints, self.topic, consumers) self.client = n_rpc.get_client(self.target) self.sec_groups_agent = HyperVSecurityAgent( self.context, self.sg_plugin_rpc) report_interval = CONF.AGENT.report_interval if report_interval: heartbeat = loopingcall.FixedIntervalLoopingCall( self._report_state) heartbeat.start(interval=report_interval)
def _create_rpc_publisher(self): self.topic = constants.TOPIC_LOADBALANCER_AGENT_V2 if self.driver.env: self.topic = self.topic + "_" + self.driver.env target = messaging.Target(topic=self.topic, version=constants.BASE_RPC_API_VERSION) self._client = rpc.get_client(target, version_cap=None)
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__() target = oslo_messaging.Target(topic=topics.METERING_PLUGIN, version="1.0") self.client = n_rpc.get_client(target)
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) target = oslo_messaging.Target(topic=topic, version="1.0") self.client = n_rpc.get_client(target)
def __init__(self, sc): self.sc = sc self.topic = const.NOTIFICATION_QUEUE target = messaging.Target(topic=self.topic, version=self.API_VERSION) self.client = n_rpc.get_client(target) self.cctxt = self.client.prepare(version=self.API_VERSION, topic=self.topic)
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_subnet_update = topics.get_topic_name(topic, topics.SUBNET, topics.UPDATE)
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)
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.0', namespace=constants.RPC_NAMESPACE_RESOURCES) cls._instance.client = n_rpc.get_client(target) return cls._instance
def __init__(self, topic, context, use_namespaces): self.context = context self.host = cfg.CONF.host self.use_namespaces = use_namespaces target = oslo_messaging.Target( topic=topic, namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN, version='1.0') self.client = n_rpc.get_client(target)
def __init__(self, topic=topics.DHCP_AGENT, plugin=None): 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)
def __init__(self, topic=topics.CASCADING_SERVICE): target = oslo_messaging.Target(topic=topic, exchange="tricircle", namespace="networking", version='1.0', fanout=True) self.client = n_rpc.get_client( target, serializer=Serializer(), )
def __init__(self, service_plugin): LOG.debug("Loading IsoflatRpcDriver.") self.service_plugin = service_plugin self.endpoints = [self] self.conn = n_rpc.create_connection() self.conn.create_consumer(constants.TOPIC_ISOFLAT_PLUGIN, self.endpoints, fanout=False) self.conn.consume_in_threads() target = messaging.Target(topic=constants.TOPIC_ISOFLAT_AGENT, version='1.0') self.client = n_rpc.get_client(target)
def get_networks(context, config): host = get_dhcp_agent_host(config) if not host: return [] target = messaging.Target( topic=n_topics.PLUGIN, namespace=n_constants.RPC_NAMESPACE_DHCP_PLUGIN, version='1.0') client = n_rpc.get_client(target) cctxt = client.prepare(version='1.1') return cctxt.call(context, 'get_active_networks_info', host=host)
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_tunnel_update = topics.get_topic_name( topic, constants.TUNNEL, topics.UPDATE) target = 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=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_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)
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)
def __init__(self, context, topic, host): """Initialize LBaaSv2PluginRPC.""" super(LBaaSv2PluginRPC, self).__init__() if topic: self.topic = topic else: self.topic = constants.TOPIC_LBAASV2_BIGIQ_DRIVER self.target = messaging.Target(topic=self.topic, version=constants.RPC_API_VERSION) self._client = rpc.get_client(self.target, version_cap=None) self.context = context self.host = host
def setUp(self): super(CastExceptionTestCase, self).setUp() self.messaging_conf = messaging_conffixture.ConfFixture(CONF) self.messaging_conf.transport_driver = '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()
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()
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_tunnel_update = topics.get_topic_name(topic, constants.TUNNEL, topics.UPDATE) target = messaging.Target(topic=topic, version='1.0') self.client = n_rpc.get_client(target)
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, n_topics.PORT_BINDING, n_topics.DEACTIVATE) self.topic_port_binding_activate = topics.get_topic_name( topic, n_topics.PORT_BINDING, n_topics.ACTIVATE) target = oslo_messaging.Target(topic=topic, version='1.0') self.client = n_rpc.get_client(target)
def setUp(self): super(TimeoutTestCase, self).setUp() self.messaging_conf = messaging_conffixture.ConfFixture(CONF) self.messaging_conf.transport_driver = '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
def __init__(self, topic, context, env, group, host): """Initialize LBaaSv2PluginRPC.""" super(LBaaSv2PluginRPC, self).__init__() if topic: self.topic = topic else: self.topic = constants.TOPIC_PROCESS_ON_HOST_V2 self.target = messaging.Target(topic=self.topic, version=constants.RPC_API_VERSION) self._client = rpc.get_client(self.target, version_cap=None) self.context = context self.env = env self.group = group self.host = host
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_subnet_create = topics.get_topic_name( topic, topics.SUBNET, topics.CREATE) self.topic_subnet_delete = topics.get_topic_name( topic, topics.SUBNET, topics.DELETE) target = oslo_messaging.Target(topic=topic, version='1.0') self.client = n_rpc.get_client(target)
def _setup_rpc(self): self.agent_id = 'hyperv_%s' % platform.node() self.topic = topics.AGENT self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN) self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN) # RPC network init self.context = context.get_admin_context_without_session() self.sec_groups_agent = HyperVSecurityAgent(self.context, self.sg_plugin_rpc) self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) # Handle updates from service self.endpoints = [self] # Define the listening consumers for the agent consumers = [[topics.PORT, topics.UPDATE], [topics.NETWORK, topics.DELETE], [topics.PORT, topics.DELETE]] if CONF.NVGRE.enable_support: consumers.append([h_const.TUNNEL, topics.UPDATE]) consumers.append([h_const.LOOKUP, h_const.UPDATE]) self.connection = agent_rpc.create_consumers(self.endpoints, self.topic, consumers, start_listening=False) if CONF.AGENT.enable_qos_extension: self._qos_ext = qos_extension.QosAgentExtension() self._qos_ext.consume_api(self) self._qos_ext.initialize(self.connection, 'hyperv') self.connection.consume_in_threads() self.client = n_rpc.get_client(self.target) report_interval = CONF.AGENT.report_interval if report_interval: heartbeat = loopingcall.FixedIntervalLoopingCall( self._report_state) heartbeat.start(interval=report_interval) self._vlan_driver = trunk_driver.HyperVTrunkDriver(self.context)
def __init__(self, topic=topics.DHCP_AGENT, plugin=None): 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, ) for resource in callback_resources: registry.subscribe(self._send_dhcp_notification, resource, events.BEFORE_RESPONSE)
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, n_topics.PORT_BINDING, n_topics.DEACTIVATE) self.topic_port_binding_activate = topics.get_topic_name( topic, n_topics.PORT_BINDING, n_topics.ACTIVATE) target = oslo_messaging.Target(topic=topic, version='1.0') self.client = n_rpc.get_client(target)
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)
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)
def __init__(self, topic): target = messaging.Target(topic=topic, version='1.0') self.client = n_rpc.get_client(target)
def __init__(self, topic=topics.L3_AGENT): 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) self.topic_info_update = topics.get_topic_name(topic, constants.INFO, topics.UPDATE)
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
def __init__(self, topic): target = oslo_messaging.Target(topic=topic, version='1.0', namespace=constants.RPC_NAMESPACE_DVR) self.client = n_rpc.get_client(target)
def __init__(self, l3plugin, topic=CFG_AGENT_L3_ROUTING): self._l3plugin = l3plugin target = oslo_messaging.Target(topic=topic, version='1.0') self.client = n_rpc.get_client(target)
def __init__(self, topic=topics.PLUGIN): topic = topics.get_topic_name(topic, topics.L2POPULATION, l2pop_rpc.L2POP_QUERY) 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=self.RPC_API_VERSION) self.client = n_rpc.get_client(target)
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=topics.L3_AGENT): target = oslo_messaging.Target(topic=topic, version='1.0') self.client = n_rpc.get_client(target)
def __init__(self): target = oslo_messaging.Target(topic=TOPIC_APIC_SERVICE, version='1.1') self.client = rpc.get_client(target)
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)
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)
def __init__(self, topic): target = messaging.Target(topic=topic, version='1.0') self.client = n_rpc.get_client(target, serializer=DataModelSerializer())
def __init__(self, topic): self.topic = topic target = messaging.Target(topic=topic, version=sg_rpc.SG_RPC_VERSION) self.client = n_rpc.get_client(target)
def __init__(self, topic, context, use_namespaces): self.context = context self.host = cfg.CONF.host self.use_namespaces = use_namespaces target = messaging.Target(topic=topic, version='1.0') self.client = n_rpc.get_client(target)