From ed2f5e99ec55cdbb4ba6a421342d5df24f8b27a1 Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342-AKURBATOV.local>
Date: Mon, 16 Sep 2024 19:54:13 +0100
Subject: [PATCH] pe_promotion - related changes
in templates names, etc
---
.../routers/nokia/pe_promotion_base_config.j2 | 12 ++++++++++++
.../routers/nokia/pe_promotion_base_vprn.j2 | 5 +++++
.../bc_templates/routers/nokia/pe_update_sdp.j2 | 5 +++++
.../routers/nokia/router/base_static_routes.j2 | 2 +-
.../roles/bc_templates/routers/nokia/router/bgp.j2 | 2 +-
.../bc_templates/routers/nokia/router/router_base.j2 | 2 +-
.../roles/bc_templates/routers/nokia/service_vprn.j2 | 4 +++-
.../roles/promote_p_to_pe/tasks/compile.yaml | 12 ++++++------
.../roles/promote_p_to_pe/tasks/deploy.yaml | 8 ++++----
9 files changed, 38 insertions(+), 14 deletions(-)
create mode 100644 geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_config.j2
create mode 100644 geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_vprn.j2
create mode 100644 geant/gap_ansible/roles/bc_templates/routers/nokia/pe_update_sdp.j2
diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_config.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_config.j2
new file mode 100644
index 00000000..36365193
--- /dev/null
+++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_config.j2
@@ -0,0 +1,12 @@
+<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:alu="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf">
+ {% include 'filter_log.j2' %}
+ {% include 'ip_prefix_list.j2' %}
+ {% include 'filters/cpm_filters.j2' %}
+ {% include 'policy_options/policy_options.j2' %}
+ {% include 'cflowd.j2' %}
+ {% include 'system/security/security.j2' %}
+ {% include 'router/router_base.j2' %}
+ {% include 'sdp_mesh.j2' %}
+ </configure>
+</config>
diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_vprn.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_vprn.j2
new file mode 100644
index 00000000..f8467b33
--- /dev/null
+++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_vprn.j2
@@ -0,0 +1,5 @@
+<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:alu="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf">
+ {% include 'service_vprn.j2' %}
+ </configure>
+</config>
diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_update_sdp.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_update_sdp.j2
new file mode 100644
index 00000000..5ffc1bde
--- /dev/null
+++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_update_sdp.j2
@@ -0,0 +1,5 @@
+<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:alu="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf">
+ {% include 'sdp_mesh.j2' %}
+ </configure>
+</config>
diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/base_static_routes.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/base_static_routes.j2
index 3fc1919e..d7d5ff5e 100644
--- a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/base_static_routes.j2
+++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/base_static_routes.j2
@@ -1,4 +1,4 @@
- {% if router_role == 'pe' %}
+ {% if router_role == 'pe' or is_pe_promotion_wf %}
{% with static_routes_obj=nokia_pe_static_routes %}
{% include 'router/static_routes.j2' %}
{% endwith %}
diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp.j2
index cf0811e5..f45754dc 100644
--- a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp.j2
+++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp.j2
@@ -1,5 +1,5 @@
<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 router_role == 'pe' %}
+{% if router_role == 'pe' or is_pe_promotion_wf %}
{% with bgp_base_obj=pe_bgp_base, bgp_context='bgp_base' %}
{% include 'router/bgp_base.j2' %}
{% endwith %}
diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/router_base.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/router_base.j2
index 9d3c8693..f0670959 100644
--- a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/router_base.j2
+++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/router_base.j2
@@ -1,7 +1,7 @@
<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>
<autonomous-system xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes" alu:operation="replace">{{ geant_re_as_number }}</autonomous-system>
- {% if router_role == 'pe' and pe_bgp_base.ecmp is defined %}
+ {% if (router_role == 'pe' or is_pe_promotion_wf) and pe_bgp_base.ecmp is defined %}
<ecmp>{{ pe_bgp_base.ecmp }}</ecmp>
{% endif %}
<router-id xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes" alu:operation="replace">{{ lo_ipv4_address }}</router-id>
diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/service_vprn.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/service_vprn.j2
index 4d8a57d9..b588b730 100644
--- a/geant/gap_ansible/roles/bc_templates/routers/nokia/service_vprn.j2
+++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/service_vprn.j2
@@ -8,5 +8,7 @@
</md-auto-id>
{% include 'router/vprn.j2' %}
</service>
- {#{% include 'ip_prefix_list.j2' %}#}
+{% if is_pe_promotion_wf %}
+ {% include 'ip_prefix_list.j2' %}
+{% endif %}
diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml
index 6208e177..46a463d1 100644
--- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml
+++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml
@@ -15,21 +15,21 @@
mode: '0755'
delegate_to: localhost
-- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_base_config.conf"
+- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_promotion_base_config.conf"
when: verb == "deploy_pe_base_config"
ansible.builtin.template:
- src: "routers/{{ subscription.router.vendor }}/pe_base_config.j2"
- dest: "/var/tmp/ansible_run_{{ opid }}/pe_base_config.conf"
+ src: "routers/{{ subscription.router.vendor }}/pe_promotion_base_config.j2"
+ dest: "/var/tmp/ansible_run_{{ opid }}/pe_promotion_base_config.conf"
lstrip_blocks: true
trim_blocks: true
mode: '0755'
delegate_to: localhost
-- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_base_vprn.conf"
+- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_promotion_base_vprn.conf"
when: verb == "deploy_routing_instances"
ansible.builtin.template:
- src: "routers/{{ subscription.router.vendor }}/pe_base_vprn.j2"
- dest: "/var/tmp/ansible_run_{{ opid }}/pe_base_vprn.conf"
+ src: "routers/{{ subscription.router.vendor }}/pe_promotion_base_vprn.j2"
+ dest: "/var/tmp/ansible_run_{{ opid }}/pe_promotion_base_vprn.conf"
lstrip_blocks: true
trim_blocks: true
mode: '0755'
diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy.yaml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy.yaml
index dbae83ee..1533f134 100644
--- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy.yaml
+++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy.yaml
@@ -5,7 +5,7 @@
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
- content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_base_config.j2') }}"
+ content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_promotion_base_config.j2') }}"
commit: true
validate: true
diff: true
@@ -19,7 +19,7 @@
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
- content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_base_vprn.j2') }}"
+ content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_promotion_base_vprn.j2') }}"
commit: true
validate: true
diff: true
@@ -69,7 +69,7 @@
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
- content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_base_config.j2') }}"
+ content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_promotion_base_config.j2') }}"
commit: true
commit_comment: "{{ commit_comment }}"
diff: true
@@ -82,7 +82,7 @@
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
- content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_base_vprn.j2') }}"
+ content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_promotion_base_vprn.j2') }}"
commit: true
commit_comment: "{{ commit_comment }}"
diff: true
--
GitLab