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

Merge branch 'feature/nat-904-lhcone-access' into 'develop'

Update `vrf` role

See merge request !208
parents a50c0623 bc4fde00
No related branches found
No related tags found
1 merge request!208Update `vrf` role
Pipeline #91315 passed
Showing
with 173 additions and 54 deletions
...@@ -3,13 +3,16 @@ ...@@ -3,13 +3,16 @@
gather_facts: false gather_facts: false
tasks: tasks:
- name: Check SBP - name: Check SBP
# FIX: rewrite
when: verb == 'check' when: verb == 'check'
ansible.builtin.include_role: ansible.builtin.meta: end_play
name: service_checks
loop: # ansible.builtin.include_role:
"{{ subscription.l3_core_service.ap_list }}" # name: service_checks
loop_control: # loop:
loop_var: ap # "{{ subscription.l3_core_service.ap_list }}"
# loop_control:
# loop_var: ap
# - name: Check BGP # - name: Check BGP
# # FIX: rewrite # # FIX: rewrite
...@@ -42,10 +45,13 @@ ...@@ -42,10 +45,13 @@
ansible.builtin.include_vars: ansible.builtin.include_vars:
dir: /opt/ansible_inventory/geant_services/{{ subscription.product.product_type }}/{{ subscription.l3_core_service_type | replace(' ', '_') }} dir: /opt/ansible_inventory/geant_services/{{ subscription.product.product_type }}/{{ subscription.l3_core_service_type | replace(' ', '_') }}
- name: Import partner specific variables for "{{ partner_name | upper }}" - name: Import {{ partner_name | upper }} general variables
ansible.builtin.include_vars: ansible.builtin.include_vars:
dir: /opt/ansible_inventory/geant_partners/{{ partner_name | upper }} file: /opt/ansible_inventory/geant_partners/{{ partner_name | upper }}/general.yaml
- name: Import {{ partner_name | upper }} specific variables for {{ subscription.l3_core_service_type | replace(' ', '_') }}
ansible.builtin.include_vars:
dir: /opt/ansible_inventory/geant_partners/{{ partner_name | upper }}/{{ subscription.l3_core_service_type | replace(' ', '_') }}
- name: Compile SBP-related config - name: Compile SBP-related config
when: object == 'sbp' when: object == 'sbp'
...@@ -66,20 +72,11 @@ ...@@ -66,20 +72,11 @@
loop_control: loop_control:
loop_var: ap loop_var: ap
# - name: Compile SBP config
# block:
# - name: Include SBP role
# ansible.builtin.include_role:
# name: sbp
# loop:
# "{{ subscription.l3_core_service.ap_list }}"
# loop_control:
# loop_var: ap
#
- name: Compile BGP-related config - name: Compile BGP-related config
when: object == "bgp" when: object == "bgp"
block: block:
- name: Include Prefix-list role - name: Include Prefix-list role
when: subscription.l3_core_service_type in ["GÉANT IP", "GEANT IP", "GEANT_IP"]
ansible.builtin.include_role: ansible.builtin.include_role:
name: po_prefix_lists name: po_prefix_lists
loop: loop:
...@@ -103,25 +100,6 @@ ...@@ -103,25 +100,6 @@
loop_control: loop_control:
loop_var: ap loop_var: ap
# - name: Compile BGP policies
# block:
# - name: Include BGP policies
# ansible.builtin.include_role:
# name: policy_options
# loop:
# "{{ subscription.l3_core_service.ap_list }}"
# loop_control:
# loop_var: ap
#
# - name: Compile BGP sesssions config
# block:
# - name: Include BGP session
# ansible.builtin.include_role:
# name: bgp_config
# loop:
# "{{ subscription.l3_core_service.ap_list }}"
# loop_control:
# loop_var: ap
- name: Deploy - name: Deploy
# when: verb == deploy # when: verb == deploy
......
...@@ -41,7 +41,3 @@ ...@@ -41,7 +41,3 @@
- name: Assemble and deploy generated config - name: Assemble and deploy generated config
ansible.builtin.include_role: ansible.builtin.include_role:
name: deploy_service_config name: deploy_service_config
loop:
"{{ subscription.vrf.vrf_router_list }}"
loop_control:
loop_var: router
--- ---
# tasks file for bgp_config # tasks file for bgp_config
- name: Set BGP V4 session object to check for custom policies
ansible.builtin.set_fact:
bgp_session_v4: "{{ ap.sbp | json_query(query) }}"
vars:
query: "bgp_session_list[?ip_type == 'ipv4'] | [0]"
- name: Set BGP V6 session object to check for custom policies
ansible.builtin.set_fact:
bgp_session_v6: "{{ ap.sbp | json_query(query) }}"
vars:
query: "bgp_session_list[?ip_type == 'ipv6'] | [0]"
- name: Load Standard Policy Statements vars - name: Load Standard Policy Statements vars
ansible.builtin.include_tasks: merge_vars.yaml ansible.builtin.include_tasks: merge_vars.yaml
......
--- ---
- name: Set Standard Import and export policies names - name: Set Standard BGP import and export policy names for GEANT_IP
when: >
subscription.l3_core_service_type in ["GEANT_IP", "GEANT IP"]
ansible.builtin.set_fact: ansible.builtin.set_fact:
import_policies_v4: "{{ bgp.policies.import.v4 }}" import_policies_v4: "{{ bgp.policies.import.v4 }}"
import_policies_v6: "{{ bgp.policies.import.v6 }}" import_policies_v6: "{{ bgp.policies.import.v6 }}"
export_policies_v4: "{{ bgp.policies.export.v4 }}" export_policies_v4: "{{ bgp.policies.export.v4 }}"
export_policies_v6: "{{ bgp.policies.export.v6 }}" export_policies_v6: "{{ bgp.policies.export.v6 }}"
- name: Set standard BGP import and export policy names for LHCONE
when: >
subscription.l3_core_service_type in ["LHCONE"]
and
not bgp_session_v4.has_custom_policies | ansible.builtin.bool
or
not bgp_session_v4.has_custom_policies | ansible.builtin.bool
ansible.builtin.set_fact:
import_policies_v4: "{{ bgp.policies.import.v4 }}"
import_policies_v6: "{{ bgp.policies.import.v6 }}"
export_policies_v4: "{{ bgp.policies.export.v4 }}"
export_policies_v6: "{{ bgp.policies.export.v6 }}"
- name: Set custom BGP import and export policy names for LHCONE
when: >
subscription.l3_core_service_type in ["LHCONE"]
and
bgp_session_v4.has_custom_policies | ansible.builtin.bool
or
bgp_session_v4.has_custom_policies | ansible.builtin.bool
ansible.builtin.set_fact:
import_policies_v4: "{{ bgp_custom.policies.import.v4 }}"
import_policies_v6: "{{ bgp_custom.policies.import.v6 }}"
export_policies_v4: "{{ bgp_custom.policies.export.v4 }}"
export_policies_v6: "{{ bgp_custom.policies.export.v6 }}"
{% if subscription.l3_core_service_type in ['GEANT_IP', 'GEANT IP'] %}
<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 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> <router-name>Base</router-name>
<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">
{% include 'bgp_neighbor.j2' %} {% include 'bgp_neighbor.j2' %}
</bgp> </bgp>
</router> </router>
{% elif subscription.l3_core_service_type in ['LHCONE'] %}
<service 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">
<vprn 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">
<service-name>{{ vprn_name }}</service-name>
<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">
{% include 'bgp_neighbor.j2' %}
</bgp>
</vprn>
</service>
{% endif %}
...@@ -9,7 +9,20 @@ ...@@ -9,7 +9,20 @@
when: subscription.product.product_type == 'L3CoreService' when: subscription.product.product_type == 'L3CoreService'
ansible.builtin.set_fact: ansible.builtin.set_fact:
router: "{{ ap.sbp.edge_port.node }}" router: "{{ ap.sbp.edge_port.node }}"
vendor: "{{ router.vendor }}" vendor: "{{ ap.sbp.edge_port.node.vendor }}"
- name: Extract current inventory router from "vrf_router_list"
when: subscription.product.product_type == 'VRF'
ansible.builtin.set_fact:
current_router: "{{ vrf_router_list | community.general.json_query(query) }}"
vars:
query: "[?router.router_fqdn == '{{ inventory_hostname }}'] | [0]"
- name: Set router and vendor for the use with VRF update
when: subscription.product.product_type == 'VRF'
ansible.builtin.set_fact:
router: "{{ current_router.router }}"
vendor: "{{ current_router.router.vendor }}"
- name: Assemble the config from fragments in previous roles - name: Assemble the config from fragments in previous roles
ansible.builtin.include_tasks: assemble_config.yml ansible.builtin.include_tasks: assemble_config.yml
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
# vars file for deploy_service_config # vars file for deploy_service_config
dry_run: true dry_run: true
is_verification_workflow: false is_verification_workflow: false
#
router: "{{ ap.sbp.edge_port.node }}" # router: "{{ ap.sbp.edge_port.node }}"
vendor: "{{ router.vendor }}" # vendor: "{{ router.vendor }}"
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
when: >- when: >-
subscription.product.product_type == "L3CoreService" subscription.product.product_type == "L3CoreService"
and and
subscription.l3_core_service_type == "GÉANT IP" subscription.l3_core_service_type in ["GÉANT IP", "GEANT IP", "GEANT_IP"]
and and
ap.sbp.custom_firewall_filters | ansible.builtin.bool ap.sbp.custom_firewall_filters | ansible.builtin.bool
block: block:
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
when: >- when: >-
subscription.product.product_type == "L3CoreService" subscription.product.product_type == "L3CoreService"
and and
subscription.l3_core_service_type == "GÉANT IP" subscription.l3_core_service_type in ["GÉANT IP", "GEANT IP", "GEANT_IP", "LHCONE"]
and and
not ap.sbp.custom_firewall_filters | ansible.builtin.bool not ap.sbp.custom_firewall_filters | ansible.builtin.bool
block: block:
......
--- ---
# tasks file for policy_options # tasks file for policy_options
- name: Set BGP V4 session object to check for custom policies
when: >
subscription.product.product_type == "L3CoreService"
ansible.builtin.set_fact:
bgp_session_v4: "{{ ap.sbp | json_query(query) }}"
vars:
query: "bgp_session_list[?ip_type == 'ipv4'] | [0]"
- name: Set BGP V6 session object to check for custom policies
when: >
subscription.product.product_type == "L3CoreService"
ansible.builtin.set_fact:
bgp_session_v6: "{{ ap.sbp | json_query(query) }}"
vars:
query: "bgp_session_list[?ip_type == 'ipv6'] | [0]"
- name: Load Standard Policy Statements vars - name: Load Standard Policy Statements vars
when: > when: >
subscription.product.product_type == "L3CoreService" subscription.product.product_type == "L3CoreService"
...@@ -7,10 +23,21 @@ ...@@ -7,10 +23,21 @@
subscription.l3_core_service_type in ["GÉANT IP", "GEANT IP", "GEANT_IP"] subscription.l3_core_service_type in ["GÉANT IP", "GEANT IP", "GEANT_IP"]
ansible.builtin.include_tasks: merge_geant_ip_vars.yaml ansible.builtin.include_tasks: merge_geant_ip_vars.yaml
- name: Load NREN custom VRF policies
when: >
subscription.product.product_type == "L3CoreService"
and
subscription.l3_core_service_type in ["LHCONE"]
and
(bgp_session_v4.has_custom_policies | ansible.builtin.bool
or
bgp_session_v6.has_custom_policies | ansible.builtin.bool)
ansible.builtin.include_tasks: merge_vrf_custom_vars.yaml
- name: Load Standard Policy Options for VRF {{ subscription.vrf.vrf_name }} - name: Load Standard Policy Options for VRF {{ subscription.vrf.vrf_name }}
when: > when: >
subscription.product.product_type == "VRF" subscription.product.product_type == "VRF"
ansible.builtin.include_tasks: merge_vrf_vars.yaml ansible.builtin.include_tasks: merge_vrf_standard_vars.yaml
- name: Compile templates - name: Compile templates
ansible.builtin.include_tasks: compile.yaml ansible.builtin.include_tasks: compile.yaml
......
---
- name: Set custom PO vars
# when: >
# bgp_session_v6.has_custom_policies | ansible.builtin.bool
block:
- name: Set NREN custom communities
ansible.builtin.set_fact:
po_final_communities: "{{ lookup('community.general.merge_variables', 'CUSTOM_COMMUNITIES') }}"
# - name: Set NREN custom AS paths
# ansible.builtin.set_fact:
# po_final_aspath: "{{ lookup('community.general.merge_variables', 'CUSTOM_ASPATH') }}"
- name: Set NREN custom policies
ansible.builtin.set_fact:
po_final_policies: "{{ lookup('community.general.merge_variables', 'CUSTOM_PO_POL_STATEMENTS') }}"
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
ansible.builtin.set_fact: ansible.builtin.set_fact:
po_final_prefix_lists: "{{ lookup('community.general.merge_variables', 'STANDARD_VRF_PO_PREFIX_LISTS') }}" po_final_prefix_lists: "{{ lookup('community.general.merge_variables', 'STANDARD_VRF_PO_PREFIX_LISTS') }}"
- name: Load Standard Policy Options prefix lists for VRF {{ subscription.vrf.vrf_name }}
ansible.builtin.set_fact:
po_final_communities: "{{ lookup('community.general.merge_variables', 'STANDARD_VRF_COMMUNITIES') }}"
- name: Load Standard Policy Options policies for VRF {{ subscription.vrf.vrf_name }} - name: Load Standard Policy Options policies for VRF {{ subscription.vrf.vrf_name }}
ansible.builtin.set_fact: ansible.builtin.set_fact:
po_final_policies: "{{ lookup('community.general.merge_variables', 'STANDARD_VRF_PO_POLICIES') }}" po_final_policies: "{{ lookup('community.general.merge_variables', 'STANDARD_VRF_PO_POLICIES') }}"
...@@ -57,6 +57,11 @@ ...@@ -57,6 +57,11 @@
<add>{{ community }}</add> <add>{{ community }}</add>
</community> </community>
{% endfor %} {% endfor %}
{% elif act_k == "as_path_prepend" %}
<as-path-prepend>
<as-path>{{ act_v.as_path }}</as-path>
<repeat>{{ act_v.repeat }}</repeat>
</as-path-prepend>
{% elif act_k == "bgp_med" %} {% elif act_k == "bgp_med" %}
<bgp-med> <bgp-med>
<set>{{ act_v | default(bgp.standard_metric.med[ap_type]) }}</set> <set>{{ act_v | default(bgp.standard_metric.med[ap_type]) }}</set>
......
...@@ -4,11 +4,20 @@ ...@@ -4,11 +4,20 @@
{% endif %} {% endif %}
<service 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"> <service 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 subscription.l3_core_service_type in ['GEANT_IP', 'GEANT IP'] %}
<ies 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"> <ies 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">
<service-name>{{ ies_re_name }}</service-name> <service-name>{{ ies_re_name }}</service-name>
{% elif subscription.l3_core_service_type in ['LHCONE'] %}
<vprn 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">
<service-name>{{ vprn_name }}</service-name>
{% endif %}
<interface alu:operation="replace"> <interface alu:operation="replace">
<interface-name>{{ lag_name }}.{{ ap.sbp.vlan_id }}</interface-name> <interface-name>{{ lag_name }}.{{ ap.sbp.vlan_id }}</interface-name>
{% if subscription.l3_core_service_type in ['GEANT_IP', 'GEANT IP'] %}
<description>SRV_GLOBAL CUSTOMER {{ partner_name }} #{{ partner_name }}-{{ ap.ap_type }} ${{ ap.sbp.gs_id }} | ASN{{ partner.asn }} | </description> <description>SRV_GLOBAL CUSTOMER {{ partner_name }} #{{ partner_name }}-{{ ap.ap_type }} ${{ ap.sbp.gs_id }} | ASN{{ partner.asn }} | </description>
{% elif subscription.l3_core_service_type in ['LHCONE'] %}
<description>SRV_L3VPN CUSTOMER {{ partner_name }} #{{ partner_name }}-{{ ap.ap_type }} ${{ ap.sbp.gs_id }} | ASN{{ partner.asn }} | </description>
{% endif %}
<ip-mtu>{{ sbp_params.ip_mtu }}</ip-mtu> <ip-mtu>{{ sbp_params.ip_mtu }}</ip-mtu>
<sap> <sap>
{% if ap.sbp.is_tagged %} {% if ap.sbp.is_tagged %}
...@@ -19,14 +28,24 @@ ...@@ -19,14 +28,24 @@
<admin-state>enable</admin-state> <admin-state>enable</admin-state>
<ingress> <ingress>
<filter> <filter>
{% if subscription.l3_core_service_type in ['GEANT_IP', 'GEANT IP'] %}
<ip>{{ partner_name | upper }}_EDGE_IN</ip> <ip>{{ partner_name | upper }}_EDGE_IN</ip>
<ipv6>{{ partner_name | upper }}_EDGE_IN_V6</ipv6> <ipv6>{{ partner_name | upper }}_EDGE_IN_V6</ipv6>
{% elif subscription.l3_core_service_type in ['LHCONE'] %}
<ip>LHCONE_{{ partner_name | upper }}_IN</ip>
<ipv6>LHCONE_{{ partner_name | upper }}_IN_V6</ipv6>
{% endif %}
</filter> </filter>
</ingress> </ingress>
<egress> <egress>
<filter> <filter>
{% if subscription.l3_core_service_type in ['GEANT_IP', 'GEANT IP'] %}
<ip>{{ partner_name | upper }}_EDGE_OUT</ip> <ip>{{ partner_name | upper }}_EDGE_OUT</ip>
<ipv6>{{ partner_name | upper }}_EDGE_OUT_V6</ipv6> <ipv6>{{ partner_name | upper }}_EDGE_OUT_V6</ipv6>
{% elif subscription.l3_core_service_type in ['LHCONE'] %}
<ip>LHCONE_{{ partner_name | upper }}_OUT</ip>
<ipv6>LHCONE_{{ partner_name | upper }}_OUT_V6</ipv6>
{% endif %}
</filter> </filter>
</egress> </egress>
</sap> </sap>
...@@ -83,7 +102,11 @@ ...@@ -83,7 +102,11 @@
</address> </address>
</ipv6> </ipv6>
</interface> </interface>
{% if subscription.l3_core_service_type in ['GEANT_IP', 'GEANT IP'] %}
</ies> </ies>
{% elif subscription.l3_core_service_type in ['LHCONE'] %}
</vprn>
{% endif %}
</service> </service>
{% if is_standalone_run %} {% if is_standalone_run %}
......
--- ---
# tasks file for service_checks # tasks file for service_checks
- name: Import group_vars/all
ansible.builtin.include_vars:
dir: /opt/ansible_inventory/group_vars/all
- name: Load netconf connection config
ansible.builtin.set_fact:
ansible_connection: "{{ netconf_access[ap.sbp.edge_port.node.vendor].ansible_connection }}"
ansible_network_os: "{{ netconf_access[ap.sbp.edge_port.node.vendor].ansible_network_os }}"
- name: Ping peer via SBP - name: Ping peer via SBP
when: object == 'sbp' when: object == 'sbp'
ansible.builtin.include_tasks: sbp_checks.yaml ansible.builtin.include_tasks: sbp_checks.yaml
......
<service 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"> <service 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">
{% with pe_vprns=LHCONE_VPRN %} {% with pe_vprns=VPRN %}
{% include 'router/vprn.j2' %} {% include 'router/vprn.j2' %}
{% endwith %} {% endwith %}
</service> </service>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment