Commit 61b7b8b0 by Bach Dániel Committed by Guba Sándor

firewall: add Vlan.network_type

parent d5fe25eb
...@@ -170,6 +170,8 @@ class Vlan(models.Model): ...@@ -170,6 +170,8 @@ class Vlan(models.Model):
range. The gateway also has an IP address in each range. range. The gateway also has an IP address in each range.
""" """
CHOICES_NETWORK_TYPE = (('public', _('public')), ('dmz', _('dmz')),
('portforward', _('portforward')))
vid = models.IntegerField(unique=True, vid = models.IntegerField(unique=True,
verbose_name=_('VID'), verbose_name=_('VID'),
help_text=_('The vlan ID of the subnet.'), help_text=_('The vlan ID of the subnet.'),
...@@ -215,6 +217,9 @@ class Vlan(models.Model): ...@@ -215,6 +217,9 @@ class Vlan(models.Model):
'translated, i.e. their source ' 'translated, i.e. their source '
'address is rewritten to the value ' 'address is rewritten to the value '
'of NAT IP address.')) 'of NAT IP address.'))
network_type = models.CharField(choices=CHOICES_NETWORK_TYPE,
verbose_name=_('network type'),
max_length=20)
description = models.TextField(blank=True, verbose_name=_('description'), description = models.TextField(blank=True, verbose_name=_('description'),
help_text=_( help_text=_(
'Description of the goals and elements ' 'Description of the goals and elements '
......
...@@ -110,6 +110,12 @@ class Interface(Model): ...@@ -110,6 +110,12 @@ class Interface(Model):
host.ipv4 = addresses['ipv4'] host.ipv4 = addresses['ipv4']
host.ipv6 = addresses['ipv6'] host.ipv6 = addresses['ipv6']
host.owner = owner host.owner = owner
if vlan.network_type == 'public':
host.shared_ip = False
host.pub_ipv4 = None
elif vlan.network_type == 'portforward':
host.shared_ip = True
host.pub_ipv4 = vlan.snat_ip
host.full_clean() host.full_clean()
host.save() host.save()
else: else:
......
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