Merge "Display clear error message while no subnet poll support"
This commit is contained in:
@@ -642,9 +642,9 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
|
||||
url = reverse('horizon:project:networks:create')
|
||||
res = self.client.post(url, form_data)
|
||||
|
||||
self.assertContains(res, escape('Specify "Network Address", '
|
||||
'"Address pool" or '
|
||||
'clear "Create Subnet" checkbox.'))
|
||||
self.assertContains(res, escape('Specify "Network Address" or '
|
||||
'clear "Create Subnet" checkbox'
|
||||
' in previous step.'))
|
||||
|
||||
@test.update_settings(
|
||||
OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'})
|
||||
|
||||
@@ -190,14 +190,17 @@ class CreateSubnetInfoAction(workflows.Action):
|
||||
}),
|
||||
initial=False,
|
||||
required=False)
|
||||
msg = _('Specify "Network Address", "Address pool" or '
|
||||
'clear "Create Subnet" checkbox.')
|
||||
|
||||
class Meta(object):
|
||||
name = _("Subnet")
|
||||
help_text = _('Create a subnet associated with the network. '
|
||||
'Advanced configuration is available by clicking on the '
|
||||
'"Subnet Details" tab.')
|
||||
help_text = _('Creates a subnet associated with the network.'
|
||||
' You need to enter a valid "Network Address"'
|
||||
' and "Gateway IP". If you did not enter the'
|
||||
' "Gateway IP", the first value of a network'
|
||||
' will be assigned by default. If you do not want'
|
||||
' gateway please check the "Disable Gateway" checkbox.'
|
||||
' Advanced configuration is available by clicking on'
|
||||
' the "Subnet Details" tab.')
|
||||
|
||||
def __init__(self, request, context, *args, **kwargs):
|
||||
super(CreateSubnetInfoAction, self).__init__(request, context, *args,
|
||||
@@ -287,7 +290,9 @@ class CreateSubnetInfoAction(workflows.Action):
|
||||
# pool configured by the operator. This is also part of the IPv6
|
||||
# Prefix Delegation Workflow.
|
||||
if not cidr and address_source != 'subnetpool':
|
||||
raise forms.ValidationError(self.msg)
|
||||
msg = _('Specify "Network Address" or '
|
||||
'clear "Create Subnet" checkbox in previous step.')
|
||||
raise forms.ValidationError(msg)
|
||||
if cidr:
|
||||
subnet = netaddr.IPNetwork(cidr)
|
||||
if subnet.version != ip_version:
|
||||
@@ -297,14 +302,14 @@ class CreateSubnetInfoAction(workflows.Action):
|
||||
(ip_version == 6 and subnet.prefixlen == 128):
|
||||
msg = _("The subnet in the Network Address is "
|
||||
"too small (/%s).") % subnet.prefixlen
|
||||
raise forms.ValidationError(msg)
|
||||
self._errors['cidr'] = self.error_class([msg])
|
||||
if not no_gateway and gateway_ip:
|
||||
if netaddr.IPAddress(gateway_ip).version is not ip_version:
|
||||
msg = _('Gateway IP and IP version are inconsistent.')
|
||||
raise forms.ValidationError(msg)
|
||||
if not is_create and not no_gateway and not gateway_ip:
|
||||
msg = _('Specify IP address of gateway or '
|
||||
'check "Disable Gateway".')
|
||||
'check "Disable Gateway" checkbox.')
|
||||
raise forms.ValidationError(msg)
|
||||
|
||||
def clean(self):
|
||||
|
||||
Reference in New Issue
Block a user