From fa2f2cf6a52a4122b8e9413dfeeb109cb88ef73f Mon Sep 17 00:00:00 2001 From: Sumit Naiksatam Date: Wed, 7 Dec 2016 16:27:26 -0800 Subject: [PATCH] [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 --- gbpautomation/heat/engine/resources/grouppolicy.py | 10 ++++++++-- gbpautomation/heat/tests/test_grouppolicy.py | 11 ++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gbpautomation/heat/engine/resources/grouppolicy.py b/gbpautomation/heat/engine/resources/grouppolicy.py index e381f03..44a936b 100644 --- a/gbpautomation/heat/engine/resources/grouppolicy.py +++ b/gbpautomation/heat/engine/resources/grouppolicy.py @@ -149,11 +149,12 @@ class PolicyTargetGroup(gbpresource.GBPResource): PROPERTIES = ( TENANT_ID, NAME, DESCRIPTION, L2_POLICY_ID, PROVIDED_POLICY_RULE_SETS, - CONSUMED_POLICY_RULE_SETS, NETWORK_SERVICE_POLICY_ID, SHARED + CONSUMED_POLICY_RULE_SETS, NETWORK_SERVICE_POLICY_ID, SHARED, + INTRA_PTG_ALLOW ) = ( 'tenant_id', 'name', 'description', 'l2_policy_id', 'provided_policy_rule_sets', 'consumed_policy_rule_sets', - 'network_service_policy_id', 'shared' + 'network_service_policy_id', 'shared', 'intra_ptg_allow' ) properties_schema = { @@ -195,6 +196,11 @@ class PolicyTargetGroup(gbpresource.GBPResource): properties.Schema.BOOLEAN, _('Shared.'), update_allowed=True, required=True + ), + INTRA_PTG_ALLOW: properties.Schema( + properties.Schema.BOOLEAN, + _('Allow or disallow intra-ptg traffic.'), + update_allowed=True ) } diff --git a/gbpautomation/heat/tests/test_grouppolicy.py b/gbpautomation/heat/tests/test_grouppolicy.py index 2550ed2..1f7829c 100644 --- a/gbpautomation/heat/tests/test_grouppolicy.py +++ b/gbpautomation/heat/tests/test_grouppolicy.py @@ -89,7 +89,8 @@ policy_target_group_template = ''' {"policy_rule_set_id": "policy_rule_set4", "policy_rule_set_scope": "scope4"} ], - "shared": True + "shared": True, + "intra_ptg_allow": False } } } @@ -516,7 +517,8 @@ class PolicyTargetGroupTest(HeatTestCase): "policy_rule_set3": "scope3", "policy_rule_set4": "scope4" }, - "shared": True + "shared": True, + "intra_ptg_allow": False } }).AndReturn({'policy_target_group': {'id': '5678'}}) @@ -548,7 +550,8 @@ class PolicyTargetGroupTest(HeatTestCase): "policy_rule_set3": "scope3", "policy_rule_set4": "scope4" }, - "shared": True + "shared": True, + "intra_ptg_allow": False } }).AndRaise(grouppolicy.NeutronClientException()) self.m.ReplayAll() @@ -623,6 +626,7 @@ class PolicyTargetGroupTest(HeatTestCase): 'policy_rule_set4': 'scope4', 'policy_rule_set6': 'scope6' }, + 'intra_ptg_allow': True }}) self.m.ReplayAll() scheduler.TaskRunner(rsrc.create)() @@ -645,6 +649,7 @@ class PolicyTargetGroupTest(HeatTestCase): {'policy_rule_set_id': 'policy_rule_set6', 'policy_rule_set_scope': 'scope6'} ] + update_template['Properties']['intra_ptg_allow'] = True scheduler.TaskRunner(rsrc.update, update_template)() self.m.VerifyAll()