예제 #1
0
 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__()
예제 #2
0
    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)
예제 #3
0
    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)
예제 #4
0
    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)
예제 #5
0
    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)
예제 #6
0
    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()
예제 #7
0
 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)
예제 #8
0
 def initialize(self):
     self._server = n_rpc.get_server(self._target, [self._endpoint])
     self._server.start()