From 0f0e3ceeaddc121a7b6d04379c0378fbceea9676 Mon Sep 17 00:00:00 2001 From: Yoichiro Iura Date: Wed, 25 May 2016 05:59:31 +0000 Subject: [PATCH] Fix validation of direction on TapFlow This patch fixes the validation of direction. * change API validator from type:string to type:values * remove None from direction_enum because of NOT NULL constraint Change-Id: Iae4f13451002db7567425ae33d1c36bd2013ae75 Closes-Bug: #1585445 --- API_REFERENCE.rst | 4 ++-- neutron_taas/extensions/taas.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/API_REFERENCE.rst b/API_REFERENCE.rst index d45352e3..0f763c43 100644 --- a/API_REFERENCE.rst +++ b/API_REFERENCE.rst @@ -71,11 +71,11 @@ TapFlow Represents the port from which the traffic needs to be mirrored. 'validate': {'type:uuid': None}, 'required_by_policy': True, 'is_visible': True}, 'direction': {'allow_post': True, 'allow_put': False, - 'validate': {'type:string': direction_enum}, + 'validate': {'type:values': direction_enum}, 'is_visible': True} } - direction_enum = [None, 'IN', 'OUT', 'BOTH'] + direction_enum = ['IN', 'OUT', 'BOTH'] Multiple TapFlow instances can be associated with a single TapService diff --git a/neutron_taas/extensions/taas.py b/neutron_taas/extensions/taas.py index e2bafb49..ffe64ba8 100644 --- a/neutron_taas/extensions/taas.py +++ b/neutron_taas/extensions/taas.py @@ -61,7 +61,7 @@ class TapServiceLimitReached(qexception.OverQuota): message = _("Reached the maximum quota for Tap Services") -direction_enum = [None, 'IN', 'OUT', 'BOTH'] +direction_enum = ['IN', 'OUT', 'BOTH'] ''' @@ -117,7 +117,7 @@ RESOURCE_ATTRIBUTE_MAP = { 'validate': {'type:uuid': None}, 'required_by_policy': True, 'is_visible': True}, 'direction': {'allow_post': True, 'allow_put': False, - 'validate': {'type:string': direction_enum}, + 'validate': {'type:values': direction_enum}, 'is_visible': True} } }