mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Export de l'ensemble des ip du switch
This commit is contained in:
parent
e21a0eb9b0
commit
b219221342
3 changed files with 8 additions and 7 deletions
|
@ -729,7 +729,7 @@ class SwitchPortSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = topologie.Switch
|
model = topologie.Switch
|
||||||
fields = ('short_name', 'model', 'switchbay', 'ports', 'ipv4', 'ipv6',
|
fields = ('short_name', 'model', 'switchbay', 'ports', 'ipv4', 'ipv6',
|
||||||
'subnet', 'subnet6', 'automatic_provision', 'rest_enabled',
|
'interfaces_subnet', 'interfaces6_subnet', 'automatic_provision', 'rest_enabled',
|
||||||
'web_management_enabled', 'get_radius_key_value', 'get_management_cred_value')
|
'web_management_enabled', 'get_radius_key_value', 'get_management_cred_value')
|
||||||
|
|
||||||
# DHCP
|
# DHCP
|
||||||
|
|
|
@ -407,7 +407,7 @@ class IpType(RevMixin, AclMixin, models.Model):
|
||||||
'netmask' : 'ffff:ffff:ffff:ffff::',
|
'netmask' : 'ffff:ffff:ffff:ffff::',
|
||||||
'netmask_cidr' : '64',
|
'netmask_cidr' : '64',
|
||||||
'vlan': str(self.vlan),
|
'vlan': str(self.vlan),
|
||||||
'vlan_id': str(self.vlan.vlan_id)
|
'vlan_id': self.vlan.vlan_id
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -350,13 +350,14 @@ class Switch(AclMixin, Machine):
|
||||||
return str(self.main_interface().ipv6().first())
|
return str(self.main_interface().ipv6().first())
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def subnet(self):
|
def interfaces_subnet(self):
|
||||||
""" Return the subnet of the management ip"""
|
"""Return dict ip:subnet for all ip of the switch"""
|
||||||
return self.main_interface().type.ip_type.ip_set_full_info
|
return dict((str(interface.ipv4), interface.type.ip_type.ip_set_full_info) for interface in self.interface_set.all())
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def subnet6(self):
|
def interfaces6_subnet(self):
|
||||||
return self.main_interface().type.ip_type.ip6_set_full_info
|
"""Return dict ip6:subnet for all ipv6 of the switch"""
|
||||||
|
return dict((str(interface.ipv6().first()), interface.type.ip_type.ip6_set_full_info) for interface in self.interface_set.all())
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.main_interface())
|
return str(self.main_interface())
|
||||||
|
|
Loading…
Reference in a new issue