move internet emulator to new tosca

Change-Id: Ibacbf5a9461c9918440f338e2317cfaa166f16fe
diff --git a/profile_manifests/mcord.yml b/profile_manifests/mcord.yml
index 9ccfae3..0ee5ef5 100644
--- a/profile_manifests/mcord.yml
+++ b/profile_manifests/mcord.yml
@@ -43,14 +43,13 @@
   - sgi-net.yaml
 #  - mcord-services.yml
   - xos-gui-extensions.yml
-  - internet-emulator-service.yaml
   - sdn-controller-service.yaml
 
 xos_new_tosca_config_templates:
   - mcord-subscriber.yml
   - s11-net.yaml
   - mcord-services.yml
-
+  - internet-emulator-service.yaml
 
 xos_other_templates:
   - fabric-network-cfg.json
diff --git a/roles/cord-profile/templates/internet-emulator-service.yaml.j2 b/roles/cord-profile/templates/internet-emulator-service.yaml.j2
index ac7768f..94f0d39 100644
--- a/roles/cord-profile/templates/internet-emulator-service.yaml.j2
+++ b/roles/cord-profile/templates/internet-emulator-service.yaml.j2
@@ -22,7 +22,13 @@
 
 imports:
    - custom_types/xos.yaml
-   - custom_types/internetemulator.yaml
+   - custom_types/slice.yaml
+   - custom_types/site.yaml
+   - custom_types/image.yaml
+   - custom_types/flavor.yaml
+   - custom_types/network.yaml
+   - custom_types/internetemulatorservice.yaml
+   - custom_types/internetemulatorserviceinstance.yaml
 
 topology_template:
   node_templates:
@@ -30,51 +36,52 @@
 # site, image, fully created in deployment.yaml
     {{ site_name }}:
       type: tosca.nodes.Site
+      properties:
+        must-exist: true
+        name: {{ site_name }}
 
     m1.small:
       type: tosca.nodes.Flavor
-    m1.large:
-      type: tosca.nodes.Flavor
-    m1.medium:
-      type: tosca.nodes.Flavor
-    m1.xlarge:
-      type: tosca.nodes.Flavor
+      properties:
+        name: m1.small
+        must-exist: true
 
     trusty-server-multi-nic:
       type: tosca.nodes.Image
+      properties:
+        name: trusty-server-multi-nic
+        must-exist: true
 
 # management networks, fully created in management-net.yaml
     management:
-      type: tosca.nodes.network.Network.XOS
+      type: tosca.nodes.Network
       properties:
-        no-create: true
-        no-delete: true
-        no-update: true
+        must-exist: true
+        name: management
 
 {% if use_management_hosts %}
     management_hosts:
-      type: tosca.nodes.network.Network.XOS
+      type: tosca.nodes.Network
       properties:
-        no-create: true
-        no-delete: true
-        no-update: true
+        must-exist: true
+        name: management
 {% endif %}
 
 # sgi_network is for connectivity between VMs, fully created in sgi-net.yaml
     sgi_network:
-      type: tosca.nodes.network.Network.XOS
+      type: tosca.nodes.Network
       properties:
-        no-create: true
-        no-delete: true
-        no-update: true
+        must-exist: true
+        name: sgi_network
 
 
 # CORD Services
     service#internetemulator:
       type: tosca.nodes.InternetEmulatorService
       properties:
-          public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
-          private_key_fn: /opt/xos/services/internetemulator/keys/mcord_rsa
+          name: internetemulator
+          public_key: {{ lookup('file', config_cord_profile_dir + '/key_import/mcord_rsa.pub') }}
+          private_key_fn: /opt/xos/services/vmme/keys/mcord_rsa
       artifacts:
           pubkey: /opt/cord_profile/key_import/mcord_rsa.pub
 
@@ -83,34 +90,32 @@
       description: Internet Emulator Slice
       type: tosca.nodes.Slice
       properties:
-          network: noauto
+          name: {{ site_name }}_internetemulator
+          default_isolation: vm
       requirements:
           - site:
               node: mysite
-              relationship: tosca.relationships.MemberOfSite
-          - internetemulator_service:
+              relationship: tosca.relationships.BelongsToOne
+          - service:
               node: service#internetemulator
-              relationship: tosca.relationships.MemberOfService
+              relationship: tosca.relationships.BelongsToOne
           - default_image:
               node: trusty-server-multi-nic
-              relationship: tosca.relationships.DefaultImage
+              relationship: tosca.relationships.BelongsToOne
           - default_flavor:
               node: m1.small
-              relationship: tosca.relationships.DefaultFlavor
-          - connection_to_management:
-              node: management
-              relationship: tosca.relationships.ConnectsToNetwork
-          - connection_to_sgi_network:
-              node: sgi_network
-              relationship: tosca.relationships.ConnectsToNetwork
+              relationship: tosca.relationships.BelongsToOne
 
+# TODO: will refactor this part later
 # CORD Service Instances
-    serviceinstance#internetemulator:
-      type: tosca.nodes.InternetEmulatorServiceInstance
-      requirements:
-        - tenant:
-            node: service#internetemulator
-            relationship: tosca.relationships.TenantOfService
-        - dependency:
-            node: {{ site_name }}_internetemulator
-            relationship: tosca.relationships.DependsOn
+#    serviceinstance#internetemulator_instance:
+#      type: tosca.nodes.InternetEmulatorServiceInstance
+#      properties:
+#          name: internetemulator_instance
+#      requirements:
+#        - tenant:
+#           node: service#internetemulator
+#            relationship: tosca.relationships.TenantOfService
+#        - dependency:
+#            node: {{ site_name }}_internetemulator
+#            relationship: tosca.relationships.DependsOn
diff --git a/roles/cord-profile/templates/mcord-services.yml.j2 b/roles/cord-profile/templates/mcord-services.yml.j2
index 2935f82..63f8bcb 100644
--- a/roles/cord-profile/templates/mcord-services.yml.j2
+++ b/roles/cord-profile/templates/mcord-services.yml.j2
@@ -142,6 +142,7 @@
           private_key_fn: /opt/xos/services/vmme/keys/mcord_rsa
       artifacts:
           pubkey: /opt/cord_profile/key_import/mcord_rsa.pub
+
     intel_mme:
       type: tosca.nodes.VMMEVendor
       properties:
@@ -186,12 +187,6 @@
           - default_flavor:
               node: m1.small
               relationship: tosca.relationships.BelongsToOne
-          #- connection_to_management:
-          #    node: management
-          #    relationship: tosca.relationships.BelongsToMany
-          #- connection_to_s11_network:
-          #    node: s11_network
-          #   relationship: tosca.relationships.ConnectsToNetwork
 
 # will enable this part after sapan fix the obj issue
 #    mme_slice_s11_network: