From 00c72cf0d32478bf87403843634ea09dffd37dec Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342.local>
Date: Thu, 7 Mar 2024 15:40:29 +0000
Subject: [PATCH] Added Nokia specific templates
Working / updated:
- trunk_interface
- isis_interface
---
.../templates/nokia/isis_interface.j2 | 20 +++++
.../templates/nokia/trunk_interface.j2 | 89 +++++++++++++++++++
2 files changed, 109 insertions(+)
create mode 100644 geant/gap_ansible/roles/iptrunk_migration/templates/nokia/isis_interface.j2
create mode 100644 geant/gap_ansible/roles/iptrunk_migration/templates/nokia/trunk_interface.j2
diff --git a/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/isis_interface.j2 b/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/isis_interface.j2
new file mode 100644
index 00000000..fe23b765
--- /dev/null
+++ b/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/isis_interface.j2
@@ -0,0 +1,20 @@
+<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">
+ <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">
+ <isis-instance>0</isis-instance>
+ <interface 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="replace">
+ <interface-name>{{ new_side.ae_name | lower }}.0</interface-name>
+ <admin-state>enable</admin-state>
+ <interface-type>point-to-point</interface-type>
+ <level-capability>2</level-capability>
+ <level>
+ <level-number>2</level-number>
+ <metric>{{ new_side.isis_metric }}</metric>
+ </level>
+ </interface>
+ </isis>
+ </router>
+ </configure>
+</config>
diff --git a/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/trunk_interface.j2 b/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/trunk_interface.j2
new file mode 100644
index 00000000..efbceabe
--- /dev/null
+++ b/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/trunk_interface.j2
@@ -0,0 +1,89 @@
+<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">
+
+{##}
+{% for member in new_side.members %}
+ <port 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="replace">
+ <port-id>{{ member.interface_name }}</port-id>
+ <admin-state>enable</admin-state>
+ <description>PHY INFRASTRUCTURE BACKBONE P_{{ new_side.ae_name }} | {{ new_side.description }} | {{ member.interface_description }}</description>
+ <ethernet>
+ <mode>network</mode>
+ <mtu>9212</mtu>
+ <lldp>
+ <dest-mac>
+ <mac-type>nearest-bridge</mac-type>
+ <receive>true</receive>
+ <transmit>true</transmit>
+ <tx-tlvs>
+ <port-desc>true</port-desc>
+ <sys-name>true</sys-name>
+ <sys-cap>true</sys-cap>
+ </tx-tlvs>
+ </dest-mac>
+ </lldp>
+ </ethernet>
+ </port>
+{% endfor %}
+ <lag 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="replace">
+ <lag-name>{{ new_side.ae_name | lower }}</lag-name>
+ <admin-state>enable</admin-state>
+ <description>LAG INFRASTRUCTURE BACKBONE ${{ new_side.port_sid }} | {{ new_side.description }}</description>
+ <mode>network</mode>
+ <lacp>
+ <mode>active</mode>
+ <administrative-key>{{ (new_side.ae_name|split("-"))[1] }}</administrative-key>
+ </lacp>
+{% for member in new_side.members %}
+ <port>
+ <port-id>{{ member.interface_name }}</port-id>
+ </port>
+{% endfor %}
+ </lag>
+ <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>
+ <interface alu:operation="replace">
+ <interface-name>{{ new_side.ae_name | lower }}.0</interface-name>
+ <admin-state>enable</admin-state>
+ <description>SRV_GLOBAL INFRASTRUCTURE BACKBONE #{{ new_side.description }}-IPTRUNK ${{ new_side.id }}| </description>
+ <ip-mtu>9000</ip-mtu>
+ <port>{{ new_side.ae_name | lower }}</port>
+ <ipv4>
+ <primary>
+ <address>{{(new_ipv4_address| split('/'))[0]}}</address>
+ <prefix-length>{{(new_ipv4_address| split('/'))[1]}}</prefix-length>
+ </primary>
+ </ipv4>
+ <ipv6>
+ <address>
+ <ipv6-address>{{(new_ipv6_address| split('/'))[0]}}</ipv6-address>
+ <prefix-length>{{(new_ipv6_address| split('/'))[1]}}</prefix-length>
+ </address>
+ </ipv6>
+ <qos>
+ <network-policy>GEANT_BASIC</network-policy>
+ </qos>
+ </interface>
+ {# Add new LAG trunk into standard protocols #}
+ <mpls 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">
+ <interface alu:operation="replace">
+ <interface-name>{{ new_side.ae_name | lower }}.0</interface-name>
+ </interface>
+ </mpls>
+ <pim 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">
+ <interface alu:operation="replace">
+ <interface-name>{{ new_side.ae_name | lower }}.0</interface-name>
+ </interface>
+ </pim>
+ <rsvp 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">
+ <interface alu:operation="replace">
+ <interface-name>{{ new_side.ae_name | lower }}.0</interface-name>
+ {# <refresh-reduction> #}
+ {# <reliable-delivery>true</reliable-delivery> #}
+ {# </refresh-reduction> #}
+ </interface>
+ </rsvp>
+ </router>
+
+ </configure>
+</config>
--
GitLab