From a5226a6442767ffec315d947ccdac6109c48a7e8 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342-AKURBATOV.local> Date: Wed, 14 Aug 2024 20:10:10 +0100 Subject: [PATCH] updates and fixes to router templates --- .../routers/nokia/router/base_bgp.j2 | 5 +- .../routers/nokia/router/flowspec.j2 | 9 +-- .../routers/nokia/router/isis_overload.j2 | 14 ++-- .../templates/routers/nokia/router/ldp.j2 | 2 +- .../routers/nokia/router/router_base.j2 | 7 +- .../templates/routers/nokia/router/rpki.j2 | 24 +++---- .../routers/nokia/router/static_routes.j2 | 72 ++++++++++--------- .../templates/routers/nokia/router/vprn.j2 | 7 +- 8 files changed, 76 insertions(+), 64 deletions(-) diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/base_bgp.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/base_bgp.j2 index 4aa65507..e6159684 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/base_bgp.j2 +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/base_bgp.j2 @@ -1,4 +1,4 @@ - <bgp 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"> + <bgp 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 pe_bgp_base.best_path_selection is defined %} <best-path-selection> {% for bps in pe_bgp_base.best_path_selection %} @@ -32,4 +32,5 @@ {% with bgp_obj=pe_bgp_internal %} {% include "router/bgp_group.j2" %} {% endwith %} - </bgp> + </bgp> + diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/flowspec.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/flowspec.j2 index 22a7f05d..e1f40f15 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/flowspec.j2 +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/flowspec.j2 @@ -1,5 +1,6 @@ -<flowspec alu:operation="replace"> - <ip-filter-max-size>{{ nokia_flowspec.ip_filter_max_size }}</ip-filter-max-size> - <ipv6-filter-max-size>{{ nokia_flowspec.ipv6_filter_max_size }}</ipv6-filter-max-size> -</flowspec> + <flowspec alu:operation="replace"> + <ip-filter-max-size>{{ nokia_flowspec.ip_filter_max_size }}</ip-filter-max-size> + <ipv6-filter-max-size>{{ nokia_flowspec.ipv6_filter_max_size }}</ipv6-filter-max-size> + </flowspec> + diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/isis_overload.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/isis_overload.j2 index e2301caa..c8d177ab 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/isis_overload.j2 +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/isis_overload.j2 @@ -2,11 +2,15 @@ <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf"> <router 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"> <router-name>Base</router-name> - <isis 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 set_isis_overload is defined %} - <overload></overload> - {% elif remove_isis_overload is defined %} - <overload alu:operation="delete"></overload> + <isis> + <isis-instance>0</isis-instance> + {% if verb == 'set_isis_overload' %} + <overload 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"> + </overload> + {% endif %} + {% if verb == 'remove_isis_overload' %} + <overload 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" alu:operation="delete"> + </overload> {% endif %} </isis> </router> diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/ldp.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/ldp.j2 index b6799a52..8a312b71 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/ldp.j2 +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/ldp.j2 @@ -4,4 +4,4 @@ <sdp-auto-targeted-session>true</sdp-auto-targeted-session> </targeted-session> </ldp> - + diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/router_base.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/router_base.j2 index 961cd5c7..ce792e85 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/router_base.j2 +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/router_base.j2 @@ -1,8 +1,13 @@ <router 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"> <router-name>Base</router-name> + {% with static_routes_obj=nokia_pe_static_routes %} {% include 'router/static_routes.j2' %} - {% include 'router/bgp.j2' %} + {% endwith %} + {% with bgp_group_context='bgp_base' %} + {% include 'router/base_bgp.j2' %} + {% endwith %} {% include 'router/flowspec.j2' %} {% include 'router/ldp.j2' %} {% include 'router/rpki.j2' %} </router> + diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/rpki.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/rpki.j2 index 3f60b99b..ce18ab74 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/rpki.j2 +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/rpki.j2 @@ -1,13 +1,13 @@ -<origin-validation 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 validator in pe_rpki.validators %} - <rpki-session alu:operation="replace"> - <ip-address>{{ validator.ip }}</ip-address> - <admin-state>{{ validator.admin_state | default('enable') }}</admin-state> - <connect-retry>{{ validator.connect_retry }}</connect-retry> - <local-address>{{ lo_ipv4_address }}</local-address> - <port>{{ validator.port }}</port> - <stale-time>{{ validator.stale_time }}</stale-time> - </rpki-session> - {% endfor %} -</origin-validation> + <origin-validation 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 validator in pe_rpki.validators %} + <rpki-session alu:operation="replace"> + <ip-address>{{ validator.ip }}</ip-address> + <admin-state>{{ validator.admin_state | default('enable') }}</admin-state> + <connect-retry>{{ validator.connect_retry }}</connect-retry> + <local-address>{{ lo_ipv4_address }}</local-address> + <port>{{ validator.port }}</port> + <stale-time>{{ validator.stale_time }}</stale-time> + </rpki-session> + {% endfor %} + </origin-validation> diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/static_routes.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/static_routes.j2 index 2b16762a..1c1d8f4b 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/static_routes.j2 +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/static_routes.j2 @@ -1,36 +1,38 @@ - {% for route in static_routes_obj %} - <route alu:operation="replace"> - <ip-prefix>{{ route.ip_prefix }}</ip-prefix> - <route-type>{{ route.route_type }}</route-type> - {% if route.indirect is defined %} - {% for ir in route.indirect %} - <indirect> - <ip-address>{{ ir.next_hop }}</ip-address> - <admin-state>{{ ir.admin_state }}</admin-state> - {% if ir.description is defined %} - <description>{{ ir.description }}</description> - {% endif %} - {% if ir.preference is defined %} - <preference>{{ ir.preference }}</preference> - {% endif %} - </indirect> - {% endfor %} - {% endif %} - {# Blackhole #} - {% if route.blackhole is defined %} - <blackhole> - <admin-state>{{ route.blackhole.admin_state }}</admin-state> - {% if route.blackhole.description is defined %} - <description>{{ route.blackhole.description }}</description> - {% endif %} - </blackhole> - {% endif %} - {# Communities #} - {% if route.communities is defined %} - {% for community in route.communities %} - <community>{{ community }}</community> - {% endfor %} - {% endif %} - </route> - {% endfor %} + <static-routes 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 route in static_routes_obj %} + <route alu:operation="replace"> + <ip-prefix>{{ route.ip_prefix }}</ip-prefix> + <route-type>{{ route.route_type }}</route-type> + {% if route.indirect is defined %} + {% for ir in route.indirect %} + <indirect> + <ip-address>{{ ir.next_hop }}</ip-address> + <admin-state>{{ ir.admin_state }}</admin-state> + {% if ir.description is defined %} + <description>{{ ir.description }}</description> + {% endif %} + {% if ir.preference is defined %} + <preference>{{ ir.preference }}</preference> + {% endif %} + </indirect> + {% endfor %} + {% endif %} + {# Blackhole #} + {% if route.blackhole is defined %} + <blackhole> + <admin-state>{{ route.blackhole.admin_state }}</admin-state> + {% if route.blackhole.description is defined %} + <description>{{ route.blackhole.description }}</description> + {% endif %} + </blackhole> + {% endif %} + {# Communities #} + {% if route.communities is defined %} + {% for community in route.communities %} + <community>{{ community }}</community> + {% endfor %} + {% endif %} + </route> + {% endfor %} + </static-routes> diff --git a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/vprn.j2 b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/vprn.j2 index 4444e061..fa0ebb64 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/vprn.j2 +++ b/geant/gap_ansible/roles/promote_p_to_pe/templates/routers/nokia/router/vprn.j2 @@ -40,15 +40,13 @@ </best-path-selection> {% endif %} {% with bgp_obj=vprn.bgp, bgp_group_context='vprn' %} - {% include 'bgp_group.j2' %} + {% include 'router/bgp_group.j2' %} {% endwith %} </bgp> {% if vprn.static_routes is defined %} - <static-routes> {% with static_routes_obj=vprn.static_routes %} - {% include 'static_routes.j2' %} + {% include 'router/static_routes.j2' %} {% endwith %} - </static-routes> {% endif %} {% if vprn.flowspec is defined %} <flowspec> @@ -59,3 +57,4 @@ </vprn> {% endfor %} </service> + -- GitLab