Exemple #1
0
    def _setup_rpc(self):
        self.agent_id = 'hyperv_%s' % platform.node()
        self.topic = topics.AGENT
        self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)

        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)

        # RPC network init
        self.context = context.get_admin_context_without_session()
        # Handle updates from service
        self.endpoints = [self]
        # Define the listening consumers for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.NETWORK, topics.DELETE],
                     [topics.PORT, topics.DELETE],
                     [constants.TUNNEL, topics.UPDATE]]
        self.connection = agent_rpc.create_consumers(self.endpoints,
                                                     self.topic, consumers)

        self.sec_groups_agent = HyperVSecurityAgent(self.context,
                                                    self.sg_plugin_rpc)
        report_interval = CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)
    def start(self):
        self.prevent_arp_spoofing = cfg.CONF.AGENT.prevent_arp_spoofing
        self.setup_linux_bridge(self.interface_mappings)
        configurations = {'interface_mappings': self.interface_mappings}
        if self.br_mgr.vxlan_mode != lconst.VXLAN_NONE:
            configurations['tunneling_ip'] = self.br_mgr.local_ip
            configurations['tunnel_types'] = [p_const.TYPE_VXLAN]
            configurations['l2_population'] = cfg.CONF.VXLAN.l2_population
        self.agent_state = {
            'binary': 'neutron-linuxbridge-agent',
            'host': cfg.CONF.host,
            'topic': constants.L2_AGENT_TOPIC,
            'configurations': configurations,
            'agent_type': constants.AGENT_TYPE_LINUXBRIDGE,
            'start_flag': True
        }

        # stores received port_updates for processing by the main loop
        self.updated_devices = set()
        self.context = context.get_admin_context_without_session()
        self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.sg_agent = sg_rpc.SecurityGroupAgentRpc(
            self.context, self.sg_plugin_rpc, defer_refresh_firewall=True)
        self.setup_rpc(self.interface_mappings.values())
        self.daemon_loop()
Exemple #3
0
    def __init__(self,
                 vsphere_hostname,
                 vsphere_login,
                 vsphere_password,
                 bridge_mappings,
                 polling_interval,
                 quitting_rpc_timeout=None):
        super(DVSAgent, self).__init__()

        self.agent_state = {
            'binary': 'neutron-dvs-agent',
            'host': cfg.CONF.host,
            'topic': n_const.L2_AGENT_TOPIC,
            'configurations': {
                'bridge_mappings': bridge_mappings,
                'vsphere_hostname': vsphere_hostname
            },
            'agent_type': 'DVS agent',
            'start_flag': True
        }

        report_interval = cfg.CONF.DVS_AGENT.report_interval

        self.polling_interval = polling_interval
        # Security group agent support
        self.context = context.get_admin_context_without_session()
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.sg_agent = dvs_rpc.DVSSecurityGroupRpc(
            self.context, self.sg_plugin_rpc, defer_refresh_firewall=True)

        self.setup_rpc()
        self.run_daemon_loop = True
        self.iter_num = 0

        self.quitting_rpc_timeout = quitting_rpc_timeout
        self.network_map = dvs_util.create_network_map_from_config(
            cfg.CONF.ML2_VMWARE, pg_cache=True)
        uplink_map = dvs_util.create_uplink_map_from_config(
            cfg.CONF.ML2_VMWARE, self.network_map)
        for phys, dvs in self.network_map.iteritems():
            if phys in uplink_map:
                dvs.load_uplinks(phys, uplink_map[phys])
        self.updated_ports = set()
        self.deleted_ports = set()
        self.known_ports = set()
        self.added_ports = set()
        self.booked_ports = set()
        LOG.info(_LI("Agent out of sync with plugin!"))
        connected_ports = self._get_dvs_ports()
        self.added_ports = connected_ports
        if cfg.CONF.DVS.clean_on_restart:
            self._clean_up_vsphere_extra_resources(connected_ports)
        self.fullsync = False

        # The initialization is complete; we can start receiving messages
        self.connection.consume_in_threads()
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)
    def setup_rpc(self):
        self.plugin_rpc = DVSPluginApi(topics.PLUGIN)
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)

        self.agent_id = 'dvs-agent-%s' % self.conf.host

        self.topic = topics.AGENT
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)

        # RPC network init

        # Handle updates from service
        endpoints = [self]

        # Define the listening consumers for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.PORT, topics.DELETE],
                     [topics.NETWORK, topics.UPDATE],
                     [topics.SECURITY_GROUP, topics.UPDATE],
                     [dvs_const.DVS, topics.UPDATE]]

        self.connection = agent_rpc.create_consumers(endpoints,
                                                     self.topic,
                                                     consumers,
                                                     start_listening=False)
    def __init__(self, physical_devices_mappings, exclude_devices,
                 polling_interval):

        self.polling_interval = polling_interval
        self.setup_eswitch_mgr(physical_devices_mappings,
                               exclude_devices)
        configurations = {'device_mappings': physical_devices_mappings}
        self.agent_state = {
            'binary': 'neutron-sriov-nic-agent',
            'host': cfg.CONF.host,
            'topic': q_constants.L2_AGENT_TOPIC,
            'configurations': configurations,
            'agent_type': q_constants.AGENT_TYPE_NIC_SWITCH,
            'start_flag': True}

        # Stores port update notifications for processing in the main loop
        self.updated_devices = set()

        self.context = context.get_admin_context_without_session()
        self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.sg_agent = sg_rpc.SecurityGroupAgentRpc(self.context,
                self.sg_plugin_rpc)
        self._setup_rpc()
        # Initialize iteration counter
        self.iter_num = 0
