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

updates and fixes to policy_options

parent 1aa08419
No related branches found
No related tags found
1 merge request!162promote-p-to-pe role
<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 %}
{% with prefix_lists_obj=nokia_po_prefix_lists %} {% with prefix_lists_obj=nokia_po_prefix_lists %}
{% include 'policy_options/prefix_lists.j2' %} {% include 'policy_options/prefix_lists.j2' %}
{% endwith %} {% endwith %}
{% endif %} {% endif %}
{# Communities #}
{% if nokia_po_communities is defined %} {# Communities #}
{% with communities_obj=nokia_po_communities %} {% if nokia_po_communities is defined %}
{% include 'policy_options/communites.j2' %} {% with communities_obj=nokia_po_communities %}
{% endwith %} {% include 'policy_options/communities.j2' %}
{% endif %} {% endwith %}
{# AS paths #} {% endif %}
{% if nokia_po_as_paths is defined %}
{% with as_paths_obj=nokia_po_as_paths %} {# AS paths #}
{% include 'policy_options/as_paths.j2' %} {% if nokia_po_as_paths is defined %}
{% endwith %} {% with as_paths_obj=nokia_po_as_paths %}
{% endif %} {% include 'policy_options/as_paths.j2' %}
{# Policy statements #} {% endwith %}
{% if nokia_po_policy_statements is defined %} {% endif %}
{% with policy_obj=nokia_po_policy_statements %}
{% include 'policy_options/policy_statement.j2' %} {# Policy statements #}
{% endwith %} {% if nokia_po_policy_statements is defined %}
{% endif %} {% with policy_obj=nokia_po_policy_statements %}
</policy-options> {% include 'policy_options/policy_statements.j2' %}
{% endwith %}
{% endif %}
</policy-options>
...@@ -3,60 +3,64 @@ ...@@ -3,60 +3,64 @@
<name>{{ pol.name }}</name> <name>{{ pol.name }}</name>
<entry-type>{{ pol.entry_type }}</entry-type> <entry-type>{{ pol.entry_type }}</entry-type>
{% for entry in pol.entries %} {% for entry in pol.entries %}
{% if pol.entry_type == 'named' %}
<named-entry>
{% endif %}
<entry-name>{{ entry.name }}</entry-name> <entry-name>{{ entry.name }}</entry-name>
{% if entry.from is defined %} {% if entry.from is defined %}
<from> <from>
{% if entry.from.as_path is defined %} {% if entry.from.as_path is defined %}
<as-path> <as-path>
{% if entry.from.as_path.name is defined %} {% if entry.from.as_path.name is defined %}
<name>{{ entry.from.as_path.name }}</name> <name>{{ entry.from.as_path.name }}</name>
{% endif %} {% endif %}
{% if entry.from.as_path.length is defined %} {% if entry.from.as_path.length is defined %}
<length> <length>
<value>{{ entry.from.as_path.length }}</value> <value>{{ entry.from.as_path.length }}</value>
</length> </length>
{% endif %} {% endif %}
</as-path> </as-path>
{% endif %} {% endif %}
{% if entry.from.prefix_list is defined %} {% if entry.from.prefix_list is defined %}
{% for pl in entry.from.prefix_list %} {% for pl in entry.from.prefix_list %}
<prefix_list>{{ pl }}</prefix_list> <prefix-list>{{ pl }}</prefix-list>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if entry.from.community is defined %} {% if entry.from.community is defined %}
<community> <community>
<name>{{ entry.from.community }}</name> <name>{{ entry.from.community }}</name>
</community> </community>
{% endif %} {% endif %}
{% if entry.from.origin_validation_state is defined %} {% if entry.from.origin_validation_state is defined %}
<origin-validation-state>{{ entry.from.origin_validation_state }}</origin-validation-state> <origin-validation-state>{{ entry.from.origin_validation_state }}</origin-validation-state>
{% endif %} {% endif %}
{% if entry.from.protocol is defined %} {% if entry.from.protocol is defined %}
{% for proto in entry.from.protocol %} {% for proto in entry.from.protocol %}
<protocol> <protocol>
<name>{{ proto }}</name> <name>{{ proto }}</name>
</protocol> </protocol>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</from> </from>
{% endif %} {% endif %}
<action> <action>
<action-type>{{ entry.action_type }}</action-type> <action-type>{{ entry.action_type }}</action-type>
{% if entry.action is defined %} {% if entry.action is defined %}
{% for action_item in entry.action %} {% for action_item in entry.action %}
{% for act_k, act_v in action_item.items() %} {% for act_k, act_v in action_item.items() %}
{% if act_k == "community_add" %} {% if act_k == "community_add" %}
<community> <community>
<add>{{ act_v }}</add> <add>{{ act_v }}</add>
</community> </community>
{% else %} {% else %}
<{{ act_k }}>{{ act_v }}</{{act_k }}> <{{ act_k | replace("_", "-") }}>{{ act_v }}</{{act_k | replace("_", "-") }}>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</action> </action>
</named-entry>
{% endfor %} {% endfor %}
</policy-statement> </policy-statement>
{% endfor %} {% endfor %}
{% endif %}
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<start-length>{{ prefix.range_start_length }}</start-length> <start-length>{{ prefix.range_start_length }}</start-length>
<end-length>{{ prefix.range_end_length }}</end-length> <end-length>{{ prefix.range_end_length }}</end-length>
{% endif %} {% endif %}
</prefix>
{% endfor %} {% endfor %}
</prefix-list> </prefix-list>
{% endfor %} {% endfor %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment