From 9a2224d2ab9f3dec5e2a64d56edc4dc95698cf81 Mon Sep 17 00:00:00 2001
From: Mark Hamzy <hamzy@us.ibm.com>
Date: Wed, 13 Jun 2018 14:04:21 -0500
Subject: [PATCH] osp13 219 openstack tripleo heat templates

---
 environments/network-environment.j2.yaml |   8 +-
 network_data.yaml                        |  50 +--------
 nic-configs/compute.yaml                 | 113 ++++++++++++++++++++
 nic-configs/controller.yaml              | 126 +++++++++++++++++++++++
 node-info.yaml                           |   7 ++
 roles/Controller.yaml                    |   4 -
 roles_data.yaml                          | 124 ----------------------
 7 files changed, 253 insertions(+), 179 deletions(-)
 create mode 100644 nic-configs/compute.yaml
 create mode 100644 nic-configs/controller.yaml
 create mode 100644 node-info.yaml

diff --git a/environments/network-environment.j2.yaml b/environments/network-environment.j2.yaml
index fff6039..67aebd9 100644
--- a/environments/network-environment.j2.yaml
+++ b/environments/network-environment.j2.yaml
@@ -7,7 +7,7 @@ resource_registry:
 {%- for role in roles %}
   # Port assignments for the {{role.name}}
   OS::TripleO::{{role.name}}::Net::SoftwareConfig:
-    ../network/config/single-nic-vlans/{{role.deprecated_nic_config_name|default(role.name.lower() ~ ".yaml")}}
+    /home/stack/templates/nic-configs/{{role.deprecated_nic_config_name|default(role.name.lower() ~ ".yaml")}}
 {%- endfor %}
 
 parameter_defaults:
@@ -15,8 +15,8 @@ parameter_defaults:
   # CIDR subnet mask length for provisioning network
   ControlPlaneSubnetCidr: '24'
   # Gateway router for the provisioning network (or Undercloud IP)
-  ControlPlaneDefaultRoute: 192.168.24.254
-  EC2MetadataIp: 192.168.24.1  # Generally the IP of the Undercloud
+  ControlPlaneDefaultRoute: 9.114.219.254
+  EC2MetadataIp: 9.114.219.30  # Generally the IP of the Undercloud
   # Customize the IP subnets to match the local environment
 {%- for network in networks if network.enabled|default(true) %}
 {%- if network.ipv6|default(false) %}
