add flat network for vm conncet to server outside cord

Change-Id: I7949a457b6dc299df4fe403737565c996d0bcda6
(cherry picked from commit 003a53164ab87bb0c25a0e61670634d8876b7f7e)
diff --git a/profile_manifests/mcord-spirent.yml b/profile_manifests/mcord-spirent.yml
index e31d4a7..781b812 100644
--- a/profile_manifests/mcord-spirent.yml
+++ b/profile_manifests/mcord-spirent.yml
@@ -35,7 +35,6 @@
   - shared-net.yaml
   - wan-net.yaml
   - vsg-net.yaml
-  - flat-net.yaml
   - xos-gui-extensions.yml
 
 xos_new_tosca_config_templates:
@@ -45,6 +44,7 @@
   - sbi-net.yaml
   - spgw-net.yaml
   - sgi-net.yaml
+  - flat-net.yaml
   - mcord-spirent-services.yml
 
 xos_other_templates:
diff --git a/roles/cord-profile/templates/flat-net.yaml.j2 b/roles/cord-profile/templates/flat-net.yaml.j2
index bd6f5c8..e9588c0 100644
--- a/roles/cord-profile/templates/flat-net.yaml.j2
+++ b/roles/cord-profile/templates/flat-net.yaml.j2
@@ -2,8 +2,13 @@
 
 imports:
    - custom_types/xos.yaml
+   - custom_types/site.yaml
+   - custom_types/slice.yaml
+   - custom_types/flavor.yaml
+   - custom_types/network.yaml
+   - custom_types/networktemplate.yaml
 
-description: flat network config, generated by platform-install
+description: flat network for connecting from VM in CORD to servers outside
 
 topology_template:
   node_templates:
@@ -11,24 +16,28 @@
 # site, fully created in deployment.yaml
     {{ site_name }}:
       type: tosca.nodes.Site
+      properties:
+          name: {{ site_name }}
 
 # flat network
     flat_template:
       type: tosca.nodes.NetworkTemplate
       properties:
+          name: flat_template
           visibility: private
           translation: none
           vtn_kind: FLAT
 
     flat_network:
-      type: tosca.nodes.network.Network
+      type: tosca.nodes.Network
       properties:
-          ip_version: 4
-          cidr: 103.0.0.0/24
+          name: flat_network
+          subnet: 103.0.0.0/24
+          permit_all_slices: true
       requirements:
-          - network_template:
+          - template:
               node: flat_template
-              relationship: tosca.relationships.UsesNetworkTemplate
+              relationship: tosca.relationships.BelongsToOne
           - owner:
               node: {{ site_name }}_flat
               relationship: tosca.relationships.MemberOfSlice
@@ -37,9 +46,11 @@
       description: This slice exists solely to own the flat network
       type: tosca.nodes.Slice
       properties:
+          name: {{ site_name }}_flat
+          default_isolation: vm
           network: noauto
       requirements:
           - site:
               node: {{ site_name }}
-              relationship: tosca.relationships.MemberOfSite
+              relationship: tosca.relationships.BelongsToOne
 
diff --git a/roles/cord-profile/templates/mcord-spirent-services.yml.j2 b/roles/cord-profile/templates/mcord-spirent-services.yml.j2
index 1392c20..716121d 100644
--- a/roles/cord-profile/templates/mcord-spirent-services.yml.j2
+++ b/roles/cord-profile/templates/mcord-spirent-services.yml.j2
@@ -119,12 +119,18 @@
       properties:
         must-exist: true
         name: sgi_network
-# spgw_network is for connectivity between VMs, fully created in sgi-net.yaml
+# spgw_network is for connectivity between VMs, fully created in spgw-net.yaml
     spgw_network:
       type: tosca.nodes.Network
       properties:
         must-exist: true
         name: spgw_network
+# flat_network is for connectivity between VM inside cord and server outside, fully created in flat-net.yaml
+    flat_network:
+      type: tosca.nodes.Network
+      properties:
+        must-exist: true
+        name: flat_network
 
 # ONOS_CORD, fully created in vtn.yaml
     service#ONOS_CORD:
@@ -221,6 +227,16 @@
             node: {{ site_name }}_venb
             relationship: tosca.relationships.BelongsToOne
 
+    venb_slice_flat_network:
+      type: tosca.nodes.NetworkSlice
+      requirements:
+        - network:
+            node: flat_network
+            relationship: tosca.relationships.BelongsToOne
+        - slice:
+            node: {{ site_name }}_venb
+            relationship: tosca.relationships.BelongsToOne
+
 #vSPGWC Service
     service#vspgwc:
       type: tosca.nodes.VSPGWCService