-
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.
* add filter for non-vpc peer interfaces * Create ndfc_vpc_peering.yml * Create ndfc_vpc_peering.j2 * Update vpc_peering.yml * Update ndfc_interface_vpc_peer_link.j2 * Update main.yml * Update main.yml * Create ndfc_interface_vpc_peering.j2 * Update vpc_peering.yml * update vpc files * Update main.yml * adjust title heading in ndfc_interface_vpc_peering.j2 * update j2 file descriptions * set deploy to false for vpc peering interface list build * limit vpc peering paramters to just what is supported by vxlan fabric --------- Co-authored-by: Matt Tarkington <[email protected]>
- Loading branch information
Showing
10 changed files
with
174 additions
and
132 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,36 @@ | ||
--- | ||
- name: Set interface_vpc_peering_file_name Var | ||
ansible.builtin.set_fact: | ||
interface_vpc_peering_file_name: "{{ MD.fabric.global.name }}_ndfc_interface_vpc_peering_.yml" | ||
|
||
- name: Build Interfaces for VPC Peering | ||
ansible.builtin.template: | ||
src: ndfc_interface_vpc_peering.j2 | ||
dest: "{{ role_path }}/files/{{ interface_vpc_peering_file_name }}" | ||
|
||
- name: Set interface_vpc_peering Var default | ||
ansible.builtin.set_fact: | ||
interface_vpc_peering: [] | ||
|
||
- name: Set interface_vpc_peering Var | ||
ansible.builtin.set_fact: | ||
interface_vpc_peering: "{{ lookup('file', interface_vpc_peering_file_name) | from_yaml }}" | ||
when: MD_Extended.fabric.topology.vpc_peers | length > 0 | ||
|
||
- name: Set vpc_peering_file_name Var | ||
ansible.builtin.set_fact: | ||
vpc_peering_file_name: "{{ MD.fabric.global.name }}_ndfc_vpc_peering.yml" | ||
|
||
- name: Build vPC Peering | ||
ansible.builtin.template: | ||
src: ndfc_vpc_peering.j2 | ||
dest: "{{ role_path }}/files/{{ vpc_peering_file_name }}" | ||
|
||
- name: Set vpc_peering Var default | ||
ansible.builtin.set_fact: | ||
vpc_peering: [] | ||
|
||
- name: Set vpc_peering Var | ||
ansible.builtin.set_fact: | ||
vpc_peering: "{{ lookup('file', 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
# This NDFC interface vPC Peering config data structure 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 in peers['peer1_peerlink_interfaces'] %} | ||
- name : {{ interface['name'] }} | ||
type: eth | ||
switch: | ||
{% 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 %} | ||
deploy: false | ||
profile: | ||
admin_state: True | ||
mode: 'trunk' | ||
{% endfor %} | ||
{% for interface in peers['peer2_peerlink_interfaces'] %} | ||
- name : {{ interface['name'] }} | ||
type: eth | ||
switch: | ||
{% 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 %} | ||
deploy: true | ||
profile: | ||
admin_state: True | ||
mode: 'trunk' | ||
{% 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
# This NDFC vPC Peering config data structure is auto-generated | ||
# DO NOT EDIT MANUALLY | ||
# | ||
|
||
{% if MD.fabric.topology.vpc_peers is defined and MD.fabric.topology.vpc_peers is not none %} | ||
{% for vpc_peer in MD.fabric.topology.vpc_peers %} | ||
{% if MD_Extended.fabric.topology.leaf[vpc_peer.peer1].management_ipv4_address is not none %} | ||
- peerOneId: {{ MD_Extended.fabric.topology.leaf[vpc_peer.peer1].management_ipv4_address }} | ||
{% elif MD_Extended.fabric.topology.leaf[vpc_peer.peer1].management_ipv6_address is not none %} | ||
- peerOneId: {{ MD_Extended.fabric.topology.leaf[vpc_peer.peer1].management_ipv6_address }} | ||
{% endif %} | ||
{% if MD_Extended.fabric.topology.leaf[vpc_peer.peer2].management_ipv4_address is not none %} | ||
peerTwoId: {{ MD_Extended.fabric.topology.leaf[vpc_peer.peer2].management_ipv4_address }} | ||
{% elif MD_Extended.fabric.topology.leaf[vpc_peer.peer2].management_ipv6_address is not none %} | ||
peerTwoId: {{ MD_Extended.fabric.topology.leaf[vpc_peer.peer2].management_ipv6_address }} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} |
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 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,37 @@ | ||
--- | ||
|
||
- 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 | ||
|
||
- name: Manage vPC Peering | ||
cisco.dcnm.dcnm_vpc_pair: | ||
src_fabric: "{{ MD.fabric.global.name }}" | ||
deploy: false | ||
state: replaced | ||
config: "{{ vpc_peering }}" |
20 changes: 20 additions & 0 deletions
20
roles/dtc/create/templates/ndfc_interface_vpc_peer_link.j2
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,20 @@ | ||
# This NDFC vPC peer-link interface config data structure is auto-generated | ||
# DO NOT EDIT MANUALLY | ||
# | ||
|
||
{% for item in interface_not_vpc_peering %} | ||
{% set switch_serial_number = item.interfaces[0].serialNumber %} | ||
{% set query = "[?(@.serial_number==`" ~ switch_serial_number ~ "`)].management" %} | ||
{% set switch_management = (MD.fabric.topology.switches | community.general.json_query(query))[0] %} | ||
- name: {{ item.interfaces[0].ifName }} | ||
type: eth | ||
switch: | ||
{% if switch_management.management_ipv4_address is defined %} | ||
- {{ switch_management.management_ipv4_address}} | ||
{% elif (switch_management.management_ipv4_address is not defined) and (switch_management.management_ipv6_address is defined) %} | ||
- {{ switch_management.management_ipv6_address}} | ||
{% endif %} | ||
profile: | ||
admin_state: true | ||
mode: trunk | ||
{% 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