From e9a56336b664f4575194c2317aa747652a2ecb6f Mon Sep 17 00:00:00 2001
From: Narinder Gupta <narinder.gupta@canonical.com>
Date: Tue, 15 Aug 2017 13:28:22 -0500
Subject: [PATCH] modified templates and added variable to easlity understand
 the templates and added support for multiple networks.

Change-Id: I1074c722c9007bd12c711dbfc58afa1a098d2a17
Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>
---
 ci/03-maasdeploy.sh                                |  2 +-
 ci/config_tpl/juju2/bundle_tpl/aodh.yaml           | 15 +++---
 ci/config_tpl/juju2/bundle_tpl/bundle.yaml         |  2 +
 ci/config_tpl/juju2/bundle_tpl/ceilometer.yaml     | 18 +++----
 ci/config_tpl/juju2/bundle_tpl/ceph.yaml           | 53 ++++++------------
 ci/config_tpl/juju2/bundle_tpl/cinder.yaml         | 21 ++++----
 ci/config_tpl/juju2/bundle_tpl/congress.yaml       | 15 +++---
 ci/config_tpl/juju2/bundle_tpl/glance.yaml         | 27 ++++------
 ci/config_tpl/juju2/bundle_tpl/heat.yaml           | 21 +++-----
 ci/config_tpl/juju2/bundle_tpl/keystone.yaml       | 19 +++----
 ci/config_tpl/juju2/bundle_tpl/mysql.yaml          | 11 ++--
 ci/config_tpl/juju2/bundle_tpl/neutron-api.yaml    | 23 ++++----
 .../juju2/bundle_tpl/neutron-gateway.yaml          | 51 ++++--------------
 ci/config_tpl/juju2/bundle_tpl/neutron-ovs.yaml    | 25 +++------
 .../juju2/bundle_tpl/nova-cloud-controller.yaml    | 24 ++++-----
 ci/config_tpl/juju2/bundle_tpl/nova-compute.yaml   | 13 +++--
 ci/config_tpl/juju2/bundle_tpl/odl.yaml            |  3 +-
 ci/config_tpl/juju2/bundle_tpl/openbaton.yaml      |  3 +-
 .../juju2/bundle_tpl/openstack-dashboard.yaml      | 17 +++---
 ci/config_tpl/juju2/bundle_tpl/opnfv-promise.yaml  |  2 +-
 ci/config_tpl/juju2/bundle_tpl/rabbitmq.yaml       |  6 ++-
 ci/config_tpl/juju2/bundle_tpl/spaces.yaml         | 62 ++++++++++++++++++++++
 ci/deploy.sh                                       |  2 +-
 23 files changed, 201 insertions(+), 234 deletions(-)
 create mode 100644 ci/config_tpl/juju2/bundle_tpl/spaces.yaml

diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh
index 2b99ff6c..a162bfb9 100755
--- a/ci/03-maasdeploy.sh
+++ b/ci/03-maasdeploy.sh
@@ -396,7 +396,7 @@ addnodes(){
 
     if [ "$virtinstall" -eq 1 ]; then
         netw=" --network bridge=virbr0,model=virtio"
-    elif ([ $VIRSHHOST != "" ]); then
+    elif ([ "$VIRSHHOST" != "" ]); then
         # Get the bridge hosting the remote virsh
         brid=$(ssh $VIRSHHOST "ip a l | grep $VIRSHHOST | perl -pe 's/.* (.*)\$/\$1/g'")
         netw=" --network bridge=$brid,model=virtio"
diff --git a/ci/config_tpl/juju2/bundle_tpl/aodh.yaml b/ci/config_tpl/juju2/bundle_tpl/aodh.yaml
index 49117901..1c297ce2 100644
--- a/ci/config_tpl/juju2/bundle_tpl/aodh.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/aodh.yaml
@@ -3,17 +3,14 @@
       num_units: 1
 {% if os.service.bindings %}
       bindings:
-        internal: internal-api
-        admin: internal-api
-        shared-db: internal-api
-{% if opnfv.spaces_dict.public is defined %}
-        public: public-api
-{% else %}
-        public: internal-api
-{% endif %}
+        "": *oam-space
+        public: *public-space
+        admin: *admin-space
+        internal: *internal-space
+        shared-db: *internal-space
 {% endif %}
       options:
-        openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}"
+        openstack-origin: *openstack-origin
       to:
         - "lxd:nodes/0"
 {# Empty block to avoid bad block trim #}
diff --git a/ci/config_tpl/juju2/bundle_tpl/bundle.yaml b/ci/config_tpl/juju2/bundle_tpl/bundle.yaml
index 910d6073..dd0ba146 100644
--- a/ci/config_tpl/juju2/bundle_tpl/bundle.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/bundle.yaml
@@ -1,5 +1,7 @@
 # vim: set ts=2 et:
   series: {{ ubuntu.release }}
+  variables:
+{% include 'spaces.yaml' %}
   services:
 {% if os.hyperconverged %}
     nodes:
diff --git a/ci/config_tpl/juju2/bundle_tpl/ceilometer.yaml b/ci/config_tpl/juju2/bundle_tpl/ceilometer.yaml
index 5c52d91d..b34bec24 100644
--- a/ci/config_tpl/juju2/bundle_tpl/ceilometer.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/ceilometer.yaml
@@ -3,7 +3,7 @@
       num_units: 1
 {% if os.service.bindings %}
       bindings:
-        "": internal-api
+        "": *internal-space
 {% endif %}
       to:
         - "lxd:nodes/0"
@@ -12,18 +12,14 @@
       num_units: {{ unit_qty() }}
 {% if os.service.bindings %}
       bindings:
-        shared-db: internal-api
-        internal: internal-api
-        admin: internal-api
-{% if opnfv.spaces_dict.public is defined %}
-        public: public-api
-{% else %}
-        public: internal-api
-{% endif %}
+        "": *oam-space
+        public: *public-space
+        admin: *admin-space
+        internal: *internal-space
 {% endif %}
       options:
-        openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}"
-        region: {{ os.region }}
+        openstack-origin: *openstack-origin
+        region: *openstack-region
 {% if os.ha.mode == 'ha' %}
         vip: {{ opnfv.vip.ceilometer }}
 {% endif %}