Exemple #6
0
    def setup_rpc(self):

        self.host = socket.gethostname()
        self.agent_id = 'nvsd-q-agent.%s' % self.host
        LOG.info(_LI("RPC agent_id: %s"), self.agent_id)

        self.topic = topics.AGENT
        self.context = n_context.get_admin_context_without_session()
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.sg_agent = sg_rpc.SecurityGroupAgentRpc(self.context,
                                                     self.sg_plugin_rpc,
                                                     self.root_helper)

        # RPC network init
        # Handle updates from service
        self.callback_oc = NVSDAgentRpcCallback(self.context, self,
                                                self.sg_agent)
        self.callback_sg = SecurityGroupAgentRpcCallback(
            self.context, self.sg_agent)
        self.endpoints = [self.callback_oc, self.callback_sg]
        # Define the listening consumer for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.SECURITY_GROUP, topics.UPDATE]]
        self.connection = agent_rpc.create_consumers(self.endpoints,
                                                     self.topic, consumers)
Exemple #7
0
    def __init__(self, physical_devices_mappings, exclude_devices,
                 polling_interval):

        self.polling_interval = polling_interval
        self.conf = cfg.CONF
        self.setup_eswitch_mgr(physical_devices_mappings, exclude_devices)
        configurations = {'device_mappings': physical_devices_mappings}
        self.agent_state = {
            'binary': 'neutron-sriov-nic-agent',
            'host': self.conf.host,
            'topic': n_constants.L2_AGENT_TOPIC,
            'configurations': configurations,
            'agent_type': n_constants.AGENT_TYPE_NIC_SWITCH,
            'start_flag': True
        }

        # Stores port update notifications for processing in the main loop
        self.updated_devices = set()
        self.mac_to_port_id_mapping = {}

        self.context = context.get_admin_context_without_session()
        self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.sg_agent = sg_rpc.SecurityGroupAgentRpc(self.context,
                                                     self.sg_plugin_rpc)
        self._setup_rpc()
        self.ext_manager = self._create_agent_extension_manager(
            self.connection)
        # The initialization is complete; we can start receiving messages
        self.connection.consume_in_threads()
        # Initialize iteration counter
        self.iter_num = 0
Exemple #8
0
 def _setup_rpc(self):
     self.topic = topics.AGENT
     self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
     self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
     self.context = q_context.get_admin_context_without_session()
     self.endpoints = [self]
     consumers = [[topics.PORT, topics.UPDATE],
                  [topics.SECURITY_GROUP, topics.UPDATE]]
     self.connection = agent_rpc.create_consumers(self.endpoints,
                                                  self.topic, consumers)
 def _setup_rpc(self):
     self.topic = topics.AGENT
     self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
     self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
     self.context = q_context.get_admin_context_without_session()
     self.endpoints = [self]
     consumers = [[topics.PORT, topics.UPDATE],
                  [topics.SECURITY_GROUP, topics.UPDATE]]
     self.connection = agent_rpc.create_consumers(self.endpoints,
                                                  self.topic, consumers)
     self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
     report_interval = cfg.CONF.AGENT.report_interval
     if report_interval:
         heartbeat = loopingcall.FixedIntervalLoopingCall(
             self._report_state)
         heartbeat.start(interval=report_interval)
