From b336c7ed0ac14daf8203cea2b0628da449629b1c Mon Sep 17 00:00:00 2001 From: Thomas Bachman Date: Thu, 8 Jun 2017 13:57:43 +0000 Subject: [PATCH] Support protocol numbers in PolicyClassifier The PolicyClassifier currently only supports the named protocols of 'icmp', 'tcp', and 'udp'. In order to allow for the full range of protocols, the constraint validation needs to be relaxed to support protocol numbers 0-255. Change-Id: Icd9c442e868339cf845b1255dd6ed3ffe31e85af --- gbpautomation/heat/engine/resources/grouppolicy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gbpautomation/heat/engine/resources/grouppolicy.py b/gbpautomation/heat/engine/resources/grouppolicy.py index 238902a..8be393f 100644 --- a/gbpautomation/heat/engine/resources/grouppolicy.py +++ b/gbpautomation/heat/engine/resources/grouppolicy.py @@ -580,6 +580,9 @@ class PolicyClassifier(gbpresource.GBPResource): 'direction', 'shared' ) + protocols_list = ['tcp', 'udp', 'icmp', None] + protocols_list.extend([str(protocol_num) for protocol_num in range(256)]) + properties_schema = { TENANT_ID: properties.Schema( properties.Schema.STRING, @@ -599,7 +602,7 @@ class PolicyClassifier(gbpresource.GBPResource): properties.Schema.STRING, _('Protocol of traffic described by the policy classifier.'), constraints=[ - constraints.AllowedValues(['tcp', 'udp', 'icmp', None]) + constraints.AllowedValues(protocols_list) ], update_allowed=True ),