diff --git a/ci/config_tpl/juju2/bundle_tpl/ceph.yaml b/ci/config_tpl/juju2/bundle_tpl/ceph.yaml
index 5dd544ed..0d4866d7 100644
--- a/ci/config_tpl/juju2/bundle_tpl/ceph.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/ceph.yaml
@@ -4,20 +4,14 @@
       num_units: {{ unit_ceph_qty() }}
 {% if os.service.bindings %}
       bindings:
-        "": internal-api
-{% if opnfv.spaces_dict.storage is defined %}
-        cluster: storage-cluster
-{% endif %}
+        "": *oam-space
+        public: *ceph-public-space
 {% endif %}
       options:
         monitor-count: {{ unit_ceph_qty() }}
         fsid: ecbb8960-0e21-11e2-b495-83a88f44db01
         monitor-secret: AQD1P2xQiKglDhAA4NGUF5j38Mhq56qwz+45wg==
-{% if ubuntu.release == 'trusty' and os.release < 'newton' %}
-        source: "cloud:{{ ubuntu.release }}-updates/{{ os.release }}"
-{% elif ubuntu.release == 'xenial' and os.release >= 'newton' %}
-        source: "cloud:{{ ubuntu.release }}-updates/{{ os.release }}"
-{% endif %}
+        source: *openstack-origin
 {% if os.network.ipv6 %}
         prefer-ipv6: {{ os.network.ipv6 }}
 {% endif %}
@@ -50,23 +44,15 @@
 {% endif %}
 {% if os.service.bindings %}
       bindings:
-        "": internal-api
-{% if opnfv.spaces_dict.storage is defined %}
-        cluster: storage-cluster
-{% endif %}
+        "": *oam-space
+        public: *ceph-public-space
+        cluster: *ceph-cluster-space
 {% endif %}
       options:
-{% if os.lxd %}
-        osd-devices: /srv/ceph-osd
-{% else %}
-        osd-devices: {{ opnfv.storage_dict.ceph.disk }}
-{% endif %}
+        osd-devices: *osd-devices
+        osd-journal: *osd-journal
         osd-reformat: 'yes'
-{% if ubuntu.release == 'trusty' and os.release < 'newton' %}
-        source: "cloud:{{ ubuntu.release }}-updates/{{ os.release }}"
-{% elif ubuntu.release == 'xenial' and os.release >= 'newton' %}
-        source: "cloud:{{ ubuntu.release }}-updates/{{ os.release }}"
-{% endif %}
+        source: *openstack-origin
 {% if os.network.ipv6 %}
         prefer-ipv6: {{ os.network.ipv6 }}
 {% endif %}
@@ -97,23 +83,16 @@
       num_units: {{ unit_qty() if os.beta.hacluster_ceph_radosgw else 1 }}
 {% if os.service.bindings %}
       bindings:
