diff --git a/geant/gap_ansible/playbooks/l3_core_service.yaml b/geant/gap_ansible/playbooks/l3_core_service.yaml index 9b1548170ddcf531ff63919da5f70968798b8324..d09db643480913a288df5d24c450869e3a87421b 100644 --- a/geant/gap_ansible/playbooks/l3_core_service.yaml +++ b/geant/gap_ansible/playbooks/l3_core_service.yaml @@ -2,6 +2,23 @@ hosts: all gather_facts: false tasks: + - name: Check SBP + when: verb == 'check' + ansible.builtin.include_role: + name: service_checks + loop: + "{{ subscription.l3_core_service.ap_list }}" + loop_control: + loop_var: ap + + # - name: Check BGP + # # FIX: rewrite + # when: > + # object == 'bgp' + # and + # verb == 'check' + # ansible.builtin.meta: end_play + - name: Generate an ID for this run ansible.builtin.set_fact: opid: "{{ lookup('community.general.random_string', length=18, special=false) }}" diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp.j2 index f45754dcb21f50975bda15ee8da9e3237e9a1b57..17db9b1894063f500bc09a5c37734cc64e3cb197 100644 --- a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp.j2 +++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp.j2 @@ -10,6 +10,9 @@ {% with bgp_obj=pe_bgp_internal, bgp_group_context='bgp_base' %} {% include "router/bgp_group.j2" %} {% endwith %} + {% with bgp_obj=pe_bgp_egeant, bgp_group_context='bgp_base' %} + {% include "router/bgp_group.j2" %} + {% endwith %} {% else %} {% with bgp_base_obj=p_bgp_base, bgp_obj=p_bgp_internal, bgp_context='bgp_base', bgp_group_context='bgp_base' %} diff --git a/geant/gap_ansible/roles/deploy_service_config/tasks/connection_tasks.yml b/geant/gap_ansible/roles/deploy_service_config/tasks/connection_tasks.yml index 6dd169a32d9fa7e30ac3f416e12e1259f4682072..cef17805f2fee28c25ebdbfbe20ebff801f6dc1b 100644 --- a/geant/gap_ansible/roles/deploy_service_config/tasks/connection_tasks.yml +++ b/geant/gap_ansible/roles/deploy_service_config/tasks/connection_tasks.yml @@ -5,6 +5,11 @@ ansible_port: "{{ router.router_ts_port }}" when: router.router_access_via_ts | ansible.builtin.bool +- name: Set ansible_host back to the {{ inventory_hostname }} + when: not router.router_access_via_ts | ansible.builtin.bool + ansible.builtin.set_fact: + ansible_host: "{{ inventory_hostname }}" + - name: Load netconf connection config ansible.builtin.set_fact: ansible_connection: "{{ netconf_access[router.vendor].ansible_connection }}" diff --git a/geant/gap_ansible/roles/edge_port/templates/nokia/edge_port_create.j2 b/geant/gap_ansible/roles/edge_port/templates/nokia/edge_port_create.j2 index 296e9fbc28e9f943128d98b361e7748d28eebcc2..af6f3156b1099150548fd6f27d40bde573d10695 100644 --- a/geant/gap_ansible/roles/edge_port/templates/nokia/edge_port_create.j2 +++ b/geant/gap_ansible/roles/edge_port/templates/nokia/edge_port_create.j2 @@ -8,6 +8,7 @@ <description>PHY {{ ep.edge_port_type }} {{ partner_name }} P_{{ ep.edge_port_name }} | {{ member.interface_description }}</description> <ethernet> <mode>access</mode> + <encap-type>{{ ep.encapsulation }}</encap-type> <mtu>{{ mtu_phy | default(9192) }}</mtu> {% if edge_port_lldp_enable_map[ep.edge_port_type] is true %} <lldp> @@ -37,6 +38,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>{{ ep.edge_port_name | lower }}</lag-name> <admin-state>enable</admin-state> + <encap-type>{{ ep.encapsulation }}</encap-type> {% if ep.geant_ga_id is string %} <description>LAG {{ ep.edge_port_type }} {{ partner_name }} ${{ ep.geant_ga_id }} |</description> {% else %} diff --git a/geant/gap_ansible/roles/service_checks/README.md b/geant/gap_ansible/roles/service_checks/README.md new file mode 100644 index 0000000000000000000000000000000000000000..225dd44b9fc5b3abff7e9c68ff9e91d505cdd5f0 --- /dev/null +++ b/geant/gap_ansible/roles/service_checks/README.md @@ -0,0 +1,38 @@ +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). diff --git a/geant/gap_ansible/roles/service_checks/defaults/main.yml b/geant/gap_ansible/roles/service_checks/defaults/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..693a16cab7abbd1fa0735bfd001a689b921f83b6 --- /dev/null +++ b/geant/gap_ansible/roles/service_checks/defaults/main.yml @@ -0,0 +1,4 @@ +--- +# defaults file for service_checks +sbp_ping_count: 10 +sbp_ping_size: 512 diff --git a/geant/gap_ansible/roles/service_checks/meta/main.yml b/geant/gap_ansible/roles/service_checks/meta/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..51500bc45aee99f3aaac1cd7fd145f7cf668d2c6 --- /dev/null +++ b/geant/gap_ansible/roles/service_checks/meta/main.yml @@ -0,0 +1,34 @@ +galaxy_info: + author: A. Kurbatov + description: GOAT engineer + 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. diff --git a/geant/gap_ansible/roles/service_checks/tasks/bgp_checks.yaml b/geant/gap_ansible/roles/service_checks/tasks/bgp_checks.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1408690fa433ffa2cf14150197b1fa9b4c44121c --- /dev/null +++ b/geant/gap_ansible/roles/service_checks/tasks/bgp_checks.yaml @@ -0,0 +1,18 @@ +--- +- name: Check BGP neigbor + ansible.netcommon.netconf_rpc: + rpc: action + xmlns: "urn:ietf:params:xml:ns:yang:1" + content: | + <global-operations xmlns="urn:nokia.com:sros:ns:yang:sr:oper-global"> + <md-cli-raw-command> + <md-cli-input-line>show router bgp neighbor "{{ neighbor.peer_address }}"</md-cli-input-line> + </md-cli-raw-command> + </global-operations> + display: json + register: out + +- name: Show ping results + when: "'nokiaoper:results' in out.output.['rpc-reply']" + ansible.builtin.debug: + msg: "{{out.output['rpc-reply']['nokiaoper:results']['nokiaoper:md-cli-output-block'].split('\n')}}" diff --git a/geant/gap_ansible/roles/service_checks/tasks/main.yml b/geant/gap_ansible/roles/service_checks/tasks/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..a6554fdd727299135902a84b2c432195544c666b --- /dev/null +++ b/geant/gap_ansible/roles/service_checks/tasks/main.yml @@ -0,0 +1,15 @@ +--- +# tasks file for service_checks +- name: Ping peer via SBP + when: object == 'sbp' + ansible.builtin.include_tasks: sbp_checks.yaml + loop: "{{ bgp_obj }}" + loop_control: + loop_var: neighbor + +- name: Check peer status + when: object == 'bgp' + ansible.builtin.include_tasks: bgp_checks.yaml + loop: "{{ bgp_obj }}" + loop_control: + loop_var: neighbor diff --git a/geant/gap_ansible/roles/service_checks/tasks/sbp_checks.yaml b/geant/gap_ansible/roles/service_checks/tasks/sbp_checks.yaml new file mode 100644 index 0000000000000000000000000000000000000000..68db009318cc5e8d94b24df76a1b6d5ec58c19f5 --- /dev/null +++ b/geant/gap_ansible/roles/service_checks/tasks/sbp_checks.yaml @@ -0,0 +1,18 @@ +--- +- name: Perform ping + ansible.netcommon.netconf_rpc: + rpc: action + xmlns: "urn:ietf:params:xml:ns:yang:1" + content: | + <global-operations xmlns="urn:nokia.com:sros:ns:yang:sr:oper-global"> + <md-cli-raw-command> + <md-cli-input-line>//ping count {{ sbp_ping_count }} size {{ sbp_ping_size }} rapid {{ neighbor.peer_address }}</md-cli-input-line> + </md-cli-raw-command> + </global-operations> + display: json + register: out + +- name: Show ping results + when: "'nokiaoper:results' in out.output.['rpc-reply']" + ansible.builtin.debug: + msg: "{{out.output['rpc-reply']['nokiaoper:results']['nokiaoper:md-cli-output-block'].split('\n')}}" diff --git a/geant/gap_ansible/roles/service_checks/vars/main.yml b/geant/gap_ansible/roles/service_checks/vars/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..d5c118718f49ca1d503a5a43c6ec56a7905af94d --- /dev/null +++ b/geant/gap_ansible/roles/service_checks/vars/main.yml @@ -0,0 +1,4 @@ +--- +# vars file for service_checks + +bgp_obj: "{{ ap.sbp.bgp_session_list }}"