From fa1eed9a79da1eb29e3b9325968e9693616a6016 Mon Sep 17 00:00:00 2001 From: deepak_mourya Date: Wed, 28 Feb 2018 12:51:43 +0530 Subject: [PATCH] Improve the validation of 'nets' parameter This PS will improve the validation for the 'nets' parameter. Change-Id: I3007c412d06ebe9f3494dc07eef4f962ead4d151 Closes-Bug: #1748811 Depends-On: Iebb3ddb53e5e9d31175e6e7eeb170a66a8630a17 --- zun/api/validation/parameter_types.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/zun/api/validation/parameter_types.py b/zun/api/validation/parameter_types.py index dea43cd34..a2cc29419 100644 --- a/zun/api/validation/parameter_types.py +++ b/zun/api/validation/parameter_types.py @@ -110,7 +110,31 @@ hints = { } nets = { - 'type': ['array', 'null'] + 'type': ['array', 'null'], + 'items': { + 'type': 'object', + 'properties': { + 'network': { + 'type': ['string'], + 'minLength': 1, + 'maxLength': 255, + }, + 'v4-fixed-ip': { + 'type': ['string'], + 'format': 'ipv4' + }, + 'v6-fixed-ip': { + 'type': ['string'], + 'format': 'ipv6' + }, + 'port': { + 'type': ['string'], + 'maxLength': 255, + 'minLength': 1, + } + }, + 'additionalProperties': False + } } availability_zone = {