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

Changes around `ims_service_name`

If `custom_service_name` is passed from GSO, use this;
else construct `ims_service_name` according to the agreed algorithm, and
use in the service description after `#`.
- `partners_sorted` - always use partners names sorted in alphabetical
order in the service description.
parent c4105225
No related branches found
No related tags found
1 merge request!265Changes around `ims_service_name`
Pipeline #93983 passed
...@@ -14,12 +14,42 @@ ...@@ -14,12 +14,42 @@
- name: Set partner names for the l2circuit Local endpoint - name: Set partner names for the l2circuit Local endpoint
ansible.builtin.set_fact: ansible.builtin.set_fact:
local_partner_name: "{{ local_side.sbp.edge_port.partner_name }}" local_partner_name: "{{ local_side.sbp.edge_port.partner_name | upper }}"
- name: Set partner names for the l2circuit Remote endpoint - name: Set partner names for the l2circuit Remote endpoint
when: not local_cross_connect when: not local_cross_connect
ansible.builtin.set_fact: ansible.builtin.set_fact:
remote_partner_name: "{{ remote_side.sbp.edge_port.partner_name }}" remote_partner_name: "{{ remote_side.sbp.edge_port.partner_name | upper }}"
- name: Set partners combination for the service description
when: not local_cross_connect
ansible.builtin.set_fact:
partners_sorted: "{{ [local_partner_name, remote_partner_name] | sort | join(' ') }}"
- name: Set IMS service name to subscription custom_service_name if it is defined
when: subscription.layer_2_circuit.custom_service_name is not none
ansible.builtin.set_fact:
ims_service_name: "{{ subscription.layer_2_circuit.custom_service_name }}"
- name: Calculate IMS service name
when: subscription.layer_2_circuit.custom_service_name is none
block:
- name: Set local and remote site names
ansible.builtin.set_fact:
local_site_name: "{{ local_side.sbp.edge_port.node.router_site.site_name }}"
remote_site_name: "{{ remote_side.sbp.edge_port.node.router_site.site_name }}"
- name: Sort site names alphabetically
ansible.builtin.set_fact:
site_names_sorted: "{{ [local_site_name, remote_site_name] | sort | join('-') }}"
- name: Extract last 5 digits from the GS-ID
ansible.builtin.set_fact:
gsid: "{{ local_side.sbp.gs_id[-5:] | join('') }}"
- name: Put IMS name together
ansible.builtin.set_fact:
ims_service_name: "{{ site_names_sorted + '-' + gsid }}"
- name: Calculate SDP to use locally - name: Calculate SDP to use locally
when: not local_cross_connect when: not local_cross_connect
......
set interfaces {{ l2circuits_lag_name }} unit {{ l2circuits_vlan }} description "SRV_L2CIRCUIT CUSTOMER {{ local_partner_name | upper }} {{ remote_partner_name | upper }} #{{ l2circuits_custom_service_name | replace(' ', '_') }} ${{ local_side.sbp.gs_id }}" set interfaces {{ l2circuits_lag_name }} unit {{ l2circuits_vlan }} description "SRV_L2CIRCUIT CUSTOMER {{ patners_sorted }} #{{ ims_service_name }} ${{ local_side.sbp.gs_id }}"
set interfaces {{ l2circuits_lag_name }} unit {{ l2circuits_vlan }} encapsulation vlan-ccc set interfaces {{ l2circuits_lag_name }} unit {{ l2circuits_vlan }} encapsulation vlan-ccc
set interfaces {{ l2circuits_lag_name }} unit {{ l2circuits_vlan }} family ccc set interfaces {{ l2circuits_lag_name }} unit {{ l2circuits_vlan }} family ccc
{% if l2circuits_l2c_type == 'Ethernet' %} {% if l2circuits_l2c_type == 'Ethernet' %}
......
{#{% if l2circuits_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"> <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"> <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf">
...@@ -14,14 +13,12 @@ ...@@ -14,14 +13,12 @@
</connection-profile> </connection-profile>
{% endif %} {% endif %}
{% set csn = '#'+l2circuits_custom_service_name|replace(' ', '_') if l2circuits_custom_service_name|length > 0 %}
<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">
<epipe alu:operation="replace"> <epipe alu:operation="replace">
<service-name>EPIPE:{{ l2circuits_custom_service_name | replace(' ', '_') }}:{{ l2circuits_l2c_vcid }}</service-name> <service-name>EPIPE:{{ ims_service_name }}:{{ l2circuits_l2c_vcid }}</service-name>
<admin-state>enable</admin-state> <admin-state>enable</admin-state>
<description>SRV_L2CIRCUIT CUSTOMER {{ local_partner_name | upper }} {{ remote_partner_name | upper }} {{ csn | replace(' ', '_') if csn is defined }} ${{ local_side.sbp.gs_id }}</description> <description>SRV_L2CIRCUIT CUSTOMER {{ partners_sorted }} #{{ ims_service_name }} ${{ local_side.sbp.gs_id }}</description>
<service-id>{{ l2circuits_l2c_vcid }}</service-id> <service-id>{{ l2circuits_l2c_vcid }}</service-id>
<customer>1</customer> <customer>1</customer>
<service-mtu>{{ service_mtu.nokia }}</service-mtu> <service-mtu>{{ service_mtu.nokia }}</service-mtu>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<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">
<epipe alu:operation="delete"> <epipe alu:operation="delete">
<service-name>EPIPE:{{ l2circuits_custom_service_name | replace(' ', '_') }}:{{ l2circuits_l2c_vcid }}</service-name> <service-name>EPIPE:{{ ims_service_name }}:{{ l2circuits_l2c_vcid }}</service-name>
</epipe> </epipe>
</service> </service>
......
...@@ -9,4 +9,4 @@ l2circuits_lag_name: "{{ l2c_side.sbp.edge_port.edge_port_name }}" ...@@ -9,4 +9,4 @@ l2circuits_lag_name: "{{ l2c_side.sbp.edge_port.edge_port_name }}"
l2circuits_vlan: "{{ l2c_side.sbp.vlan_id }}" l2circuits_vlan: "{{ l2c_side.sbp.vlan_id }}"
l2circuits_l2c_type: "{{ subscription.layer_2_circuit.layer_2_circuit_type }}" l2circuits_l2c_type: "{{ subscription.layer_2_circuit.layer_2_circuit_type }}"
l2circuits_l2c_vcid: "{{ subscription.layer_2_circuit.virtual_circuit_id }}" l2circuits_l2c_vcid: "{{ subscription.layer_2_circuit.virtual_circuit_id }}"
l2circuits_custom_service_name: "{{ subscription.layer_2_circuit.custom_service_name }}" # l2circuits_custom_service_name: "{{ subscription.layer_2_circuit.custom_service_name }}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment