Merge "[CORD-1650] Update TOSCA/variables to work with bridge/bond refactor"
diff --git a/mcord-cavium.yml b/mcord-cavium.yml
index 89d8741..fd577f3 100644
--- a/mcord-cavium.yml
+++ b/mcord-cavium.yml
@@ -136,11 +136,6 @@
 
 profile_library: "mcord"
 
-# VTN network configuration
-management_network_cidr: 172.27.0.0/24
-management_network_ip: 172.27.0.1/24
-data_plane_ip: 10.168.0.253/24
-
 # Juju config
 charm_versions:
   ceilometer: "cs:trusty/ceilometer-17"
diff --git a/mcord-ng40.yml b/mcord-ng40.yml
index a209620..3168dd1 100644
--- a/mcord-ng40.yml
+++ b/mcord-ng40.yml
@@ -101,11 +101,6 @@
 
 profile_library: "mcord"
 
-# VTN network configuration
-management_network_cidr: 172.27.0.0/24
-management_network_ip: 172.27.0.1/24
-data_plane_ip: 10.168.0.253/24
-
 # Juju config
 charm_versions:
   ceilometer: "cs:trusty/ceilometer-17"
diff --git a/templates/management-net.yaml.j2 b/templates/management-net.yaml.j2
index 9c7b03c..41af735 100644
--- a/templates/management-net.yaml.j2
+++ b/templates/management-net.yaml.j2
@@ -24,7 +24,7 @@
    - custom_types/slice.yaml
    - custom_types/site.yaml
 
-description: management network config, generated by platform-install
+description: management network config, generated by mcord profile
 
 topology_template:
   node_templates:
@@ -35,7 +35,7 @@
       properties:
         name: {{ site_name }}
 
-# management network
+# management (vtn: MANAGEMENT_LOCAL) network
     management_template:
       type: tosca.nodes.NetworkTemplate
       properties:
@@ -49,7 +49,7 @@
       properties:
         name: management
         # ip_version: 4
-        subnet: {{ management_network_cidr }}
+        subnet: {{ vtn_net_management_local_cidr }}
         permit_all_slices: true
       requirements:
         - template:
@@ -59,33 +59,37 @@
             node: slice#{{ site_name }}_management
             relationship: tosca.relationships.BelongsToOne
 
-{% if use_management_hosts %}
-    management_hosts_template:
+{% if use_vtn_net_management_host %}
+# management_host (vtn: MANAGEMENT_HOST) network
+    management_host_template:
       type: tosca.nodes.NetworkTemplate
       properties:
-        name: management_hosts_template
+        name: management_host_template
         visibility: private
         translation: none
         vtn_kind: MANAGEMENT_HOST
 
-    management_hosts:
+    management_host:
       type: tosca.nodes.Network
       properties:
+        name: management_host
         # ip_version: 4
-        subnet: {{ management_hosts_net_cidr }}
-        start_ip: {{ management_hosts_net_range_xos_low }}
-        end_ip: {{ management_hosts_net_range_xos_high }}
+        subnet: {{ vtn_net_management_host_cidr }}
+        start_ip: {{ vtn_net_management_host_range_xos_low }}
+        end_ip: {{ vtn_net_management_host_range_xos_high }}
+        permit_all_slices: true
       requirements:
         - template:
-            node: management_hosts_template
+            node: management_host_template
             relationship: tosca.relationships.BelongsToOne
         - owner:
             node: slice#{{ site_name }}_management
             relationship: tosca.relationships.BelongsToOne
 {% endif %}
 
+# Slice to own management networks
     slice#{{ site_name }}_management:
-      description: This slice exists solely to own the management network
+      description: This slice exists solely to own the management network(s)
       type: tosca.nodes.Slice
       properties:
         network: noauto
