{% from 'macros.j2' import write_prefix_list %}
{% from 'macros.j2' import write_prefixset_list %}
# ---------------------------------------------------------
# IRRDB

{{ "pre-irrdb"|include_local_file -}}

{% 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 %}
as-set "AS_SET_{{ as_set_bundle.name }}_asns" {
{%		for asns in as_set_bundle.asns|sort|batch(8) %}
{{			"    " -}}
{%			for asn in asns %}{{ asn }}{% if not loop.last %}{{ " " }}{% else %}{{ "\n" }}{% endif %}{% endfor %}
{%		endfor %}
}
{%	endif %}
{%	if as_set_bundle.prefixes|length == 0 %}
# no prefixes found for {{ as_set_bundle.name }}
{%	else %}
prefix-set "AS_SET_{{ as_set_bundle.name }}_prefixes" {
{{			write_prefixset_list(as_set_bundle.prefixes) -}}
}
{%	endif %}

{% endfor %}

{{ "post-irrdb"|include_local_file -}}

