Add a ports (ip address) abstraction layer

This patch adds a set of templates to create ports on isolated
networks via Heat. There are 5 port templates in total
which are split out according to the available overcloud
networks.

Change-Id: I5175ef48c1960ea0d13fc8518328db53921c70cd
This commit is contained in:
Dan Prince 2015-04-27 11:00:52 -04:00
parent 5c8576f455
commit c527d88e9d
6 changed files with 207 additions and 0 deletions

View File

@ -0,0 +1,36 @@
heat_template_version: 2015-04-30
description: >
Creates a port on the external network.
parameters:
ExternalNetName:
description: Name of the external neutron network
default: external
type: string
ControlPlaneIP: # Here for compatability with noop.yaml
description: IP address on the control plane
type: string
resources:
ExternalPort:
type: OS::Neutron::Port
properties:
network: {get_param: ExternalNetName}
replacement_policy: AUTO
outputs:
ip_address:
description: external network IP
value: {get_attr: [ExternalPort, fixed_ips, 0, ip_address]}
ip_subnet:
# FIXME: this assumes a 2 digit subnet CIDR (need more heat functions?)
description: IP/Subnet CIDR for the external network IP
value:
list_join:
- ''
- - {get_attr: [ExternalPort, fixed_ips, 0, ip_address]}
- '/'
- {get_attr: [ExternalPort, subnets, 0, cidr, -2]}
- {get_attr: [ExternalPort, subnets, 0, cidr, -1]}

View File

@ -0,0 +1,36 @@
heat_template_version: 2015-04-30
description: >
Creates a port on the internal_api network.
parameters:
InternalApiNetName:
description: Name of the internal API neutron network
default: internal_api
type: string
ControlPlaneIP: # Here for compatability with noop.yaml
description: IP address on the control plane
type: string
resources:
InternalApiPort:
type: OS::Neutron::Port
properties:
network: {get_param: InternalApiNetName}
replacement_policy: AUTO
outputs:
ip_address:
description: internal API network IP
value: {get_attr: [InternalApiPort, fixed_ips, 0, ip_address]}
ip_subnet:
# FIXME: this assumes a 2 digit subnet CIDR (need more heat functions?)
description: IP/Subnet CIDR for the internal API network IP
value:
list_join:
- ''
- - {get_attr: [InternalApiPort, fixed_ips, 0, ip_address]}
- '/'
- {get_attr: [InternalApiPort, subnets, 0, cidr, -2]}
- {get_attr: [InternalApiPort, subnets, 0, cidr, -1]}

26
network/ports/noop.yaml Normal file
View File

@ -0,0 +1,26 @@
heat_template_version: 2015-04-30
description: >
Returns the control plane port (provisioning network) as the ip_address.
parameters:
ControlPlaneIP:
description: IP address on the control plane
type: string
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
outputs:
ip_address:
description: pass thru network IP
value: {get_param: ControlPlaneIP}
ip_subnet:
description: IP/Subnet CIDR for the pass thru network IP
value:
list_join:
- ''
- - {get_param: ControlPlaneIP}
- '/'
- {get_param: ControlPlaneSubnetCidr}

View File

@ -0,0 +1,37 @@
heat_template_version: 2015-04-30
description: >
Creates a port on the storage network.
parameters:
StorageNetName:
description: Name of the storage neutron network
default: storage
type: string
ControlPlaneIP: # Here for compatability with noop.yaml
description: IP address on the control plane
type: string
resources:
StoragePort:
type: OS::Neutron::Port
properties:
network: {get_param: StorageNetName}
replacement_policy: AUTO
outputs:
ip_address:
description: storage network IP
value: {get_attr: [StoragePort, fixed_ips, 0, ip_address]}
ip_subnet:
# FIXME: this assumes a 2 digit subnet CIDR (need more heat functions?)
description: IP/Subnet CIDR for the storage network IP
value:
list_join:
- ''
- - {get_attr: [StoragePort, fixed_ips, 0, ip_address]}
- '/'
- {get_attr: [StoragePort, subnets, 0, cidr, -2]}
- {get_attr: [StoragePort, subnets, 0, cidr, -1]}

View File

@ -0,0 +1,36 @@
heat_template_version: 2015-04-30
description: >
Creates a port on the storage_mgmt API network.
parameters:
StorageMgmtNetName:
description: Name of the storage_mgmt API neutron network
default: storage_mgmt
type: string
ControlPlaneIP: # Here for compatability with noop.yaml
description: IP address on the control plane
type: string
resources:
StorageMgmtPort:
type: OS::Neutron::Port
properties:
network: {get_param: StorageMgmtNetName}
replacement_policy: AUTO
outputs:
ip_address:
description: storage_mgmt network IP
value: {get_attr: [StorageMgmtPort, fixed_ips, 0, ip_address]}
ip_subnet:
# FIXME: this assumes a 2 digit subnet CIDR (need more heat functions?)
description: IP/Subnet CIDR for the storage_mgmt network IP
value:
list_join:
- ''
- - {get_attr: [StorageMgmtPort, fixed_ips, 0, ip_address]}
- '/'
- {get_attr: [StorageMgmtPort, subnets, 0, cidr, -2]}
- {get_attr: [StorageMgmtPort, subnets, 0, cidr, -1]}

36
network/ports/tenant.yaml Normal file
View File

@ -0,0 +1,36 @@
heat_template_version: 2015-04-30
description: >
Creates a port on the tenant network.
parameters:
TenantNetName:
description: Name of the tenant neutron network
default: tenant
type: string
ControlPlaneIP: # Here for compatability with noop.yaml
description: IP address on the control plane
type: string
resources:
TenantPort:
type: OS::Neutron::Port
properties:
network: {get_param: TenantNetName}
replacement_policy: AUTO
outputs:
ip_address:
description: tenant network IP
value: {get_attr: [TenantPort, fixed_ips, 0, ip_address]}
ip_subnet:
# FIXME: this assumes a 2 digit subnet CIDR (need more heat functions?)
description: IP/Subnet CIDR for the tenant network IP
value:
list_join:
- ''
- - {get_attr: [TenantPort, fixed_ips, 0, ip_address]}
- '/'
- {get_attr: [TenantPort, subnets, 0, cidr, -2]}
- {get_attr: [TenantPort, subnets, 0, cidr, -1]}