{% from 'macros.j2' import write_prefix_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 }}, ID {{ as_set_bundle.id }}
{%	if as_set_bundle.asns|length == 0 %}
# no origin ASNs found for {{ as_set_bundle.name }}
{%	else %}
{%		for asns in as_set_bundle.asns|sort|batch(50) %}
AS_SET_{{ as_set_bundle.name }}_asns{{ loop.index }}="{ {% for asn in asns %}{{ asn }}{% if not loop.last %}, {% endif %}{% endfor %} }"
{%		endfor %}
{%	endif %}
{%	if as_set_bundle.prefixes|length == 0 %}
# no prefixes found for {{ as_set_bundle.name }}
{%	else %}
{%              for prefixes in as_set_bundle.prefixes|batch(50) %}
AS_SET_{{ as_set_bundle.name }}_prefixes{{ loop.index }}="{ {{ write_prefix_list(prefixes) }} }"
{%		endfor %}
{%	endif %}

{% endfor %}

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

