Commit 97b69b04 by Dudás Ádám

firewall: change get_new_address to return dict instead of tuple

parent 8d7d535a
......@@ -298,7 +298,7 @@ class Vlan(models.Model):
print ipv4
ipv6 = ipv4_2_ipv6(ipv4)
if ipv6 not in used_v6:
return (ipv4, ipv6)
return {'ipv4': ipv4, 'ipv6': ipv6}
raise ValidationError(_("All IP addresses are already in use."))
......@@ -754,20 +754,20 @@ class Interface(Model):
if template.managed:
host = Host()
host.vlan = template.vlan
# TODO change Host's mac field's type to EUI in firewall
host.mac = str(cls.generate_mac(instance, template.vlan))
# TODO Fix at firewall EUI mac
host.hostname = instance.vm_name
# Get adresses from firewall #TODO fix tupple to dict.
# Get adresses from firewall
addresses = template.vlan.get_new_address()
host.ipv4 = addresses[0]
host.ipv6 = addresses[1]
host.ipv4 = addresses['ipv4']
host.ipv6 = addresses['ipv6']
host.owner = owner
host = None
iface = cls(vlan=template.vlan, host=host, instance=instance)
return iface
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment