Esempio n. 1
0
    def __init__(self, parsed_url):
        super(RPCPublisher, self).__init__(parsed_url)

        options = urlparse.parse_qs(parsed_url.query)
        self.target = options.get('target', ['record_metering_data'])[0]

        self.rpc_client = messaging.get_rpc_client(messaging.get_transport(),
                                                   retry=self.retry,
                                                   version='1.0')
Esempio n. 2
0
    def __init__(self, parsed_url):
        super(RPCPublisher, self).__init__(parsed_url)

        options = urlparse.parse_qs(parsed_url.query)
        self.target = options.get('target', ['record_metering_data'])[0]

        self.rpc_client = messaging.get_rpc_client(
            messaging.get_transport(),
            retry=self.retry, version='1.0'
        )
Esempio n. 3
0
    def test_collector_no_mock(self, mylog):
        self.CONF.set_override('enable_rpc', True, group='collector')
        self.CONF.set_override('udp_address', '', group='collector')
        mylog.info.side_effect = lambda *args: self.srv.stop()
        self.srv.start()

        client = messaging.get_rpc_client(self.transport, version='1.0')
        cclient = client.prepare(topic='metering')
        cclient.cast(context.RequestContext(),
                     'record_metering_data', data=[self.utf8_msg])
        self.srv.rpc_server.wait()
        mylog.info.assert_called_once_with(
            'metering data test for test_run_tasks: 1')
Esempio n. 4
0
    def test_collector_no_mock(self, mylog):
        self.CONF.set_override('udp_address', '', group='collector')
        self.srv.start()
        mylog.info.side_effect = lambda *args: self.srv.stop()

        client = messaging.get_rpc_client(self.transport, version='1.0')
        cclient = client.prepare(topic='metering')
        cclient.cast(context.RequestContext(),
                     'record_metering_data', data=[self.utf8_msg])

        self.srv.rpc_server.wait()
        mylog.info.assert_called_once_with(
            'metering data test for test_run_tasks: 1')
Esempio n. 5
0
def get_rpc_client(config_file):
    service.prepare_service(argv=['/', '--config-file', config_file])
    transport = messaging.get_transport()
    rpc_client = messaging.get_rpc_client(transport, version='1.0')
    return rpc_client
Esempio n. 6
0
 def __init__(self):
     transport = messaging.get_transport()
     self.client = messaging.get_rpc_client(
         transport, topic=cfg.CONF.alarm.partition_rpc_topic,
         version="1.0")
Esempio n. 7
0
def get_rpc_client(config_file):
    service.prepare_service(argv=["/", "--config-file", config_file])
    transport = messaging.get_transport()
    rpc_client = messaging.get_rpc_client(transport, version="1.0")
    return rpc_client
Esempio n. 8
0
def get_rpc_client(config_file):
    service.prepare_service(argv=['/', '--config-file', config_file])
    transport = messaging.get_transport()
    rpc_client = messaging.get_rpc_client(transport, version='1.0')
    return rpc_client
Esempio n. 9
0
 def __init__(self):
     self.client = messaging.get_rpc_client(
         topic=cfg.CONF.alarm.notifier_rpc_topic, version="1.0")
Esempio n. 10
0
 def __init__(self):
     self.client = messaging.get_rpc_client(
         topic=cfg.CONF.alarm.notifier_rpc_topic,
         version="1.0")