-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Switchover vPC peeri interface prep to use dcnm_links change from provisioning interfaces to provisioning links * Remove vpc peering before switch delete * fix feedbacks from PR 84 * add removal for links * fix state
- Loading branch information
Showing
8 changed files
with
132 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Set link_vpc_peering_file_name Var | ||
ansible.builtin.set_fact: | ||
link_vpc_peering_file_name: "{{ MD.fabric.global.name }}_ndfc_link_vpc_peering_.yml" | ||
|
||
- name: Build Links for VPC Peering | ||
ansible.builtin.template: | ||
src: ndfc_links_vpc_peering.j2 | ||
dest: "{{ role_path }}/files/{{ link_vpc_peering_file_name }}" | ||
|
||
- name: Set link_vpc_peering Var default | ||
ansible.builtin.set_fact: | ||
link_vpc_peering: [] | ||
|
||
- name: Set link_vpc_peering Var | ||
ansible.builtin.set_fact: | ||
link_vpc_peering: "{{ lookup('file', link_vpc_peering_file_name) | from_yaml }}" | ||
when: MD_Extended.fabric.topology.vpc_peers | length > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
# This NDFC links for vPC Peering is auto-generated | ||
# DO NOT EDIT MANUALLY | ||
# | ||
#jinja2: trim_blocks: True, lstrip_blocks: False | ||
{% for peers in MD_Extended.fabric.topology.vpc_peers %} | ||
{% for interface_index in range(peers['peer1_peerlink_interfaces']|length) %} | ||
{% set peer1_interface = peers['peer1_peerlink_interfaces'][interface_index] %} | ||
{% set peer2_interface = peers['peer2_peerlink_interfaces'][interface_index] %} | ||
{% if peer1_interface is defined and peer2_interface is defined %} | ||
- dst_fabric : {{ MD_Extended.fabric.global.name }} | ||
template: int_pre_provision_intra_fabric_link | ||
src_interface: {{peer1_interface.name}} | ||
dst_interface: {{peer2_interface.name}} | ||
src_device: | ||
{% set switch = MD_Extended.fabric.topology.leaf[peers.peer1] %} | ||
{% if switch.management_ipv4_address is defined %} | ||
{{ switch.management_ipv4_address}} | ||
{% elif (switch.management_ipv4_address is not defined) and (switch.management_ipv6_address is defined) %} | ||
{{ switch.management_ipv6_address}} | ||
{% endif %} | ||
dst_device: | ||
{% set switch = MD_Extended.fabric.topology.leaf[peers.peer2] %} | ||
{% if switch.management_ipv4_address is defined %} | ||
{{ switch.management_ipv4_address}} | ||
{% elif (switch.management_ipv4_address is not defined) and (switch.management_ipv6_address is defined) %} | ||
{{ switch.management_ipv6_address}} | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,70 @@ | ||
--- | ||
|
||
- name: Query for vPC Peering Interfaces | ||
cisco.dcnm.dcnm_interface: | ||
fabric: "{{ MD.fabric.global.name }}" | ||
state: query | ||
config: "{{ interface_vpc_peering }}" | ||
register: interface_vpc_peering_query | ||
|
||
- name: Get Interfaces Not Associated to vPC Peering Policy | ||
ansible.builtin.set_fact: | ||
interface_not_vpc_policy: "{{ interface_vpc_peering_query.response | community.general.json_query(vpc_peer_policy_query) }}" | ||
vars: | ||
vpc_peer_policy_query: "[?(@.policy!=`int_vpc_peer_link_po_member_11_1`)]" | ||
|
||
- name: Generate Config Payload Update for Interfaces Not Associated to vPC Peering Policy | ||
ansible.builtin.set_fact: | ||
interface_vpc_peering_payload: "{{ lookup('template', 'ndfc_interface_vpc_peer_link.j2') }}" | ||
when: interface_not_vpc_policy | length > 0 | ||
# -------------------------------------------------------------------- | ||
# Manage Intra Fabric Links Configuration on NDFC (prepare links for vpc peering) | ||
# -------------------------------------------------------------------- | ||
|
||
- name: Manage Interfaces for vPC Peering | ||
cisco.dcnm.dcnm_interface: | ||
fabric: "{{ MD.fabric.global.name }}" | ||
- name: Manage Intra Fabric Links for vpc peering | ||
cisco.dcnm.dcnm_links: | ||
state: replaced | ||
config: "{{ interface_vpc_peering_payload | from_yaml }}" | ||
deploy: true | ||
src_fabric: "{{ MD_Extended.fabric.global.name }}" | ||
config: "{{ link_vpc_peering }}" | ||
vars: | ||
ansible_command_timeout: 3000 | ||
ansible_connect_timeout: 3000 | ||
when: interface_not_vpc_policy | length > 0 | ||
|
||
# tune this based on field testing. for now we are leaving at 60 seconds to allow the interfaces to come up. | ||
# we can also look at the interface status and wait for the interfaces to be up before proceeding. | ||
- name: Wait for vPC Peering Interfaces to come up | ||
ansible.builtin.pause: | ||
seconds: 60 | ||
when: interface_not_vpc_policy | length > 0 | ||
# -------------------------------------------------------------------- | ||
# Manage vPC Peering | ||
# -------------------------------------------------------------------- | ||
|
||
- name: Manage vPC Peering | ||
cisco.dcnm.dcnm_vpc_pair: | ||
src_fabric: "{{ MD.fabric.global.name }}" | ||
deploy: false | ||
state: replaced | ||
config: "{{ vpc_peering }}" | ||
|
||
|
||
|
||
# - name: Query for vPC Peering Interfaces | ||
# cisco.dcnm.dcnm_interface: | ||
# fabric: "{{ MD.fabric.global.name }}" | ||
# state: query | ||
# config: "{{ interface_vpc_peering }}" | ||
# register: interface_vpc_peering_query | ||
|
||
# - name: Get Interfaces Not Associated to vPC Peering Policy | ||
# ansible.builtin.set_fact: | ||
# interface_not_vpc_policy: "{{ interface_vpc_peering_query.response | community.general.json_query(vpc_peer_policy_query) }}" | ||
# vars: | ||
# vpc_peer_policy_query: "[?(@.policy!=`int_vpc_peer_link_po_member_11_1`)]" | ||
|
||
# - name: Generate Config Payload Update for Interfaces Not Associated to vPC Peering Policy | ||
# ansible.builtin.set_fact: | ||
# interface_vpc_peering_payload: "{{ lookup('template', 'ndfc_interface_vpc_peer_link.j2') }}" | ||
# when: interface_not_vpc_policy | length > 0 | ||
|
||
# - name: Manage Interfaces for vPC Peering | ||
# cisco.dcnm.dcnm_interface: | ||
# fabric: "{{ MD.fabric.global.name }}" | ||
# state: replaced | ||
# config: "{{ interface_vpc_peering_payload | from_yaml }}" | ||
# deploy: true | ||
# vars: | ||
# ansible_command_timeout: 3000 | ||
# ansible_connect_timeout: 3000 | ||
# when: interface_not_vpc_policy | length > 0 | ||
|
||
# # tune this based on field testing. for now we are leaving at 60 seconds to allow the interfaces to come up. | ||
# # we can also look at the interface status and wait for the interfaces to be up before proceeding. | ||
# - name: Wait for vPC Peering Interfaces to come up | ||
# ansible.builtin.pause: | ||
# seconds: 60 | ||
# when: interface_not_vpc_policy | length > 0 | ||
|
||
# - name: Manage vPC Peering | ||
# cisco.dcnm.dcnm_vpc_pair: | ||
# src_fabric: "{{ MD.fabric.global.name }}" | ||
# deploy: false | ||
# state: replaced | ||
# config: "{{ vpc_peering }}" |
21 changes: 0 additions & 21 deletions
21
roles/dtc/create/templates/ndfc_interface_vpc_peer_link.j2
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters