Skip to content

Commit

Permalink
small fixes for ipv6 mgmtdomains, one more problem with reservedip an…
Browse files Browse the repository at this point in the history
…d dualstack mgmtdomains identified but not fixed yet
  • Loading branch information
indy-independence committed Mar 1, 2024
1 parent e85df6b commit 5b8800e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/cnaas_nms/api/mgmtdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class f_mgmtdomain(BaseModel):
@field_validator("ipv4_gw")
@classmethod
def ipv4_gw_valid_address(cls, v):
if not v:
return v
try:
addr = IPv4Interface(v)
prefix_len = int(addr.network.prefixlen)
Expand All @@ -62,6 +64,8 @@ def ipv4_gw_valid_address(cls, v):
@field_validator("ipv6_gw")
@classmethod
def ipv6_gw_valid_address(cls, v):
if not v:
return v
try:
addr = IPv6Interface(v)
prefix_len = int(addr.network.prefixlen)
Expand Down
2 changes: 1 addition & 1 deletion src/cnaas_nms/devicehandler/init_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def init_access_device_step1(

secondary_mgmt_ip = None
if mgmtdomain.is_dual_stack:
secondary_mgmt_ip = mgmtdomain.find_free_secondary_mgmt_ip()
secondary_mgmt_ip = mgmtdomain.find_free_secondary_mgmt_ip(session)
if not secondary_mgmt_ip:
raise Exception(
"Could not find free secondary management IP for management domain {}/{}".format(
Expand Down
1 change: 1 addition & 0 deletions src/cnaas_nms/devicehandler/sync_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ def populate_device_vars(
{
"id": mgmtdom.id,
"ipv4_gw": mgmtdom.ipv4_gw,
"ipv6_gw": mgmtdom.ipv6_gw,
"vlan": mgmtdom.vlan,
"description": mgmtdom.description,
"esi_mac": mgmtdom.esi_mac,
Expand Down

0 comments on commit 5b8800e

Please sign in to comment.