8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00

Don't use disabled ip for administration purpose

This commit is contained in:
Gabriel Detraz 2020-08-05 00:06:05 +02:00
parent 2d6d1a6024
commit 383aaf3132
3 changed files with 4 additions and 4 deletions

View file

@ -1365,11 +1365,11 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
DHCPv6). DHCPv6).
""" """
if preferences.models.OptionalMachine.get_cached_value("ipv6_mode") == "SLAAC": if preferences.models.OptionalMachine.get_cached_value("ipv6_mode") == "SLAAC":
return self.ipv6list.all() return self.ipv6list.filter(active=True)
elif ( elif (
preferences.models.OptionalMachine.get_cached_value("ipv6_mode") == "DHCPV6" preferences.models.OptionalMachine.get_cached_value("ipv6_mode") == "DHCPV6"
): ):
return self.ipv6list.filter(slaac_ip=False) return self.ipv6list.filter(active=True).filter(slaac_ip=False)
else: else:
return [] return []

View file

@ -369,7 +369,7 @@ class OptionalTopologie(AclMixin, PreferencesModel):
def return_ips_dict(interfaces): def return_ips_dict(interfaces):
return { return {
"ipv4": [str(interface.ipv4) for interface in interfaces], "ipv4": [str(interface.ipv4) for interface in interfaces],
"ipv6": Ipv6List.objects.filter(interface__in=interfaces).values_list( "ipv6": Ipv6List.objects.filter(interface__in=interfaces).filter(active=True).values_list(
"ipv6", flat=True "ipv6", flat=True
), ),
} }

View file

@ -377,7 +377,7 @@ class Switch(Machine):
def return_ips_dict(interfaces): def return_ips_dict(interfaces):
return { return {
"ipv4": [str(interface.ipv4) for interface in interfaces], "ipv4": [str(interface.ipv4) for interface in interfaces],
"ipv6": Ipv6List.objects.filter(interface__in=interfaces).values_list( "ipv6": Ipv6List.objects.filter(interface__in=interfaces).filter(active=True).values_list(
"ipv6", flat=True "ipv6", flat=True
), ),
} }