Пример #1
0
    def _get_port_infos(self, port, segment, agent_host):
        if not agent_host:
            return

        session = db_api.get_session()
        agent = l2pop_db.get_agent_by_host(session, agent_host)
        if not agent:
            return

        agent_ip = l2pop_db.get_agent_ip(agent)
        if not agent_ip:
            LOG.warning(_LW("Unable to retrieve the agent ip, check the agent "
                            "configuration."))
            return

        if not segment:
            LOG.warning(_LW("Port %(port)s updated by agent %(agent)s "
                            "isn't bound to any segment"),
                        {'port': port['id'], 'agent': agent})
            return

        network_types = l2pop_db.get_agent_l2pop_network_types(agent)
        if network_types is None:
            network_types = l2pop_db.get_agent_tunnel_types(agent)
        if segment['network_type'] not in network_types:
            return

        fdb_entries = [l2pop_rpc.PortInfo(mac_address=port['mac_address'],
                                          ip_address=ip['ip_address'])
                       for ip in port['fixed_ips']]
        return agent_ip, fdb_entries
Пример #2
0
    def _validate_segment(self, segment, port_id, agent):
        if not segment:
            LOG.debug("Port %(port)s updated by agent %(agent)s isn't bound "
                      "to any segment", {'port': port_id, 'agent': agent})
            return False

        network_types = l2pop_db.get_agent_l2pop_network_types(agent)
        if network_types is None:
            network_types = l2pop_db.get_agent_tunnel_types(agent)
        if segment['network_type'] not in network_types:
            return False

        return True
    def _get_and_validate_segment(self, context, port_id, agent):
        segment = context.bottom_bound_segment
        if not segment:
            LOG.debug("Port %(port)s updated by agent %(agent)s isn't bound "
                      "to any segment", {'port': port_id, 'agent': agent})
            return

        network_types = l2pop_db.get_agent_l2pop_network_types(agent)
        if network_types is None:
            network_types = l2pop_db.get_agent_tunnel_types(agent)
        if segment['network_type'] not in network_types:
            return

        return segment
Пример #4
0
    def _validate_segment(self, segment, port_id, agent):
        if not segment:
            LOG.debug(
                "Port %(port)s updated by agent %(agent)s isn't bound "
                "to any segment", {
                    'port': port_id,
                    'agent': agent
                })
            return False

        network_types = l2pop_db.get_agent_l2pop_network_types(agent)
        if network_types is None:
            network_types = l2pop_db.get_agent_tunnel_types(agent)
        if segment['network_type'] not in network_types:
            return False

        return True
Пример #5
0
    def _get_and_validate_segment(self, context, port_id, agent):
        segment = context.bottom_bound_segment
        if not segment:
            LOG.debug(
                "Port %(port)s updated by agent %(agent)s isn't bound "
                "to any segment", {
                    'port': port_id,
                    'agent': agent
                })
            return

        network_types = l2pop_db.get_agent_l2pop_network_types(agent)
        if network_types is None:
            network_types = l2pop_db.get_agent_tunnel_types(agent)
        if segment['network_type'] not in network_types:
            return

        return segment
Пример #6
0
    def _get_port_infos(self, port, segment, agent_host):
        if not agent_host:
            return

        session = db_api.get_session()
        agent = l2pop_db.get_agent_by_host(session, agent_host)
        if not agent:
            return

        agent_ip = l2pop_db.get_agent_ip(agent)
        if not agent_ip:
            LOG.warning(
                _LW("Unable to retrieve the agent ip, check the agent "
                    "configuration."))
            return

        if not segment:
            LOG.warning(
                _LW("Port %(port)s updated by agent %(agent)s "
                    "isn't bound to any segment"), {
                        'port': port['id'],
                        'agent': agent
                    })
            return

        network_types = l2pop_db.get_agent_l2pop_network_types(agent)
        if network_types is None:
            network_types = l2pop_db.get_agent_tunnel_types(agent)
        if segment['network_type'] not in network_types:
            return

        fdb_entries = [
            l2pop_rpc.PortInfo(mac_address=port['mac_address'],
                               ip_address=ip['ip_address'])
            for ip in port['fixed_ips']
        ]
        return agent_ip, fdb_entries