-        "": internal-api
-        internal: internal-api
-        admin: internal-api
-{% if opnfv.spaces_dict.public is defined %}
-        public: public-api
-{% else %}
-        public: internal-api
-{% endif %}
+        "": *oam-space
+        public: *public-space
+        admin: *admin-space
+        internal: *internal-space
+        mon: *ceph-public-space
 {% endif %}
       options:
-        region: {{ os.region }}
+        region: *openstack-region
         operator-roles: "Member,admin"
-{% if ubuntu.release == 'trusty' and os.release < 'newton' %}
-        source: "cloud:{{ ubuntu.release }}-updates/{{ os.release }}"
-{% elif ubuntu.release == 'xenial' and os.release >= 'newton' %}
-        source: "cloud:{{ ubuntu.release }}-updates/{{ os.release }}"
-{% endif %}
+        source: *openstack-origin
 {% if os.network.ipv6 %}
         prefer-ipv6: {{ os.network.ipv6 }}
 {% endif %}
diff --git a/ci/config_tpl/juju2/bundle_tpl/cinder.yaml b/ci/config_tpl/juju2/bundle_tpl/cinder.yaml
index cce12e01..28b72227 100644
--- a/ci/config_tpl/juju2/bundle_tpl/cinder.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/cinder.yaml
@@ -7,31 +7,28 @@
 {% endif %}
 {% if os.service.bindings %}
       bindings:
-        internal: internal-api
-        admin: internal-api
-        shared-db: internal-api
-{% if opnfv.spaces_dict.public is defined %}
-        public: public-api
-{% else %}
-        public: internal-api
-{% endif %}
+        "": *oam-space
+        public: *public-space
+        admin: *admin-space
+        internal: *internal-space
+        shared-db: *internal-space
 {% endif %}
       options:
-        openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}"
+        openstack-origin: *openstack-origin
 {% if os.git_repo.origin_git %}
         openstack-origin-git: "{{ os.git_repo.branch }}"
 {% endif %}
-        region: {{ os.region }}
+        region: *openstack-region
         block-device: None
         glance-api-version: 2
 {% if os.beta.public_api %}
-        use-internal-endpoints: true
+        use-internal-endpoints: True
 {% endif %}
 {% if os.network.ipv6 %}
         prefer-ipv6: {{ os.network.ipv6 }}
 {% endif %}
 {% if os.api.worker_multiplier %}
-        worker-multiplier: {{ os.api.worker_multiplier }}
+        worker-multiplier: *worker-multiplier
 {% endif %}
 {% if opnfv.storage_dict.ceph is defined %}
         ceph-osd-replication-count: {{ unit_ceph_qty() }}
diff --git a/ci/config_tpl/juju2/bundle_tpl/congress.yaml b/ci/config_tpl/juju2/bundle_tpl/congress.yaml
index d2dcdaaf..03ebc7d0 100644
--- a/ci/config_tpl/juju2/bundle_tpl/congress.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/congress.yaml
@@ -3,17 +3,14 @@
       num_units: 1
 {% if os.service.bindings %}
       bindings:
-        internal: internal-api
-        admin: internal-api
-        shared-db: internal-api
-{% if opnfv.spaces_dict.public is defined %}
-        public: public-api
-{% else %}
-        public: internal-api
-{% endif %}
+        "": *oam-space
+        internal: *internal-space
+        admin: *admin-space
+        shared-db: *internal-space
+        public: *public-space
 {% endif %}
       options:
-        region: {{ os.region }}
+        region: *openstack-region
 {% if ubuntu.release == 'trusty' %}
         source-branch: "stable/{{ os.release  }}"
 {% endif %}
diff --git a/ci/config_tpl/juju2/bundle_tpl/glance.yaml b/ci/config_tpl/juju2/bundle_tpl/glance.yaml
index be80bb39..d1136446 100644
--- a/ci/config_tpl/juju2/bundle_tpl/glance.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/glance.yaml
@@ -3,23 +3,21 @@
       num_units: {{ unit_qty() }}
 {% if os.service.bindings %}
       bindings:
-        internal: internal-api
-        admin: internal-api
-        shared-db: internal-api
-{% if opnfv.spaces_dict.public is defined %}
-        public: public-api
-{% else %}
-        public: internal-api
-{% endif %}
+        "": *oam-space
+        public: *public-space
+        admin: *admin-space
+        internal: *internal-space
+        shared-db: *internal-space
 {% endif %}
       options:
-        openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}"
+        openstack-origin: *openstack-origin
+        worker-multiplier: *worker-multiplier
+        region: *openstack-region
+{% if os.beta.public_api %}
+        use-internal-endpoints: True
+{% endif %}
 {% if os.git_repo.origin_git %}
         openstack-origin-git: "{{ os.git_repo.branch }}"
