diff --git a/circle/firewall/models.py b/circle/firewall/models.py index bf0c373..dc03a11 100644 --- a/circle/firewall/models.py +++ b/circle/firewall/models.py @@ -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.")) diff --git a/circle/vm/models.py b/circle/vm/models.py index 78a0d26..3c2db88 100644 --- a/circle/vm/models.py +++ b/circle/vm/models.py @@ -754,20 +754,20 @@ class Interface(Model): InterfaceTemplate. """ 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.save() else: host = None + iface = cls(vlan=template.vlan, host=host, instance=instance) iface.save() return iface