Merge "check DPD interval and timeout for IPSec site connection"
This commit is contained in:
commit
15984b3c2c
@ -249,7 +249,7 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
|
||||
dpd_interval = forms.IntegerField(
|
||||
min_value=1,
|
||||
label=_("Dead peer detection interval"),
|
||||
help_text=_("Valid integer"))
|
||||
help_text=_("Valid integer lesser than the DPD timeout"))
|
||||
dpd_timeout = forms.IntegerField(
|
||||
min_value=1,
|
||||
label=_("Dead peer detection timeout"),
|
||||
@ -264,6 +264,16 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
|
||||
|
||||
failure_url = 'horizon:project:vpn:index'
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super(UpdateIPSecSiteConnection, self).clean()
|
||||
interval = cleaned_data.get('dpd_interval')
|
||||
timeout = cleaned_data.get('dpd_timeout')
|
||||
|
||||
if not interval < timeout:
|
||||
msg = _("DPD Timeout must be greater than DPD Interval")
|
||||
self._errors['dpd_timeout'] = self.error_class([msg])
|
||||
return cleaned_data
|
||||
|
||||
def handle(self, request, context):
|
||||
context['admin_state_up'] = (context['admin_state_up'] == 'True')
|
||||
try:
|
||||
|
@ -408,7 +408,7 @@ class AddIPSecSiteConnectionOptionalAction(workflows.Action):
|
||||
dpd_interval = forms.IntegerField(
|
||||
min_value=1, label=_("Dead peer detection interval"),
|
||||
initial=30,
|
||||
help_text=_("Valid integer"))
|
||||
help_text=_("Valid integer lesser than DPD timeout"))
|
||||
dpd_timeout = forms.IntegerField(
|
||||
min_value=1, label=_("Dead peer detection timeout"),
|
||||
initial=120,
|
||||
@ -436,6 +436,17 @@ class AddIPSecSiteConnectionOptionalAction(workflows.Action):
|
||||
self.fields['dpd_action'].choices = dpd_action_choices
|
||||
return dpd_action_choices
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super(AddIPSecSiteConnectionOptionalAction,
|
||||
self).clean()
|
||||
interval = cleaned_data.get('dpd_interval')
|
||||
timeout = cleaned_data.get('dpd_timeout')
|
||||
|
||||
if not interval < timeout:
|
||||
msg = _("DPD Timeout must be greater than DPD Interval")
|
||||
self._errors['dpd_timeout'] = self.error_class([msg])
|
||||
return cleaned_data
|
||||
|
||||
class Meta(object):
|
||||
name = _("Optional Parameters")
|
||||
permissions = ('openstack.services.network',)
|
||||
|
Loading…
Reference in New Issue
Block a user