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
This commit is contained in:
Thomas Bachman 2017-06-08 13:57:43 +00:00 committed by Thomas Bachman
parent 711f40b41c
commit b336c7ed0a
1 changed files with 4 additions and 1 deletions

View File

@ -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
),