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
parent 0088d5be2a
commit a6a416843a
1 changed files with 4 additions and 1 deletions

View File

@ -580,6 +580,9 @@ class PolicyClassifier(gbpresource.GBPResource):
'direction', 'shared' 'direction', 'shared'
) )
protocols_list = ['tcp', 'udp', 'icmp', None]
protocols_list.extend([str(protocol_num) for protocol_num in range(256)])
properties_schema = { properties_schema = {
TENANT_ID: properties.Schema( TENANT_ID: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
@ -599,7 +602,7 @@ class PolicyClassifier(gbpresource.GBPResource):
properties.Schema.STRING, properties.Schema.STRING,
_('Protocol of traffic described by the policy classifier.'), _('Protocol of traffic described by the policy classifier.'),
constraints=[ constraints=[
constraints.AllowedValues(['tcp', 'udp', 'icmp', None]) constraints.AllowedValues(protocols_list)
], ],
update_allowed=True update_allowed=True
), ),