Skip to content
Snippets Groups Projects
Commit 5ef30b14 authored by Aleksandr Kurbatov's avatar Aleksandr Kurbatov
Browse files

Merge branch 'feature/nat-1159-asn-override' into 'develop'

Use custom ASN if defined in inventory

See merge request !263
parents d993d87e 6d2140ef
Branches
Tags
1 merge request!263Use custom ASN if defined in inventory
Pipeline #93768 passed
...@@ -33,3 +33,11 @@ ...@@ -33,3 +33,11 @@
import_policies_v6: "{{ bgp_custom.policies.import.v6 }}" import_policies_v6: "{{ bgp_custom.policies.import.v6 }}"
export_policies_v4: "{{ bgp_custom.policies.export.v4 }}" export_policies_v4: "{{ bgp_custom.policies.export.v4 }}"
export_policies_v6: "{{ bgp_custom.policies.export.v6 }}" export_policies_v6: "{{ bgp_custom.policies.export.v6 }}"
- name: Set ASN override if defined in Partners inventory file
when: >
subscription.product.product_type | upper in l3_service_types.vprn
and
partner[subscription.product.product_type | upper].asn is defined
ansible.builtin.set_fact:
partner_custom_asn: "{{ partner[subscription.product.product_type | upper].asn }}"
...@@ -17,7 +17,11 @@ ...@@ -17,7 +17,11 @@
<description>-- IPv6 Peering with {{ partner_name | upper }} --</description> <description>-- IPv6 Peering with {{ partner_name | upper }} --</description>
<group>{{ bgp.group.ipv6 }}</group> <group>{{ bgp.group.ipv6 }}</group>
{% endif %} {% endif %}
{% if partner_custom_asn is defined %}
<peer-as>{{ partner_custom_asn }}</peer-as>
{% else %}
<peer-as>{{ partner.asn }}</peer-as> <peer-as>{{ partner.asn }}</peer-as>
{% endif %}
{% if neighbor.send_default_route %} {% if neighbor.send_default_route %}
<send-default> <send-default>
<{{ neighbor.ip_type }}>true</{{ neighbor.ip_type }}> <{{ neighbor.ip_type }}>true</{{ neighbor.ip_type }}>
......
--- ---
# When custom ASN is defined in partner general.yaml inventory for LHCONE,
# this is used for only _BLOCK community to configure, the GEANT_<NREN>
# community will stay standard with the standard partner's ASN.
#
- name: Set NREN community names - name: Set NREN community names
when: not subscription.product.product_type | upper in ['LHCONE'] when: not subscription.product.product_type | upper in ['LHCONE']
ansible.builtin.set_fact: ansible.builtin.set_fact:
...@@ -6,18 +10,42 @@ ...@@ -6,18 +10,42 @@
- name: Set NREN community names - name: Set NREN community names
when: subscription.product.product_type | upper in ['LHCONE'] when: subscription.product.product_type | upper in ['LHCONE']
ansible.builtin.set_fact: block:
nren_community_names: ["GEANT_{{ partner_name | upper }}", "LHCONE_{{ partner_name | upper }}_BLOCK"] - name: Set standard NREN community names
when: not partner[subscription.product.product_type | upper].asn is defined
ansible.builtin.set_fact:
nren_community_names: ["GEANT_{{ partner_name | upper }}", "LHCONE_{{ partner_name | upper }}_BLOCK"]
- name: Set NREN community values (2-byte ASN) - name: Set custom NREN community names
when: (partner.asn | int) < 65536 when: partner[subscription.product.product_type | upper].asn is defined
ansible.builtin.set_fact: ansible.builtin.set_fact:
nren_community_values: ["{{ geant_re_as_number }}:{{ partner.asn }}", "{{ bgp.block_community_prefix }}:{{ partner.asn }}"] nren_community_names: ["LHCONE_{{ partner_name | upper }}_BLOCK"]
- name: Set NREN community values (4-byte ASN) - name: Set NREN communities values using "partner.asn"
when: (partner.asn | int) > 65535 when: not partner[subscription.product.product_type | upper].asn is defined
ansible.builtin.set_fact: block:
nren_community_values: ["origin:{{ partner.asn }}:{{ geant_re_as_number }}", "origin:{{ partner.asn }}:{{ bgp.block_community_prefix }}"] - name: Set NREN community values (2-byte ASN)
when: (partner.asn | int) < 65536
ansible.builtin.set_fact:
nren_community_values: ["{{ geant_re_as_number }}:{{ partner.asn }}", "{{ bgp.block_community_prefix }}:{{ partner.asn }}"]
- name: Set NREN community values (4-byte ASN)
when: (partner.asn | int) > 65535
ansible.builtin.set_fact:
nren_community_values: ["origin:{{ partner.asn }}:{{ geant_re_as_number }}", "origin:{{ partner.asn }}:{{ bgp.block_community_prefix }}"]
- name: Set NREN communities values using {{partner[subscription.product.product_type | upper]}}.asn
when: partner[subscription.product.product_type | upper].asn is defined
block:
- name: Set NREN community values (2-byte ASN)
when: (partner[subscription.product.product_type | upper].asn | int) < 65536
ansible.builtin.set_fact:
nren_community_values: ["{{ bgp.block_community_prefix }}:{{ partner[subscription.product.product_type | upper].asn }}"]
- name: Set NREN community values (4-byte ASN)
when: (partner[subscription.product.product_type | upper].asn | int) > 65535
ansible.builtin.set_fact:
nren_community_values: ["origin:{{ partner[subscription.product.product_type | upper].asn }}:{{ bgp.block_community_prefix }}"]
- name: Create a list of NREN communities - name: Create a list of NREN communities
ansible.builtin.set_fact: ansible.builtin.set_fact:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment