summaryrefslogtreecommitdiffstats
path: root/python/knot_resolver_manager/manager/datamodel/templates/views.lua.j2
blob: 81de8c7b78d28ef04ad0eb856d2094046c71ce37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{% from 'macros/common_macros.lua.j2' import quotes %}
{% from 'macros/view_macros.lua.j2' import get_proto_set, view_flags, view_answer %}
{% from 'macros/policy_macros.lua.j2' import policy_flags, policy_tags_assign %}

{% if cfg.views %}
{% for view in cfg.views %}
{% for subnet in view.subnets %}

assert(C.kr_view_insert_action('{{ subnet }}', '{{ view.dst_subnet or '' }}',
  {{ get_proto_set(view.protocols) }}, policy.COMBINE({
{%- set flags = view_flags(view.options) -%}
{% if flags %}
	{{ quotes(policy_flags(flags)) }},
{%- endif %}

{% if view.tags %}
	{{ policy_tags_assign(view.tags) }},
{% elif view.answer %}
	{{ view_answer(view.answer) }},
{%- endif %}
  })) == 0)

{% endfor %}
{% endfor %}
{% endif %}