Merge "remove asterisk for optional fields in VPN forms"

This commit is contained in:
Jenkins 2015-05-14 10:29:28 +00:00 committed by Gerrit Code Review
commit 9543c7232a
3 changed files with 75 additions and 38 deletions

View File

@ -36,7 +36,8 @@ class UpdateVPNService(forms.SelfHandlingForm):
required=False, max_length=80, label=_("Description"))
admin_state_up = forms.ChoiceField(choices=[(True, _('UP')),
(False, _('DOWN'))],
label=_("Admin State"))
label=_("Admin State"),
required=False)
failure_url = 'horizon:project:vpn:index'
@ -72,36 +73,43 @@ class UpdateIKEPolicy(forms.SelfHandlingForm):
auth_algorithm = forms.ChoiceField(
label=_("Authorization algorithm"),
choices=[('sha1', _('sha1'))],
widget=forms.Select(attrs={'readonly': 'readonly'}))
widget=forms.Select(attrs={'readonly': 'readonly'}),
required=False)
encryption_algorithm = forms.ChoiceField(
label=_("Encryption algorithm"),
choices=[('3des', _('3des')),
('aes-128', _('aes-128')),
('aes-192', _('aes-192')),
('aes-256', _('aes-256'))])
('aes-256', _('aes-256'))],
required=False)
ike_version = forms.ChoiceField(
label=_("IKE version"),
choices=[('v1', _('v1')),
('v2', _('v2'))])
('v2', _('v2'))],
required=False)
# Currently this field has only one choice, so mark it as readonly.
lifetime_units = forms.ChoiceField(
label=_("Lifetime units for IKE keys"),
choices=[('seconds', _('seconds'))],
widget=forms.Select(attrs={'readonly': 'readonly'}))
widget=forms.Select(attrs={'readonly': 'readonly'}),
required=False)
lifetime_value = forms.IntegerField(
min_value=60,
label=_("Lifetime value for IKE keys"),
help_text=_("Equal to or greater than 60"))
help_text=_("Equal to or greater than 60"),
required=False)
pfs = forms.ChoiceField(
label=_("Perfect Forward Secrecy"),
choices=[('group2', _('group2')),
('group5', _('group5')),
('group14', _('group14'))])
('group14', _('group14'))],
required=False)
# Currently this field has only one choice, so mark it as readonly.
phase1_negotiation_mode = forms.ChoiceField(
label=_("IKE Phase1 negotiation mode"),
choices=[('main', 'main')],
widget=forms.Select(attrs={'readonly': 'readonly'}))
widget=forms.Select(attrs={'readonly': 'readonly'}),
required=False)
failure_url = 'horizon:project:vpn:index'
@ -144,36 +152,43 @@ class UpdateIPSecPolicy(forms.SelfHandlingForm):
auth_algorithm = forms.ChoiceField(
label=_("Authorization algorithm"),
choices=[('sha1', _('sha1'))],
widget=forms.TextInput(attrs={'readonly': 'readonly'}))
widget=forms.TextInput(attrs={'readonly': 'readonly'}),
required=False)
encapsulation_mode = forms.ChoiceField(
label=_("Encapsulation mode"),
choices=[('tunnel', _('tunnel')),
('transport', _('transport'))])
('transport', _('transport'))],
required=False)
encryption_algorithm = forms.ChoiceField(
label=_("Encryption algorithm"),
choices=[('3des', _('3des')),
('aes-128', _('aes-128')),
('aes-192', _('aes-192')),
('aes-256', _('aes-256'))])
('aes-256', _('aes-256'))],
required=False)
# Currently this field has only one choice, so mark it as readonly.
lifetime_units = forms.ChoiceField(
label=_("Lifetime units"),
choices=[('seconds', _('seconds'))],
widget=forms.Select(attrs={'readonly': 'readonly'}))
widget=forms.Select(attrs={'readonly': 'readonly'}),
required=False)
lifetime_value = forms.IntegerField(
min_value=60,
label=_("Lifetime value"),
help_text=_("Equal to or greater than 60"))
help_text=_("Equal to or greater than 60"),
required=False)
pfs = forms.ChoiceField(
label=_("Perfect Forward Secrecy"),
choices=[('group2', _('group2')),
('group5', _('group5')),
('group14', _('group14'))])
('group14', _('group14'))],
required=False)
transform_protocol = forms.ChoiceField(
label=_("Transform Protocol"),
choices=[('esp', _('esp')),
('ah', _('ah')),
('ah-esp', _('ah-esp'))])
('ah-esp', _('ah-esp'))],
required=False)
failure_url = 'horizon:project:vpn:index'
@ -235,12 +250,14 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
max_length=80, label=_("Pre-Shared Key (PSK) string"))
mtu = forms.IntegerField(
min_value=68,
required=False,
label=_("Maximum Transmission Unit size for the connection"),
help_text=_("Equal to or greater than 68 if the local subnet is IPv4. "
"Equal to or greater than 1280 if the local subnet "
"is IPv6."))
dpd_action = forms.ChoiceField(
label=_("Dead peer detection actions"),
required=False,
choices=[('hold', _('hold')),
('clear', _('clear')),
('disabled', _('disabled')),
@ -248,19 +265,23 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
('restart-by-peer', _('restart-by-peer'))])
dpd_interval = forms.IntegerField(
min_value=1,
required=False,
label=_("Dead peer detection interval"),
help_text=_("Valid integer lesser than the DPD timeout"))
dpd_timeout = forms.IntegerField(
min_value=1,
required=False,
label=_("Dead peer detection timeout"),
help_text=_("Valid integer greater than the DPD interval"))
initiator = forms.ChoiceField(
label=_("Initiator state"),
required=False,
choices=[('bi-directional', _('bi-directional')),
('response-only', _('response-only'))])
admin_state_up = forms.ChoiceField(choices=[(True, _('UP')),
(False, _('DOWN'))],
label=_("Admin State"))
label=_("Admin State"),
required=False)
failure_url = 'horizon:project:vpn:index'

View File

@ -548,7 +548,7 @@ class VPNTests(test.TestCase):
res = self.client.post(reverse(self.ADDVPNCONNECTION_PATH), form_data)
self.assertFormErrors(res, 8)
self.assertFormErrors(res, 7)
@test.create_stubs({api.vpn: ('vpnservice_get', )})
def test_update_vpnservice_get(self):

View File

@ -22,7 +22,7 @@ from openstack_dashboard import api
class AddVPNServiceAction(workflows.Action):
name = forms.CharField(max_length=80, label=_("Name"))
name = forms.CharField(max_length=80, label=_("Name"), required=False)
description = forms.CharField(
initial="", required=False,
max_length=80, label=_("Description"))
@ -31,7 +31,8 @@ class AddVPNServiceAction(workflows.Action):
admin_state_up = forms.ChoiceField(choices=[(True, _('UP')),
(False, _('DOWN'))],
label=_("Admin State"),
help_text=_("The state to start in."))
help_text=_("The state to start in."),
required=False)
def __init__(self, request, *args, **kwargs):
super(AddVPNServiceAction, self).__init__(request, *args, **kwargs)
@ -107,21 +108,25 @@ class AddVPNService(workflows.Workflow):
class AddIKEPolicyAction(workflows.Action):
name = forms.CharField(max_length=80, label=_("Name"))
name = forms.CharField(max_length=80, label=_("Name"), required=False)
description = forms.CharField(
initial="", required=False,
max_length=80, label=_("Description"))
auth_algorithm = forms.ChoiceField(label=_("Authorization algorithm"))
encryption_algorithm = forms.ChoiceField(label=_("Encryption algorithm"))
ike_version = forms.ChoiceField(label=_("IKE version"))
lifetime_units = forms.ChoiceField(label=_("Lifetime units for IKE keys"))
auth_algorithm = forms.ChoiceField(label=_("Authorization algorithm"),
required=False)
encryption_algorithm = forms.ChoiceField(label=_("Encryption algorithm"),
required=False)
ike_version = forms.ChoiceField(label=_("IKE version"), required=False)
lifetime_units = forms.ChoiceField(label=_("Lifetime units for IKE keys"),
required=False)
lifetime_value = forms.IntegerField(
min_value=60, label=_("Lifetime value for IKE keys"),
initial=3600,
help_text=_("Equal to or greater than 60"))
pfs = forms.ChoiceField(label=_("Perfect Forward Secrecy"))
help_text=_("Equal to or greater than 60"),
required=False)
pfs = forms.ChoiceField(label=_("Perfect Forward Secrecy"), required=False)
phase1_negotiation_mode = forms.ChoiceField(
label=_("IKE Phase1 negotiation mode"))
label=_("IKE Phase1 negotiation mode"), required=False)
def __init__(self, request, *args, **kwargs):
super(AddIKEPolicyAction, self).__init__(request, *args, **kwargs)
@ -206,20 +211,26 @@ class AddIKEPolicy(workflows.Workflow):
class AddIPSecPolicyAction(workflows.Action):
name = forms.CharField(max_length=80, label=_("Name"))
name = forms.CharField(max_length=80, label=_("Name"), required=False)
description = forms.CharField(
initial="", required=False,
max_length=80, label=_("Description"))
auth_algorithm = forms.ChoiceField(label=_("Authorization algorithm"))
encapsulation_mode = forms.ChoiceField(label=_("Encapsulation mode"))
encryption_algorithm = forms.ChoiceField(label=_("Encryption algorithm"))
lifetime_units = forms.ChoiceField(label=_("Lifetime units"))
auth_algorithm = forms.ChoiceField(label=_("Authorization algorithm"),
required=False)
encapsulation_mode = forms.ChoiceField(label=_("Encapsulation mode"),
required=False)
encryption_algorithm = forms.ChoiceField(label=_("Encryption algorithm"),
required=False)
lifetime_units = forms.ChoiceField(label=_("Lifetime units"),
required=False)
lifetime_value = forms.IntegerField(
min_value=60, label=_("Lifetime value for IKE keys "),
initial=3600,
help_text=_("Equal to or greater than 60"))
pfs = forms.ChoiceField(label=_("Perfect Forward Secrecy"))
transform_protocol = forms.ChoiceField(label=_("Transform Protocol"))
help_text=_("Equal to or greater than 60"),
required=False)
pfs = forms.ChoiceField(label=_("Perfect Forward Secrecy"), required=False)
transform_protocol = forms.ChoiceField(label=_("Transform Protocol"),
required=False)
def __init__(self, request, *args, **kwargs):
super(AddIPSecPolicyAction, self).__init__(request, *args, **kwargs)
@ -303,7 +314,7 @@ class AddIPSecPolicy(workflows.Workflow):
class AddIPSecSiteConnectionAction(workflows.Action):
name = forms.CharField(max_length=80, label=_("Name"))
name = forms.CharField(max_length=80, label=_("Name"), required=False)
description = forms.CharField(
initial="", required=False,
max_length=80, label=_("Description"))
@ -401,22 +412,27 @@ class AddIPSecSiteConnectionOptionalAction(workflows.Action):
min_value=68,
label=_("Maximum Transmission Unit size for the connection"),
initial=1500,
required=False,
help_text=_("Equal to or greater than 68 if the local subnet is IPv4. "
"Equal to or greater than 1280 if the local subnet "
"is IPv6."))
dpd_action = forms.ChoiceField(label=_("Dead peer detection actions"))
dpd_action = forms.ChoiceField(label=_("Dead peer detection actions"),
required=False)
dpd_interval = forms.IntegerField(
min_value=1, label=_("Dead peer detection interval"),
initial=30,
required=False,
help_text=_("Valid integer lesser than DPD timeout"))
dpd_timeout = forms.IntegerField(
min_value=1, label=_("Dead peer detection timeout"),
initial=120,
required=False,
help_text=_("Valid integer greater than the DPD interval"))
initiator = forms.ChoiceField(label=_("Initiator state"))
initiator = forms.ChoiceField(label=_("Initiator state"), required=False)
admin_state_up = forms.ChoiceField(choices=[(True, _('UP')),
(False, _('DOWN'))],
label=_("Admin State"),
required=False,
help_text=_("The state to start in."))
def __init__(self, request, *args, **kwargs):