def __init__(self):
     super(OpflexTrunkMixin, self).__init__()
     self.managed_trunks = {}
     registry.unsubscribe(self.handle_trunks, resources.TRUNK)
     registry.register(self.handle_subports, resources.SUBPORT)
     self._context = n_context.get_admin_context_without_session()
     self.trunk_rpc = agent.TrunkStub()
Exemple #2
0
 def _init_rpc_listeners(self):
     endpoints = [resources_rpc.ResourcesPushRpcCallback()]
     self._connection = n_rpc.create_connection()
     for rtype in self.rcache.resource_types:
         registry_rpc.register(self.resource_change_handler, rtype)
         topic = resources_rpc.resource_type_versioned_topic(rtype)
         self._connection.create_consumer(topic, endpoints, fanout=True)
     self._connection.consume_in_threads()
Exemple #3
0
 def _register_rpc_consumers(self):
     registry.register(self._handle_notification, resources.NDPPROXY)
     self._connection = n_rpc.Connection()
     endpoints = [resources_rpc.ResourcesPushRpcCallback()]
     topic = resources_rpc.resource_type_versioned_topic(
         resources.NDPPROXY)
     self._connection.create_consumer(topic, endpoints, fanout=True)
     self._connection.consume_in_threads()
Exemple #4
0
 def _init_rpc_listeners(self):
     endpoints = [resources_rpc.ResourcesPushRpcCallback()]
     self._connection = n_rpc.Connection()
     for rtype in self.rcache.resource_types:
         registry_rpc.register(self.resource_change_handler, rtype)
         topic = resources_rpc.resource_type_versioned_topic(rtype)
         self._connection.create_consumer(topic, endpoints, fanout=True)
     self._connection.consume_in_threads()
Exemple #5
0
    def _register_rpc_consumers(self):
        registry.register(self._handle_notification, resources.QOS_POLICY)

        self._connection = n_rpc.Connection()
        endpoints = [resources_rpc.ResourcesPushRpcCallback()]
        topic = resources_rpc.resource_type_versioned_topic(
            resources.QOS_POLICY)
        self._connection.create_consumer(topic, endpoints, fanout=True)
        self._connection.consume_in_threads()
Exemple #6
0
    def _register_rpc_consumers(self):
        LOG.info('%s(): caller(): %s', log_utils.get_fname(1), log_utils.get_fname(2))
        registry.register(self._handle_notification, resources.QOS_POLICY)

        self._connection = n_rpc.Connection()
        endpoints = [resources_rpc.ResourcesPushRpcCallback()]
        topic = resources_rpc.resource_type_versioned_topic(
            resources.QOS_POLICY)
        self._connection.create_consumer(topic, endpoints, fanout=True)
        self._connection.consume_in_threads()
Exemple #7
0
 def _init_rpc_listeners(self):
     LOG.info('%s(): caller(): %s', log_utils.get_fname(1),
              log_utils.get_fname(2))
     endpoints = [resources_rpc.ResourcesPushRpcCallback()]
     self._connection = n_rpc.Connection()
     for rtype in self.rcache.resource_types:
         registry_rpc.register(self.resource_change_handler, rtype)
         topic = resources_rpc.resource_type_versioned_topic(rtype)
         self._connection.create_consumer(topic, endpoints, fanout=True)
     self._connection.consume_in_threads()
Exemple #8
0
    def __init__(self):
        registry.register(self.handle_trunks, resources.TRUNK)
        registry.register(self.handle_subports, resources.SUBPORT)

        self._connection = n_rpc.Connection()
        endpoints = [resources_rpc.ResourcesPushRpcCallback()]
        topic = resources_rpc.resource_type_versioned_topic(resources.SUBPORT)
        self._connection.create_consumer(topic, endpoints, fanout=True)
        topic = resources_rpc.resource_type_versioned_topic(resources.TRUNK)
        self._connection.create_consumer(topic, endpoints, fanout=True)
        self._connection.consume_in_threads()
Exemple #9
0
    def __init__(self):
        registry.register(self.handle_trunks, resources.TRUNK)
        registry.register(self.handle_subports, resources.SUBPORT)

        self._connection = n_rpc.Connection()
        endpoints = [resources_rpc.ResourcesPushRpcCallback()]
        topic = resources_rpc.resource_type_versioned_topic(resources.SUBPORT)
        self._connection.create_consumer(topic, endpoints, fanout=True)
        topic = resources_rpc.resource_type_versioned_topic(resources.TRUNK)
        self._connection.create_consumer(topic, endpoints, fanout=True)
        self._connection.consume_in_threads()
Exemple #10
0
 def _register_rpc_consumers(self, connection):
     """Allows an extension to receive notifications of updates made to
        items of interest.
     """
     endpoints = [resources_rpc.ResourcesPushRpcCallback()]
     for resource_type in self.SUPPORTED_RESOURCE_TYPES:
         # We assume that the neutron server always broadcasts the latest
         # version known to the agent
         registry.register(self._handle_notification, resource_type)
         topic = resources_rpc.resource_type_versioned_topic(resource_type)
         connection.create_consumer(topic, endpoints, fanout=True)