Exemple #10
0
 def setUp(self):
     super(TestOneConvergenceAgentBase, self).setUp()
     cfg.CONF.set_default('firewall_driver',
                          'neutron.agent.firewall.NoopFirewallDriver',
                          group='SECURITYGROUP')
     with mock.patch('oslo_service.loopingcall.'
                     'FixedIntervalLoopingCall') as loopingcall:
         kwargs = {'integ_br': 'integration_bridge', 'polling_interval': 5}
         context = mock.Mock()
         self.agent = nvsd_neutron_agent.NVSDNeutronAgent(**kwargs)
         sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
         self.sg_agent = sg_rpc.SecurityGroupAgentRpc(
             context, sg_plugin_rpc)
         self.callback_nvsd = nvsd_neutron_agent.NVSDAgentRpcCallback(
             context, self.agent, self.sg_agent)
         self.loopingcall = loopingcall
    def _setup_rpc(self):
        self.agent_id = 'hyperv_%s' % platform.node()
        self.topic = topics.AGENT
        self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)

        # RPC network init
        self.context = context.get_admin_context_without_session()
        self.sec_groups_agent = HyperVSecurityAgent(self.context,
                                                    self.sg_plugin_rpc)
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)

        # Handle updates from service
        self.endpoints = [self]
        # Define the listening consumers for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.NETWORK, topics.DELETE],
                     [topics.PORT, topics.DELETE]]
        if CONF.NVGRE.enable_support:
            consumers.append([h_const.TUNNEL, topics.UPDATE])
            consumers.append([h_const.LOOKUP, h_const.UPDATE])

        self.connection = agent_rpc.create_consumers(self.endpoints,
                                                     self.topic,
                                                     consumers,
                                                     start_listening=False)

        if CONF.AGENT.enable_qos_extension:
            self._qos_ext = qos_extension.QosAgentExtension()
            self._qos_ext.consume_api(self)
            self._qos_ext.initialize(self.connection, 'hyperv')

        self.connection.consume_in_threads()

        self.client = n_rpc.get_client(self.target)
        report_interval = CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)

        self._vlan_driver = trunk_driver.HyperVTrunkDriver(self.context)
Exemple #12
0
    def setup_rpc(self):
        self.agent_id = 'opflex-agent-%s' % cfg.CONF.host
        self.context = context.get_admin_context_without_session()
        # Set GBP rpc API
        self.of_rpc = rpc.GBPServerRpcApi(rpc.TOPIC_OPFLEX)
        self.plugin_rpc = ovs.OVSPluginApi(topics.PLUGIN)
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.sg_agent = sg_rpc.SecurityGroupAgentRpc(
            self.context, self.sg_plugin_rpc, defer_refresh_firewall=True)

        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
        self.topic = topics.AGENT
        self.endpoints = [self]
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.PORT, topics.DELETE],
                     [topics.SECURITY_GROUP, topics.UPDATE],
                     [topics.SUBNET, topics.UPDATE],
                     [rpc.TOPIC_OPFLEX, rpc.VRF, topics.UPDATE]]
        self.connection = agent_rpc.create_consumers(
            self.endpoints, self.topic, consumers, start_listening=False)
Exemple #13
0
 def __init__(self, interface_mapping, root_helper):
     self._polling_interval = cfg.CONF.AGENT.polling_interval
     self._setup_eswitches(interface_mapping)
     configurations = {'interface_mappings': interface_mapping}
     self.agent_state = {
         'binary': 'neutron-mlnx-agent',
         'host': cfg.CONF.host,
         'topic': q_constants.L2_AGENT_TOPIC,
         'configurations': configurations,
         'agent_type': q_constants.AGENT_TYPE_MLNX,
         'start_flag': True
     }
     # Stores port update notifications for processing in main rpc loop
     self.updated_ports = set()
     self.context = context.get_admin_context_without_session()
     self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
     self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
     self.sg_agent = sg_rpc.SecurityGroupAgentRpc(self.context,
                                                  self.sg_plugin_rpc,
                                                  root_helper)
     self._setup_rpc()
Exemple #14
0
    def setup_rpc(self):
        self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.sg_agent = sg_rpc.SecurityGroupAgentRpc(
            self.context, self.sg_plugin_rpc, defer_refresh_firewall=True)

        self.agent_id = self.mgr.get_agent_id()
        LOG.info(_LI("RPC agent_id: %s"), self.agent_id)

        self.topic = topics.AGENT
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS)
        # RPC network init
        # Handle updates from service
        self.rpc_callbacks = self.mgr.get_rpc_callbacks(self.context, self,
                                                        self.sg_agent)
        self.endpoints = [self.rpc_callbacks]
        self._validate_rpc_endpoints()
        # Define the listening consumers for the agent
        consumers = self.mgr.get_rpc_consumers()
        self.connection = agent_rpc.create_consumers(self.endpoints,
                                                     self.topic,
                                                     consumers)
Exemple #15
0
    def setup_rpc(self):
        mac = self.int_br.get_local_port_mac()
        self.agent_id = '%s%s' % ('ovs', (mac.replace(":", "")))
        self.topic = topics.AGENT
        self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)

        # RPC network init
        self.context = context.get_admin_context_without_session()
        # Handle updates from service
        self.endpoints = [self]
        # Define the listening consumers for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.SECURITY_GROUP, topics.UPDATE],
                     [topics.L2POPULATION, topics.UPDATE, cfg.CONF.host]]
        self.connection = agent_rpc.create_consumers(self.endpoints,
                                                     self.topic, consumers)
        report_interval = cfg.CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)