diff --git a/templates/mcord-cavium-services.yml.j2 b/templates/mcord-cavium-services.yml.j2
index a182c90..dae78a8 100644
--- a/templates/mcord-cavium-services.yml.j2
+++ b/templates/mcord-cavium-services.yml.j2
@@ -1,4 +1,4 @@
-
+---
 {#
 Copyright 2017-present Open Networking Foundation
 
@@ -15,10 +15,9 @@
 limitations under the License.
 #}
 
-
 tosca_definitions_version: tosca_simple_yaml_1_0
 
-description: created by platform-install
+description: created by mcord profile
 
 imports:
    - custom_types/slice.yaml
@@ -139,12 +138,12 @@
         must-exist: true
         name: management
 
-{% if use_management_hosts %}
-    management_hosts:
+{% if use_vtn_net_management_host %}
+    management_host:
       type: tosca.nodes.Network
       properties:
+        name: management_host
         must-exist: true
-        name: management_hosts
 {% endif %}
 
 # Other networks are created by vEPC service
diff --git a/templates/mcord-ng40-services.yml.j2 b/templates/mcord-ng40-services.yml.j2
index 1c04883..c1a2ce0 100644
--- a/templates/mcord-ng40-services.yml.j2
+++ b/templates/mcord-ng40-services.yml.j2
@@ -1,4 +1,4 @@
-
+---
 {#
 Copyright 2017-present Open Networking Foundation
 
@@ -15,10 +15,9 @@
 limitations under the License.
 #}
 
-
 tosca_definitions_version: tosca_simple_yaml_1_0
 
-description: created by platform-install, need to add M-CORD services later
+description: created by mcord profile, need to add M-CORD services later
 
 imports:
    - custom_types/slice.yaml
@@ -111,12 +110,12 @@
         must-exist: true
         name: management
 
-{% if use_management_hosts %}
-    management_hosts:
+{% if use_vtn_net_management_host %}
+    management_host:
       type: tosca.nodes.Network
       properties:
+        name: management_host
         must-exist: true
-        name: management_hosts
 {% endif %}
 
 # ONOS_CORD, fully created in vtn.yaml
@@ -336,4 +335,4 @@
               node: {{ site_name }}_{{ network['owner'] }}
               relationship: tosca.relationships.BelongsToOne
 
-{% endfor %}
\ No newline at end of file
+{% endfor %}
diff --git a/templates/shared-net.yaml.j2 b/templates/shared-net.yaml.j2
index 186e69f..0678e6c 100644
--- a/templates/shared-net.yaml.j2
+++ b/templates/shared-net.yaml.j2
@@ -1,3 +1,4 @@
+---
 tosca_definitions_version: tosca_simple_yaml_1_0
 
 imports:
@@ -6,7 +7,7 @@
   - custom_types/slice.yaml
   - custom_types/site.yaml
 
-description: shared network config, generated by platform-install
+description: shared network config, generated by mcord profile
 
 topology_template:
   node_templates:
@@ -22,33 +23,32 @@
     shared_template:
       type: tosca.nodes.NetworkTemplate
       properties:
-          name: shared_template
-          visibility: private
-          translation: none
-          vtn_kind: PRIVATE
+        name: shared_template
+        visibility: private
+        translation: none
+        vtn_kind: PRIVATE
 
     shared_network:
       type: tosca.nodes.Network
       properties:
-          name: shared_network
-          subnet: 100.0.0.0/24
+        name: shared_network
+        subnet: 100.0.0.0/24
       requirements:
-          - template:
-              node: shared_template
-              relationship: tosca.relationships.BelongsToOne
-          - owner:
-              node: {{ site_name }}_shared
-              relationship: tosca.relationships.BelongsToOne
+        - template:
+            node: shared_template
+            relationship: tosca.relationships.BelongsToOne
+        - owner:
+            node: {{ site_name }}_shared
+            relationship: tosca.relationships.BelongsToOne
 
     {{ site_name }}_shared:
       description: This slice exists solely to own the private network
       type: tosca.nodes.Slice
       properties:
-          name: {{ site_name }}_shared
-          network: noauto
+        name: {{ site_name }}_shared
+        network: noauto
       requirements:
-          - site:
-              node: {{ site_name }}
-              relationship: tosca.relationships.BelongsToOne
-
+        - site:
+            node: {{ site_name }}
+            relationship: tosca.relationships.BelongsToOne
 
diff --git a/templates/vsg-net.yaml.j2 b/templates/vsg-net.yaml.j2
index 9bcf397..18e9f2e 100644
--- a/templates/vsg-net.yaml.j2
+++ b/templates/vsg-net.yaml.j2
@@ -6,7 +6,7 @@
   - custom_types/slice.yaml
   - custom_types/site.yaml
 
-description: vsg network config, generated by platform-install
+description: vsg network config, generated by mcord profile
 
 topology_template:
   node_templates:
@@ -31,7 +31,7 @@
       type: tosca.nodes.Network
       properties:
           name: vsg_network
-          subnet: 101.0.0.0/24
+          subnet: {{ addresspool_vsg_cidr }}
       requirements:
           - template:
               node: vsg_template
@@ -51,4 +51,3 @@
               node: {{ site_name }}
               relationship: tosca.relationships.BelongsToOne
 
-
diff --git a/templates/vtn-service.yaml.j2 b/templates/vtn-service.yaml.j2
index 6a2dbd6..4f5a419 100644
--- a/templates/vtn-service.yaml.j2
+++ b/templates/vtn-service.yaml.j2
@@ -44,7 +44,7 @@
           kind: platform
           view_url: /admin/vtn/vtnservice/$id$/
           privateGatewayMac: 00:00:00:00:00:01
-          localManagementIp: {{ management_network_ip }}
+          localManagementIp: {{ vtn_net_management_local_cidr | ipaddr('1') }}
           ovsdbPort: 6641
           sshUser: root
           sshKeyFile: /root/node_key
diff --git a/templates/wan-net.yaml.j2 b/templates/wan-net.yaml.j2
index 0ada8be..ad3287f 100644
--- a/templates/wan-net.yaml.j2
+++ b/templates/wan-net.yaml.j2
@@ -6,7 +6,7 @@
   - custom_types/slice.yaml
   - custom_types/site.yaml
 
-description: wan network config, generated by platform-install
+description: wan network config, generated by mcord profile
 
 topology_template:
   node_templates:
@@ -22,33 +22,32 @@
     wan_template:
       type: tosca.nodes.NetworkTemplate
       properties:
-          name: wan_template
-          visibility: private
-          translation: none
-          vtn_kind: PRIVATE
+        name: wan_template
+        visibility: private
+        translation: none
+        vtn_kind: PRIVATE
 
     wan_network:
       type: tosca.nodes.Network
       properties:
-          name: wan_network
-          subnet: 102.0.0.0/24
+        name: wan_network
+        subnet: 102.0.0.0/24
       requirements:
-          - template:
-              node: wan_template
-              relationship: tosca.relationships.BelongsToOne
-          - owner:
-              node: {{ site_name }}_wan
-              relationship: tosca.relationships.BelongsToOne
+        - template:
+            node: wan_template
+            relationship: tosca.relationships.BelongsToOne
+        - owner:
+            node: {{ site_name }}_wan
+            relationship: tosca.relationships.BelongsToOne
 
     {{ site_name }}_wan:
       description: This slice exists solely to own the private network
       type: tosca.nodes.Slice
       properties:
-          name: {{ site_name }}_wan
-          network: noauto
+        name: {{ site_name }}_wan
+        network: noauto
       requirements:
-          - site:
-              node: {{ site_name }}
-              relationship: tosca.relationships.BelongsToOne
-
+        - site:
+            node: {{ site_name }}
+            relationship: tosca.relationships.BelongsToOne