Esempio n. 1
0
 def agent_restarted(self, context):
     agent_host = context.host
     port_context = context._plugin_context
     agent = l2pop_db.get_agent_by_host(port_context, agent_host)
     if l2pop_db.get_agent_uptime(agent) < cfg.CONF.l2pop.agent_boot_time:
         return True
     return False
Esempio n. 2
0
 def agent_restarted(self, context):
     agent_host = context.host
     port_context = context._plugin_context
     agent = l2pop_db.get_agent_by_host(port_context, agent_host)
     if l2pop_db.get_agent_uptime(agent) < cfg.CONF.l2pop.agent_boot_time:
         return True
     return False
Esempio n. 3
0
 def agent_restarted(self, context):
     agent_host = context.host
     port_context = context._plugin_context
     agent = l2pop_db.get_agent_by_host(port_context, agent_host)
     if l2pop_db.get_agent_uptime(agent) < cfg.CONF.l2pop.agent_boot_time:
         LOG.warning("Agent on host '%s' did not supply 'agent_restarted' "
                     "information in RPC message, determined it restarted "
                     "based on deprecated 'agent_boot_time' config option.",
                     agent_host)
         return True
     return False
Esempio n. 4
0
 def agent_restarted(self, context):
     agent_host = context.host
     session = db_api.get_reader_session()
     agent = l2pop_db.get_agent_by_host(session, agent_host)
     if l2pop_db.get_agent_uptime(agent) < cfg.CONF.l2pop.agent_boot_time:
         LOG.warning(
             _LW("Agent on host '%s' did not supply "
                 "'agent_restarted'information in RPC message, "
                 "determined it restarted based on deprecated "
                 "'agent_boot_time' config option."), agent_host)
         return True
     return False
Esempio n. 5
0
    def update_port_up(self, context):
        port = context.current
        agent_host = context.host
        session = db_api.get_reader_session()
        port_context = context._plugin_context
        agent = l2pop_db.get_agent_by_host(session, agent_host)
        if not agent:
            LOG.warning(_LW("Unable to retrieve active L2 agent on host %s"),
                        agent_host)
            return

        network_id = port['network_id']

        agent_active_ports = l2pop_db.get_agent_network_active_port_count(
            session, agent_host, network_id)

        agent_ip = l2pop_db.get_agent_ip(agent)
        segment = context.bottom_bound_segment
        if not self._validate_segment(segment, port['id'], agent):
            return
        other_fdb_entries = self._get_fdb_entries_template(
            segment, agent_ip, network_id)
        other_fdb_ports = other_fdb_entries[network_id]['ports']

        if agent_active_ports == 1 or (l2pop_db.get_agent_uptime(agent) <
                                       cfg.CONF.l2pop.agent_boot_time):
            # First port activated on current agent in this network,
            # we have to provide it with the whole list of fdb entries
            agent_fdb_entries = self._create_agent_fdb(session,
                                                       agent,
                                                       segment,
                                                       network_id)

            # And notify other agents to add flooding entry
            other_fdb_ports[agent_ip].append(const.FLOODING_ENTRY)

            if agent_fdb_entries[network_id]['ports'].keys():
                self.L2populationAgentNotify.add_fdb_entries(
                    self.rpc_ctx, agent_fdb_entries, agent_host)

        # Notify other agents to add fdb rule for current port
        if (port['device_owner'] != const.DEVICE_OWNER_DVR_INTERFACE and
            not l3_hamode_db.is_ha_router_port(
                port_context, port['device_owner'], port['device_id'])):
            other_fdb_ports[agent_ip] += self._get_port_fdb_entries(port)

        self.L2populationAgentNotify.add_fdb_entries(self.rpc_ctx,
                                                     other_fdb_entries)
Esempio n. 6
0
    def update_port_up(self, context):
        port = context.current
        agent_host = context.host
        port_context = context._plugin_context
        agent = l2pop_db.get_agent_by_host(port_context, agent_host)
        if not agent:
            LOG.warning("Unable to retrieve active L2 agent on host %s",
                        agent_host)
            return

        network_id = port['network_id']

        agent_active_ports = l2pop_db.get_agent_network_active_port_count(
            port_context, agent_host, network_id)

        agent_ip = l2pop_db.get_agent_ip(agent)
        segment = context.bottom_bound_segment
        if not self._validate_segment(segment, port['id'], agent):
            return
        other_fdb_entries = self._get_fdb_entries_template(
            segment, agent_ip, network_id)
        other_fdb_ports = other_fdb_entries[network_id]['ports']

        if agent_active_ports == 1 or (l2pop_db.get_agent_uptime(agent) <
                                       cfg.CONF.l2pop.agent_boot_time):
            # First port activated on current agent in this network,
            # we have to provide it with the whole list of fdb entries
            agent_fdb_entries = self._create_agent_fdb(port_context,
                                                       agent,
                                                       segment,
                                                       network_id)

            # And notify other agents to add flooding entry
            other_fdb_ports[agent_ip].append(const.FLOODING_ENTRY)

            if agent_fdb_entries[network_id]['ports'].keys():
                self.L2populationAgentNotify.add_fdb_entries(
                    self.rpc_ctx, agent_fdb_entries, agent_host)

        # Notify other agents to add fdb rule for current port
        if (port['device_owner'] != const.DEVICE_OWNER_DVR_INTERFACE and
            not l3_hamode_db.is_ha_router_port(
                port_context, port['device_owner'], port['device_id'])):
            other_fdb_ports[agent_ip] += self._get_port_fdb_entries(port)

        self.L2populationAgentNotify.add_fdb_entries(self.rpc_ctx,
                                                     other_fdb_entries)