[CORD-3100] Upgrading TOSCA to new ONOS Service format

Change-Id: I0863881a305a78fe918d3558f4475a90c7d3b966
diff --git a/xos-profiles/base-openstack/templates/_tosca.tpl b/xos-profiles/base-openstack/templates/_tosca.tpl
index 80faa1b..e580a8a 100644
--- a/xos-profiles/base-openstack/templates/_tosca.tpl
+++ b/xos-profiles/base-openstack/templates/_tosca.tpl
@@ -48,7 +48,9 @@
 
 imports:
    - custom_types/onosapp.yaml
+   - custom_types/onosservice.yaml
    - custom_types/servicegraphconstraint.yaml
+   - custom_types/serviceinstance.yaml
    - custom_types/serviceinstancelink.yaml
    - custom_types/vtnservice.yaml
 
@@ -64,21 +66,57 @@
         must-exist: true
         resync: false
 
-    VTN_ONOS_app:
+    service#ONOS_CORD:
+      type: tosca.nodes.ONOSService
+      properties:
+        name: ONOS_CORD
+        must-exist: true
+
+    # NOTE this is defined in the onos-service TOSCA
+    onos_app#vtn:
       type: tosca.nodes.ONOSApp
       properties:
-          name: VTN_ONOS_app
+          name: vtn
           must-exist: true
 
-    VTN_ONOS_app_VTN_Service:
+    # NOTE this is defined in the vtn-service TOSCA
+    vtn_service_instance:
+      type: tosca.nodes.ServiceInstance
+      properties:
+          name: VTN config
+          must-exist: true
+
+    onos_app#vtn_VTN_Service:
         type: tosca.nodes.ServiceInstanceLink
         requirements:
           - provider_service_instance:
-              node: VTN_ONOS_app
+              node: onos_app#vtn
               relationship: tosca.relationships.BelongsToOne
           - subscriber_service:
               node: service#vtn
               relationship: tosca.relationships.BelongsToOne
+
+    link#vtn_to_vtn-config:
+      type: tosca.nodes.ServiceInstanceLink
+      requirements:
+        - subscriber_service_instance:
+            node: vtn_service_instance
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service_instance:
+            node: onos_app#vtn
+            relationship: tosca.relationships.BelongsToOne
+
+    service_dependency#onos-cord_vtn:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: None
+      requirements:
+        - subscriber_service:
+            node: service#ONOS_CORD
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#vtn
+            relationship: tosca.relationships.BelongsToOne
 {{- end -}}
 
 {{- define "base-openstack.testTosca" -}}
diff --git a/xos-profiles/base-openstack/templates/tosca-configmap.yaml b/xos-profiles/base-openstack/templates/tosca-configmap.yaml
index 5353086..308fc83 100644
--- a/xos-profiles/base-openstack/templates/tosca-configmap.yaml
+++ b/xos-profiles/base-openstack/templates/tosca-configmap.yaml
@@ -25,14 +25,14 @@
 {{ include "openstack.controllerTosca" .Values | indent 4 }}
   030-openstack-flavors.yaml: |
 {{ include "openstack.flavorTosca" .Values.openstack | indent 4 }}
-  040-vtn-service.yaml: |
+  040-onos-service-vtn-app.yaml: |
+{{ include "onos-service.vtnAppTosca" (index .Values "onos-service") | indent 4 }}
+  041-vtn-service.yaml: |
 {{ include "vtn-service.serviceTosca" (index .Values "vtn-service") | indent 4 }}
   050-openstack-compute.yaml: |
 {{ include "base-openstack.computeNodeTosca" . | indent 4 }}
   060-openstack-networks.yaml: |
 {{ include "openstack.networkTosca" .Values | indent 4 }}
-  070-onos-service-vtn-app.yaml: |
-{{ include "onos-service.vtnAppTosca" (index .Values "onos-service") | indent 4 }}
   300-service-graph.yaml: |
 {{ include "base-openstack.serviceGraphTosca" . | indent 4 }}