Browse Source

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
Thomas Bachman 1 year ago
parent
commit
a6a416843a
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      gbpautomation/heat/engine/resources/grouppolicy.py

+ 4
- 1
gbpautomation/heat/engine/resources/grouppolicy.py View File

@@ -580,6 +580,9 @@ class PolicyClassifier(gbpresource.GBPResource):
580 580
         'direction', 'shared'
581 581
     )
582 582
 
583
+    protocols_list = ['tcp', 'udp', 'icmp', None]
584
+    protocols_list.extend([str(protocol_num) for protocol_num in range(256)])
585
+
583 586
     properties_schema = {
584 587
         TENANT_ID: properties.Schema(
585 588
             properties.Schema.STRING,
@@ -599,7 +602,7 @@ class PolicyClassifier(gbpresource.GBPResource):
599 602
             properties.Schema.STRING,
600 603
             _('Protocol of traffic described by the policy classifier.'),
601 604
             constraints=[
602
-                constraints.AllowedValues(['tcp', 'udp', 'icmp', None])
605
+                constraints.AllowedValues(protocols_list)
603 606
             ],
604 607
             update_allowed=True
605 608
         ),

Loading…
Cancel
Save