Exemple #11
0
 def _register_rpc_consumers(self, connection):
     """Allows an extension to receive notifications of updates made to
        items of interest.
     """
     endpoints = [resources_rpc.ResourcesPushRpcCallback()]
     for resource_type in self.SUPPORTED_RESOURCE_TYPES:
         # We assume that the neutron server always broadcasts the latest
         # version known to the agent
         registry.register(self._handle_notification, resource_type)
         topic = resources_rpc.resource_type_versioned_topic(resource_type)
         connection.create_consumer(topic, endpoints, fanout=True)
    def _register_port_notification(self, connection):
        """Allows an extension to receive notifications of updates made to
           items of interest.
        """
        #endpoints = [resources_rpc.ResourcesPushRpcCallback()]
        endpoints = [taas_plugin_callbacks.TaasCallbacks()]

        # We assume that the neutron server always broadcasts the latest
        # version known to the agent
        registry.register(self._handle_port_notification, resources.PORT)
        topic = resources_rpc.resource_type_versioned_topic(resources.PORT)
        connection.create_consumer(topic, endpoints, fanout=True)
Exemple #13
0
    def test_push(self, manager_mock):
        resource_type_ = object()
        resource_ = object()
        event_type_ = object()

        context = mock.Mock()
        callback1 = mock.Mock()
        callback2 = mock.Mock()
        registry.register(callback1, 'x')
        registry.register(callback2, 'x')
        callbacks = {callback1, callback2}
        manager_mock().get_callbacks.return_value = callbacks
        registry.push(context, resource_type_, [resource_], event_type_)
        for callback in (callback1, callback2):
            callback.assert_called_with(context, resource_type_,
                                        [resource_], event_type_)
    def test_push(self, manager_mock):
        resource_type_ = object()
        resource_ = object()
        event_type_ = object()

        context = mock.Mock()
        callback1 = mock.Mock()
        callback2 = mock.Mock()
        registry.register(callback1, 'x')
        registry.register(callback2, 'x')
        callbacks = {callback1, callback2}
        manager_mock().get_callbacks.return_value = callbacks
        registry.push(context, resource_type_, [resource_], event_type_)
        for callback in (callback1, callback2):
            callback.assert_called_with(context, resource_type_, [resource_],
                                        event_type_)
    def _register_rpc_consumers(self, connection):
        endpoints = [resources_rpc.ResourcesPushRpcCallback()]

        # Consume BaGPipeChainHop OVO RPC
        cons_registry.register(self.handle_sfc_chain_hops,
                               sfc_obj.BaGPipeChainHop.obj_name())
        topic_chain_hop = resources_rpc.resource_type_versioned_topic(
            sfc_obj.BaGPipeChainHop.obj_name())
        connection.create_consumer(topic_chain_hop, endpoints, fanout=True)

        # Consume BaGPipePortHops OVO RPC
        cons_registry.register(self.handle_sfc_port_hops,
                               sfc_obj.BaGPipePortHops.obj_name())
        topic_port_hops = resources_rpc.resource_type_versioned_topic(
            sfc_obj.BaGPipePortHops.obj_name())
        connection.create_consumer(topic_port_hops, endpoints, fanout=True)
Exemple #16
0
    def _setup_rpc(self, connection):
        self.rpc_pull_api = resources_rpc.ResourcesPullRpcApi()

        rpc_registry.register(self.handle_notification_net_assocs,
                              objects.BGPVPNNetAssociation.obj_name())
        rpc_registry.register(self.handle_notification_router_assocs,
                              objects.BGPVPNRouterAssociation.obj_name())
        rpc_registry.register(self.handle_notification_port_assocs,
                              objects.BGPVPNPortAssociation.obj_name())
        endpoints = [resources_rpc.ResourcesPushRpcCallback()]
        topic_net_assoc = resources_rpc.resource_type_versioned_topic(
            objects.BGPVPNNetAssociation.obj_name())
        topic_router_assoc = resources_rpc.resource_type_versioned_topic(
            objects.BGPVPNRouterAssociation.obj_name())
        topic_port_assoc = resources_rpc.resource_type_versioned_topic(
            objects.BGPVPNPortAssociation.obj_name())
        connection.create_consumer(topic_net_assoc, endpoints, fanout=True)
        connection.create_consumer(topic_router_assoc, endpoints, fanout=True)
        connection.create_consumer(topic_port_assoc, endpoints, fanout=True)
Exemple #17
0
 def _register_rpc_consumers(self, connection):
     endpoints = [resources_rpc.ResourcesPushRpcCallback()]
     for resource_type in self.SUPPORTED_RESOURCE_TYPES:
         registry.register(self._handle_notification, resource_type)
         topic = resources_rpc.resource_type_versioned_topic(resource_type)
         connection.create_consumer(topic, endpoints, fanout=True)
Exemple #18
0
 def test_register(self, manager_mock):
     callback = lambda: None
     registry.register(callback, 'TYPE')
     manager_mock().register.assert_called_with(callback, 'TYPE')
Exemple #19
0
 def _register_rpc_consumers(self, connection):
     endpoints = [resources_rpc.ResourcesPushRpcCallback()]
     for resource_type in self.SUPPORTED_RESOURCE_TYPES:
         registry.register(self._handle_notification, resource_type)
         topic = resources_rpc.resource_type_versioned_topic(resource_type)
         connection.create_consumer(topic, endpoints, fanout=True)
 def test_register(self, manager_mock):
     callback = lambda: None
     registry.register(callback, 'TYPE')
     manager_mock().register.assert_called_with(callback, 'TYPE')