[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
This commit is contained in:
Sumit Naiksatam 2016-12-07 16:27:26 -08:00
parent 40345ee068
commit fa2f2cf6a5
2 changed files with 16 additions and 5 deletions

View File

@ -149,11 +149,12 @@ class PolicyTargetGroup(gbpresource.GBPResource):
PROPERTIES = ( PROPERTIES = (
TENANT_ID, NAME, DESCRIPTION, L2_POLICY_ID, PROVIDED_POLICY_RULE_SETS, 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', 'tenant_id', 'name', 'description', 'l2_policy_id',
'provided_policy_rule_sets', 'consumed_policy_rule_sets', 'provided_policy_rule_sets', 'consumed_policy_rule_sets',
'network_service_policy_id', 'shared' 'network_service_policy_id', 'shared', 'intra_ptg_allow'
) )
properties_schema = { properties_schema = {
@ -195,6 +196,11 @@ class PolicyTargetGroup(gbpresource.GBPResource):
properties.Schema.BOOLEAN, properties.Schema.BOOLEAN,
_('Shared.'), _('Shared.'),
update_allowed=True, required=True update_allowed=True, required=True
),
INTRA_PTG_ALLOW: properties.Schema(
properties.Schema.BOOLEAN,
_('Allow or disallow intra-ptg traffic.'),
update_allowed=True
) )
} }

View File

@ -89,7 +89,8 @@ policy_target_group_template = '''
{"policy_rule_set_id": "policy_rule_set4", {"policy_rule_set_id": "policy_rule_set4",
"policy_rule_set_scope": "scope4"} "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_set3": "scope3",
"policy_rule_set4": "scope4" "policy_rule_set4": "scope4"
}, },
"shared": True "shared": True,
"intra_ptg_allow": False
} }
}).AndReturn({'policy_target_group': {'id': '5678'}}) }).AndReturn({'policy_target_group': {'id': '5678'}})
@ -548,7 +550,8 @@ class PolicyTargetGroupTest(HeatTestCase):
"policy_rule_set3": "scope3", "policy_rule_set3": "scope3",
"policy_rule_set4": "scope4" "policy_rule_set4": "scope4"
}, },
"shared": True "shared": True,
"intra_ptg_allow": False
} }
}).AndRaise(grouppolicy.NeutronClientException()) }).AndRaise(grouppolicy.NeutronClientException())
self.m.ReplayAll() self.m.ReplayAll()
@ -623,6 +626,7 @@ class PolicyTargetGroupTest(HeatTestCase):
'policy_rule_set4': 'scope4', 'policy_rule_set4': 'scope4',
'policy_rule_set6': 'scope6' 'policy_rule_set6': 'scope6'
}, },
'intra_ptg_allow': True
}}) }})
self.m.ReplayAll() self.m.ReplayAll()
scheduler.TaskRunner(rsrc.create)() scheduler.TaskRunner(rsrc.create)()
@ -645,6 +649,7 @@ class PolicyTargetGroupTest(HeatTestCase):
{'policy_rule_set_id': 'policy_rule_set6', {'policy_rule_set_id': 'policy_rule_set6',
'policy_rule_set_scope': 'scope6'} 'policy_rule_set_scope': 'scope6'}
] ]
update_template['Properties']['intra_ptg_allow'] = True
scheduler.TaskRunner(rsrc.update, update_template)() scheduler.TaskRunner(rsrc.update, update_template)()
self.m.VerifyAll() self.m.VerifyAll()