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">
{% if nokia_po_prefix_lists is defined %}
{% with prefix_lists_obj=nokia_po_prefix_lists %}
{% include 'policy_options/prefix_lists.j2' %}
{% endwith %}
{% endif %}
{# Communities #}
{% if nokia_po_communities is defined %}
{% with communities_obj=nokia_po_communities %}
{% include 'policy_options/communites.j2' %}
{% endwith %}
{% endif %}
{# AS paths #}
{% if nokia_po_as_paths is defined %}
{% 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_prefix_lists is defined %}
{% with prefix_lists_obj=nokia_po_prefix_lists %}
{% include 'policy_options/prefix_lists.j2' %}
{% endwith %}
{% endif %}
{# Communities #}
{% if nokia_po_communities is defined %}
{% with communities_obj=nokia_po_communities %}
{% include 'policy_options/communities.j2' %}
{% endwith %}
{% endif %}
{# AS paths #}
{% if nokia_po_as_paths is defined %}
{% 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_statements.j2' %}
{% endwith %}
{% endif %}
</policy-options>
......@@ -3,60 +3,64 @@
<name>{{ pol.name }}</name>
<entry-type>{{ pol.entry_type }}</entry-type>
{% for entry in pol.entries %}
{% if pol.entry_type == 'named' %}
<named-entry>
{% endif %}
<entry-name>{{ entry.name }}</entry-name>
{% if entry.from is defined %}
<from>
{% if entry.from.as_path is defined %}
<as-path>
{% if entry.from.as_path.name is defined %}
<name>{{ entry.from.as_path.name }}</name>
<name>{{ entry.from.as_path.name }}</name>
{% endif %}
{% if entry.from.as_path.length is defined %}
<length>
<value>{{ entry.from.as_path.length }}</value>
</length>
<length>
<value>{{ entry.from.as_path.length }}</value>
</length>
{% endif %}
</as-path>
{% endif %}
{% if entry.from.prefix_list is defined %}
{% for pl in entry.from.prefix_list %}
<prefix_list>{{ pl }}</prefix_list>
<prefix-list>{{ pl }}</prefix-list>
{% endfor %}
{% endif %}
{% if entry.from.community is defined %}
<community>
<name>{{ entry.from.community }}</name>
</community>
<community>
<name>{{ entry.from.community }}</name>
</community>
{% endif %}
{% 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 %}
{% if entry.from.protocol is defined %}
{% for proto in entry.from.protocol %}
<protocol>
<name>{{ proto }}</name>
</protocol>
<protocol>
<name>{{ proto }}</name>
</protocol>
{% endfor %}
{% endif %}
</from>
{% endif %}
<action>
<action-type>{{ entry.action_type }}</action-type>
<action-type>{{ entry.action_type }}</action-type>
{% if entry.action is defined %}
{% for action_item in entry.action %}
{% for act_k, act_v in action_item.items() %}
{% if act_k == "community_add" %}
<community>
<add>{{ act_v }}</add>
</community>
<community>
<add>{{ act_v }}</add>
</community>
{% else %}
<{{ act_k }}>{{ act_v }}</{{act_k }}>
<{{ act_k | replace("_", "-") }}>{{ act_v }}</{{act_k | replace("_", "-") }}>
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
</action>
</named-entry>
{% endfor %}
</policy-statement>
{% endfor %}
{% endif %}
......@@ -9,6 +9,7 @@
<start-length>{{ prefix.range_start_length }}</start-length>
<end-length>{{ prefix.range_end_length }}</end-length>
{% endif %}
</prefix>
{% 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