@@ -51,7 +51,7 @@ parameter_defaults:
 {%- endfor %}
 {#- FIXME: These global parameters should be defined in a YAML file, e.g. network_data.yaml. #}
   # Define the DNS servers (maximum 2) for the overcloud nodes
-  DnsServers: ["8.8.8.8","8.8.4.4"]
+  DnsServers: ["9.12.16.2","9.0.128.50"]
   # List of Neutron network types for tenant networks (will be used in order)
   NeutronNetworkType: 'vxlan,vlan'
   # The tunnel type for the tenant network (vxlan or gre). Set to '' to disable tunneling.
diff --git a/network_data.yaml b/network_data.yaml
index 7d96eec..94833d2 100644
--- a/network_data.yaml
+++ b/network_data.yaml
@@ -48,57 +48,13 @@
 # are assigned in the network/config/multiple-nics templates, beginning with
 # NIC2, Control Plane is always NIC1.
 
-- name: Storage
-  vip: true
-  vlan: 30
-  name_lower: storage
-  ip_subnet: '172.16.1.0/24'
-  allocation_pools: [{'start': '172.16.1.4', 'end': '172.16.1.250'}]
-  ipv6_subnet: 'fd00:fd00:fd00:3000::/64'
-  ipv6_allocation_pools: [{'start': 'fd00:fd00:fd00:3000::10', 'end': 'fd00:fd00:fd00:3000:ffff:ffff:ffff:fffe'}]
-- name: StorageMgmt
-  name_lower: storage_mgmt
-  vip: true
-  vlan: 40
-  ip_subnet: '172.16.3.0/24'
-  allocation_pools: [{'start': '172.16.3.4', 'end': '172.16.3.250'}]
-  ipv6_subnet: 'fd00:fd00:fd00:4000::/64'
-  ipv6_allocation_pools: [{'start': 'fd00:fd00:fd00:4000::10', 'end': 'fd00:fd00:fd00:4000:ffff:ffff:ffff:fffe'}]
-- name: InternalApi
-  name_lower: internal_api
-  vip: true
-  vlan: 20
-  ip_subnet: '172.16.2.0/24'
-  allocation_pools: [{'start': '172.16.2.4', 'end': '172.16.2.250'}]
-  ipv6_subnet: 'fd00:fd00:fd00:2000::/64'
-  ipv6_allocation_pools: [{'start': 'fd00:fd00:fd00:2000::10', 'end': 'fd00:fd00:fd00:2000:ffff:ffff:ffff:fffe'}]
-- name: Tenant
-  vip: false  # Tenant network does not use VIPs
-  name_lower: tenant
-  vlan: 50
-  ip_subnet: '172.16.0.0/24'
-  allocation_pools: [{'start': '172.16.0.4', 'end': '172.16.0.250'}]
-  # Note that tenant tunneling is only compatible with IPv4 addressing at this time.
-  ipv6_subnet: 'fd00:fd00:fd00:5000::/64'
-  ipv6_allocation_pools: [{'start': 'fd00:fd00:fd00:5000::10', 'end': 'fd00:fd00:fd00:5000:ffff:ffff:ffff:fffe'}]
 - name: External
   vip: true
   name_lower: external
   vlan: 10
-  ip_subnet: '10.0.0.0/24'
-  allocation_pools: [{'start': '10.0.0.4', 'end': '10.0.0.250'}]
-  gateway_ip: '10.0.0.1'
+  ip_subnet: '9.114.118.0/24'
+  allocation_pools: [{'start': '9.114.118.240', 'end': '9.114.118.248'}]
+  gateway_ip: '9.114.118.254'
   ipv6_subnet: '2001:db8:fd00:1000::/64'
   ipv6_allocation_pools: [{'start': '2001:db8:fd00:1000::10', 'end': '2001:db8:fd00:1000:ffff:ffff:ffff:fffe'}]
   gateway_ipv6: '2001:db8:fd00:1000::1'
-- name: Management
-  # Management network is enabled by default for backwards-compatibility, but
-  # is not included in any roles by default. Add to role definitions to use.
-  enabled: true
-  vip: false  # Management network does not use VIPs
-  name_lower: management
-  vlan: 60
-  ip_subnet: '10.0.1.0/24'
-  allocation_pools: [{'start': '10.0.1.4', 'end': '10.0.1.250'}]
-  ipv6_subnet: 'fd00:fd00:fd00:6000::/64'
-  ipv6_allocation_pools: [{'start': 'fd00:fd00:fd00:6000::10', 'end': 'fd00:fd00:fd00:6000:ffff:ffff:ffff:fffe'}]
diff --git a/nic-configs/compute.yaml b/nic-configs/compute.yaml
new file mode 100644
index 0000000..2a87826
--- /dev/null
+++ b/nic-configs/compute.yaml
@@ -0,0 +1,113 @@
+heat_template_version: pike
+description: >
+  Software Config to drive os-net-config to configure multiple interfaces for the compute role.
+parameters:
+  ControlPlaneIp:
+    default: ''
+    description: IP address/subnet on the ctlplane network
+    type: string
+  ExternalIpSubnet:
+    default: ''
+    description: IP address/subnet on the external network
+    type: string
+  InternalApiIpSubnet:
+    default: ''
+    description: IP address/subnet on the internal_api network
+    type: string
+  StorageIpSubnet:
+    default: ''
+    description: IP address/subnet on the storage network
+    type: string
+  StorageMgmtIpSubnet:
+    default: ''
+    description: IP address/subnet on the storage_mgmt network
+    type: string
+  TenantIpSubnet:
+    default: ''
+    description: IP address/subnet on the tenant network
+    type: string
+  ManagementIpSubnet: # Only populated when including environments/network-management.yaml
+    default: ''
+    description: IP address/subnet on the management network
+    type: string
+  ExternalNetworkVlanID:
+    default: 10
+    description: Vlan ID for the external network traffic.
+    type: number
+  InternalApiNetworkVlanID:
+    default: 20
+    description: Vlan ID for the internal_api network traffic.
+    type: number
+  StorageNetworkVlanID:
+    default: 30
+    description: Vlan ID for the storage network traffic.
+    type: number
+  StorageMgmtNetworkVlanID:
+    default: 40
+    description: Vlan ID for the storage mgmt network traffic.
+    type: number
+  TenantNetworkVlanID:
+    default: 50
+    description: Vlan ID for the tenant network traffic.
+    type: number
+  ManagementNetworkVlanID:
+    default: 60
+    description: Vlan ID for the management network traffic.
+    type: number
+  ControlPlaneSubnetCidr: # Override this via parameter_defaults
+    default: '24'
+    description: The subnet CIDR of the control plane network.
+    type: string
+  ControlPlaneDefaultRoute: # Override this via parameter_defaults
+    description: The default route of the control plane network.
+    type: string
+  ExternalInterfaceDefaultRoute: # Not used by default in this template
+    default: 9.114.219.254
+    description: The default route of the external network.
+    type: string
+  ManagementInterfaceDefaultRoute: # Commented out by default in this template
+    default: unset
+    description: The default route of the management network.
+    type: string
+  DnsServers: # Override this via parameter_defaults
+    default: []
+    description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
+    type: comma_delimited_list
+  EC2MetadataIp: # Override this via parameter_defaults
+    description: The IP address of the EC2 metadata server.
+    type: string
+resources:
+  OsNetConfigImpl:
+    type: OS::Heat::SoftwareConfig
+    properties:
+      group: script
+      config:
+        str_replace:
+          template:
+            get_file: /home/stack/templates/network/scripts/run-os-net-config.sh
+          params:
+            $network_config:
+              network_config:
+              - type: interface
+                name: nic1
+                use_dhcp: false
+                dns_servers:
+                  get_param: DnsServers
+                addresses:
+                - ip_netmask:
+                    list_join:
+                    - /
+                    - - get_param: ControlPlaneIp
+                      - get_param: ControlPlaneSubnetCidr
+                routes:
+                - ip_netmask: 169.254.169.254/32
+                  next_hop:
+                    get_param: EC2MetadataIp
+                - default: true
+                  next_hop:
+                    get_param: ControlPlaneDefaultRoute
+outputs:
+  OS::stack_id:
+    description: The OsNetConfigImpl resource.
+    value:
+      get_resource: OsNetConfigImpl
diff --git a/nic-configs/controller.yaml b/nic-configs/controller.yaml
new file mode 100644
index 0000000..1374988
--- /dev/null
+++ b/nic-configs/controller.yaml
@@ -0,0 +1,126 @@
+heat_template_version: pike
+description: >
+  Software Config to drive os-net-config to configure multiple interfaces for the controller role.
+parameters:
+  ControlPlaneIp:
+    default: ''
+    description: IP address/subnet on the ctlplane network
+    type: string
+  ExternalIpSubnet:
+    default: ''
+    description: IP address/subnet on the external network
+    type: string
+  InternalApiIpSubnet:
+    default: ''
+    description: IP address/subnet on the internal_api network
+    type: string
+  StorageIpSubnet:
+    default: ''
+    description: IP address/subnet on the storage network
+    type: string
+  StorageMgmtIpSubnet:
+    default: ''
+    description: IP address/subnet on the storage_mgmt network
+    type: string
+  TenantIpSubnet:
+    default: ''
+    description: IP address/subnet on the tenant network
+    type: string
+  ManagementIpSubnet: # Only populated when including environments/network-management.yaml
+    default: ''
+    description: IP address/subnet on the management network
+    type: string
+  ExternalNetworkVlanID:
+    default: 10
+    description: Vlan ID for the external network traffic.
+    type: number
+  InternalApiNetworkVlanID:
+    default: 20
+    description: Vlan ID for the internal_api network traffic.
+    type: number
+  StorageNetworkVlanID:
+    default: 30
+    description: Vlan ID for the storage network traffic.
+    type: number
+  StorageMgmtNetworkVlanID:
+    default: 40
+    description: Vlan ID for the storage mgmt network traffic.
+    type: number
+  TenantNetworkVlanID:
+    default: 50
+    description: Vlan ID for the tenant network traffic.
+    type: number
+  ManagementNetworkVlanID:
+    default: 60
+    description: Vlan ID for the management network traffic.
+    type: number
+  ControlPlaneSubnetCidr: # Override this via parameter_defaults
+    default: '24'
+    description: The subnet CIDR of the control plane network.
+    type: string
+  ControlPlaneDefaultRoute: # Override this via parameter_defaults
+    description: The default route of the control plane network.
+    type: string
+  ExternalInterfaceDefaultRoute:
+    default: 9.114.219.254
+    description: default route for the external network
+    type: string
+  ManagementInterfaceDefaultRoute: # Commented out by default in this template
+    default: unset
+    description: The default route of the management network.
+    type: string
+  DnsServers: # Override this via parameter_defaults
+    default: []
+    description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
+    type: comma_delimited_list
+  EC2MetadataIp: # Override this via parameter_defaults
+    description: The IP address of the EC2 metadata server.
+    type: string
+resources:
+  OsNetConfigImpl:
+    type: OS::Heat::SoftwareConfig
+    properties:
+      group: script
+      config:
+        str_replace:
+          template:
+            get_file: /home/stack/templates/network/scripts/run-os-net-config.sh
+          params:
+            $network_config:
+              network_config:
+              - type: interface
+                name: nic1
+                use_dhcp: false
+                dns_servers:
+                  get_param: DnsServers
+                addresses:
+                - ip_netmask:
+                    list_join:
+                    - /
+                    - - get_param: ControlPlaneIp
+                      - get_param: ControlPlaneSubnetCidr
+                routes:
+                - ip_netmask: 169.254.169.254/32
+                  next_hop:
+                    get_param: EC2MetadataIp
+              - type: ovs_bridge
+                name: bridge_name
+                dns_servers:
+                  get_param: DnsServers
+                use_dhcp: false
+                addresses:
+                - ip_netmask:
+                    get_param: ExternalIpSubnet
+                routes:
+                - default: true
+                  next_hop:
+                    get_param: ExternalInterfaceDefaultRoute
+                members:
+                - type: interface
+                  name: nic3
+                  primary: true
+outputs:
+  OS::stack_id:
+    description: The OsNetConfigImpl resource.
+    value:
+      get_resource: OsNetConfigImpl
diff --git a/node-info.yaml b/node-info.yaml
new file mode 100644
index 0000000..c7eccad
--- /dev/null
+++ b/node-info.yaml
@@ -0,0 +1,7 @@
+parameter_defaults:
+  OvercloudControllerFlavor: control
+  OvercloudComputeFlavor: compute
+  OvercloudCephStorageFlavor: ceph-storage
+  ControllerCount: 1
+  ComputeCount: 1
+  CephStorageCount: 0
diff --git a/roles/Controller.yaml b/roles/Controller.yaml
index f50014e..fd7a5a5 100644
--- a/roles/Controller.yaml
+++ b/roles/Controller.yaml
@@ -11,10 +11,6 @@
     - controller
   networks:
     - External
-    - InternalApi
-    - Storage
-    - StorageMgmt
-    - Tenant
   # For systems with both IPv4 and IPv6, you may specify a gateway network for
   # each, such as ['ControlPlane', 'External']
   default_route_networks: ['External']
diff --git a/roles_data.yaml b/roles_data.yaml
index d870f25..725b541 100644
--- a/roles_data.yaml
+++ b/roles_data.yaml
@@ -241,127 +241,3 @@
     - OS::TripleO::Services::OVNController
     - OS::TripleO::Services::OVNMetadataAgent
     - OS::TripleO::Services::Ptp
-###############################################################################
-# Role: BlockStorage                                                          #
-###############################################################################
-- name: BlockStorage
-  description: |
-    Cinder Block Storage node role
-  networks:
-    - InternalApi
-    - Storage
-    - StorageMgmt
-  uses_deprecated_params: False
-  deprecated_nic_config_name: 'cinder-storage.yaml'
-  ServicesDefault:
-    - OS::TripleO::Services::Aide
-    - OS::TripleO::Services::AuditD
-    - OS::TripleO::Services::BlockStorageCinderVolume
-    - OS::TripleO::Services::CACerts
-    - OS::TripleO::Services::CertmongerUser
-    - OS::TripleO::Services::CinderBackendVRTSHyperScale
-    - OS::TripleO::Services::Collectd
-    - OS::TripleO::Services::Docker
-    - OS::TripleO::Services::Fluentd
-    - OS::TripleO::Services::Ipsec
-    - OS::TripleO::Services::Iscsid
-    - OS::TripleO::Services::Kernel
-    - OS::TripleO::Services::LoginDefs
-    - OS::TripleO::Services::MySQLClient
-    - OS::TripleO::Services::Ntp
-    - OS::TripleO::Services::ContainersLogrotateCrond
-    - OS::TripleO::Services::Rhsm
-    - OS::TripleO::Services::RsyslogSidecar
-    - OS::TripleO::Services::Securetty
-    - OS::TripleO::Services::SensuClient
-    - OS::TripleO::Services::Snmp
-    - OS::TripleO::Services::Sshd
-    - OS::TripleO::Services::Timezone
-    - OS::TripleO::Services::TripleoFirewall
-    - OS::TripleO::Services::TripleoPackages
-    - OS::TripleO::Services::Tuned
-    - OS::TripleO::Services::Ptp
-###############################################################################
-# Role: ObjectStorage                                                         #
-###############################################################################
-- name: ObjectStorage
-  description: |
-    Swift Object Storage node role
-  networks:
-    - InternalApi
-    - Storage
-    - StorageMgmt
-  # Deprecated & backward-compatible values (FIXME: Make parameters consistent)
-  # Set uses_deprecated_params to True if any deprecated params are used.
-  uses_deprecated_params: True
-  deprecated_param_metadata: 'SwiftStorageServerMetadata'
-  deprecated_param_ips: 'SwiftStorageIPs'
-  deprecated_param_image: 'SwiftStorageImage'
-  deprecated_param_flavor: 'OvercloudSwiftStorageFlavor'
-  deprecated_nic_config_name: 'swift-storage.yaml'
-  disable_upgrade_deployment: True
-  ServicesDefault:
-    - OS::TripleO::Services::Aide
-    - OS::TripleO::Services::AuditD
-    - OS::TripleO::Services::CACerts
-    - OS::TripleO::Services::CertmongerUser
-    - OS::TripleO::Services::Collectd
-    - OS::TripleO::Services::Docker
-    - OS::TripleO::Services::Fluentd
-    - OS::TripleO::Services::Ipsec
-    - OS::TripleO::Services::Kernel
-    - OS::TripleO::Services::LoginDefs
-    - OS::TripleO::Services::MySQLClient
-    - OS::TripleO::Services::Ntp
-    - OS::TripleO::Services::ContainersLogrotateCrond
-    - OS::TripleO::Services::Rhsm
-    - OS::TripleO::Services::RsyslogSidecar
-    - OS::TripleO::Services::Securetty
-    - OS::TripleO::Services::SensuClient
-    - OS::TripleO::Services::Snmp
-    - OS::TripleO::Services::Sshd
-    - OS::TripleO::Services::SwiftRingBuilder
-    - OS::TripleO::Services::SwiftStorage
-    - OS::TripleO::Services::Timezone
-    - OS::TripleO::Services::TripleoFirewall
-    - OS::TripleO::Services::TripleoPackages
-    - OS::TripleO::Services::Tuned
-    - OS::TripleO::Services::Ptp
-###############################################################################
-# Role: CephStorage                                                           #
-###############################################################################
-- name: CephStorage
-  description: |
-    Ceph OSD Storage node role
-  networks:
-    - Storage
-    - StorageMgmt
-  uses_deprecated_params: False
-  deprecated_nic_config_name: 'ceph-storage.yaml'
-  ServicesDefault:
-    - OS::TripleO::Services::Aide
-    - OS::TripleO::Services::AuditD
-    - OS::TripleO::Services::CACerts
-    - OS::TripleO::Services::CephOSD
-    - OS::TripleO::Services::CertmongerUser
-    - OS::TripleO::Services::Collectd
-    - OS::TripleO::Services::Docker
-    - OS::TripleO::Services::Fluentd
-    - OS::TripleO::Services::Ipsec
-    - OS::TripleO::Services::Kernel
-    - OS::TripleO::Services::LoginDefs
-    - OS::TripleO::Services::MySQLClient
-    - OS::TripleO::Services::Ntp
-    - OS::TripleO::Services::ContainersLogrotateCrond
-    - OS::TripleO::Services::Rhsm
-    - OS::TripleO::Services::RsyslogSidecar
-    - OS::TripleO::Services::Securetty
-    - OS::TripleO::Services::SensuClient
-    - OS::TripleO::Services::Snmp
-    - OS::TripleO::Services::Sshd
-    - OS::TripleO::Services::Timezone
-    - OS::TripleO::Services::TripleoFirewall
-    - OS::TripleO::Services::TripleoPackages
-    - OS::TripleO::Services::Tuned
-    - OS::TripleO::Services::Ptp
-
-- 
2.17.1

