Skip to content

Commit

Permalink
No dynamic NAT for routers without external gw
Browse files Browse the repository at this point in the history
Routers that do not have an external gateway also don't have a bridge
domain associated with it, meaning the dynamic NAT list would always
produce a diff. Therefore we delete the dynamic NAT list if there's
nothing to configure and also make sure it doesn't appear in the diff.
  • Loading branch information
sebageek committed Jan 22, 2025
1 parent c2676ec commit f43a43b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions asr1k_neutron_l3/models/neutron/l3/nat.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ def _rest_definition(self):
bridge_domain=self.bridge_domain, redundancy=self.redundancy,
mapping_id=self.mapping_id, overload=True)

def diff(self, should_be_none=False):
return super().diff(should_be_none=not bool(self.bridge_domain))

def update(self):
if self.bridge_domain:
return super().update()
else:
return super().delete()


class NatList(BaseNAT):
yang_model = None
Expand Down

0 comments on commit f43a43b

Please sign in to comment.