[SEBA-376] Splitting workflow from profile, rename att-workflow to seba

Change-Id: I19975b80fd6f7b6d2dc673cf1a76bd47fc3717c7
diff --git a/.gitignore b/.gitignore
index 4029c6e..815925b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,5 +10,6 @@
 xos-core/charts
 nem-monitoring/charts/
 xos-profiles/*/charts
+workflows/*/charts
 storage/*/charts
 logging/charts
diff --git a/configs/seba-ponsim-latest.yaml b/configs/seba-ponsim-latest.yaml
index 13d2d0d..f4a08e9 100644
--- a/configs/seba-ponsim-latest.yaml
+++ b/configs/seba-ponsim-latest.yaml
@@ -66,10 +66,7 @@
     xos_ws:
       tag: 'master'
 
-# in att-workflow service chart
-att-workflow-driver:
-  image:
-    tag: 'master'
+# in seba service chart
 fabric:
   image:
     tag: 'master'
@@ -89,3 +86,7 @@
   image:
     tag: 'master'
 
+# in workflow/seba-att service chart
+att-workflow-driver:
+  image:
+    tag: 'master'
diff --git a/scripts/helmlint.sh b/scripts/helmlint.sh
index 4af271c..aabdca0 100755
--- a/scripts/helmlint.sh
+++ b/scripts/helmlint.sh
@@ -41,7 +41,7 @@
   chartdir=$(dirname "${chart}")
 
   # only update dependencies for profiles
-  if [[ $chartdir =~ xos-profiles ]] && [ -f "${chartdir}/requirements.yaml" ]
+  if [[ $chartdir =~ xos-profiles || $chartdir =~ workflows ]] && [ -f "${chartdir}/requirements.yaml" ]
   then
     helm dependency update "${chartdir}"
   fi
diff --git a/xos-profiles/att-workflow/Chart.yaml b/workflows/att-workflow/Chart.yaml
similarity index 90%
rename from xos-profiles/att-workflow/Chart.yaml
rename to workflows/att-workflow/Chart.yaml
index 5d4c137..cae249c 100644
--- a/xos-profiles/att-workflow/Chart.yaml
+++ b/workflows/att-workflow/Chart.yaml
@@ -15,9 +15,9 @@
 
 apiVersion: v1
 name: att-workflow
-description: A Helm chart for XOS's "att-workflow" profile
+description: A Helm chart for XOS's "att-workflow"
 icon: https://guide.opencord.org/logos/cord.svg
-version: 1.0.1
+version: 1.0.0
 
 # xosproject/tosca-loader version
 appVersion: 1.1.5
diff --git a/xos-profiles/att-workflow/Chart.yaml b/workflows/att-workflow/requirements.yaml
similarity index 73%
copy from xos-profiles/att-workflow/Chart.yaml
copy to workflows/att-workflow/requirements.yaml
index 5d4c137..01dc8f3 100644
--- a/xos-profiles/att-workflow/Chart.yaml
+++ b/workflows/att-workflow/requirements.yaml
@@ -13,11 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-apiVersion: v1
-name: att-workflow
-description: A Helm chart for XOS's "att-workflow" profile
-icon: https://guide.opencord.org/logos/cord.svg
-version: 1.0.1
-
-# xosproject/tosca-loader version
-appVersion: 1.1.5
+dependencies:
+- name: att-workflow-driver
+  version: 1.0.10
+  repository: file://../../xos-services/att-workflow-driver
diff --git a/xos-profiles/att-workflow/templates/_helpers.tpl b/workflows/att-workflow/templates/_helpers.tpl
similarity index 95%
rename from xos-profiles/att-workflow/templates/_helpers.tpl
rename to workflows/att-workflow/templates/_helpers.tpl
index 432a7f1..6f83543 100644
--- a/xos-profiles/att-workflow/templates/_helpers.tpl
+++ b/workflows/att-workflow/templates/_helpers.tpl
@@ -45,7 +45,3 @@
 {{- define "att-workflow.chart" -}}
 {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
 {{- end -}}
-
-{{/*
-The R-CORD synchronizer loads R-CORD-specific models into the core
-*/}}
diff --git a/workflows/att-workflow/templates/_tosca.tpl b/workflows/att-workflow/templates/_tosca.tpl
new file mode 100644
index 0000000..b919834
--- /dev/null
+++ b/workflows/att-workflow/templates/_tosca.tpl
@@ -0,0 +1,53 @@
+{{/* 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 "att-workflow.serviceGraphTosca" -}}
+tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+  - custom_types/attworkflowdriverservice.yaml
+  - custom_types/voltservice.yaml
+  - custom_types/servicedependency.yaml
+description: att-workflow-driver service graph
+topology_template:
+  node_templates:
+
+# These services must be defined before loading the graph
+
+    service#volt:
+      type: tosca.nodes.VOLTService
+      properties:
+        name: volt
+        must-exist: true
+
+    service#att-workflow-driver:
+      type: tosca.nodes.AttWorkflowDriverService
+      properties:
+        name: att-workflow-driver
+        must-exist: true
+
+    service_dependency#workflow_volt:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: none
+      requirements:
+        - subscriber_service:
+            node: service#att-workflow-driver
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#volt
+            relationship: tosca.relationships.BelongsToOne
+{{- end -}}
diff --git a/xos-profiles/att-workflow/Chart.yaml b/workflows/att-workflow/templates/tosca-configmap.yaml
similarity index 69%
copy from xos-profiles/att-workflow/Chart.yaml
copy to workflows/att-workflow/templates/tosca-configmap.yaml
index 5d4c137..9fc6add 100644
--- a/xos-profiles/att-workflow/Chart.yaml
+++ b/workflows/att-workflow/templates/tosca-configmap.yaml
@@ -1,4 +1,5 @@
 ---
+
 # Copyright 2018-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,10 +15,11 @@
 # limitations under the License.
 
 apiVersion: v1
-name: att-workflow
-description: A Helm chart for XOS's "att-workflow" profile
-icon: https://guide.opencord.org/logos/cord.svg
-version: 1.0.1
-
-# xosproject/tosca-loader version
-appVersion: 1.1.5
+kind: ConfigMap
+metadata:
+  name: att-workflow-tosca
+data:
+  010-fixtures.yaml: |
+{{ include "att-workflow-driver.serviceTosca"  (index .Values "att-workflow-driver") | indent 4 }}
+  300-service-graph.yaml: |
+{{ include "att-workflow.serviceGraphTosca" . | indent 4 }}
diff --git a/xos-profiles/att-workflow/templates/tosca-job.yaml b/workflows/att-workflow/templates/tosca-job.yaml
similarity index 100%
rename from xos-profiles/att-workflow/templates/tosca-job.yaml
rename to workflows/att-workflow/templates/tosca-job.yaml
diff --git a/xos-profiles/att-workflow/Chart.yaml b/workflows/att-workflow/values.yaml
similarity index 60%
copy from xos-profiles/att-workflow/Chart.yaml
copy to workflows/att-workflow/values.yaml
index 5d4c137..730219b 100644
--- a/xos-profiles/att-workflow/Chart.yaml
+++ b/workflows/att-workflow/values.yaml
@@ -13,11 +13,22 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-apiVersion: v1
-name: att-workflow
-description: A Helm chart for XOS's "att-workflow" profile
-icon: https://guide.opencord.org/logos/cord.svg
-version: 1.0.1
+# Default values for the att-workflow profile.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
 
-# xosproject/tosca-loader version
-appVersion: 1.1.5
+
+nameOverride: ""
+fullnameOverride: ""
+
+images:
+  tosca_loader:
+    repository: 'xosproject/tosca-loader'
+    tag: '{{ .Chart.AppVersion }}'
+    pullPolicy: 'Always'
+
+global:
+  registry: ""
+
+xosAdminUser: "admin@opencord.org"
+xosAdminPassword: "letmein"
diff --git a/xos-profiles/att-workflow/Chart.yaml b/xos-profiles/seba-services/Chart.yaml
similarity index 90%
copy from xos-profiles/att-workflow/Chart.yaml
copy to xos-profiles/seba-services/Chart.yaml
index 5d4c137..7636729 100644
--- a/xos-profiles/att-workflow/Chart.yaml
+++ b/xos-profiles/seba-services/Chart.yaml
@@ -14,8 +14,8 @@
 # limitations under the License.
 
 apiVersion: v1
-name: att-workflow
-description: A Helm chart for XOS's "att-workflow" profile
+name: seba-services
+description: A Helm chart for XOS's "SEBA" profile
 icon: https://guide.opencord.org/logos/cord.svg
 version: 1.0.1
 
diff --git a/xos-profiles/att-workflow/requirements.yaml b/xos-profiles/seba-services/requirements.yaml
similarity index 91%
rename from xos-profiles/att-workflow/requirements.yaml
rename to xos-profiles/seba-services/requirements.yaml
index ac20c11..c490ef5 100644
--- a/xos-profiles/att-workflow/requirements.yaml
+++ b/xos-profiles/seba-services/requirements.yaml
@@ -29,9 +29,6 @@
 - name: fabric-crossconnect
   version: 1.1.2
   repository: file://../../xos-services/fabric-crossconnect
-- name: att-workflow-driver
-  version: 1.0.10
-  repository: file://../../xos-services/att-workflow-driver
 - name: sadis-server
   version: 1.0.1
   repository: file://../../sadis-server
diff --git a/xos-profiles/att-workflow/templates/_helpers.tpl b/xos-profiles/seba-services/templates/_helpers.tpl
similarity index 88%
copy from xos-profiles/att-workflow/templates/_helpers.tpl
copy to xos-profiles/seba-services/templates/_helpers.tpl
index 432a7f1..6519e2f 100644
--- a/xos-profiles/att-workflow/templates/_helpers.tpl
+++ b/xos-profiles/seba-services/templates/_helpers.tpl
@@ -17,7 +17,7 @@
 {{/*
 Expand the name of the chart.
 */}}
-{{- define "att-workflow.name" -}}
+{{- define "seba-services.name" -}}
 {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
 {{- end -}}
 
@@ -26,7 +26,7 @@
 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 "att-workflow.fullname" -}}
+{{- define "seba-services.fullname" -}}
 {{- if .Values.fullnameOverride -}}
 {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
 {{- else -}}
@@ -42,10 +42,6 @@
 {{/*
 Create chart name and version as used by the chart label.
 */}}
-{{- define "att-workflow.chart" -}}
+{{- define "seba-services.chart" -}}
 {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
 {{- end -}}
-
-{{/*
-The R-CORD synchronizer loads R-CORD-specific models into the core
-*/}}
diff --git a/xos-profiles/att-workflow/templates/_tosca.tpl b/xos-profiles/seba-services/templates/_tosca.tpl
similarity index 93%
rename from xos-profiles/att-workflow/templates/_tosca.tpl
rename to xos-profiles/seba-services/templates/_tosca.tpl
index aca682d..4b07e26 100644
--- a/xos-profiles/att-workflow/templates/_tosca.tpl
+++ b/xos-profiles/seba-services/templates/_tosca.tpl
@@ -14,7 +14,7 @@
 See the License for the specific language governing permissions and
 limitations under the License.
 */}}
-{{- define "att-workflow.onosTosca" -}}
+{{- define "seba-services.onosTosca" -}}
 tosca_definitions_version: tosca_simple_yaml_1_0
 
 imports:
