diff --git a/meta/io.murano/Classes/SharedIp.yaml b/meta/io.murano/Classes/SharedIp.yaml index f55ba351..adf5e218 100644 --- a/meta/io.murano/Classes/SharedIp.yaml +++ b/meta/io.murano/Classes/SharedIp.yaml @@ -26,13 +26,14 @@ Properties: Contract: $.string() Usage: Out -Workflow: +Methods: initialize: Body: - $.environment: $.find(Environment).require() - $.network: $.environment.defaultNetworks.environment - $.instances: [] + deploy: Body: - If: not $.getAttr(deployed, false) @@ -59,20 +60,20 @@ Workflow: - If: $.assignFloatingIp Then: - $extNetId: $networkData.floatingIpNetId - - $fip_name: format('Shared-Floating-ip-{0}', $.id()) + - $fipName: format('Shared-Floating-ip-{0}', $.id()) - $template: resources: - $fip_name: + $fipName: type: 'OS::Neutron::FloatingIP' properties: floating_network_id: $extNetId port_id: get_resource: $aapPortName outputs: - $fip_name + '-val': + $fipName + '-val': value: - get_attr: [$fip_name, floating_ip_address] + get_attr: [$fipName, floating_ip_address] description: Shared Floating IP assigned - $.environment.stack.updateTemplate($template) @@ -95,6 +96,16 @@ Workflow: get_attr: [$aapPortName, fixed_ips, 0, ip_address] - - - + releaseResources: + Body: + - $template: $.environment.stack.current() + - $template.resources: $template.resources.delete(format('AllowedAddressPairsPort-{0}', id($))) + - $template.outputs: $template.outputs.delete(format('AllowedAddressPairsPort-{0}-virtualIp', id($))) + - If: $.assignFloatingIp + Then: + - $template.resources: $template.resources.delete(format('Shared-Floating-ip-{0}', id($))) + - $template.outputs: $template.outputs.delete(format('Shared-Floating-ip-{0}-val', id($))) + - $._environment.stack.setTemplate($template) + - $._environment.stack.push() + - $.floatingIpAddress: null + - $.virtualIp: null diff --git a/meta/io.murano/Classes/resources/CinderVolume.yaml b/meta/io.murano/Classes/resources/CinderVolume.yaml index a3464682..4d4d5f4b 100644 --- a/meta/io.murano/Classes/resources/CinderVolume.yaml +++ b/meta/io.murano/Classes/resources/CinderVolume.yaml @@ -129,6 +129,7 @@ Methods: - $._environment.stack.setTemplate($template) - $._environment.stack.push() - $.setAttr(lastTemplate, null) + - $.openstackId: null getRef: Body: diff --git a/meta/io.murano/Classes/resources/Instance.yaml b/meta/io.murano/Classes/resources/Instance.yaml index 616d17c6..b2c7c9e2 100644 --- a/meta/io.murano/Classes/resources/Instance.yaml +++ b/meta/io.murano/Classes/resources/Instance.yaml @@ -270,6 +270,9 @@ Methods: - $.setAttr(instanceResources, []) - $.setAttr(instanceOutputs, []) - $.setAttr(fipAssigned, false) + - $.openstackId: null + - $.ipAddresses: [] + - $.floatingIpAddress: null destroy: Body: diff --git a/meta/io.murano/Classes/resources/NeutronNetwork.yaml b/meta/io.murano/Classes/resources/NeutronNetwork.yaml index 6516fbda..c092ebf9 100644 --- a/meta/io.murano/Classes/resources/NeutronNetwork.yaml +++ b/meta/io.murano/Classes/resources/NeutronNetwork.yaml @@ -184,6 +184,23 @@ Methods: gateway: $subnet.gateway_ip floatingIpNetId: $._getExternalNetId() + releaseResources: + Body: + - $template: $.environment.stack.current() + + - $template.resources: $template.resources.delete(format('{0}-{1}', $.name, $.id())) + - $template.resources: $template.resources.delete($._getSubnetName()) + + - $template.outputs: $template.outputs.delete(format('{0}-id', $.name)) + + - If: $.externalRouterId != null + Then: + $template.resources: $template.resources.delete($._getRouterInterfaceName()) + + - $._environment.stack.setTemplate($template) + - $._environment.stack.push() + - $.openstackId: null + _getRouterInterfaceName: Body: