diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/pe_base_config.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/pe_base_config.j2 index 0df1cfb3413c3ab8e04c6a31491f2cb3997703eb..b2b897bc45e0e9a2e31f1cd4d28e0c7ce4f7b6fe 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/pe_base_config.j2 +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/pe_base_config.j2 @@ -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' %} diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/as_paths.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/as_paths.j2 new file mode 100644 index 0000000000000000000000000000000000000000..fadb9c5b01a5b69c57cd13877f0c9b4d86dea62a --- /dev/null +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/as_paths.j2 @@ -0,0 +1,6 @@ + {% 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 %} diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/communities.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/communities.j2 new file mode 100644 index 0000000000000000000000000000000000000000..631ddacf38c264784038e969961227f8a09f186c --- /dev/null +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/communities.j2 @@ -0,0 +1,8 @@ + {% for community in communities_obj %} + <community alu:operation="replace"> + <name>{{ community.name }}</name> + <member> + <member>{{ community.member }}</member> + </member> + </community> + {% endfor %} diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/policy_options.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/policy_options.j2 index 089e202d432ee0dbfcfebe1165471795a542e00a..047dc0e8d49df8f4ba3409189c6fde4a1aa27684 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/policy_options.j2 +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/policy_options.j2 @@ -1,39 +1,26 @@ <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> diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/policy_statements.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/policy_statements.j2 index 1da7e3215916eb8ee3807e4b3f7e01d50b066f27..3e451852fba859acd7595ca33e8b5d0d2888986c 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/policy_statements.j2 +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/policy_statements.j2 @@ -1,6 +1,4 @@ -<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> diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/prefix_lists.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/prefix_lists.j2 new file mode 100644 index 0000000000000000000000000000000000000000..67529ea5b0af0e1b6cf0b5ddb936a502dc3d4643 --- /dev/null +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/policy_options/prefix_lists.j2 @@ -0,0 +1,14 @@ + {% 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 %}