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

Merge branch 'feature/nat-697-sbp' into 'develop'

FW role finishing

See merge request !200
parents 2ea32c8d c626afe4
Branches
Tags
1 merge request!200FW role finishing
Pipeline #90786 passed
Showing
with 314 additions and 1 deletion
{% if is_standalone_run %}
<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">
{% endif %}
<policy-options 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">
{% for prefix_list in nren_prefix_lists %}
<prefix-list alu:operation="replace">
<name>{{ prefix_list.name }}</name>
{% for prefix in prefix_list.prefixes %}
<prefix>
<ip-prefix>{{ prefix }}</ip-prefix>
<type>exact</type>
</prefix>
{% endfor %}
</prefix-list>
{% endfor %}
</policy-options>
{% if is_standalone_run %}
</configure>
</config>
{% endif %}
---
# vars file for prefix_lists
is_standalone_run: false
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# defaults file for sbp
---
# handlers file for sbp
galaxy_info:
author: A. Kurbatov
description: GEANT Orchestration and Automation Team
company: GEANT
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: MIT
min_ansible_version: '2.10'
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
galaxy_tags:
- network
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
---
- name: Set ansible host to localhost to compile template
ansible.builtin.set_fact:
ansible_host: "localhost"
ansible_connection: local
- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf"
# when: verb in ["deploy", "update", "terminate"]
ansible.builtin.template:
src: "{{ verb }}_sbp.j2"
dest: "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf"
lstrip_blocks: true
trim_blocks: true
mode: '0755'
delegate_to: localhost
---
- name: Import variables from 'all'
ansible.builtin.include_vars:
dir: /opt/ansible_inventory/group_vars/all
- name: Set ansible_host to terminal server when router is offline
when: ap.sbp.edge_port.node.router_access_via_ts | ansible.builtin.bool
ansible.builtin.set_fact:
ansible_host: "{{ ap.sbp.edge_port.node.router_site.site_ts_address }}"
ansible_port: "{{ ap.sbp.edge_port.node.router_ts_port }}"
- 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: Deploy FW config on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA]
when: dry_run | ansible.builtin.bool
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf') }}"
commit: true
validate: true
config_mode: private
diff: true
register: output
check_mode: true
- name: Deploy FW config on "{{ inventory_hostname }}" [COMMIT][NOKIA]
when: not (dry_run | ansible.builtin.bool)
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
content: "{{ lookup('ansible.builtin.file', '/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_sbp.conf') }}"
commit: true
commit_comment: "{{ commit_comment }}"
config_mode: private
diff: true
register: output
check_mode: false
---
# tasks file for sbp
- name: Merge vars
ansible.builtin.include_tasks: merge_vars.yaml
- name: Include filter compilation
ansible.builtin.include_tasks: compile.yaml
- name: Include filter compilation
when: is_standalone_run | ansible.builtin.bool
ansible.builtin.include_tasks: deploy_sbp.yaml
---
- name: Set interface v4 BFD values
when: ap.sbp.v4_bfd_settings.bfd_enabled | ansible.builtin.bool
block:
- name: Set v4 BFD RX interval to GSO value
when: ap.sbp.v4_bfd_settings.bfd_interval_rx != None
ansible.builtin.set_fact:
sbp_v4_bfd_interval_rx: "{{ ap.sbp.v4_bfd_settings.bfd_interval_rx }}"
- name: Set v4 BFD TX interval to GSO value
when: ap.sbp.v4_bfd_settings.bfd_interval_tx != None
ansible.builtin.set_fact:
sbp_v4_bfd_interval_tx: "{{ ap.sbp.v4_bfd_settings.bfd_interval_tx }}"
- name: Set v4 BFD multiplier to GSO value
when: ap.sbp.v4_bfd_settings.bfd_multiplier != None
ansible.builtin.set_fact:
sbp_v4_bfd_multiplier: "{{ ap.sbp.v4_bfd_settings.bfd_multiplier }}"
- name: Set interface v6 BFD values
when: ap.sbp.v6_bfd_settings.bfd_enabled | ansible.builtin.bool
block:
- name: Set v6 BFD RX interval to GSO value
when: ap.sbp.v6_bfd_settings.bfd_interval_rx != None
ansible.builtin.set_fact:
sbp_v6_bfd_interval_rx: "{{ ap.sbp.v6_bfd_settings.bfd_interval_rx }}"
- name: Set v6 BFD TX interval to GSO value
when: ap.sbp.v6_bfd_settings.bfd_interval_tx != None
ansible.builtin.set_fact:
sbp_v6_bfd_interval_tx: "{{ ap.sbp.v6_bfd_settings.bfd_interval_tx }}"
- name: Set v6 BFD multiplier to GSO value
when: ap.sbp.v6_bfd_settings.bfd_multiplier != None
ansible.builtin.set_fact:
sbp_v6_bfd_multiplier: "{{ ap.sbp.v6_bfd_settings.bfd_multiplier }}"
{% if is_standalone_run %}
<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">
{% 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">
<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>
<interface alu:operation="replace">
<interface-name>{{ lag_name }}.{{ ap.sbp.vlan_id }}</interface-name>
<description>SRV_GLOBAL CUSTOMER {{ partner_name }} #{{ partner_name }}-{{ ap.ap_type }} ${{ ap.sbp.geant_sid }} | ASN{{ partner.asn }} | </description>
<ip-mtu>{{ sbp_params.ip_mtu }}</ip-mtu>
<sap>
{% if ap.sbp.is_tagged %}
<sap-id>{{ lag_name }}:{{ ap.sbp.vlan_id }}</sap-id>
{% else %}
<sap-id>{{ lag_name }}</sap-id>
{% endif %}
<admin-state>enable</admin-state>
<ingress>
<filter>
<ip>{{ partner_name | upper }}_EDGE_IN</ip>
<ipv6>{{ partner_name | upper }}_EDGE_IN_V6</ipv6>
</filter>
</ingress>
<egress>
<filter>
<ip>{{ partner_name | upper }}_EDGE_OUT</ip>
<ipv6>{{ partner_name | upper }}_EDGE_OUT_V6</ipv6>
</filter>
</egress>
</sap>
<ipv4>
{% if ap.sbp.v4_bfd_settings.bfd_enabled %}
<bfd>
<admin-state>enable</admin-state>
{% if ap.sbp.v4_bfd_settings.bfd_interval_tx is not none %}
<transmit-interval>{{ ap.sbp.v4_bfd_settings.bfd_interval_tx }}</transmit-interval>
{% else %}
<transmit-interval>{{ sbp_params.bfd.ipv4.transmit }}</transmit-interval>
{% endif %}
{% if ap.sbp.v4_bfd_settings.bfd_interval_rx is not none %}
<receive>{{ ap.sbp.v4_bfd_settings.bfd_interval_rx }}</receive>
{% else %}
<receive>{{ sbp_params.bfd.ipv4.receive }}</receive>
{% endif %}
{% if ap.sbp.v4_bfd_settings.bfd_multiplier is not none %}
<multiplier>{{ ap.sbp.v4_bfd_settings.bfd_multiplier }}</multiplier>
{% else %}
<multiplier>{{ sbp_params.bfd.ipv4.multiplier }}</multiplier>
{% endif %}
</bfd>
{% endif %}
<primary>
<address>{{ ap.sbp.ipv4_address }}</address>
<prefix-length>{{ ap.sbp.ipv4_mask }}</prefix-length>
</primary>
</ipv4>
<ipv6>
{% if ap.sbp.v6_bfd_settings.bfd_enabled %}
<bfd>
<admin-state>enable</admin-state>
{% if ap.sbp.v6_bfd_settings.bfd_interval_tx is not none %}
<transmit-interval>{{ ap.sbp.v6_bfd_settings.bfd_interval_tx }}</transmit-interval>
{% else %}
<transmit-interval>{{ sbp_params.bfd.ipv6.transmit }}</transmit-interval>
{% endif %}
{% if ap.sbp.v6_bfd_settings.bfd_interval_rx is not none %}
<receive>{{ ap.sbp.v6_bfd_settings.bfd_interval_rx }}</receive>
{% else %}
<receive>{{ sbp_params.bfd.ipv6.receive }}</receive>
{% endif %}
{% if ap.sbp.v6_bfd_settings.bfd_multiplier is not none %}
<multiplier>{{ ap.sbp.v6_bfd_settings.bfd_multiplier }}</multiplier>
{% else %}
<multiplier>{{ sbp_params.bfd.ipv6.multiplier }}</multiplier>
{% endif %}
</bfd>
{% endif %}
<address>
<ipv6-address>{{ ap.sbp.ipv6_address }}</ipv6-address>
<prefix-length>{{ ap.sbp.ipv6_mask }}</prefix-length>
</address>
</ipv6>
</interface>
</ies>
</service>
{% if is_standalone_run %}
</configure>
</config>
{% endif %}
---
# vars file for sbp
is_standalone_run: false
lag_name: "{{ ap.sbp.edge_port.edge_port_name }}"
sbp_v4_bfd_multiplier: "{{ sbp_params.bfd.ipv4.multiplier }}"
sbp_v4_bfd_interval_rx: "{{ sbp_params.bfd.ipv4.receive }}"
sbp_v4_bfd_interval_tx: "{{ sbp_params.bfd.ipv4.transmit }}"
sbp_v6_bfd_multiplier: "{{ sbp_params.bfd.ipv6.multiplier }}"
sbp_v6_bfd_interval_rx: "{{ sbp_params.bfd.ipv6.receive }}"
sbp_v6_bfd_interval_tx: "{{ sbp_params.bfd.ipv6.transmit }}"
ncclient ncclient
\ No newline at end of file ansible
ansible-lint
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment