CORD-3162 Create demo-exampleservice profile

Change-Id: I1720360013c3dc916add7b4d8a5dc7962cbdf037
diff --git a/xos-profiles/demo-exampleservice/Chart.yaml b/xos-profiles/demo-exampleservice/Chart.yaml
new file mode 100644
index 0000000..926af58
--- /dev/null
+++ b/xos-profiles/demo-exampleservice/Chart.yaml
@@ -0,0 +1,21 @@
+---
+
+# 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.
+
+apiVersion: v1
+appVersion: "1.0"
+description: A Helm chart that launches and configures ExampleService. It's assumed that base-kubernetes profile is installed.
+name: demo-exampleservice
+version: 0.1.0
diff --git a/xos-profiles/demo-exampleservice/requirements.yaml b/xos-profiles/demo-exampleservice/requirements.yaml
new file mode 100644
index 0000000..b398892
--- /dev/null
+++ b/xos-profiles/demo-exampleservice/requirements.yaml
@@ -0,0 +1,20 @@
+---
+
+# 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.
+
+dependencies:
+- name: exampleservice
+  version: 0.1.0
+  repository: file://../../xos-services/exampleservice
diff --git a/xos-profiles/demo-exampleservice/templates/_helpers.tpl b/xos-profiles/demo-exampleservice/templates/_helpers.tpl
new file mode 100644
index 0000000..abeb4d4
--- /dev/null
+++ b/xos-profiles/demo-exampleservice/templates/_helpers.tpl
@@ -0,0 +1,47 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+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.
+*/}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "demo-exampleservice.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "demo-exampleservice.fullname" -}}
+{{- if .Values.fullnameOverride -}}
+{{- .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.
+*/}}
+{{- define "demo-exampleservice.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/xos-profiles/demo-exampleservice/templates/_tosca.tpl b/xos-profiles/demo-exampleservice/templates/_tosca.tpl
new file mode 100644
index 0000000..7747670
--- /dev/null
+++ b/xos-profiles/demo-exampleservice/templates/_tosca.tpl
@@ -0,0 +1,67 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+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.
+*/}}
+{{- define "demo-exampleservice.publicNetworkTosca" -}}
+tosca_definitions_version: tosca_simple_yaml_1_0
+description: Setup public network
+imports:
+  - custom_types/networktemplate.yaml
+  - custom_types/network.yaml
+  - custom_types/site.yaml
+  - custom_types/slice.yaml
+topology_template:
+  node_templates:
+    mysite:
+      type: tosca.nodes.Site
+      properties:
+        name: {{ .Values.cordSiteName }}
+        must-exist: true
+
+    public_networking_slice:
+      description: This slice exists solely to own the public network
+      type: tosca.nodes.Slice
+      properties:
+        network: noauto
+        name: public_networking
+      requirements:
+        - site:
+            node: mysite
+            relationship: tosca.relationships.BelongsToOne
+
+    # public network
+    public_template:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+        name: public_template
+        visibility: public
+        translation: none
+        vtn_kind: PUBLIC
+
+    public:
+      type: tosca.nodes.Network
+      properties:
+        name: public
+        permit_all_slices: true
+        subnet: {{ .Values.addresspool_public_cidr }}
+        # ip_version: 4
+      requirements:
+        - template:
+            node: public_template
+            relationship: tosca.relationships.BelongsToOne
+        - owner:
+            node: public_networking_slice
+            relationship: tosca.relationships.BelongsToOne
+{{- end -}}
diff --git a/xos-profiles/demo-exampleservice/templates/tosca-configmap.yaml b/xos-profiles/demo-exampleservice/templates/tosca-configmap.yaml
new file mode 100644
index 0000000..1c7f0a7
--- /dev/null
+++ b/xos-profiles/demo-exampleservice/templates/tosca-configmap.yaml
@@ -0,0 +1,25 @@
+---
+
+# 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.
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: demo-exampleservice-tosca
+data:
+  010-publicnet.yaml: |
+{{ include "demo-exampleservice.publicNetworkTosca" . | indent 4 }}
+  050-exampleservice-service.yaml: |
+{{ include "exampleservice.serviceTosca" .Values.exampleservice | indent 4 }}
diff --git a/xos-profiles/demo-exampleservice/templates/tosca-job.yaml b/xos-profiles/demo-exampleservice/templates/tosca-job.yaml
new file mode 100644
index 0000000..6b9b529
--- /dev/null
+++ b/xos-profiles/demo-exampleservice/templates/tosca-job.yaml
@@ -0,0 +1,56 @@
+---
+
+# 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.
+
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: {{ template "demo-exampleservice.fullname" . }}-tosca-loader
+  labels:
+    app: {{ template "demo-exampleservice.name" . }}
+    chart: {{ template "demo-exampleservice.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  template:
+    metadata:
+      labels:
+        app: {{ template "demo-exampleservice.name" . }}
+        release: {{ .Release.Name }}
+      annotations:
+        checksum/config: {{ include (print $.Template.BasePath "/tosca-configmap.yaml") . | sha256sum }}
+    spec:
+      restartPolicy: OnFailure
+      containers:
+        - name: {{ .Chart.Name }}-tosca-loader
+          image: {{ .Values.httpieImage | quote }}
+          imagePullPolicy: {{ .Values.imagePullPolicy }}
+          command: ["/bin/sh"]
+          args:
+            - "-c"
+            - |
+              for recipe in /opt/tosca/*
+              do
+                echo $recipe
+                http --check-status --ignore-stdin POST http://xos-tosca:$XOS_TOSCA_SERVICE_PORT/run xos-username:{{ .Values.xosAdminUser }} xos-password:{{ .Values.xosAdminPassword }} @$recipe || exit 1
+                echo ''
+              done
+          volumeMounts:
+            - name: demo-exampleservice-tosca
+              mountPath: /opt/tosca
+      volumes:
+        - name: demo-exampleservice-tosca
+          configMap:
+            name: demo-exampleservice-tosca
diff --git a/xos-profiles/demo-exampleservice/values.yaml b/xos-profiles/demo-exampleservice/values.yaml
new file mode 100644
index 0000000..a9fc768
--- /dev/null
+++ b/xos-profiles/demo-exampleservice/values.yaml
@@ -0,0 +1,39 @@
+---
+# 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.
+
+# Default values for the base-openstack profile.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+replicaCount: 1
+
+nameOverride: ""
+fullnameOverride: ""
+
+imagePullPolicy: 'IfNotPresent'
+
+httpieImage: "clue/httpie:latest"
+
+xosAdminUser: "admin@opencord.org"
+xosAdminPassword: "letmein"
+
+cordSiteName: "mysite"
+cordDeploymentName: "mydeployment"
+
+addresspool_public_cidr: "10.8.1.0/24"
+
+global:
+  proxySshEnabled: true
+  proxySshUser: root