Merge "Move node TOSCA to a template"
diff --git a/examples/compute-nodes.yaml b/examples/compute-nodes.yaml
new file mode 100644
index 0000000..8bdc80b
--- /dev/null
+++ b/examples/compute-nodes.yaml
@@ -0,0 +1,33 @@
+---
+# Copyright 2018-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Information for the cluster's OpenStack compute nodes
+
+computeNodes:
+  master:
+    name: node0.opencord.org
+    bridgeId: of:00000000abcdef01
+    dataPlaneIntf: fabric
+    dataPlaneIp: 10.6.1.1/24
+  node1:
+    name: node1.opencord.org
+    bridgeId: of:00000000abcdef02
+    dataPlaneIntf: fabric
+    dataPlaneIp: 10.6.1.2/24
+  node2:
+    name: node2.opencord.org
+    bridgeId: of:00000000abcdef03
+    dataPlaneIntf: fabric
+    dataPlaneIp: 10.6.1.3/24
\ No newline at end of file
diff --git a/xos-profiles/base-openstack/templates/_tosca.tpl b/xos-profiles/base-openstack/templates/_tosca.tpl
index 962047c..ac429ff 100644
--- a/xos-profiles/base-openstack/templates/_tosca.tpl
+++ b/xos-profiles/base-openstack/templates/_tosca.tpl
@@ -147,4 +147,58 @@
           - slice:
               node: {{ .Values.cordSiteName }}_test
               relationship: tosca.relationships.BelongsToOne
-{{- end -}}
\ No newline at end of file
+{{- end -}}
+
+{{- define "base-openstack.computeNodeTosca" -}}
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+  - custom_types/deployment.yaml
+  - custom_types/node.yaml
+  - custom_types/site.yaml
+  - custom_types/sitedeployment.yaml
+
+description: Adds OpenStack compute nodes
+
+topology_template:
+  node_templates:
+
+# Site/Deployment, fully defined in deployment.yaml
+    site:
+      type: tosca.nodes.Site
+      properties:
+        name: {{ .Values.cordSiteName }}
+        must-exist: true
+
+    deployment:
+      type: tosca.nodes.Deployment
+      properties:
+        name: {{ .Values.cordDeploymentName }}
+        must-exist: true
+
+    site_deployment:
+      type: tosca.nodes.SiteDeployment
+      requirements:
+        - site:
+            node: site
+            relationship: tosca.relationships.BelongsToOne
+        - deployment:
+            node: deployment
+            relationship: tosca.relationships.BelongsToOne
+
+# OpenStack compute nodes
+
+    {{- range .Values.computeNodes }}
+    {{ .name }}:
+      type: tosca.nodes.Node
+      properties:
+        name: {{ .name }}
+        bridgeId: {{ .bridgeId }}
+        dataPlaneIntf: {{ .dataPlaneIntf }}
+        dataPlaneIp: {{ .dataPlaneIp }}
+      requirements:
+        - site_deployment:
+            node:  site_deployment
+            relationship: tosca.relationships.BelongsToOne
+    {{- end }}
+{{- end -}}
diff --git a/xos-profiles/base-openstack/templates/tosca-configmap.yaml b/xos-profiles/base-openstack/templates/tosca-configmap.yaml
index 6d4448e..5353086 100644
--- a/xos-profiles/base-openstack/templates/tosca-configmap.yaml
+++ b/xos-profiles/base-openstack/templates/tosca-configmap.yaml
@@ -28,13 +28,11 @@
   040-vtn-service.yaml: |
 {{ include "vtn-service.serviceTosca" (index .Values "vtn-service") | indent 4 }}
   050-openstack-compute.yaml: |
-{{ toYaml .Values.toscaRecipes.openstackCompute | indent 4 }}
+{{ 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 }}
-  400-openstack-test.yaml: |
-{{ include "base-openstack.testTosca" . | indent 4 }}
 
diff --git a/xos-profiles/base-openstack/values.yaml b/xos-profiles/base-openstack/values.yaml
index dbf6a9a..1a28a72 100644
--- a/xos-profiles/base-openstack/values.yaml
+++ b/xos-profiles/base-openstack/values.yaml
@@ -37,79 +37,10 @@
 keystoneAdminTenant: "admin"
 keystoneDomain: "Default"
 
