From c527d88e9d0ab11b2490713623b2f84f64d71a12 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Mon, 27 Apr 2015 11:00:52 -0400 Subject: 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 --- network/ports/external.yaml | 36 ++++++++++++++++++++++++++++++++++++ network/ports/internal_api.yaml | 36 ++++++++++++++++++++++++++++++++++++ network/ports/noop.yaml | 26 ++++++++++++++++++++++++++ network/ports/storage.yaml | 37 +++++++++++++++++++++++++++++++++++++ network/ports/storage_mgmt.yaml | 36 ++++++++++++++++++++++++++++++++++++ network/ports/tenant.yaml | 36 ++++++++++++++++++++++++++++++++++++ 6 files changed, 207 insertions(+) create mode 100644 network/ports/external.yaml create mode 100644 network/ports/internal_api.yaml create mode 100644 network/ports/noop.yaml create mode 100644 network/ports/storage.yaml create mode 100644 network/ports/storage_mgmt.yaml create mode 100644 network/ports/tenant.yaml (limited to 'network/ports') diff --git a/network/ports/external.yaml b/network/ports/external.yaml new file mode 100644 index 00000000..db86b329 --- /dev/null +++ b/network/ports/external.yaml @@ -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]} diff --git a/network/ports/internal_api.yaml b/network/ports/internal_api.yaml new file mode 100644 index 00000000..59c0e0ad --- /dev/null +++ b/network/ports/internal_api.yaml @@ -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]} diff --git a/network/ports/noop.yaml b/network/ports/noop.yaml new file mode 100644 index 00000000..6bbf23c9 --- /dev/null +++ b/network/ports/noop.yaml @@ -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} diff --git a/network/ports/storage.yaml b/network/ports/storage.yaml new file mode 100644 index 00000000..27f60a0d --- /dev/null +++ b/network/ports/storage.yaml @@ -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]} + diff --git a/network/ports/storage_mgmt.yaml b/network/ports/storage_mgmt.yaml new file mode 100644 index 00000000..03cc224e --- /dev/null +++ b/network/ports/storage_mgmt.yaml @@ -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]} diff --git a/network/ports/tenant.yaml b/network/ports/tenant.yaml new file mode 100644 index 00000000..1957c41b --- /dev/null +++ b/network/ports/tenant.yaml @@ -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]} -- cgit 1.2.3-korg