def __init__(self): endpoints = [self] target = messaging.Target(topic='hyperswitch-callback', version='1.0', exchange='hyperswitch', server=config.get_host()) self.server = rpc.get_server(target, endpoints) self.server.start() self._plugin_property = None self._l3_plugin_property = None self._hyperswitch_plugin_property = None super(HyperswitchCallback, self).__init__()
def test_get_server(self, mock_get, mock_ser): rpc.TRANSPORT = mock.Mock() ser = mock.Mock() tgt = mock.Mock() ends = mock.Mock() mock_ser.return_value = ser mock_get.return_value = 'server' server = rpc.get_server(tgt, ends, serializer='foo') mock_ser.assert_called_once_with('foo') mock_get.assert_called_once_with(rpc.TRANSPORT, tgt, ends, 'eventlet', ser) self.assertEqual('server', server)
def test_get_server(self, mock_get, mock_ser): rpc.TRANSPORT = mock.Mock() ser = mock.Mock() tgt = mock.Mock() ends = mock.Mock() mock_ser.return_value = ser mock_get.return_value = 'server' server = rpc.get_server(tgt, ends, serializer='foo') mock_ser.assert_called_once_with('foo') access_policy = dispatcher.DefaultRPCAccessPolicy mock_get.assert_called_once_with(rpc.TRANSPORT, tgt, ends, 'eventlet', ser, access_policy=access_policy) self.assertEqual('server', server)
def __init__(self): super(HyperSwitchAgent, self).__init__() self.device_id = cfg.CONF.host # the queue client for plug/unplug calls from nova driver endpoints = [self] target = messaging.Target(topic='hyperswitch-update', version='1.0', exchange='hyperswitch', server=cfg.CONF.host) self.server = rpc.get_server(target, endpoints) # the call back to nova driver init self.call_back = HyperSwitchAgentCallback() # instance according to configuration self.vif_driver = vif_hyperswitch_driver.HyperSwitchVIFDriver( device_id=self.device_id, call_back=self.call_back) self.vif_driver.startup_init() self.server.start()
def create_consumer(self, topic, endpoints, fanout=False): target = messaging.Target( topic=topic, server=cfg.CONF.host, fanout=fanout) server = n_rpc.get_server(target, endpoints) self.servers.append(server)
def initialize(self): self._server = n_rpc.get_server(self._target, [self._endpoint]) self._server.start()