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 @@ ...@@ -2,6 +2,7 @@
<configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf"> <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf">
{% include 'ip_prefix_list.j2' %} {% include 'ip_prefix_list.j2' %}
{% include 'filters/cpm_filters.j2' %} {% include 'filters/cpm_filters.j2' %}
{% include 'policy_options/policy_options.j2' %}
{% include 'cflowd.j2' %} {% include 'cflowd.j2' %}
{% include 'router/router_base.j2' %} {% include 'router/router_base.j2' %}
{% include 'sdp_mesh.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"> <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 %} {% if nokia_po_prefix_lists is defined %}
{% for prefix_list in nokia_po_prefix_lists %} {% with prefix_lists_obj=nokia_po_prefix_lists %}
<prefix-list alu:operation="replace"> {% include 'policy_options/prefix_lists.j2' %}
<name>{{ prefix_list.name }}</name> {% endwith %}
{% 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 %}
{% endif %} {% endif %}
{# Communities #} {# Communities #}
{% if nokia_po_communities is defined %} {% if nokia_po_communities is defined %}
{% for community in nokia_po_communities %} {% with communities_obj=nokia_po_communities %}
<community alu:operation="replace"> {% include 'policy_options/communites.j2' %}
<name>{{ community.name }}</name> {% endwith %}
<member>
<member>{{ community.member }}</member>
</member>
</community>
{% endfor %}
{% endif %} {% endif %}
{# AS paths #} {# AS paths #}
{% if nokia_po_as_paths is defined %} {% if nokia_po_as_paths is defined %}
{% for as_path in nokia_po_as_paths %} {% with as_paths_obj=nokia_po_as_paths %}
<as-path alu:operation="replace"> {% include 'policy_options/as_paths.j2' %}
<name>{{ as_path.name }}</name> {% endwith %}
<expression>{{ as_path.expression}}</expression> {% endif %}
</as-path> {# Policy statements #}
{% endfor %} {% if nokia_po_policy_statements is defined %}
{% with policy_obj=nokia_po_policy_statements %}
{% include 'policy_options/policy_statement.j2' %}
{% endwith %}
{% endif %} {% endif %}
</policy-options> </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"> {% for pol in policy_obj %}
{% if nokia_po_policy_statements is defined %}
{% for pol in nokia_po_policy_statements %}
<policy-statement alu:operation="replace"> <policy-statement alu:operation="replace">
<name>{{ pol.name }}</name> <name>{{ pol.name }}</name>
<entry-type>{{ pol.entry_type }}</entry-type> <entry-type>{{ pol.entry_type }}</entry-type>
...@@ -62,4 +60,3 @@ ...@@ -62,4 +60,3 @@
</policy-statement> </policy-statement>
{% endfor %} {% endfor %}
{% endif %} {% 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