diff --git a/geant/gap_ansible/roles/iptrunk_twamp/tasks/check_twamp_status.yaml b/geant/gap_ansible/roles/iptrunk_twamp/tasks/check_twamp_status.yaml index ee72afc6cc0cefee5659825d433d5c547f5900fe..80f39f9c29a498b1b67366912d1c14aae198592b 100644 --- a/geant/gap_ansible/roles/iptrunk_twamp/tasks/check_twamp_status.yaml +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/check_twamp_status.yaml @@ -5,12 +5,14 @@ - name: Juniper TWAMP client status when: > + local_side.iptrunk_side_node.vendor != remote_side.iptrunk_side_node.vendor + and local_side.iptrunk_side_node.vendor == "juniper" block: - name: Get TWAMP client stats junipernetworks.junos.junos_command: commands: - - show services rpm twamp client probe-results control-connection "{{ remote_side_short_name }}" test-session "{{ local_side_short_name }}--{{ remote_side_short_name }}" | except "Measurement|Samples" + - show services rpm twamp client probe-results control-connection "{{ local_side_short_name }}--{{ remote_side_short_name }}" test-session "{{ local_side_short_name }}--{{ remote_side_short_name }}" | except "Measurement|Samples" register: response - name: Show stats of TWAMP client @@ -18,7 +20,9 @@ msg: "{{ response.stdout_lines[0] }}" - name: Nokia TWAMP server status - when: > + when: >- + local_side.iptrunk_side_node.vendor != remote_side.iptrunk_side_node.vendor + and local_side.iptrunk_side_node.vendor == "nokia" block: - name: Get TWAMP server status @@ -33,6 +37,32 @@ </global-operations> display: json register: out - - name: Show ISIS status + + - name: Show TWAMP server status + ansible.builtin.debug: + msg: "{{out.output['rpc-reply']['nokiaoper:results']['nokiaoper:md-cli-output-block'].split('\n')}}" + +- name: Nokia TWAMP Light client status + when: >- + local_side.iptrunk_side_node.vendor == remote_side.iptrunk_side_node.vendor + and + local_side.iptrunk_side_node.vendor == "nokia" + and + inventory_hostname == trunks[0].config.nodeB.name + block: + - name: Get TWAMP light stats from the client + 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 oam-pm statistics session "{{ local_side_short_name }}--{{ remote_side_short_name }}" twamp-light meas-interval raw</md-cli-input-line> + </md-cli-raw-command> + </global-operations> + display: json + register: out + + - name: Show TWAMP Light stats from the client "{{ trunks[0].config.nodeB.name }}" ansible.builtin.debug: msg: "{{out.output['rpc-reply']['nokiaoper:results']['nokiaoper:md-cli-output-block'].split('\n')}}" diff --git a/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml b/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml index 876b4a428bbd8122f9293f75f010dfad49fe8c64..2138f98dc9d9116ffc7279b962daac7ee1f7ab98 100644 --- a/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml +++ b/geant/gap_ansible/roles/iptrunk_twamp/tasks/main.yml @@ -40,8 +40,8 @@ - name: Set short router names for local and remote sides ansible.builtin.set_fact: - local_side_short_name: '{{ local_side.iptrunk_side_node.router_fqdn | replace(".lab.office.geant.net", "") }}' - remote_side_short_name: '{{ remote_side.iptrunk_side_node.router_fqdn | replace(".lab.office.geant.net", "") }}' + local_side_short_name: '{{ local_side.iptrunk_side_node.router_fqdn | replace(postfix_to_remove, "") }}' + remote_side_short_name: '{{ remote_side.iptrunk_side_node.router_fqdn | replace(postfix_to_remove, "") }}' - name: Set Local and Remote side IPv4 addresses nodeA ansible.builtin.set_fact: @@ -55,15 +55,41 @@ remote_side_address: "{{ trunks[0].config.nodeA.ipv4_address }}" when: local_side.iptrunk_side_node.router_fqdn == trunks[0].config.nodeB.name -- name: Set the "config_object" to "twamp_client" when trunks side is Juniper +- name: Set the "config_object" to "twamp_client" when trunk is Juniper-Nokia and trunk side is Juniper ansible.builtin.set_fact: config_object: "twamp_client" - when: local_side.iptrunk_side_node.vendor == "juniper" + when: >- + local_side.iptrunk_side_node.vendor != remote_side.iptrunk_side_node.vendor + and + local_side.iptrunk_side_node.vendor == "juniper" -- name: Set the "config_object" to "twamp_server" when trunk side is Nokia +- name: Set the "config_object" to "twamp_server" when trunk is Juniper-Nokia and trunk side is Nokia ansible.builtin.set_fact: config_object: "twamp_server" - when: local_side.iptrunk_side_node.vendor == "nokia" + when: >- + local_side.iptrunk_side_node.vendor != remote_side.iptrunk_side_node.vendor + and + local_side.iptrunk_side_node.vendor == "nokia" + +- name: Set the "config_object" to "twamp_light_server" when trunk is Nokia-Nokia and node is nodeA + ansible.builtin.set_fact: + config_object: "twamp_light_server" + when: >- + local_side.iptrunk_side_node.vendor == remote_side.iptrunk_side_node.vendor + and + local_side.iptrunk_side_node.vendor == "nokia" + and + inventory_hostname == trunks[0].config.nodeA.name + +- name: Set the "config_object" to "twamp_light_client" when trunk is Nokia-Nokia and node is nodeB + ansible.builtin.set_fact: + config_object: "twamp_light_client" + when: >- + local_side.iptrunk_side_node.vendor == remote_side.iptrunk_side_node.vendor + and + local_side.iptrunk_side_node.vendor == "nokia" + and + inventory_hostname == trunks[0].config.nodeB.name - name: Include compiling the template ansible.builtin.include_tasks: compile_object.yaml diff --git a/geant/gap_ansible/roles/iptrunk_twamp/templates/nokia/twamp_light_client.j2 b/geant/gap_ansible/roles/iptrunk_twamp/templates/nokia/twamp_light_client.j2 new file mode 100644 index 0000000000000000000000000000000000000000..88fc4a197b21b3615e70353e10357d3b1dcadbd7 --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_twamp/templates/nokia/twamp_light_client.j2 @@ -0,0 +1,27 @@ + +<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"> + <oam-pm 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"> + <bin-group> + <bin-group-id>{{ nokia_twamp_light.oam_pm_bin_group }}</bin-group-id> + <admin-state>enable</admin-state> + </bin-group> + <session alu:operation="replace"> + <session-name>{{ local_side_short_name }}--{{ remote_side_short_name }}</session-name> + <bin-group>{{ nokia_twamp_light.oam_pm_bin_group }}</bin-group> + <ip> + <destination>{{ remote_side_address }}</destination> + <destination-udp-port>{{ nokia_twamp_light.udp_port}}</destination-udp-port> + <source>{{ local_side_address }}</source> + <twamp-light> + <admin-state>enable</admin-state> + <test-id>{{ nokia_twamp_light.test_id }}</test-id> + <interval>{{ nokia_twamp_light.interval }}</interval> + <pad-size>{{ nokia_twamp_light.pad_size }}</pad-size> + <record-stats>{{ nokia_twamp_light.record_stats }}</record-stats> + </twamp-light> + </ip> + </session> + </oam-pm> + </configure> +</config> diff --git a/geant/gap_ansible/roles/iptrunk_twamp/templates/nokia/twamp_light_server.j2 b/geant/gap_ansible/roles/iptrunk_twamp/templates/nokia/twamp_light_server.j2 new file mode 100644 index 0000000000000000000000000000000000000000..c75802c8e2cac04d7cbe619cd2abb5f9cb026bdb --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_twamp/templates/nokia/twamp_light_server.j2 @@ -0,0 +1,17 @@ + +<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"> + <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> + <twamp-light> + <reflector> + <admin-state>enable</admin-state> + <udp-port>{{ nokia_twamp_light.udp_port }}</udp-port> + <prefix> + <ip-prefix>{{ nokia_twamp_light.trunks_subnet }}</ip-prefix> + </prefix> + </reflector> + </twamp-light> + </router> + </configure> +</config> diff --git a/geant/gap_ansible/roles/iptrunk_twamp/vars/main.yml b/geant/gap_ansible/roles/iptrunk_twamp/vars/main.yml index 161f1b440e35f626feb0671a2ca83f82882bc22b..1b39b11247a0151100bc918b329aff7e93616514 100644 --- a/geant/gap_ansible/roles/iptrunk_twamp/vars/main.yml +++ b/geant/gap_ansible/roles/iptrunk_twamp/vars/main.yml @@ -5,6 +5,8 @@ dry_run: "True" +postfix_to_remove: ".dev.geant.private" + nokia_twamp_server: max_conn: 1 max_sess: 1 @@ -18,6 +20,16 @@ juniper_twamp_client: probe_count: 500 probe_interval: 1 +nokia_twamp_light: + oam_pm_bin_group: 2 + udp_port: 64364 + test_id: 1 + interval: 1000 + pad_size: 10 + record_stats: delay-and-loss + trunks_subnet: "10.101.1.0/24" + + side_a_ipv4_address: "{{ subscription.iptrunk.iptrunk_ipv4_network | ansible.utils.ipaddr('net') | ansible.utils.ipaddr('address') }}" side_b_ipv4_address: "{{ subscription.iptrunk.iptrunk_ipv4_network | ansible.utils.ipaddr('net') | ansible.utils.ipaddr('1') | ansible.utils.ipaddr('address') }}"