Skip to content

Commit

Permalink
Support attach network to paired TOR switch - replace fix
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenramoorthy committed Oct 12, 2023
1 parent e034e03 commit 9316e52
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions plugins/modules/dcnm_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ def diff_for_attach_deploy(self, want_a, have_a, replace=False):
want.update({"torPorts": torconfig})
# Update torports_configured to True. If there is no other config change for attach
# We will still append this attach to attach_list as there is tor port change
if atch_tor_ports != h_tor_ports:
if sorted(atch_tor_ports) != sorted(h_tor_ports):
torports_configured = True

if not torports_present:
Expand All @@ -623,11 +623,19 @@ def diff_for_attach_deploy(self, want_a, have_a, replace=False):
del have["torports"]

elif have.get("torports"):
# Dont update torports_configured to True.
# If at all there is any other config change, this attach to will be appended attach_list there
for tor_h in have.get("torports"):
torconfig = tor_h["switch"] + "(" + tor_h["torPorts"] + ")"
want.update({"torPorts": torconfig})
if replace:
# There are tor ports configured, but it has to be removed as want tor ports are not present
# and state is replaced/overridden. Update torports_configured to True to remove tor ports
want.update({"torPorts": ""})
torports_configured = True

else:
# Dont update torports_configured to True.
# If at all there is any other config change, this attach to will be appended attach_list there
for tor_h in have.get("torports"):
torconfig = tor_h["switch"] + "(" + tor_h["torPorts"] + ")"
want.update({"torPorts": torconfig})

del have["torports"]

if want.get("torports"):
Expand Down

0 comments on commit 9316e52

Please sign in to comment.