mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
Merge branch 'follow_up_ipv6_flag' into 'dev'
Don't use disabled ip for administration purpose See merge request re2o/re2o!549
This commit is contained in:
commit
ed9c8fb333
3 changed files with 15 additions and 4 deletions
|
@ -1365,11 +1365,11 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
|
|||
DHCPv6).
|
||||
"""
|
||||
if preferences.models.OptionalMachine.get_cached_value("ipv6_mode") == "SLAAC":
|
||||
return self.ipv6list.all()
|
||||
return self.ipv6list.filter(active=True)
|
||||
elif (
|
||||
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:
|
||||
return []
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ class OptionalTopologie(AclMixin, PreferencesModel):
|
|||
def return_ips_dict(interfaces):
|
||||
return {
|
||||
"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
|
||||
),
|
||||
}
|
||||
|
|
|
@ -366,6 +366,11 @@ class Switch(Machine):
|
|||
|
||||
@cached_property
|
||||
def get_radius_servers_objects(self):
|
||||
"""Return radius servers objects for Switchs provisioning, via REST API.
|
||||
|
||||
Returns :
|
||||
Interfaces objects query_set for the Role type radius-server
|
||||
"""
|
||||
return Role.all_interfaces_for_roletype("radius-server").filter(
|
||||
machine_type__in=MachineType.objects.filter(
|
||||
interface__in=self.interface_set.all()
|
||||
|
@ -374,10 +379,16 @@ class Switch(Machine):
|
|||
|
||||
@cached_property
|
||||
def get_radius_servers(self):
|
||||
"""Return radius servers string, ipv4 and ipv6 for Switchs provisioning,
|
||||
via REST API.
|
||||
|
||||
Returns :
|
||||
Ip dict of interfaces for the Role type radius-server
|
||||
"""
|
||||
def return_ips_dict(interfaces):
|
||||
return {
|
||||
"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
|
||||
),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue