Skip to content

dcnm_vrf: VRF Deletion Failure Fix #451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 22, 2025
Merged
Changes from 2 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: 11 additions & 3 deletions plugins/modules/dcnm_vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3661,7 +3661,7 @@ def release_resources_by_id(self, id_list=None):
verb = "DELETE"
self.send_to_controller(action, verb, path, None, log_response=False)

def release_orphaned_resources(self, vrf, is_rollback=False):
def release_orphaned_resources(self, vrf_del_list, is_rollback=False):
"""
# Summary

Expand Down Expand Up @@ -3724,12 +3724,16 @@ def release_orphaned_resources(self, vrf, is_rollback=False):
for item in resp["DATA"]:
if "entityName" not in item:
continue
if item["entityName"] != vrf:
if item["entityName"] not in vrf_del_list:
continue
if item.get("allocatedFlag") is not False:
continue
if item.get("id") is None:
continue
if not item.get("ipAddress"):
continue
if not item.get("switchName"):
continue

msg = f"item {json.dumps(item, indent=4, sort_keys=True)}"
self.log.debug(msg)
Expand Down Expand Up @@ -3765,8 +3769,12 @@ def push_to_remote(self, is_rollback=False):
self.log.debug(msg)

self.push_diff_delete(is_rollback)

vrf_del_list = []
for vrf_name in self.diff_delete:
self.release_orphaned_resources(vrf_name, is_rollback)
vrf_del_list.append(vrf_name)
if vrf_del_list:
self.release_orphaned_resources(vrf_del_list, is_rollback)

self.push_diff_create(is_rollback)
self.push_diff_attach(is_rollback)
Expand Down