@@ -218,7 +218,7 @@
             relationship: tosca.relationships.BelongsToOne
 {{- end -}}
 
-{{- define "att-workflow.basicFixturesTosca" -}}
+{{- define "seba-services.basicFixturesTosca" -}}
 tosca_definitions_version: tosca_simple_yaml_1_0
 description: Some basic fixtures
 imports:
@@ -309,10 +309,9 @@
 {{- end -}}
 
 
-{{- define "att-workflow.serviceGraphTosca" -}}
+{{- define "seba-services.serviceGraphTosca" -}}
 tosca_definitions_version: tosca_simple_yaml_1_0
 imports:
-  - custom_types/attworkflowdriverservice.yaml
   - custom_types/fabricservice.yaml
   - custom_types/onosservice.yaml
   - custom_types/rcordservice.yaml
@@ -320,7 +319,7 @@
   - custom_types/fabriccrossconnectservice.yaml
   - custom_types/servicedependency.yaml
   - custom_types/servicegraphconstraint.yaml
-description: att-workflow service graph
+description: seba service graph
 topology_template:
   node_templates:
 
@@ -356,14 +355,6 @@
         name: fabric-crossconnect
         must-exist: true
 
-    service#att-workflow-driver:
-      type: tosca.nodes.AttWorkflowDriverService
-      properties:
-        name: att-workflow-driver
-        must-exist: true
-
-# The att-workflow service graph
-
     service_dependency#onos-fabric_fabric:
       type: tosca.nodes.ServiceDependency
       properties:
@@ -424,18 +415,6 @@
             node: service#onos
             relationship: tosca.relationships.BelongsToOne
 