-{% endif %}
-        region: {{ os.region }}
-{% if os.beta.public_api %}
-        use-internal-endpoints: true
 {% endif %}
 {% if os.network.ipv6 %}
         prefer-ipv6: {{ os.network.ipv6 }}
@@ -27,9 +25,6 @@
 {% if opnfv.storage_dict.ceph is defined %}
         ceph-osd-replication-count: {{ unit_ceph_qty() }}
 {% endif %}
-{% if os.api.worker_multiplier %}
-        worker-multiplier: {{ os.api.worker_multiplier }}
-{% endif %}
 {% if os.ha.mode == 'ha' %}
         vip: {{ opnfv.vip.glance }}
 {% endif %}
diff --git a/ci/config_tpl/juju2/bundle_tpl/heat.yaml b/ci/config_tpl/juju2/bundle_tpl/heat.yaml
index 21b2479c..e5e33605 100644
--- a/ci/config_tpl/juju2/bundle_tpl/heat.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/heat.yaml
@@ -3,24 +3,19 @@
       num_units: 1
 {% if os.service.bindings %}
       bindings:
-        internal: internal-api
-        admin: internal-api
-        shared-db: internal-api
-{% if opnfv.spaces_dict.public is defined %}
-        public: public-api
-{% else %}
-        public: internal-api
-{% endif %}
+        "": *oam-space
+        public: *public-space
+        admin: *admin-space
+        internal: *internal-space
+        shared-db: *internal-space
 {% endif %}
       options:
-        openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}"
-        region: {{ os.region }}
+        openstack-origin: *openstack-origin
+        region: *openstack-region
 {% if os.network.ipv6 %}
         prefer-ipv6: {{ os.network.ipv6 }}
 {% endif %}
-{% if os.api.worker_multiplier %}
-        worker-multiplier: {{ os.api.worker_multiplier }}
-{% endif %}
+        worker-multiplier: *worker-multiplier
 {% if os.ha.mode == 'ha' %}
 #        vip: {{ opnfv.vip.heat }}
 {% endif %}
diff --git a/ci/config_tpl/juju2/bundle_tpl/keystone.yaml b/ci/config_tpl/juju2/bundle_tpl/keystone.yaml
index 0d21f649..22912e68 100644
--- a/ci/config_tpl/juju2/bundle_tpl/keystone.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/keystone.yaml
@@ -3,21 +3,18 @@
       num_units: {{ unit_qty() }}
 {% if os.service.bindings %}
       bindings:
-        internal: internal-api
-        admin: internal-api
-        shared-db: internal-api
-{% if opnfv.spaces_dict.public is defined %}
-        public: public-api
-{% else %}
-        public: internal-api
-{% endif %}
+        "": *oam-space
+        public: *public-space
+        admin: *admin-space
+        internal: *internal-space
+        shared-db: *internal-space
 {% endif %}
       options:
-        openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}"
+        openstack-origin: *openstack-origin
 {% if os.git_repo.origin_git %}
         openstack-origin-git: "{{ os.git_repo.branch }}"
 {% endif %}
-        region: {{ os.region }}
+        region: *openstack-region
         admin-role: {{ os.admin.role }}
         keystone-admin-role: {{ os.admin.role }}
         preferred-api-version: 3
@@ -25,7 +22,7 @@
         prefer-ipv6: {{ os.network.ipv6 }}
 {% endif %}
 {% if os.api.worker_multiplier %}
-        worker-multiplier: {{ os.api.worker_multiplier }}
+        worker-multiplier: *worker-multiplier
 {% endif %}
         admin-password: {{ opnfv.admin_password | default(os.admin.password) }}
         admin-token: {{ os.admin.name }}
diff --git a/ci/config_tpl/juju2/bundle_tpl/mysql.yaml b/ci/config_tpl/juju2/bundle_tpl/mysql.yaml
index 5c0fee6c..eedc9f0e 100644
--- a/ci/config_tpl/juju2/bundle_tpl/mysql.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/mysql.yaml
@@ -3,23 +3,20 @@
       num_units: {{ unit_qty() }}
 {% if os.service.bindings %}
       bindings:
-        access: internal-api
-        shared-db: internal-api
+        "": *oam-space
+        cluster: *internal-space
+        shared-db: *internal-space
 {% endif %}
       options:
-{% if os.ha.mode == 'ha' %}
-        innodb-buffer-pool-size: 1G
-        max-connections: 4000
-{% else %}
         innodb-buffer-pool-size: 1G
         max-connections: 4000
-{% endif %}
         #performance-schema: true
         #source: "deb http://repo.percona.com/apt xenial main"
         #key: "8507EFA5"
         root-password: {{ get_password('mysql_root') }}
         sst-password: {{ get_password('mysql_sst') }}
         sst-method: rsync
+        wait-timeout: 180
 {% if os.network.ipv6 %}
         prefer-ipv6: {{ os.network.ipv6 }}
 {% endif %}
diff --git a/ci/config_tpl/juju2/bundle_tpl/neutron-api.yaml b/ci/config_tpl/juju2/bundle_tpl/neutron-api.yaml
index 620cc02e..59d83c54 100644
--- a/ci/config_tpl/juju2/bundle_tpl/neutron-api.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/neutron-api.yaml
@@ -3,31 +3,26 @@
       num_units: {{ unit_qty() }}
 {% if os.service.bindings %}
       bindings:
-        internal: internal-api
-        admin: internal-api
-        shared-db: internal-api
-{% if opnfv.spaces_dict.public is defined %}
-        public: public-api
-{% else %}
-        public: internal-api
-{% endif %}
+        "": *oam-space
+        public: *public-space
+        admin: *admin-space
+        internal: *internal-space
+        shared-db: *internal-space
 {% endif %}
       options:
-        openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}"
+        openstack-origin: *openstack-origin
 {% if os.git_repo.origin_git %}
         openstack-origin-git: "{{ os.git_repo.branch }}"
 {% endif %}
-        region: {{ os.region }}
+        region: *openstack-region
         neutron-security-groups: true
 {% if os.beta.public_api %}
-        #use-internal-endpoints: true
+        use-internal-endpoints: True
 {% endif %}
+        worker-multiplier: *worker-multiplier
 {% if os.network.ipv6 %}
         prefer-ipv6: {{ os.network.ipv6 }}
 {% endif %}
-{% if os.api.worker_multiplier %}
-        worker-multiplier: {{ os.api.worker_multiplier }}
-{% endif %}
 {% if os.ha.mode == 'ha' %}
         vip: {{ opnfv.vip.neutron }}
 {% endif %}
diff --git a/ci/config_tpl/juju2/bundle_tpl/neutron-gateway.yaml b/ci/config_tpl/juju2/bundle_tpl/neutron-gateway.yaml
index f8a3f91a..eedac793 100644
--- a/ci/config_tpl/juju2/bundle_tpl/neutron-gateway.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/neutron-gateway.yaml
@@ -2,61 +2,30 @@
       charm: "./{{ ubuntu.release }}/neutron-gateway"
       num_units: 1
 {% if os.service.bindings %}
-{% if opnfv.spaces_dict.data is defined %}
       bindings:
-        data: tenant-data
-{% else %}
-      bindings:
-        data: internal-api
-{% endif %}
+        "": *oam-space
+        data: *overlay-space
 {% endif %}
       options:
-        openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}"
+        openstack-origin: *openstack-origin
 {% if os.git_repo.origin_git %}
         openstack-origin-git: "{{ os.git_repo.branch }}"
 {% endif %}
-{% if os.api.worker_multiplier %}
-        worker-multiplier: {{ os.api.worker_multiplier }}
-{% endif %}
+        worker-multiplier: *worker-multiplier
 {% if os.network.controller == 'nosdn' %}
-{% if opnfv.ext_port is defined  %}
-{% if opnfv.data_port is defined  %}
-        bridge-mappings: physnet1:br-ex physnet2:br-data
-        data-port: br-ex:{{ opnfv.ext_port }} br-data:{{ opnfv.data_port }}
-{% else %}
-        bridge-mappings: physnet1:br-ex
-        data-port: br-ex:{{ opnfv.ext_port }}
-{% endif %}
-{% endif %}
+        bridge-mappings: physnet1:br-data
+        data-port: *data-port
 {% elif os.network.controller == 'onos' %}
         plugin: onos
-{% if opnfv.ext_port is defined  %}
-{% if opnfv.data_port is defined  %}
-        bridge-mappings: physnet1:br-data external:br-ex
-        data-port: br-data:{{ opnfv.data_port }} br-ex:{{ opnfv.ext_port }}
-{% else %}
-        bridge-mappings: external:br-ex
-        data-port: br-ex:{{ opnfv.ext_port }}
-{% endif %}
-{% endif %}
+        bridge-mappings: physnet1:br-data
+        data-port: *data-port
 {% if os.network.sfc %}
         profile: onos-sfc
 {% endif %}
 {% elif os.network.controller == 'odl' %}
         plugin: ovs-odl
-{% if opnfv.ext_port is defined  %}
-{% if opnfv.data_port is defined  %}
-        bridge-mappings: physnet1:br-ex physnet2:br-data
-        data-port: br-ex:{{ opnfv.ext_port }} br-data:{{ opnfv.data_port }}
-{% else %}
-        bridge-mappings: physnet1:br-ex
-        data-port: br-ex:{{ opnfv.ext_port }}
-{% endif %}
-{% endif %}
-{% else %}
-{% if opnfv.ext_port is defined  %}
-        ext-port: {{ opnfv.ext_port }}
-{% endif %}
+        bridge-mappings: physnet1:br-data
+        data-port: *data-port
 {% endif %}
         instance-mtu: 1400
       to:
diff --git a/ci/config_tpl/juju2/bundle_tpl/neutron-ovs.yaml b/ci/config_tpl/juju2/bundle_tpl/neutron-ovs.yaml
index 92be0418..6e7fa7ec 100644
--- a/ci/config_tpl/juju2/bundle_tpl/neutron-ovs.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/neutron-ovs.yaml
@@ -1,24 +1,18 @@
     neutron-openvswitch:
       charm: ./{{ ubuntu.release }}/neutron-openvswitch
 {% if os.service.bindings %}
-{% if opnfv.spaces_dict.data is defined %}
       bindings:
-        data: tenant-data
+        data: *overlay-space
       options:
 {% else %}
-      bindings:
-        data: internal-api
       options:
-{% endif %}
-{% else %}
-      options:
-{% if os.git_repo.origin_git %}
-        openstack-origin-git: "{{ os.git_repo.branch }}"
-{% endif %}
 {% if opnfv.spaces_dict.data is defined %}
         os-data-network: {{ opnfv.spaces_dict.data.cidr }}
 {% endif %}
 {% endif %}
+{% if os.git_repo.origin_git %}
+        openstack-origin-git: "{{ os.git_repo.branch }}"
+{% endif %}
 {% if os.network.dpdk %}
         enable-dpdk: true
         #dpdk-driver: uio_pci_generic
@@ -26,17 +20,10 @@
         #default-socket-memory: 1024
         #default-socket-cores: 1
 {% endif %}
-{% if opnfv.ext_port is defined  %}
 {% if os.network.controller == 'nosdn' %}
-{% if opnfv.data_port is defined  %}
-        bridge-mappings: physnet1:br-ex physnet2:br-data
-        data-port: br-ex:{{ opnfv.ext_port }} br-data:{{ opnfv.data_port }}
-{% else %}
-        bridge-mappings: physnet1:br-ex
-        data-port: br-ex:{{ opnfv.ext_port }}
-{% endif %}
+        bridge-mappings: physnet1:br-data
+        #data-port: *data-port
 {% else %}
         ext-port: {{ opnfv.ext_port }}
 {% endif %}
-{% endif %}
 {# Empty block to avoid bad block trim #}
diff --git a/ci/config_tpl/juju2/bundle_tpl/nova-cloud-controller.yaml b/ci/config_tpl/juju2/bundle_tpl/nova-cloud-controller.yaml
index 8373b2bb..04ac2884 100644
--- a/ci/config_tpl/juju2/bundle_tpl/nova-cloud-controller.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/nova-cloud-controller.yaml
@@ -3,40 +3,36 @@
       num_units: {{ unit_qty() }}
 {% if os.service.bindings %}
       bindings:
-        internal: internal-api
-        admin: internal-api
-        shared-db: internal-api
-{% if opnfv.spaces_dict.public is defined %}
-        public: public-api
-{% else %}
-        public: internal-api
-{% endif %}
+        "": *oam-space
+        public: *public-space
+        admin: *admin-space
+        internal: *internal-space
+        shared-db: *internal-space
 {% endif %}
       options:
-        openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}"
+        openstack-origin: *openstack-origin
 {% if os.git_repo.origin_git %}
         openstack-origin-git: "{{ os.git_repo.branch }}"
 {% endif %}
-        region: {{ os.region }}
+        region: *openstack-region
         console-access-protocol: novnc
         neutron-external-network: ext-net
         service-guard: true
+        worker-multiplier: *worker-multiplier
+        single-nova-consoleauth: False
+        network-manager: Neutron
 {% if os.beta.public_api %}
         use-internal-endpoints: true
 {% endif %}
 {% if os.network.ipv6 %}
         prefer-ipv6: {{ os.network.ipv6 }}
 {% endif %}
-{% if os.api.worker_multiplier %}
-        worker-multiplier: {{ os.api.worker_multiplier }}
-{% endif %}
 {% if os.ha.mode == 'ha' %}
         vip: {{ opnfv.vip.nova }}
 {% endif %}
 {% if opnfv.domain is defined %}
         #console-proxy-ip: {{ opnfv.domain }}
 {% endif %}
