Browse Source

[aim-mapping] intra-ptg-allow ext attr for PTG

Heat support for this extended attribute added to the backend.

Change-Id: I21bcaa658f5c0a2f5cedd903cea7de31aa2ed357
Partial-bug: #1648019
Sumit Naiksatam 2 years ago
parent
commit
fa2f2cf6a5

+ 8
- 2
gbpautomation/heat/engine/resources/grouppolicy.py View File

@@ -149,11 +149,12 @@ class PolicyTargetGroup(gbpresource.GBPResource):
149 149
 
150 150
     PROPERTIES = (
151 151
         TENANT_ID, NAME, DESCRIPTION, L2_POLICY_ID, PROVIDED_POLICY_RULE_SETS,
152
-        CONSUMED_POLICY_RULE_SETS, NETWORK_SERVICE_POLICY_ID, SHARED
152
+        CONSUMED_POLICY_RULE_SETS, NETWORK_SERVICE_POLICY_ID, SHARED,
153
+        INTRA_PTG_ALLOW
153 154
     ) = (
154 155
         'tenant_id', 'name', 'description', 'l2_policy_id',
155 156
         'provided_policy_rule_sets', 'consumed_policy_rule_sets',
156
-        'network_service_policy_id', 'shared'
157
+        'network_service_policy_id', 'shared', 'intra_ptg_allow'
157 158
     )
158 159
 
159 160
     properties_schema = {
@@ -195,6 +196,11 @@ class PolicyTargetGroup(gbpresource.GBPResource):
195 196
             properties.Schema.BOOLEAN,
196 197
             _('Shared.'),
197 198
             update_allowed=True, required=True
199
+        ),
200
+        INTRA_PTG_ALLOW: properties.Schema(
201
+            properties.Schema.BOOLEAN,
202
+            _('Allow or disallow intra-ptg traffic.'),
203
+            update_allowed=True
198 204
         )
199 205
 
200 206
     }

+ 8
- 3
gbpautomation/heat/tests/test_grouppolicy.py View File

@@ -89,7 +89,8 @@ policy_target_group_template = '''
89 89
             {"policy_rule_set_id": "policy_rule_set4",
90 90
              "policy_rule_set_scope": "scope4"}
91 91
         ],
92
-        "shared": True
92
+        "shared": True,
93
+        "intra_ptg_allow": False
93 94
       }
94 95
     }
95 96
   }
@@ -516,7 +517,8 @@ class PolicyTargetGroupTest(HeatTestCase):
516 517
                     "policy_rule_set3": "scope3",
517 518
                     "policy_rule_set4": "scope4"
518 519
                 },
519
-                "shared": True
520
+                "shared": True,
521
+                "intra_ptg_allow": False
520 522
             }
521 523
         }).AndReturn({'policy_target_group': {'id': '5678'}})
522 524
 
@@ -548,7 +550,8 @@ class PolicyTargetGroupTest(HeatTestCase):
548 550
                     "policy_rule_set3": "scope3",
549 551
                     "policy_rule_set4": "scope4"
550 552
                 },
551
-                "shared": True
553
+                "shared": True,
554
+                "intra_ptg_allow": False
552 555
             }
553 556
         }).AndRaise(grouppolicy.NeutronClientException())
554 557
         self.m.ReplayAll()
@@ -623,6 +626,7 @@ class PolicyTargetGroupTest(HeatTestCase):
623 626
                     'policy_rule_set4': 'scope4',
624 627
                     'policy_rule_set6': 'scope6'
625 628
                 },
629
+                'intra_ptg_allow': True
626 630
             }})
627 631
         self.m.ReplayAll()
628 632
         scheduler.TaskRunner(rsrc.create)()
@@ -645,6 +649,7 @@ class PolicyTargetGroupTest(HeatTestCase):
645 649
             {'policy_rule_set_id': 'policy_rule_set6',
646 650
              'policy_rule_set_scope': 'scope6'}
647 651
         ]
652
+        update_template['Properties']['intra_ptg_allow'] = True
648 653
         scheduler.TaskRunner(rsrc.update, update_template)()
649 654
 
650 655
         self.m.VerifyAll()

Loading…
Cancel
Save