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

Edge port core templates and tasks

parent adfe26f6
No related branches found
No related tags found
1 merge request!184Updates to the edge_port role
......@@ -13,11 +13,11 @@
mode: '0755'
delegate_to: localhost
- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/edge_port.conf"
- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/edge_port_{{ verb }}.conf"
when: verb == "create"
ansible.builtin.template:
src: "{{ router.vendor }}/edge_port.j2"
dest: "/var/tmp/ansible_run_{{ opid }}/edge_port.conf"
src: "{{ router.vendor }}/edge_port_{{ verb }}.j2"
dest: "/var/tmp/ansible_run_{{ opid }}/edge_port_{{ verb }}.conf"
lstrip_blocks: true
trim_blocks: true
mode: '0755'
......
- name: Deploy PE base_config on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA]
- name: Perform "{{ verb }}" Edge port on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA]
when: >-
dry_run | ansible.builtin.bool
and verb == "deploy_pe_base_config"
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_promotion_base_config.j2') }}"
content: "{{ lookup('ansible.builtin.template', '{{ router.vendor }}/edge_port_{{ verb }}.j2') }}"
commit: true
validate: true
diff: true
register: output
check_mode: true
- name: Deploy PE base VPRNs on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA]
- name: Perform "{{ verb }}" Edge port on "{{ inventory_hostname }}" [FOR REAL][NOKIA]
when: >-
dry_run | ansible.builtin.bool
and verb == "deploy_routing_instances"
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_promotion_base_vprn.j2') }}"
commit: true
validate: true
diff: true
register: output
check_mode: true
- name: Deploy SDP mesh on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA]
when: >-
dry_run | ansible.builtin.bool
and verb == "update_sdp_mesh"
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_update_sdp.j2') }}"
commit: true
validate: true
diff: true
register: output
check_mode: true
- name: Delete default routes on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA]
when: >-
dry_run | ansible.builtin.bool
and verb == "delete_default_routes"
not (dry_run | ansible.builtin.bool)
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/router/delete_default_static_routes.j2') }}"
content: "{{ lookup('ansible.builtin.template', '{{ router.vendor }}/edge_port_{{ verb }}.j2') }}"
commit: true
validate: true
diff: true
register: output
check_mode: true
# - name: Fail if there is any diff
# ansible.builtin.fail:
# msg: Base config drift detected!!!
# when: >
# output.changed | ansible.builtin.bool
# and
# is_verification_workflow | ansible.builtin.bool
- name: Deploy base_config on "{{ inventory_hostname }}" [AND COMMIT][NOKIA]
when: >-
not (dry_run | ansible.builtin.bool) and
verb == "deploy_pe_base_config"
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_promotion_base_config.j2') }}"
commit: true
commit_comment: "{{ commit_comment }}"
diff: true
check_mode: false
- name: Deploy PE base VPRNs on "{{ inventory_hostname }}" [AND COMMIT][NOKIA]
when: >-
not (dry_run | ansible.builtin.bool) and
verb == "deploy_routing_instances"
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_promotion_base_vprn.j2') }}"
commit: true
commit_comment: "{{ commit_comment }}"
diff: true
check_mode: false
- name: Deploy updated SDP mesh on "{{ inventory_hostname }}" [AND COMMIT][NOKIA]
when: >-
not (dry_run | ansible.builtin.bool) and
verb == "update_sdp_mesh"
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/pe_update_sdp.j2') }}"
commit: true
commit_comment: "{{ commit_comment }}"
diff: true
check_mode: false
- name: Delete default routes on "{{ inventory_hostname }}" [AND COMMIT][NOKIA]
when: >-
not (dry_run | ansible.builtin.bool)
and verb == "delete_default_routes"
geant.gap_ansible.nokia_netconf_config:
format: xml
default_operation: merge
content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/router/delete_default_static_routes.j2') }}"
commit: true
commit_comment: "{{ commit_comment }}"
diff: true
check_mode: false
......@@ -7,6 +7,6 @@
when: verb in verbs
ansible.builtin.include_tasks: compile.yaml
# - name: Include deploy if selected
# when: verb in verbs
# ansible.builtin.include_tasks: deploy.yaml
- name: Include create if selected
when: verb in verbs
ansible.builtin.include_tasks: deploy.yaml
<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">
{% for member in edge_port_ae_members %}
{% for member in ep.edge_port_ae_members %}
<port 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">
<port-id>{{ member.interface_name }}</port-id>
<admin-state>enable</admin-state>
<description>PHY {{ edge_port_type }} {{ partner_name }} P_{{ edge_port_name }} | {{ member.interface_description }}</description>
<description>PHY {{ ep.edge_port_type }} {{ partner_name }} P_{{ ep.edge_port_name }} | {{ member.interface_description }}</description>
<ethernet>
<mode>access</mode>
<mtu>{{ mtu_phy | default(9192) }}</mtu>
{% if edge_port_lldp_enable_map[edge_port_type] is true %}
{% if edge_port_lldp_enable_map[ep.edge_port_type] is true %}
<lldp>
<dest-mac>
<mac-type>nearest-bridge</mac-type>
......@@ -27,33 +27,37 @@
</port>
{% endfor %}
{% if edge_port_removed_ae_members is defined %}
{% for member in edge_port_removed_ae_members %}
{% for member in edge_port_removed_ae_members %}
<port 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">
<port-id>{{ member.interface_name }}</port-id>
<admin-state>disable</admin-state>
<description>''</description>
</port>
{% endfor %}
{% endfor %}
{% endif %}
<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>{{ edge_port_name | lower }}</lag-name>
<lag-name>{{ ep.edge_port_name | lower }}</lag-name>
<admin-state>enable</admin-state>
<description>LAG {{ edge_port_type }} {{ partner_name }} </description>
<mode>network</mode>
{% if edge_port_enable_lacp is true %}
{% if ep.edge_port_geant_ga_id is string %}
<description>LAG {{ ep.edge_port_type }} {{ partner_name }} ${{ ep.edge_port_geant_ga_id }} | </description>
{% else %}
<description>LAG {{ ep.edge_port_type }} {{ partner_name }} | </description>
{% endif %}
<mode>access</mode>
{% if ep.edge_port_enable_lacp is true %}
<lacp>
<mode>active</mode>
<administrative-key>{{ (edge_port_name|split("-"))[1] }}</administrative-key>
<administrative-key>{{ (ep.edge_port_name|split("-"))[1] }}</administrative-key>
</lacp>
{% endif %}
{% for member in edge_port_ae_members %}
{% for member in ep.edge_port_ae_members %}
<port>
<port-id>{{ member.interface_name }}</port-id>
</port>
{% endfor %}
{% if ( edge_port_minimum_links | int) > 1 %}
{% if ( ep.edge_port_minimum_links | int) > 1 %}
<port-threshold>
<value>{{ ( edge_port_minimum_links | int) - 1 }}</value>
<value>{{ ( ep.edge_port_minimum_links | int) - 1 }}</value>
<action>down</action>
</port-threshold>
{% endif %}
......
<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">
{% for member in ep.edge_port_ae_members %}
<port 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">
<port-id>{{ member.interface_name }}</port-id>
<admin-state>enable</admin-state>
<description>PHY {{ ep.edge_port_type }} {{ partner_name }} P_{{ ep.edge_port_name }} | {{ member.interface_description }}</description>
<ethernet>
<mode>access</mode>
<mtu>{{ mtu_phy | default(9192) }}</mtu>
{% if edge_port_lldp_enable_map[ep.edge_port_type] is true %}
<lldp>
<dest-mac>
<mac-type>nearest-bridge</mac-type>
<receive>true</receive>
<transmit>true</transmit>
<tx-tlvs>
<port-desc>true</port-desc>
<sys-name>true</sys-name>
<sys-cap>true</sys-cap>
</tx-tlvs>
</dest-mac>
</lldp>
{% endif %}
</ethernet>
</port>
{% endfor %}
{% if removed_ae_members is defined and removed_ae_members|length > 0 %}
{% for member in removed_ae_members %}
<port 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">
<port-id>{{ member.interface_name }}</port-id>
<admin-state>disable</admin-state>
</port>
{% endfor %}
{% endif %}
<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>
{% if ep.edge_port_geant_ga_id is string %}
<description>LAG {{ ep.edge_port_type }} {{ partner_name }} ${{ ep.edge_port_geant_ga_id }} | </description>
{% else %}
<description>LAG {{ ep.edge_port_type }} {{ partner_name }} | </description>
{% endif %}
<mode>access</mode>
{% if ep.edge_port_enable_lacp is true %}
<lacp>
<mode>active</mode>
<administrative-key>{{ (ep.edge_port_name|split("-"))[1] }}</administrative-key>
</lacp>
{% endif %}
{% for member in ep.edge_port_ae_members %}
<port>
<port-id>{{ member.interface_name }}</port-id>
</port>
{% endfor %}
{% if ( ep.edge_port_minimum_links | int) > 1 %}
<port-threshold>
<value>{{ ( ep.edge_port_minimum_links | int) - 1 }}</value>
<action>down</action>
</port-threshold>
{% endif %}
</lag>
</configure>
</config>
<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">
{% for member in ep.edge_port_ae_members %}
<port 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">
<port-id>{{ member.interface_name }}</port-id>
<admin-state>disable</admin-state>
</port>
{% endfor %}
<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="delete">
<lag-name>{{ ep.edge_port_name | lower }}</lag-name>
</lag>
</configure>
</config>
edge_port_create.j2
\ No newline at end of file
......@@ -4,8 +4,8 @@ dry_run: true
verbs:
- create
- deploy # deploys an EdgePort
- delete # deletes an EdgePort
- update
- terminate
- migrate # migrates an EdgePort
ep: "{{ subscription.edge_port }}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment