Add HIDDEN status to Neutron::Port

Add HIDDEN status and translation rules for
subnet_id and network_id properties in Port
resource.

bp deprecating-improvements

Change-Id: Ife70e87a4c89aba198c847b80e1d5c8330d8367d
This commit is contained in:
Peter Razumovsky 2015-06-29 11:15:29 +03:00
parent 7c49395316
commit 6c0001ffb7
2 changed files with 35 additions and 7 deletions

View File

@ -71,9 +71,14 @@ class Port(neutron.NeutronResource):
NETWORK_ID: properties.Schema(
properties.Schema.STRING,
support_status=support.SupportStatus(
status=support.DEPRECATED,
status=support.HIDDEN,
version='5.0.0',
message=_('Use property %s.') % NETWORK,
version='2014.2'),
previous_status=support.SupportStatus(
status=support.DEPRECATED,
version='2014.2'
)
),
constraints=[
constraints.CustomConstraint('neutron.network')
],
@ -118,9 +123,14 @@ class Port(neutron.NeutronResource):
FIXED_IP_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.') % FIXED_IP_SUBNET,
version='2014.2 '),
previous_status=support.SupportStatus(
status=support.DEPRECATED,
version='2014.2 '
)
),
constraints=[
constraints.CustomConstraint('neutron.subnet')
]
@ -288,6 +298,22 @@ class Port(neutron.NeutronResource):
),
}
def translation_rules(self):
return [
properties.TranslationRule(
self.properties,
properties.TranslationRule.REPLACE,
[self.NETWORK],
value_path=[self.NETWORK_ID]
),
properties.TranslationRule(
self.properties,
properties.TranslationRule.REPLACE,
[self.FIXED_IPS, self.FIXED_IP_SUBNET],
value_name=self.FIXED_IP_SUBNET_ID
)
]
def validate(self):
super(Port, self).validate()
self._validate_depr_property_required(self.properties,

View File

@ -11,6 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import copy
import mox
from neutronclient.common import exceptions as qe
from neutronclient.neutron import v2_0 as neutronV20
@ -679,7 +680,7 @@ class NeutronPortTest(common.HeatTestCase):
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
}})
prop_update2 = prop_update.copy()
prop_update2 = copy.deepcopy(prop_update)
prop_update2['binding:vnic_type'] = 'direct'
neutronclient.Client.update_port(
'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
@ -703,14 +704,15 @@ class NeutronPortTest(common.HeatTestCase):
# update to normal
update_snippet = rsrc_defn.ResourceDefinition(port.name, port.type(),
new_port_prop)
new_port_prop2 = copy.deepcopy(new_port_prop)
scheduler.TaskRunner(port.update, update_snippet)()
self.assertEqual((port.UPDATE, port.COMPLETE), port.state)
self.assertEqual('normal', port.properties['binding:vnic_type'])
# update back to direct
new_port_prop['binding:vnic_type'] = 'direct'
new_port_prop2['binding:vnic_type'] = 'direct'
update_snippet = rsrc_defn.ResourceDefinition(port.name, port.type(),
new_port_prop)
new_port_prop2)
scheduler.TaskRunner(port.update, update_snippet)()
self.assertEqual((port.UPDATE, port.COMPLETE), port.state)
self.assertEqual('direct', port.properties['binding:vnic_type'])