{% from 'macros.j2' import write_prefix_list %}

# ---------------------------------------------------------
# IRRDB

{% for as_set_bundle_id in irrdb_info|sort %}
{% set as_set_bundle = irrdb_info[as_set_bundle_id] %}
# {{ as_set_bundle.descr }}, used_by {{ as_set_bundle.used_by|sort|join(", ") }}
{% if as_set_bundle.asns|length == 0 %}
# no origin ASNs found for {{ as_set_bundle.name }}
{% else %}
define AS_SET_{{ as_set_bundle.name }}_asns = [
{{ "\t" -}}
{%	for asn in as_set_bundle.asns|sort %}
{{-		asn -}}
{%		if not loop.last %}, {% endif %}
{%		if loop.index % 5 == 0 %}{{ "\n\t" }}{% endif %}
{%	endfor %}

];
{% endif %}

{% if as_set_bundle.prefixes|length == 0 %}
# no prefixes found for {{ as_set_bundle.name }}
{% else %}
define AS_SET_{{ as_set_bundle.name }}_prefixes = [
{{ write_prefix_list(as_set_bundle.prefixes, True) }}
];
{% endif %}

{% endfor %}

{% if cfg.filtering.irrdb.use_arin_bulk_whois_data.enabled %}
# ARIN Whois database records
{%	for origin_asn in arin_whois_records|sort %}
define ARIN_Whois_db_{{ origin_asn }} = [
{{ write_prefix_list(arin_whois_records[origin_asn].prefixes, True) }}
];
{%	endfor %}
{% endif %}
