Beispiel #1
0
 def __init__(self, resource_types):
     self.resource_types = resource_types
     self._cache_by_type_and_id = {rt: {} for rt in self.resource_types}
     self._deleted_ids_by_type = {rt: set() for rt in self.resource_types}
     # track everything we've asked the server so we don't ask again
     self._satisfied_server_queries = set()
     self._puller = resources_rpc.ResourcesPullRpcApi()
Beispiel #2
0
 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)
Beispiel #3
0
 def initialize(self, connection, driver_type):
     LOG.info('%s(): caller(): %s', log_utils.get_fname(1),
              log_utils.get_fname(2))
     """Initialize agent extension."""
     self.resource_rpc = resources_rpc.ResourcesPullRpcApi()
     self.fip_qos_map = RouterFipRateLimitMaps()
     self._register_rpc_consumers()
Beispiel #4
0
 def setUp(self):
     super(ResourcesPullRpcApiTestCase, self).setUp()
     mock.patch.object(resources_rpc, '_validate_resource_type').start()
     mock.patch('neutron.api.rpc.callbacks.resources.get_resource_cls',
                return_value=FakeResource).start()
     self.rpc = resources_rpc.ResourcesPullRpcApi()
     mock.patch.object(self.rpc, 'client').start()
     self.cctxt_mock = self.rpc.client.prepare.return_value
Beispiel #5
0
 def __init__(self, rcache):
     self.rcache = rcache
     registry.subscribe(self._clear_child_sg_rules, 'SecurityGroup',
                        events.AFTER_DELETE)
     registry.subscribe(self._add_child_sg_rules, 'SecurityGroup',
                        events.AFTER_UPDATE)
     # set this attr so agent can adjust the timeout of the client
     self.client = resources_rpc.ResourcesPullRpcApi().client
Beispiel #6
0
 def __init__(self, rcache):
     self.rcache = rcache
     registry.subscribe(self._clear_child_sg_rules, 'SecurityGroup',
                        events.AFTER_DELETE)
     registry.subscribe(self._add_child_sg_rules, 'SecurityGroup',
                        events.AFTER_UPDATE)
     # set this attr so agent can adjust the timeout of the client
     LOG.info("cfarquhar: in SecurityGroupServerAPIShim - NOT EXPECTED")
     self.client = resources_rpc.ResourcesPullRpcApi().client
Beispiel #7
0
 def bulk_flood_cache(self):
     # TODO(kevinbenton): this fills the cache with *every* server record.
     # make this more intelligent to only pull ports on host, then all
     # networks and security groups for those ports, etc.
     context = n_ctx.get_admin_context()
     puller = resources_rpc.ResourcesPullRpcApi()
     for rtype in self.resource_types:
         for resource in puller.bulk_pull(context, rtype):
             self._type_cache(rtype)[resource.id] = resource
Beispiel #8
0
 def __init__(self, resource_types):
     LOG.info('%s(): caller(): %s', log_utils.get_fname(1),
              log_utils.get_fname(2))
     self.resource_types = resource_types
     self._cache_by_type_and_id = {rt: {} for rt in self.resource_types}
     self._deleted_ids_by_type = {rt: set() for rt in self.resource_types}
     # track everything we've asked the server so we don't ask again
     self._satisfied_server_queries = set()
     self._puller = resources_rpc.ResourcesPullRpcApi()
Beispiel #9
0
    def initialize(self, connection, driver_type):
        """Initialize agent extension."""

        self.resource_rpc = resources_rpc.ResourcesPullRpcApi()
        self.qos_driver = manager.NeutronManager.load_class_for_provider(
            'neutron.qos.agent_drivers', driver_type)()
        self.qos_driver.consume_api(self.agent_api)
        self.qos_driver.initialize()

        self.policy_map = PortPolicyMap()

        self._register_rpc_consumers(connection)