-        network-manager: Neutron
 {% if os.beta.public_api %}
         os-public-hostname: api.{{ opnfv.domain }}
 {% endif %}
diff --git a/ci/config_tpl/juju2/bundle_tpl/nova-compute.yaml b/ci/config_tpl/juju2/bundle_tpl/nova-compute.yaml
index 66d53852..88f4f382 100644
--- a/ci/config_tpl/juju2/bundle_tpl/nova-compute.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/nova-compute.yaml
@@ -9,16 +9,19 @@
       num_units: {{ opnfv.units - 1 }}
 {% endif %}
 {% endif %}
+      bindings:
+        "": *oam-space
+        internal: *internal-space
       options:
-        openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}"
+        openstack-origin: *openstack-origin
 {% if os.git_repo.origin_git %}
         openstack-origin-git: "{{ os.git_repo.branch }}"
 {% endif %}
-        enable-live-migration: true
-        enable-resize: true
+        enable-live-migration: True
+        enable-resize: True
         migration-auth-type: ssh
 {% if os.beta.public_api %}
-        use-internal-endpoints: true
+        use-internal-endpoints: True
 {% endif %}
 {% if os.network.ipv6 %}
         prefer-ipv6: {{ os.network.ipv6 }}
@@ -34,6 +37,8 @@
 {% endif %}
 {% if os.lxd %}
         virt-type: lxd
+{% else %}
+        virt-type: kvm
 {% endif %}
       to:
 {% if os.hyperconverged %}
diff --git a/ci/config_tpl/juju2/bundle_tpl/odl.yaml b/ci/config_tpl/juju2/bundle_tpl/odl.yaml
index d1d0f0b5..d799e1a9 100644
--- a/ci/config_tpl/juju2/bundle_tpl/odl.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/odl.yaml
@@ -3,7 +3,8 @@
       num_units: 1
 {% if os.service.bindings %}
       bindings:
-        "": internal-api
+        "": *oam-space
+        internal: internal-space
 {% endif %}
       options:
         install-url: "https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/integration/distribution-karaf/0.6.0-Carbon/distribution-karaf-0.6.0-Carbon.tar.gz"
diff --git a/ci/config_tpl/juju2/bundle_tpl/openbaton.yaml b/ci/config_tpl/juju2/bundle_tpl/openbaton.yaml
index 053da7cd..a01d13ff 100644
--- a/ci/config_tpl/juju2/bundle_tpl/openbaton.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/openbaton.yaml
@@ -3,7 +3,8 @@
       num_units: 1
 {% if os.service.bindings %}
       bindings:
-        "": internal-api
+        "": *oam-space
+        internal: *internal-space
 {% endif %}
       to:
         - "lxd:nodes/0"
diff --git a/ci/config_tpl/juju2/bundle_tpl/openstack-dashboard.yaml b/ci/config_tpl/juju2/bundle_tpl/openstack-dashboard.yaml
index cba9b794..5e240e24 100644
--- a/ci/config_tpl/juju2/bundle_tpl/openstack-dashboard.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/openstack-dashboard.yaml
@@ -3,23 +3,20 @@
       num_units: {{ unit_qty() }}
 {% if os.service.bindings %}
       bindings:
-        shared-db: internal-api
-{% if opnfv.spaces_dict.public is defined %}
-        website: public-api
-{% else %}
-        website: internal-api
-{% endif %}
-{% if os.ha.mode == 'ha' %}
-        cluster: internal-api
-{% endif %}
+        "": *public-space
+        shared-db: *internal-space
 {% endif %}
       options:
-        openstack-origin: "cloud:{{ ubuntu.release }}-{{ os.release }}"
+        openstack-origin: *openstack-origin
 {% if os.git_repo.origin_git %}
         openstack-origin-git: "{{ os.git_repo.branch }}"
 {% endif %}
         secret: admin
         webroot: /
+        neutron-network-lb: True
+        neutron-network-firewall: False
+        cinder-backup: False
+        password-retrieve: True
 {% if os.network.ipv6 %}
         prefer-ipv6: {{ os.network.ipv6 }}
 {% endif %}
diff --git a/ci/config_tpl/juju2/bundle_tpl/opnfv-promise.yaml b/ci/config_tpl/juju2/bundle_tpl/opnfv-promise.yaml
index f4abaabf..d00d47b0 100644
--- a/ci/config_tpl/juju2/bundle_tpl/opnfv-promise.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/opnfv-promise.yaml
@@ -3,7 +3,7 @@
       num_units: 1
 {% if os.service.bindings %}
       bindings:
