Skip to content
Snippets Groups Projects
Commit dc15912b authored by Aleksandr Kurbatov's avatar Aleksandr Kurbatov
Browse files

policy-options rework

decompose policy-options template into specific templates.
parent e64e2c38
No related branches found
No related tags found
1 merge request!162promote-p-to-pe role
......@@ -2,6 +2,7 @@
<configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf">
{% include 'ip_prefix_list.j2' %}
{% include 'filters/cpm_filters.j2' %}
{% include 'policy_options/policy_options.j2' %}
{% include 'cflowd.j2' %}
{% include 'router/router_base.j2' %}
{% include 'sdp_mesh.j2' %}
......
{% for as_path in as_paths_obj %}
<as-path alu:operation="replace">
<name>{{ as_path.name }}</name>
<expression>{{ as_path.expression}}</expression>
</as-path>
{% endfor %}
{% for community in communities_obj %}
<community alu:operation="replace">
<name>{{ community.name }}</name>
<member>
<member>{{ community.member }}</member>
</member>
</community>
{% endfor %}
<policy-options xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
{% if nokia_po_prefix_lists is defined %}
{% for prefix_list in nokia_po_prefix_lists %}
<prefix-list alu:operation="replace">
<name>{{ prefix_list.name }}</name>
{% for prefix in prefix_list.prefixes %}
<prefix>
<ip-prefix>{{ prefix.ip }}</ip-prefix>
<type>{{ prefix.type }}</type>
{% if prefix.type == 'range' %}
<start-length>{{ prefix.range_start_length }}</start-length>
<end-length>{{ prefix.range_end_length }}</end-length>
{% endif %}
{% endfor %}
</prefix-list>
{% endfor %}
{% with prefix_lists_obj=nokia_po_prefix_lists %}
{% include 'policy_options/prefix_lists.j2' %}
{% endwith %}
{% endif %}
{# Communities #}
{% if nokia_po_communities is defined %}
{% for community in nokia_po_communities %}
<community alu:operation="replace">
<name>{{ community.name }}</name>
<member>
<member>{{ community.member }}</member>
</member>
</community>
{% endfor %}
{% with communities_obj=nokia_po_communities %}
{% include 'policy_options/communites.j2' %}
{% endwith %}
{% endif %}
{# AS paths #}
{% if nokia_po_as_paths is defined %}
{% for as_path in nokia_po_as_paths %}
<as-path alu:operation="replace">
<name>{{ as_path.name }}</name>
<expression>{{ as_path.expression}}</expression>
</as-path>
{% endfor %}
{% with as_paths_obj=nokia_po_as_paths %}
{% include 'policy_options/as_paths.j2' %}
{% endwith %}
{% endif %}
{# Policy statements #}
{% if nokia_po_policy_statements is defined %}
{% with policy_obj=nokia_po_policy_statements %}
{% include 'policy_options/policy_statement.j2' %}
{% endwith %}
{% endif %}
</policy-options>
<policy-options xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
{% if nokia_po_policy_statements is defined %}
{% for pol in nokia_po_policy_statements %}
{% for pol in policy_obj %}
<policy-statement alu:operation="replace">
<name>{{ pol.name }}</name>
<entry-type>{{ pol.entry_type }}</entry-type>
......@@ -62,4 +60,3 @@
</policy-statement>
{% endfor %}
{% endif %}
</policy-options>
{% for prefix_list in prefix_lists_obj %}
<prefix-list alu:operation="replace">
<name>{{ prefix_list.name }}</name>
{% for prefix in prefix_list.prefixes %}
<prefix>
<ip-prefix>{{ prefix.ip }}</ip-prefix>
<type>{{ prefix.type }}</type>
{% if prefix.type == 'range' %}
<start-length>{{ prefix.range_start_length }}</start-length>
<end-length>{{ prefix.range_end_length }}</end-length>
{% endif %}
{% endfor %}
</prefix-list>
{% endfor %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment