diff --git a/geant/gap_ansible/roles/iptrunk_migration/templates/juniper/trunk_interface.j2 b/geant/gap_ansible/roles/iptrunk_migration/templates/juniper/trunk_interface.j2 index 59220828d2d9ea830dc5ac894ac034b92148fd96..e45e15465afa580253549b87a83a357dd81ca34d 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/templates/juniper/trunk_interface.j2 +++ b/geant/gap_ansible/roles/iptrunk_migration/templates/juniper/trunk_interface.j2 @@ -1,7 +1,7 @@ {##} {# I need to sort the source and the destination alfabetically #} - {% set trunk_direction_name = [ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn.split(".")[1], wfo_trunk.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn.split(".")[1] ] %} - {% set trunk_direction_name_sorted = trunk_direction_name|sort %} +{% set trunk_direction_name = [ new_node.router.router_fqdn.split(".")[1] | upper, remaining_side.name.split(".")[1] | upper ] %} +{% set trunk_direction_name_sorted = trunk_direction_name|sort %} {##} {% if new_side is defined %} interfaces { @@ -9,8 +9,18 @@ description "LAG INFRASTRUCTURE BACKBONE ${{ new_side.port_sid }} | {{ trunk_direction_name_sorted[0] }}-{{ trunk_direction_name_sorted[1] }}"; mtu 9192; aggregated-ether-options { - minimum-links {{new_side.minimum_links}}; - {#link-speed {{common.link_speed}};#} + {% if new_side.trunk_type != "Dark_fiber" %} + bfd-liveness-detection { + minimum-interval {{ bfd_min_interval }}; + neighbor {{ remaining_side['loopback'] }}; + local-address {{ new_node.router.router_lo_ipv4_address }}; + } + {% endif %} + {% if (new_side.minimum_links | int) > 0 %} + minimum-links {{ new_side.minimum_links }}; + {% endif %} + minimum-links {{ new_side.minimum_links }}; + {#link-speed {{new_side.link_speed}};#} lacp { active; periodic fast; 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 index efbceabe6d027d457530784aa11e683128da40da..414d2f6b01c4a8942898b19a7b6704d1e75baeac 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/trunk_interface.j2 +++ b/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/trunk_interface.j2 @@ -2,11 +2,14 @@ <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf"> {##} +{% set trunk_direction_name = [ new_node.router.router_fqdn.split(".")[1] | upper, remaining_side.name.split(".")[1] | upper ] %} +{% set trunk_direction_name_sorted = trunk_direction_name|sort %} + {% 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> + <description>PHY INFRASTRUCTURE BACKBONE P_{{ new_side.ae_name }} | {{ trunk_direction_name_sorted[0] }}-{{ trunk_direction_name_sorted[1] }} | {{ member.interface_description }}</description> <ethernet> <mode>network</mode> <mtu>9212</mtu> @@ -28,7 +31,7 @@ <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> + <description>LAG INFRASTRUCTURE BACKBONE ${{ new_side.port_sid }} | {{ trunk_direction_name_sorted[0] }}-{{ trunk_direction_name_sorted[1] }}</description> <mode>network</mode> <lacp> <mode>active</mode> @@ -39,13 +42,31 @@ <port-id>{{ member.interface_name }}</port-id> </port> {% endfor %} + {% if (new_side.minimum_links | int) > 1 %} + <port-threshold> + <value>{{ (new_side.minimum_links | int) - 1 }}</value> + <action>down</action> + </port-threshold> + {% endif %} + {% if new_side.trunk_type != "Dark_fiber" %} + <bfd-liveness> + <ipv4> + <admin-state>enable</admin-state> + <multiplier>3</multiplier> + <receive-interval>{{ bfd_min_interval }}</receive-interval> + <transmit-interval>{{ bfd_min_interval }}</transmit-interval> + <local-ip-address>{{ new_node.router.router_lo_ipv4_address }}</local-ip-address> + <remote-ip-address>{{ remaining_side['loopback'] }}</remote-ip-address> + </ipv4> + </bfd-liveness> + {% endif %} </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> + <description>SRV_GLOBAL INFRASTRUCTURE BACKBONE #{{ trunk_direction_name_sorted[0] }}-{{ trunk_direction_name_sorted[1] }}-IPTRUNK ${{ new_side.id }} | {{ trunk_direction_name_sorted[0] }}-{{ trunk_direction_name_sorted[1] }} | {{ new_side.description }}</description> <ip-mtu>9000</ip-mtu> <port>{{ new_side.ae_name | lower }}</port> <ipv4> diff --git a/geant/gap_ansible/roles/iptrunk_migration/vars/main.yml b/geant/gap_ansible/roles/iptrunk_migration/vars/main.yml index a0bbad43e1a68357ca3d218703b937072e9fbad8..565ba579ab88b5cc77ba5c00c60453c13574ad0d 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/vars/main.yml +++ b/geant/gap_ansible/roles/iptrunk_migration/vars/main.yml @@ -14,6 +14,10 @@ config_objects: - "isis_interface" - "trunk_deprovision" +bfd_min_interval: 3000 +mtu_phy: 9212 +mtu_ip: 9000 + wfo_trunk: "{{ wfo_trunk_json }}" config_object: "{{ object }}" side_a_ipv4_address: "{{ wfo_trunk.iptrunk.iptrunk_ipv4_network | ansible.utils.ipaddr('net') | ansible.utils.ipaddr('address') }}/31" @@ -29,13 +33,17 @@ new_side: id: "{{ wfo_trunk.iptrunk.geant_s_sid }}" description: "{{ wfo_trunk.iptrunk.iptrunk_description }}" speed: "{{ wfo_trunk.iptrunk.iptrunk_speed }}" - is_leased_line: false ## FIX: it to use iptrunk_type + trunk_type: "{{ wfo_trunk.iptrunk.iptrunk_type }}" isis_metric: "{{ wfo_trunk.iptrunk.iptrunk_isis_metric }}" minimum_links: "{{ wfo_trunk.iptrunk.iptrunk_minimum_links }}" - name: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_node.router_fqdn }}" - router_access_via_ts: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_node.router_access_via_ts }}" - loopback: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_node.router_lo_ipv4_address }}" + # name: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_node.router_fqdn }}" + # router_access_via_ts: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_node.router_access_via_ts }}" + # loopback: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_node.router_lo_ipv4_address }}" ae_name: "{{ new_lag_interface }}" members: "{{ new_lag_member_interfaces }}" # members_descriptions: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_ae_members_description }}" port_sid: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_ae_geant_a_sid }}" + +remaining_side: + name: "{{ wfo_trunk.iptrunk.iptrunk_sides[1 - (replace_index | int)].iptrunk_side_node.router_fqdn }}" + loopback: "{{ wfo_trunk.iptrunk.iptrunk_sides[1 - (replace_index | int)].iptrunk_side_node.router_lo_ipv4_address }}"