CORD-3024 M-CORD profile chart and service charts

Change-Id: Ic947da2a6e5c77e6c943200fd11f0b35b9c8655b
diff --git a/xos-services/internetemulator/.helmignore b/xos-services/internetemulator/.helmignore
new file mode 100644
index 0000000..f0c1319
--- /dev/null
+++ b/xos-services/internetemulator/.helmignore
@@ -0,0 +1,21 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
diff --git a/xos-services/internetemulator/Chart.yaml b/xos-services/internetemulator/Chart.yaml
new file mode 100644
index 0000000..b1577bf
--- /dev/null
+++ b/xos-services/internetemulator/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 for XOS's "internetemulator" service
+name: internetemulator
+version: 0.1.0
diff --git a/xos-services/internetemulator/files/id_rsa b/xos-services/internetemulator/files/id_rsa
new file mode 100644
index 0000000..c840002
--- /dev/null
+++ b/xos-services/internetemulator/files/id_rsa
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpgIBAAKCAQEAy+S+bw7ENW5knorMTH/xmRKr/OaBx7ukRRNe1WKEwLgQbB0J
+xEznHG0E/OakgcuTQDACArTndeYl2H5rpdHhXkh6EK9R9yAF09In+gDcVzpvP2dq
+5UTbYThIL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5SIhQnL8NG4906P0Dd9t+PmQz6XXu4987FjOqAc
+zYvVr5vhCFhvSvWcKJN7uGbDAoGBAKvJequlLZDXCEB9UHzkwymn3IMg9ihYQAQH
+GV6Lw7H34gEoULQXRLw0xxlCPsduOPXkUbKxnYJ/drVDebmprh2KT4wAv3SG7eyZ
+SGh/Wv7yFSDAJvSYWwfjDzufMtm5Mc3oupzgY1toD7GLNFH1xasbHswVGRK+5NFl
+QlC1ipcNAoGBAIxqGyCai6btwDlbpkdI+ck2j7k9ndZ8sosc0G2se9d58sfsHdWe
+1wpqe62t7mQZr+IgEyq7RuuEtRR6Xqb8RQqAuEdSms1zcWc30SJJhPiwxIeLL0dx
+ly/HBBqnozD4BN3ENiqnIhOgeZE7XHaS43luYkYpBOuBaWYs5IIZWcct
+-----END RSA PRIVATE KEY-----
diff --git a/xos-services/internetemulator/templates/_helpers.tpl b/xos-services/internetemulator/templates/_helpers.tpl
new file mode 100644
index 0000000..dc70a3b
--- /dev/null
+++ b/xos-services/internetemulator/templates/_helpers.tpl
@@ -0,0 +1,80 @@
+{{/* 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 "internetemulator.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 "internetemulator.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 "internetemulator.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "internetemulator.serviceConfig" -}}
+name: internetemulator
+accessor:
+  username: {{ .Values.xosAdminUser | quote }}
+  password: {{ .Values.xosAdminPassword | quote }}
+  endpoint: xos-core:50051
+required_models:
+  - InternetEmulatorService
+  - InternetEmulatorServiceInstance
+  - ServiceDependency
+dependency_graph: "/opt/xos/synchronizers/internetemulator/model-deps"
+steps_dir: "/opt/xos/synchronizers/internetemulator/steps"
+sys_dir: "/opt/xos/synchronizers/internetemulator/sys"
+model_policies_dir: "/opt/xos/synchronizers/internetemulator/model_policies"
+models_dir: "/opt/xos/synchronizers/internetemulator/models"
+logging:
+  version: 1
+  handlers:
+    console:
+      class: logging.StreamHandler
+    file:
+      class: logging.handlers.RotatingFileHandler
+      filename: /var/log/xos.log
+      maxBytes: 10485760
+      backupCount: 5
+  loggers:
+    'multistructlog':
+      handlers:
+          - console
+          - file
+      level: DEBUG
+{{- end -}}
diff --git a/xos-services/internetemulator/templates/_tosca.tpl b/xos-services/internetemulator/templates/_tosca.tpl
new file mode 100644
index 0000000..53fa4c8
--- /dev/null
+++ b/xos-services/internetemulator/templates/_tosca.tpl
@@ -0,0 +1,43 @@
+{{/* 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 "internetemulator.serviceTosca" -}}
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+  - custom_types/internetemulatorservice.yaml
+  - custom_types/image.yaml
+
+description: Configures the internetemulator service
+
+topology_template:
+  node_templates:
+
+    service#internetemulator:
+      type: tosca.nodes.InternetEmulatorService
+      properties:
+        name: internetemulator
+        public_key: {{ .publicKey | quote }}
+        private_key_fn: /opt/xos/services/internetemulator/keys/id_rsa
+
+    image_internetemulator:
+      type: tosca.nodes.Image
+      properties:
+        name: image_internetemulator_{{ .vnfImageVersion }}
+        disk_format: QCOW2
+        container_format: BARE
+        path: {{ .vnfImageURL }}
+{{- end -}}
diff --git a/xos-services/internetemulator/templates/configmap.yaml b/xos-services/internetemulator/templates/configmap.yaml
new file mode 100644
index 0000000..6e00709
--- /dev/null
+++ b/xos-services/internetemulator/templates/configmap.yaml
@@ -0,0 +1,23 @@
+---
+
+# 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: internetemulator
+data:
+  serviceConfig: |
+{{ include "internetemulator.serviceConfig" . | indent 4 }}
diff --git a/xos-services/internetemulator/templates/deployment.yaml b/xos-services/internetemulator/templates/deployment.yaml
new file mode 100644
index 0000000..22415d8
--- /dev/null
+++ b/xos-services/internetemulator/templates/deployment.yaml
@@ -0,0 +1,82 @@
+---
+# 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: apps/v1beta2
+kind: Deployment
+metadata:
+  name: {{ template "internetemulator.fullname" . }}
+  labels:
+    app: {{ template "internetemulator.name" . }}
+    chart: {{ template "internetemulator.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  replicas: {{ .Values.replicaCount }}
+  selector:
+    matchLabels:
+      app: {{ template "internetemulator.name" . }}
+      release: {{ .Release.Name }}
+  template:
+    metadata:
+      labels:
+        app: {{ template "internetemulator.name" . }}
+        release: {{ .Release.Name }}
+      annotations:
+        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
+    spec:
+      containers:
+        - name: {{ .Chart.Name }}
+          image: {{ .Values.synchronizerImage | quote }}
+          imagePullPolicy: {{ .Values.imagePullPolicy }}
+          resources:
+{{ toYaml .Values.resources | indent 12 }}
+          volumeMounts:
+            - name: internetemulator-config
+              mountPath: /opt/xos/synchronizers/internetemulator/internetemulator_config.yaml
+              subPath: internetemulator_config.yaml
+            - name: certchain-volume
+              mountPath: /usr/local/share/ca-certificates/local_certs.crt
+              subPath: config/ca_cert_chain.pem
+            - name: internetemulator-keys
+              mountPath: /opt/xos/services/internetemulator/keys
+              readOnly: true
+      volumes:
+        - name: internetemulator-config
+          configMap:
+            name: internetemulator
+            items:
+              - key: serviceConfig
+                path: internetemulator_config.yaml
+        - name: certchain-volume
+          configMap:
+            name: ca-certificates
+            items:
+              - key: chain
+                path: config/ca_cert_chain.pem
+        - name: internetemulator-keys
+          secret:
+            secretName: internetemulator-keys
+    {{- with .Values.nodeSelector }}
+      nodeSelector:
+{{ toYaml . | indent 8 }}
+    {{- end }}
+    {{- with .Values.affinity }}
+      affinity:
+{{ toYaml . | indent 8 }}
+    {{- end }}
+    {{- with .Values.tolerations }}
+      tolerations:
+{{ toYaml . | indent 8 }}
+    {{- end }}
diff --git a/xos-services/internetemulator/templates/secret.yaml b/xos-services/internetemulator/templates/secret.yaml
new file mode 100644
index 0000000..dbc9fa1
--- /dev/null
+++ b/xos-services/internetemulator/templates/secret.yaml
@@ -0,0 +1,23 @@
+---
+# Copyright 2017-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: Secret
+metadata:
+  name: internetemulator-keys
+  namespace: default
+type: Opaque
+data:
+  id_rsa: {{ .Files.Get .Values.privateKeyFile | b64enc }}
\ No newline at end of file
diff --git a/xos-services/internetemulator/values.yaml b/xos-services/internetemulator/values.yaml
new file mode 100644
index 0000000..4aba234
--- /dev/null
+++ b/xos-services/internetemulator/values.yaml
@@ -0,0 +1,44 @@
+---
+# 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 internetemulator.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+replicaCount: 1
+
+nameOverride: ""
+fullnameOverride: ""
+
+imagePullPolicy: 'IfNotPresent'
+
+synchronizerImage: "xosproject/internetemulator-synchronizer:master"
+
+xosAdminUser: "admin@opencord.org"
+xosAdminPassword: "letmein"
+
+vnfImageURL: "http://www.vicci.org/cord/image-internetemulator.qcow2.20180511"
+vnfImageVersion: "v0.1"
+
+publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDL5L5vDsQ1bmSeisxMf/GZEqv85oHHu6RFE17VYoTAuBBsHQnETOccbQT85qSBy5NAMAICtOd15iXYfmul0eFeSHoQr1H3IAXT0if6ANxXOm8/Z2rlRNthOEgsjDQU9foNxQ4wksygy5epKmbEhMqbFZjuj4zYfStPzE/gkFSE9QjhKMWaJmyLFfq9f8DnC+TTE41K5iGbtramr7qHSWsKKy75XV6MZZLLFExrQqlYDlLA2V0aYezCql3fB96KJmf6GJRT3j3Y7oWaj7gEzMCycA2QgP8ZNFL/2Q1qgvQRc6I46/HUiOh3IT8LVDdo2ZUn9qrNameQ1zR7a+wBvYIV Insecure M-CORD keypair"
+privateKeyFile: "files/id_rsa"
+
+resources: {}
+
+nodeSelector: {}
+
+tolerations: []
+
+affinity: {}