Beispiel #10
0
    def initialize(self, connection, driver_type):
        """Perform Agent Extension initialization.

        """
        self.resource_rpc = resources_rpc.ResourcesPullRpcApi()
        self.qos_driver = manager.NeutronManager.load_class_for_provider(
            'neutron.qos.agent_drivers', driver_type)()
        self.qos_driver.initialize()

        self.policy_map = PortPolicyMap()

        registry.subscribe(self._handle_notification, resources.QOS_POLICY)
        self._register_rpc_consumers(connection)
Beispiel #11
0
    def initialize(self, connection, driver_type):
        """Perform Agent Extension initialization.

        """
        self.resource_rpc = resources_rpc.ResourcesPullRpcApi()
        self.qos_driver = manager.NeutronManager.load_class_for_provider(
            'neutron.qos.agent_drivers', driver_type)()
        self.qos_driver.initialize()

        # we cannot use a dict of sets here because port dicts are not hashable
        self.qos_policy_ports = collections.defaultdict(dict)
        self.known_ports = set()

        registry.subscribe(self._handle_notification, resources.QOS_POLICY)
        self._register_rpc_consumers(connection)
Beispiel #12
0
    def setup_rpc(self):
        """Setup some rpc mechanisms

        This method try to initialise all rpc client this agent loop
        need to use. in addition to rpc client common agent loop is using,
        We setp dhcp_rpc in order to get subnet information
        Args:
            None
        Return:
            None
        """

        self.dhcp_rpc = DhcpPluginApi(topics.PLUGIN, cfg.CONF.host)
        self.meta_rpc = MetadataPluginAPI(topics.PLUGIN)
        self.resource_rpc = resources_rpc.ResourcesPullRpcApi()
        super(SrAgentLoop, self).setup_rpc()
Beispiel #13
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)
Beispiel #14
0
    def initialize(self, connection, driver_type):
        if driver_type != ovs_constants.EXTENSION_DRIVER_TYPE:
            LOG.error('Local IP extension is only supported for OVS, '
                      'currently uses %(driver_type)s',
                      {'driver_type': driver_type})
            sys.exit(1)
        if self._is_ovs_firewall() and not cfg.CONF.LOCAL_IP.static_nat:
            LOG.error('In order to use Local IP extension together with '
                      'openvswitch firewall please set static_nat config to '
                      'True')
            sys.exit(1)

        self.resource_rpc = resources_rpc.ResourcesPullRpcApi()
        self._register_rpc_consumers(connection)
        self.int_br = self.agent_api.request_int_br()

        self.local_ip_updates = {
            'added': collections.defaultdict(dict),
            'deleted': collections.defaultdict(dict)
        }

        self._pull_all_local_ip_associations()
Beispiel #15
0
 def initialize(self, connection, driver_type):
     self.resource_rpc = resources_rpc.ResourcesPullRpcApi()
     self._register_rpc_consumers()
     self.mapping = RouterFipPortForwardingMapping()
Beispiel #16
0
 def initialize(self, connection, driver_type):
     """Initialize agent extension."""
     self.resource_rpc = resources_rpc.ResourcesPullRpcApi()
     self.fip_qos_map = RouterFipRateLimitMaps()
     self._register_rpc_consumers()
 def test_is_singleton(self):
     self.assertIs(self.rpc, resources_rpc.ResourcesPullRpcApi())
 def setUp(self):
     super(ResourcesPullRpcApiTestCase, self).setUp()
     self.rpc = resources_rpc.ResourcesPullRpcApi()
     mock.patch.object(self.rpc, 'client').start()
     self.cctxt_mock = self.rpc.client.prepare.return_value
Beispiel #19
0
 def initialize(self, connection, driver_type):
     """Initialize agent extension."""
     self.resource_rpc = resources_rpc.ResourcesPullRpcApi()
     self._register_rpc_consumers()
     self.gateway_ip_qos_map = qos_base.RateLimitMaps(
         "gateway-ip-qos-cache")
 def _setup_rpc(self, connection):
     self._pull_rpc = resources_rpc.ResourcesPullRpcApi()
     self._register_rpc_consumers(connection)
Beispiel #21
0
 def initialize(self, connection, driver_type):
     self.resource_rpc = resources_rpc.ResourcesPullRpcApi()
     self._register_rpc_consumers()
     self.mapping = ConntrackHelperMapping()