Merge "Remove 'validate' key in 'type:dict_or_nodata' type" into stable/liberty

This commit is contained in:
Jenkins 2016-02-22 10:21:59 +00:00 committed by Gerrit Code Review
commit 4e0fcebb03
2 changed files with 20 additions and 1 deletions

View File

@ -32,7 +32,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
'convert_to': attrs.convert_to_boolean},
'external_fixed_ips': {
'convert_list_to': attrs.convert_kvp_list_to_dict,
'validate': {'type:fixed_ips': None},
'type:fixed_ips': None,
'default': None,
'required': False}
}

View File

@ -16,6 +16,7 @@
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
import testscenarios
from webob import exc
@ -388,6 +389,24 @@ class ExtGwModeIntTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase,
expected_code=expected_code,
neutron_context=neutron_context)
def test_router_create_with_gwinfo_invalid_ext_ip(self):
with self.subnet() as s:
self._set_net_external(s['subnet']['network_id'])
ext_info = {
'network_id': s['subnet']['network_id'],
'external_fixed_ips': [{'ip_address': '10.0.0.'}]
}
error_code = exc.HTTPBadRequest.code
res = self._create_router(
self.fmt, _uuid(), arg_list=('external_gateway_info',),
external_gateway_info=ext_info,
expected_code=error_code
)
msg = ("Invalid input for external_gateway_info. "
"Reason: '10.0.0.' is not a valid IP address.")
body = jsonutils.loads(res.body)
self.assertEqual(msg, body['NeutronError']['message'])
def test_router_create_show_no_ext_gwinfo(self):
name = 'router1'
tenant_id = _uuid()