Add HIDDEN status to Neutron::Pool

Add HIDDEN status and translation rules to
Pool resource.

bp deprecating-improvements

Change-Id: Iaea3f920ea82caa6e3ed1795cfbd1836d9153d9e
This commit is contained in:
Peter Razumovsky 2015-06-29 10:32:08 +03:00
parent 67e45d633a
commit 97f7b4f5cd
2 changed files with 28 additions and 12 deletions

View File

@ -220,9 +220,14 @@ class Pool(neutron.NeutronResource):
SUBNET_ID: properties.Schema(
properties.Schema.STRING,
support_status=support.SupportStatus(
status=support.DEPRECATED,
status=support.HIDDEN,
version='5.0.0',
message=_('Use property %s.') % SUBNET,
version='2014.2'),
previous_status=support.SupportStatus(
status=support.DEPRECATED,
version='2014.2'
)
),
constraints=[
constraints.CustomConstraint('neutron.subnet')
]
@ -382,6 +387,16 @@ class Pool(neutron.NeutronResource):
),
}
def translation_rules(self):
return [
properties.TranslationRule(
self.properties,
properties.TranslationRule.REPLACE,
[self.SUBNET],
value_path=[self.SUBNET_ID]
)
]
def validate(self):
res = super(Pool, self).validate()
if res:

View File

@ -334,12 +334,12 @@ class PoolTest(common.HeatTestCase):
stvippsn['vip']['subnet_id'] = 'sub123'
self.stub_SubnetConstraint_validate()
neutronV20.find_resourceid_by_name_or_id(
mox.IsA(neutronclient.Client),
'subnet',
'sub123'
).AndReturn('sub123')
if resolve_neutron and with_vip_subnet:
neutronV20.find_resourceid_by_name_or_id(
mox.IsA(neutronclient.Client),
'subnet',
'sub123'
).AndReturn('sub123')
neutronV20.find_resourceid_by_name_or_id(
mox.IsA(neutronclient.Client),
'subnet',
@ -350,11 +350,6 @@ class PoolTest(common.HeatTestCase):
).AndReturn({'vip': {'id': 'xyz'}})
elif resolve_neutron and not with_vip_subnet:
neutronV20.find_resourceid_by_name_or_id(
mox.IsA(neutronclient.Client),
'subnet',
'sub123'
).AndReturn('sub123')
snippet = template_format.parse(pool_template)
neutronclient.Client.create_vip(stvippsn
).AndReturn({'vip': {'id': 'xyz'}})
@ -1040,6 +1035,7 @@ class PoolUpdateHealthMonitorsTest(common.HeatTestCase):
self.m.StubOutWithMock(neutronclient.Client, 'create_vip')
self.m.StubOutWithMock(neutronclient.Client, 'delete_vip')
self.m.StubOutWithMock(neutronclient.Client, 'show_vip')
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
def _create_pool_with_health_monitors(self):
neutronclient.Client.create_health_monitor({
@ -1054,6 +1050,11 @@ class PoolUpdateHealthMonitorsTest(common.HeatTestCase):
'timeout': 10, 'admin_state_up': True}}
).AndReturn({'health_monitor': {'id': '6666'}})
self.stub_SubnetConstraint_validate()
neutronV20.find_resourceid_by_name_or_id(
mox.IsA(neutronclient.Client),
'subnet',
'sub123'
).AndReturn('sub123')
neutronclient.Client.create_pool({
'pool': {
'subnet_id': 'sub123', 'protocol': u'HTTP',