Add a ports (ip address) abstraction layer
authorDan Prince <dprince@redhat.com>
Mon, 27 Apr 2015 15:00:52 +0000 (11:00 -0400)
committerDan Prince <dprince@redhat.com>
Tue, 26 May 2015 12:50:44 +0000 (08:50 -0400)
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 [new file with mode: 0644]
network/ports/internal_api.yaml [new file with mode: 0644]
network/ports/noop.yaml [new file with mode: 0644]
network/ports/storage.yaml [new file with mode: 0644]
network/ports/storage_mgmt.yaml [new file with mode: 0644]
network/ports/tenant.yaml [new file with mode: 0644]

diff --git a/network/ports/external.yaml b/network/ports/external.yaml
new file mode 100644 (file)
index 0000000..db86b32
--- /dev/null
@@ -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 (file)
index 0000000..59c0e0a
--- /dev/null
@@ -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 (file)
index 0000000..6bbf23c
--- /dev/null
@@ -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 (file)
index 0000000..27f60a0
--- /dev/null
@@ -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 (file)
index 0000000..03cc224
--- /dev/null
@@ -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 (file)
index 0000000..1957c41
--- /dev/null
@@ -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]}