Merge "Use RESOLVE translation rules for vpnservice"

This commit is contained in:
Jenkins 2016-04-12 17:39:46 +00:00 committed by Gerrit Code Review
commit 27a1887bc8

View File

@ -155,12 +155,29 @@ class VPNService(neutron.NeutronResource):
[self.SUBNET],
value_path=[self.SUBNET_ID]
),
translation.TranslationRule(
props,
translation.TranslationRule.RESOLVE,
[self.SUBNET],
client_plugin=self.client_plugin(),
finder='find_resourceid_by_name_or_id',
entity='subnet'
),
translation.TranslationRule(
props,
translation.TranslationRule.REPLACE,
[self.ROUTER],
value_path=[self.ROUTER_ID]
)
),
translation.TranslationRule(
props,
translation.TranslationRule.RESOLVE,
[self.ROUTER],
client_plugin=self.client_plugin(),
finder='find_resourceid_by_name_or_id',
entity='router'
),
]
def _show_resource(self):
@ -170,8 +187,8 @@ class VPNService(neutron.NeutronResource):
props = self.prepare_properties(
self.properties,
self.physical_resource_name())
self.client_plugin().resolve_subnet(props, self.SUBNET, 'subnet_id')
self.client_plugin().resolve_router(props, self.ROUTER, 'router_id')
props['subnet_id'] = props.pop(self.SUBNET)
props['router_id'] = props.pop(self.ROUTER)
vpnservice = self.client().create_vpnservice({'vpnservice': props})[
'vpnservice']
self.resource_id_set(vpnservice['id'])