Do not set default fixed_ips for policy_target
When fixed_ips is not specified, this attribute should not be sent to the backend. Currently a default value of empty list is being sent which is interpreted as an actual value by the backend. Change-Id: I91ca5c1f9d86dc81f47fbb79eb8723bd21c6bd50
This commit is contained in:
parent
77b2787cdd
commit
40345ee068
@ -72,7 +72,6 @@ class PolicyTarget(gbpresource.GBPResource):
|
|||||||
FIXED_IPS: properties.Schema(
|
FIXED_IPS: properties.Schema(
|
||||||
properties.Schema.LIST,
|
properties.Schema.LIST,
|
||||||
_('Desired IPs for this port.'),
|
_('Desired IPs for this port.'),
|
||||||
default=[],
|
|
||||||
schema=properties.Schema(
|
schema=properties.Schema(
|
||||||
properties.Schema.MAP,
|
properties.Schema.MAP,
|
||||||
schema={
|
schema={
|
||||||
|
@ -46,6 +46,25 @@ policy_target_template = '''
|
|||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
policy_target_no_port_no_fixed_ip_template = '''
|
||||||
|
{
|
||||||
|
"AWSTemplateFormatVersion" : "2010-09-09",
|
||||||
|
"Description" : "Template to test neutron policy target resource",
|
||||||
|
"Parameters" : {},
|
||||||
|
"Resources" : {
|
||||||
|
"policy_target": {
|
||||||
|
"Type": "OS::GroupBasedPolicy::PolicyTarget",
|
||||||
|
"Properties": {
|
||||||
|
"name": "test-policy-target",
|
||||||
|
"policy_target_group_id": "ptg-id",
|
||||||
|
"description": "test policy target resource",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
|
||||||
policy_target_group_template = '''
|
policy_target_group_template = '''
|
||||||
{
|
{
|
||||||
"AWSTemplateFormatVersion" : "2010-09-09",
|
"AWSTemplateFormatVersion" : "2010-09-09",
|
||||||
@ -345,6 +364,29 @@ class PolicyTargetTest(HeatTestCase):
|
|||||||
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
|
def create_policy_target_no_port_no_fixed_ip(self):
|
||||||
|
gbpclient.Client.create_policy_target({
|
||||||
|
'policy_target': {
|
||||||
|
'name': 'test-policy-target',
|
||||||
|
'policy_target_group_id': 'ptg-id',
|
||||||
|
"description": "test policy target resource",
|
||||||
|
}
|
||||||
|
}).AndReturn({'policy_target': {'id': '5678'}})
|
||||||
|
|
||||||
|
snippet = template_format.parse(
|
||||||
|
policy_target_no_port_no_fixed_ip_template)
|
||||||
|
self.stack = utils.parse_stack(snippet)
|
||||||
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
|
return grouppolicy.PolicyTarget(
|
||||||
|
'policy_target', resource_defns['policy_target'], self.stack)
|
||||||
|
|
||||||
|
def test_create_no_port_no_fixed_ip(self):
|
||||||
|
rsrc = self.create_policy_target_no_port_no_fixed_ip()
|
||||||
|
self.m.ReplayAll()
|
||||||
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
||||||
|
self.m.VerifyAll()
|
||||||
|
|
||||||
def test_create_failed(self):
|
def test_create_failed(self):
|
||||||
gbpclient.Client.create_policy_target({
|
gbpclient.Client.create_policy_target({
|
||||||
'policy_target': {
|
'policy_target': {
|
||||||
|
Loading…
Reference in New Issue
Block a user