-        "": internal-api
+        "": *internal-space
 {% endif %}
       to:
         - "lxd:nodes/0"
diff --git a/ci/config_tpl/juju2/bundle_tpl/rabbitmq.yaml b/ci/config_tpl/juju2/bundle_tpl/rabbitmq.yaml
index ecbef4f1..b3bba40d 100644
--- a/ci/config_tpl/juju2/bundle_tpl/rabbitmq.yaml
+++ b/ci/config_tpl/juju2/bundle_tpl/rabbitmq.yaml
@@ -3,9 +3,12 @@
       num_units: {{ unit_qty() }}
 {% if os.service.bindings %}
       bindings:
-        amqp: internal-api
+        "": *oam-space
+        amqp: *internal-space
+        cluster: *internal-space
 {% endif %}
       options:
+        source: *openstack-origin
 {% if opnfv.storage_dict.ceph is defined %}
         ceph-osd-replication-count: {{ unit_ceph_qty() }}
 {% endif %}
@@ -13,7 +16,6 @@
         prefer-ipv6: {{ os.network.ipv6 }}
 {% endif %}
 {% if os.ha.mode == 'ha' %}
-        #vip: {{ opnfv.vip.rabbitmq }}
         min-cluster-size: {{ unit_qty() }}
 {% endif %}
       to:
diff --git a/ci/config_tpl/juju2/bundle_tpl/spaces.yaml b/ci/config_tpl/juju2/bundle_tpl/spaces.yaml
new file mode 100644
index 00000000..63f624f3
--- /dev/null
+++ b/ci/config_tpl/juju2/bundle_tpl/spaces.yaml
@@ -0,0 +1,62 @@
+
+
+{% if os.release == 'mitaka' %}
+    openstack-origin:    &openstack-origin    distro
+{% else %}
+    openstack-origin:    &openstack-origin    cloud:{{ ubuntu.release }}-{{ os.release }}
+{% endif %}
+
+    openstack-region:    &openstack-region    {{ os.region }}
+    worker-multiplier:   &worker-multiplier   {{ os.api.worker_multiplier }}
+    data-port:           &data-port           br-data:{{ opnfv.ext_port }}
+
+    # OAM - Operations, Administration and Maintenance
+{% if opnfv.spaces_dict.pxe is defined %}
+    oam-space:           &oam-space           oam-space
+{% else %}
+    oam-space:           &oam-space           internal-api
+{% endif %}
+
+    # This is OpenStack Admin network; for adminURL endpoints
+    admin-space:         &admin-space         internal-api
+
+    # This is OpenStack Public network; for publicURL endpoints
+{% if opnfv.spaces_dict.public is defined %}
+    public-space:        &public-space        public-api
+{% else %}
+    public-space:        &public-space        internal-api
+{% endif %}
+
+    # This is OpenStack Internal network; for internalURL endpoints
+    internal-space:      &internal-space      internal-api
+
+    # This is the overlay network
+{% if opnfv.spaces_dict.data is defined %}
+    overlay-space:       &overlay-space       tenant-data
+{% else %}
+    overlay-space:       &overlay-space       internal-api
+{% endif %}
+
+    # CEPH configuration
+    # CEPH access network
+    ceph-public-space:   &ceph-public-space   internal-api
+
+    # CEPH replication network
+{% if opnfv.spaces_dict.storage is defined %}
+    ceph-cluster-space:  &ceph-cluster-space  storage-cluster
+{% else %}
+    ceph-cluster-space:  &ceph-cluster-space  internal-api
+{% endif %}
+
+    # Workaround for 'only one default binding supported'
+    oam-space-constr:    &oam-space-constr    spaces=oam-space
+    ceph-access-constr:  &ceph-access-constr  spaces=ceph-access-space
+
+    # CEPH OSD and journal devices; temporary workaround for #1674148
+{% if os.lxd %}
+    osd-devices:         &osd-devices         /srv/ceph-osd
+{% else %}
+    osd-devices:         &osd-devices         {{ opnfv.storage_dict.ceph.disk }}
+{% endif %}
+    osd-journal:         &osd-journal
+
diff --git a/ci/deploy.sh b/ci/deploy.sh
index 795babbf..f9c1b2d0 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -252,7 +252,7 @@ if ([ $admin_gw ] && [ $admin_gw != "null" ]); then
     done
 fi
 
-// Configuring deployment
+# Configuring deployment
 if ([ $opnfvmodel == "openstack" ]); then
     echo_info "Configuring OpenStack deployment"
 
-- 
2.16.6