-- LOGGING section ----------------------------------
{% include "logging.lua.j2" %}
+-- MONITORING section -------------------------------
+{% include "monitoring.lua.j2" %}
+
-- WEBMGMT section ----------------------------------
{% include "webmgmt.lua.j2" %}
-- VIEWS section ------------------------------------
{# {% include "views.lua.j2" %} #}
--- LOCAL-DATA section -----------------------------
-{% include "local_data.lua.j2" %}
+-- LOCAL-DATA section -------------------------------
+{# {% include "local_data.lua.j2" %} #}
-- SLICES section -----------------------------------
{# {% include "slices.lua.j2" %} #}
-- RPZ section --------------------------------------
{# {% include "rpz.lua.j2" %} #}
--- FORWARD section ----------------------------
+-- FORWARD section ----------------------------------
{% include "forward.lua.j2" %}
-- CACHE section ------------------------------------
{% if cfg.lua.script %}
{{ cfg.lua.script }}
{% endif %}
-
--- manager's monitoring configuration
-{% include "monitoring.lua.j2" %}
\ No newline at end of file
+{% from 'macros/common_macros.lua.j2' import string_table %}
+{% from 'macros/policy_macros.lua.j2' import policy_get_tagset, policy_todname %}
+{% from 'macros/local_data_macros.lua.j2' import local_data_emptyzone, local_data_nxdomain %}
+
+local C = require('ffi').C
+
+
+{# TODO: implemented all other options/features from local_data_schema #}
+
+
+{% for subtree in cfg.local_data.subnets %}
+
+{# IF subtree.roots is not None #}
+{% if subtree.roots -%}
+{%- for root in subtree.roots -%}
+
+
+{% if subtree.type == 'empty' -%}
+{{ local_data_emptyzone(policy_todname(root), policy_get_tagset(string_table(subtree.tags))) }}
+{%- elif subtree.type == 'nxdomain' -%}
+{{ view_insert_action(policy_todname(root), policy_get_tagset(string_table(subtree.tags))) }}
+{% else %}
+{# TODO: implement other possible types #}
+{%- endif %}
+
+{%- endfor -%}
+{%- endif %}
+
+{# IF subtree.roots_file is not None #}
+{% if subtree.roots_file -%}
+{# TODO: not implemented yet #}
+{%- endif %}
+
+{# IF subtree.roots_url is not None #}
+{% if subtree.roots_url -%}
+{# TODO: not implemented yet #}
+{%- endif %}
+
+{% endfor %}
--- /dev/null
+{% macro local_data_emptyzone(dname, tags) -%}
+assert(C.kr_rule_local_data_emptyzone({{ dname }},{{ tags }})==0)
+{%- endmacro %}
+
+{% macro local_data_nxdomain(dname, tags) -%}
+assert(C.kr_rule_local_data_nxdomain({{ dname }},{{ tags }})==0)
+{%- endmacro %}