Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion plugins/action/dtc/manage_child_fabric_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ def run(self, tmp=None, task_vars=None):

nd_version = self._task.args["nd_version"]
msite_data = self._task.args["msite_data"]
net_config = self._task.args.get("net_config")

# Extract net_name values from net_config list of dicts
# net_config contains network(s) to be updated.
net_names = [item.get('net_name') for item in net_config] if net_config else []

# Extract major, minor, patch and patch letter from nd_version
# that is set in nac_dc_vxlan.dtc.connectivity_check role
Expand All @@ -80,6 +85,11 @@ def run(self, tmp=None, task_vars=None):

for network in networks:

# Skip network if its name is not in net_names list
# This reduce iteration to all networks x child_fabrics.
if network['name'] not in net_names:
continue

network_child_fabrics = network.get('child_fabrics', [])

for child_fabric in child_fabrics.keys():
Expand Down Expand Up @@ -278,13 +288,15 @@ def run(self, tmp=None, task_vars=None):
child_fabric_type = child_fabrics[child_fabric]['type']
if child_fabric_type in ['Switch_Fabric']:
# Only process child fabrics that have not already been marked as changed
# Networks must be in the DEPLOYED state when no changes are present.
# To reduce data, we filter by excluding networkStatus values that are not DEPLOYED.
if child_fabric not in results['child_fabrics_changed']:
# cf = child_fabrics
ndfc_cf_nets = self._execute_module(
module_name="cisco.dcnm.dcnm_rest",
module_args={
"method": "GET",
"path": f"/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/top-down/fabrics/{child_fabric}/networks"
"path": f"/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/top-down/fabrics/{child_fabric}/networks?filter=networkStatus!=DEPLOYED"
},
task_vars=task_vars,
tmp=tmp
Expand Down
1 change: 1 addition & 0 deletions roles/dtc/create/tasks/msd/vrfs_networks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
cisco.nac_dc_vxlan.dtc.manage_child_fabric_networks:
nd_version: "{{ nd_version }}"
msite_data: "{{ data_model_multisite }}"
netconfig: "{{ vars_common_msd.net_config }}"
register: child_fabric_network_results

- name: Update Child Fabrics VRFs and Networks Changed State
Expand Down