-    service_dependency#workflow_volt:
-      type: tosca.nodes.ServiceDependency
-      properties:
-        connect_method: none
-      requirements:
-        - subscriber_service:
-            node: service#att-workflow-driver
-            relationship: tosca.relationships.BelongsToOne
-        - provider_service:
-            node: service#volt
-            relationship: tosca.relationships.BelongsToOne
-
     constraints:
       type: tosca.nodes.ServiceGraphConstraint
       properties:
diff --git a/xos-profiles/att-workflow/templates/tests/test-att-workflow.yaml b/xos-profiles/seba-services/templates/tests/test-att-workflow.yaml
similarity index 100%
rename from xos-profiles/att-workflow/templates/tests/test-att-workflow.yaml
rename to xos-profiles/seba-services/templates/tests/test-att-workflow.yaml
diff --git a/xos-profiles/att-workflow/templates/tosca-configmap.yaml b/xos-profiles/seba-services/templates/tosca-configmap.yaml
similarity index 77%
rename from xos-profiles/att-workflow/templates/tosca-configmap.yaml
rename to xos-profiles/seba-services/templates/tosca-configmap.yaml
index 5c50ee6..4885b11 100644
--- a/xos-profiles/att-workflow/templates/tosca-configmap.yaml
+++ b/xos-profiles/seba-services/templates/tosca-configmap.yaml
@@ -17,10 +17,10 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: att-workflow-tosca
+  name: seba-services-tosca
 data:
   010-fixtures.yaml: |
-{{ include "att-workflow.basicFixturesTosca" . | indent 4 }}
+{{ include "seba-services.basicFixturesTosca" . | indent 4 }}
   020-rcord-subscriber-service.yaml: |
 {{ include "rcord.serviceTosca" .Values.rcord | indent 4 }}
   030-volt-service.yaml: |
@@ -28,10 +28,8 @@
   040-fabric-crossconnect-service.yaml: |
 {{ include "fabric-crossconnect.serviceTosca" (index .Values "fabric-crossconnect") | indent 4 }}
   061-onos-service.yaml: |
-{{ include "att-workflow.onosTosca" .Values | indent 4 }}
+{{ include "seba-services.onosTosca" .Values | indent 4 }}
   070-fabric-service.yaml: |
 {{ include "fabric.serviceTosca" .Values.fabric | indent 4 }}
-  080-workflow-service.yaml: |
-{{ include "att-workflow-driver.serviceTosca"  (index .Values "att-workflow-driver") | indent 4 }}
   300-service-graph.yaml: |
-{{ include "att-workflow.serviceGraphTosca" . | indent 4 }}
+{{ include "seba-services.serviceGraphTosca" . | indent 4 }}
diff --git a/xos-profiles/seba-services/templates/tosca-job.yaml b/xos-profiles/seba-services/templates/tosca-job.yaml
new file mode 100644
index 0000000..8317c08
--- /dev/null
+++ b/xos-profiles/seba-services/templates/tosca-job.yaml
@@ -0,0 +1,55 @@
+---
+
+# 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 "seba-services.fullname" . }}-tosca-loader
+  labels:
+    app: {{ template "seba-services.name" . }}
+    chart: {{ template "seba-services.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  backoffLimit: 12
+  template:
+    metadata:
+      labels:
+        app: {{ template "seba-services.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.global.registry }}{{ .Values.images.tosca_loader.repository }}:{{ tpl .Values.images.tosca_loader.tag . }}
+          imagePullPolicy: {{ .Values.images.tosca_loader.pullPolicy }}
+          env:
+            - name: XOS_USER
+              value: {{ .Values.xosAdminUser }}
+            - name: XOS_PASSWD
+              valueFrom:
+                secretKeyRef:
+                  name: xos-admin-passwd-secret
+                  key: password
+          volumeMounts:
+            - name: seba-services-tosca
+              mountPath: /opt/tosca
+      volumes:
+        - name: seba-services-tosca
+          configMap:
+            name: seba-services-tosca
diff --git a/xos-profiles/att-workflow/values.yaml b/xos-profiles/seba-services/values.yaml
similarity index 97%
rename from xos-profiles/att-workflow/values.yaml
rename to xos-profiles/seba-services/values.yaml
index 6eb958a..d261eca 100644
--- a/xos-profiles/att-workflow/values.yaml
+++ b/xos-profiles/seba-services/values.yaml
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Default values for the att-workflow profile.
+# Default values for the seba-services profile.
 # This is a YAML-formatted file.
 # Declare variables to be passed into your templates.