-# TOSCA recipes for the tosca-loader
-toscaRecipes:
-  openstackCompute:
-    tosca_definitions_version: tosca_simple_yaml_1_0
-
-    imports:
-      - custom_types/deployment.yaml
-      - custom_types/node.yaml
-      - custom_types/site.yaml
-      - custom_types/sitedeployment.yaml
-
-    description: Adds OpenStack compute nodes
-
-    topology_template:
-      node_templates:
-
-    # Site/Deployment, fully defined in deployment.yaml
-        site:
-          type: tosca.nodes.Site
-          properties:
-            name: *site
-            must-exist: true
-
-        deployment:
-          type: tosca.nodes.Deployment
-          properties:
-            name: *deployment
-            must-exist: true
-
-        site_deployment:
-          type: tosca.nodes.SiteDeployment
-          requirements:
-            - site:
-                node: site
-                relationship: tosca.relationships.BelongsToOne
-            - deployment:
-                node: deployment
-                relationship: tosca.relationships.BelongsToOne
-
-    # OpenStack compute nodes
-
-        head1:
-          type: tosca.nodes.Node
-          properties:
-            name: head1
-            bridgeId: of:00000000abcdef01
-            dataPlaneIntf: fabricbridge
-            dataPlaneIp: 10.6.1.1/24
-          requirements:
-            - site_deployment:
-                node:  site_deployment
-                relationship: tosca.relationships.BelongsToOne
-
-        compute1:
-          type: tosca.nodes.Node
-          properties:
-            name: compute1
-            bridgeId: of:00000000abcdef02
-            dataPlaneIntf: fabricbond
-            dataPlaneIp: 10.6.1.17/24
-          requirements:
-            - site_deployment:
-                node:  site_deployment
-                relationship: tosca.relationships.BelongsToOne
-
-        compute2:
-          type: tosca.nodes.Node
-          properties:
-            name: compute2
-            bridgeId: of:00000000abcdef03
-            dataPlaneIntf: fabricbond
-            dataPlaneIp: 10.6.1.18/24
-          requirements:
-            - site_deployment:
-                node:  site_deployment
-                relationship: tosca.relationships.BelongsToOne
+# List of compute nodes to add to XOS
+computeNodes:
+  master:
+    name: node0.opencord.org
+    bridgeId: of:00000000abcdef01
+    dataPlaneIntf: fabric
+    dataPlaneIp: 10.6.1.1/24
diff --git a/xos-services/openstack/templates/_helpers.tpl b/xos-services/openstack/templates/_helpers.tpl
index db369dd..181703e 100644
--- a/xos-services/openstack/templates/_helpers.tpl
+++ b/xos-services/openstack/templates/_helpers.tpl
@@ -31,13 +31,9 @@
 {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
 {{- else -}}
 {{- $name := default .Chart.Name .Values.nameOverride -}}
-{{- if contains $name .Release.Name -}}
-{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
-{{- else -}}
 {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
 {{- end -}}
 {{- end -}}
-{{- end -}}
 
 {{/*
 Create chart name and version as used by the chart label.
diff --git a/xos-services/vtn-service/templates/_tosca.tpl b/xos-services/vtn-service/templates/_tosca.tpl
index 9edc27e..f1d630a 100644
--- a/xos-services/vtn-service/templates/_tosca.tpl
+++ b/xos-services/vtn-service/templates/_tosca.tpl
@@ -34,9 +34,9 @@
           privateGatewayMac: 00:00:00:00:00:01
           localManagementIp: 172.27.0.1/24
           ovsdbPort: 6641
-          sshUser: vagrant
+          sshUser: {{ .sshUser }}
           sshKeyFile: /root/node_key
-          sshPort: 22
+          sshPort: {{ .sshPort }}
           xosEndpoint: xos-chameleon:9101
           xosUser: {{ .xosAdminUser }}
           xosPassword: {{ .xosAdminPassword }}
diff --git a/xos-services/vtn-service/values.yaml b/xos-services/vtn-service/values.yaml
index 857df1b..49d5af5 100644
--- a/xos-services/vtn-service/values.yaml
+++ b/xos-services/vtn-service/values.yaml
@@ -29,6 +29,9 @@
 xosAdminUser: "admin@opencord.org"
 xosAdminPassword: "letmein"
 
+sshUser: "root"
+sshPort: 22
+
 resources: {}
 
 nodeSelector: {}