ExistingNeutronNetwork didn't return IPs for the instance

When deploying an Instance joined to ExistingNeutronNetwork its
ipAddresses property returned an empty list, which was causing most of
the applications to fail. This happened because the responsibility of
managing HOT outputs for the instance IP was moved to the Network
classes and was implemented for the NeutronNetwork but not the
ExistingNeutronNetwork.

This commit moves the logic to the base class for all Neutron networks
and refactors it so that it could be used for them all

Change-Id: I552098683e0faeb66f7c622ea8c1d073a82d6338
Closes-Bug: #1649715
This commit is contained in:
Stan Lagun 2016-12-13 14:58:11 -08:00
parent 3d7159ec6d
commit 6f787ab5a2
3 changed files with 29 additions and 23 deletions

View File

@ -59,6 +59,13 @@ Workflow:
$.name = $this.internalNetworkName or
$.id = $this.internalNetworkName).first().id
- If: $._internalNetworkId = $.internalNetworkName
Then:
$._internalNetworkName: $._getNetworks().where(
$.id = $this._internalNetworkId).first().name
Else:
$._internalNetworkName: $.internalNetworkName
- If: $.internalSubnetworkName = null
Then:
$.internalSubnetworkName: $._getSubnetworks().where(
@ -145,7 +152,8 @@ Workflow:
netRef => $._internalNetworkId,
subnetRef => $._internalSubnetworkId,
floatingIpResourceName => $fipName,
floatingIpNetRef => $floatingIpNetRef
floatingIpNetRef => $floatingIpNetRef,
netName => $._internalNetworkName
)
describe:

View File

@ -150,7 +150,8 @@ Methods:
netRef => $netRef,
subnetRef => $subnetRef,
floatingIpResourceName => $fipName,
floatingIpNetRef => $extNetId
floatingIpNetRef => $extNetId,
netName => $._getHeatName()
)
# (sjmc7) This is a workaround for https://bugs.launchpad.net/heat/+bug/1299259
@ -163,19 +164,8 @@ Methods:
- $._getRouterInterfaceName()
- $result.template: $result.template.mergeWith($template)
- $addressOutputName: format('adresses-{0}-in-{1}', $instance.name, $this.name)
- $ipsOutputTemplate:
outputs:
$addressOutputName:
description: format('Addresses for {0} in {1}', $instance.name, $this.name)
value:
get_attr: [$instance.name, 'addresses', $._getHeatName()]
- $result.template: $result.template.mergeWith($ipsOutputTemplate)
- $result.instanceOutputs: $result.instanceOutputs.append($addressOutputName)
- Return: $result
describe:
Body:
- $.deploy()
@ -209,14 +199,6 @@ Methods:
- $region.stack.push()
- $.openstackId: null
getInstanceIpList:
Arguments:
- instance:
Contract: $.class(Instance).notNull()
Body:
- Return: $.getRegion().stack.output().get(format('adresses-{0}-in-{1}', $instance.name, $this.name)).select($["addr"]).distinct()
_getRouterInterfaceName:
Body:
Return: format('ri-{0}', id($))

View File

@ -49,10 +49,14 @@ Methods:
Contract: $.string()
- floatingIpNetRef:
Contract: $
- netName:
Contract: $.string().notNull()
Body:
- $netExplorer: $._getNetExplorer()
- $securityGroupsEnabled: $netExplorer.listNeutronExtensions().alias.contains('security-group')
- $portName: format('port-{0}-{1}', id($), $instance.name)
- $addressesOutputName: format('addresses-{0}-{1}', $instance.name, id($this))
- $patchTemplate:
resources:
$portName:
@ -60,6 +64,11 @@ Methods:
properties:
network: $netRef
replacement_policy: AUTO
outputs:
$addressesOutputName:
description: format('Addresses for {0} in {1}', $instance.name, $netName)
value:
get_attr: [$instance.name, 'addresses', $netName]
- If: $subnetRef
Then:
@ -82,7 +91,7 @@ Methods:
- $patchTemplate: $patchTemplate.mergeWith($template)
- $instanceResources: [$portName]
- $instanceOutputs: []
- $instanceOutputs: [$addressesOutputName]
- For: sip
In: $sharedIps
@ -123,7 +132,6 @@ Methods:
instanceResources: $instanceResources
instanceOutputs: $instanceOutputs
generateSecurityGroupManager:
Body:
- $region: $.getRegion()
@ -135,3 +143,11 @@ Methods:
Else:
- $._environment.reporter.report($this, "Warning! Security groups are disabled!")
- Return: new(sys:DummySecurityGroupManager, $region)
getInstanceIpList:
Arguments:
- instance:
Contract: $.class(Instance).notNull()
Body:
- Return: $.getRegion().stack.output()[
format('addresses-{0}-{1}', $instance.name, id($this))].addr.distinct()