SEBA-89 rcord-fc profile and fabric-crossconnect service

Change-Id: I1d1bd222c1f96ec3af75a7348a038af899e5be7d
diff --git a/xos-profiles/rcord-fc/Chart.yaml b/xos-profiles/rcord-fc/Chart.yaml
new file mode 100644
index 0000000..8dc3f2c
--- /dev/null
+++ b/xos-profiles/rcord-fc/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 "rcord-fc" profile
+name: rcord-fc
+version: 0.1.0
diff --git a/xos-profiles/rcord-fc/requirements.yaml b/xos-profiles/rcord-fc/requirements.yaml
new file mode 100644
index 0000000..f0684d9
--- /dev/null
+++ b/xos-profiles/rcord-fc/requirements.yaml
@@ -0,0 +1,31 @@
+---
+# 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: rcord
+  version: 1.0.0
+  repository: file://../../xos-services/rcord
+- name: onos-service
+  version: 2.0.0
+  repository: file://../../xos-services/onos-service
+- name: fabric
+  version: 2.0.0
+  repository: file://../../xos-services/fabric
+- name: volt
+  version: 2.0.0
+  repository: file://../../xos-services/volt
+- name: fabric-crossconnect
+  version: 1.0.0
+  repository: file://../../xos-services/fabric-crossconnect
diff --git a/xos-profiles/rcord-fc/templates/_helpers.tpl b/xos-profiles/rcord-fc/templates/_helpers.tpl
new file mode 100644
index 0000000..31d71ba
--- /dev/null
+++ b/xos-profiles/rcord-fc/templates/_helpers.tpl
@@ -0,0 +1,51 @@
+{{/* 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 "rcord-fc.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 "rcord-fc.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 "rcord-fc.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/rcord-fc/templates/_tosca.tpl b/xos-profiles/rcord-fc/templates/_tosca.tpl
new file mode 100644
index 0000000..55777be
--- /dev/null
+++ b/xos-profiles/rcord-fc/templates/_tosca.tpl
@@ -0,0 +1,236 @@
+{{/* 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 "rcord-fc.basicFixturesTosca" -}}
+tosca_definitions_version: tosca_simple_yaml_1_0
+description: Some basic fixtures
+imports:
+  - custom_types/siterole.yaml
+  - custom_types/slicerole.yaml
+  - custom_types/networkparametertype.yaml
+  - custom_types/networktemplate.yaml
+  - custom_types/deployment.yaml
+topology_template:
+  node_templates:
+
+# -----------------------------------------------------------------------------
+# Network Parameter Types
+# -----------------------------------------------------------------------------
+    s_tag:
+      type: tosca.nodes.NetworkParameterType
+      properties:
+        name: s_tag
+    c_tag:
+      type: tosca.nodes.NetworkParameterType
+      properties:
+        name: c_tag
+    next_hop:
+      type: tosca.nodes.NetworkParameterType
+      properties:
+        name: next_hop
+    device:
+      type: tosca.nodes.NetworkParameterType
+      properties:
+        name: device
+    bridge:
+      type: tosca.nodes.NetworkParameterType
+      properties:
+        name: bridge
+    neutron_port_name:
+      type: tosca.nodes.NetworkParameterType
+      properties:
+        name: neutron_port_name
+
+# ----------------------------------------------------------------------------
+# Roles
+# ----------------------------------------------------------------------------
+    siterole#admin:
+      type: tosca.nodes.SiteRole
+      properties:
+        role: admin
+    siterole#pi:
+      type: tosca.nodes.SiteRole
+      properties:
+        role: pi
+    siterole#tech:
+      type: tosca.nodes.SiteRole
+      properties:
+        role: tech
+    slicerole#admin:
+      type: tosca.nodes.SliceRole
+      properties:
+        role: admin
+    slicerole#access:
+      type: tosca.nodes.SliceRole
+      properties:
+        role: access
+
+# -----------------------------------------------------------------------------
+# Network Templates
+# -----------------------------------------------------------------------------
+    Private:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+        name: Private
+        visibility: private
+        translation: none
+
+    Public shared IPv4:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+        name: Public shared IPv4
+        visibility: private
+        translation: NAT
+        shared_network_name: nat-net
+
+    Public dedicated IPv4:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+        name: Public dedicated IPv4
+        visibility: public
+        translation: none
+        shared_network_name: ext-net
+
+# -----------------------------------------------------------------------------
+# Deployment
+# -----------------------------------------------------------------------------
+    MyDeployment:
+      type: tosca.nodes.Deployment
+      properties:
+        name: MyDeployment
+{{- end -}}
+
+
+{{- define "rcord-fc.serviceGraphTosca" -}}
+tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+  - custom_types/fabricservice.yaml
+  - custom_types/onosservice.yaml
+  - custom_types/rcordservice.yaml
+  - custom_types/voltservice.yaml
+  - custom_types/fabriccrossconnectservice.yaml
+  - custom_types/servicedependency.yaml
+  - custom_types/servicegraphconstraint.yaml
+description: rcord-fc service graph
+topology_template:
+  node_templates:
+
+# These services must be defined before loading the graph
+
+    service#ONOS_Fabric:
+      type: tosca.nodes.ONOSService
+      properties:
+        name: ONOS_Fabric
+        must-exist: true
+
+    service#ONOS_VOLTHA:
+      type: tosca.nodes.ONOSService
+      properties:
+        name: ONOS_VOLTHA
+        must-exist: true
+
+    service#fabric:
+      type: tosca.nodes.FabricService
+      properties:
+        name: fabric
+        must-exist: true
+
+    service#rcord:
+      type: tosca.nodes.RCORDService
+      properties:
+        name: rcord
+        must-exist: true
+
+    service#volt:
+      type: tosca.nodes.VOLTService
+      properties:
+        name: volt
+        must-exist: true
+
+    service#fabric-crossconnect:
+      type: tosca.nodes.FabricCrossconnectService
+      properties:
+        name: fabric-crossconnect
+        must-exist: true
+
+# The rcord-fc service graph
+
+    service_dependency#onos-fabric_fabric:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: None
+      requirements:
+        - subscriber_service:
+            node: service#ONOS_Fabric
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#fabric
+            relationship: tosca.relationships.BelongsToOne
+
+    service_dependency#rcord_volt:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: None
+      requirements:
+        - subscriber_service:
+            node: service#rcord
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#volt
+            relationship: tosca.relationships.BelongsToOne
+
+    service_dependency#onos_voltha_volt:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: None
+      requirements:
+        - subscriber_service:
+            node: service#volt
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#ONOS_VOLTHA
+            relationship: tosca.relationships.BelongsToOne
+
+    service_dependency#volt_fabric-crossconnect:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: None
+      requirements:
+        - subscriber_service:
+            node: service#volt
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#fabric-crossconnect
+            relationship: tosca.relationships.BelongsToOne
+
+    service_dependency#onos_fabric_fabric-crossconnect:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: None
+      requirements:
+        - subscriber_service:
+            node: service#fabric-crossconnect
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#ONOS_Fabric
+            relationship: tosca.relationships.BelongsToOne
+
+    constraints:
+      type: tosca.nodes.ServiceGraphConstraint
+      properties:
+        constraints: '[[null, "rcord"], ["ONOS_VOLTHA", "volt"], ["ONOS_Fabric", "fabric-crossconnect"], ["fabric", null]]'
+{{- end -}}
+
diff --git a/xos-profiles/rcord-fc/templates/tosca-configmap.yaml b/xos-profiles/rcord-fc/templates/tosca-configmap.yaml
new file mode 100644
index 0000000..f726990
--- /dev/null
+++ b/xos-profiles/rcord-fc/templates/tosca-configmap.yaml
@@ -0,0 +1,37 @@
+---
+
+# 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: rcord-fc-tosca
+data:
+  010-fixtures.yaml: |
+{{ include "rcord-fc.basicFixturesTosca" . | indent 4 }}
+  020-rcord-subscriber-service.yaml: |
+{{ include "rcord.serviceTosca" .Values.rcord | indent 4 }}
+  030-volt-service.yaml: |
+{{ include "volt.serviceTosca" .Values.volt | indent 4 }}
+  040-fabric-crossconnect-service.yaml: |
+{{ include "fabric-crossconnect.serviceTosca" (index .Values "fabric-crossconnect") | indent 4 }}
+  060-onos-service-fabric.yaml: |
+{{ include "onos-service.fabricAppTosca" (index .Values "onos-service") | indent 4 }}
+  061-onos-voltha-service-fabric.yaml: |
+{{ include "onos-service.volthaOnosTosca" (index .Values "onos-service") | indent 4 }}
+  070-fabric-service.yaml: |
+{{ include "fabric.serviceTosca" .Values.fabric | indent 4 }}
+  300-service-graph.yaml: |
+{{ include "rcord-fc.serviceGraphTosca" . | indent 4 }}
diff --git a/xos-profiles/rcord-fc/templates/tosca-job.yaml b/xos-profiles/rcord-fc/templates/tosca-job.yaml
new file mode 100644
index 0000000..6bfd6a2
--- /dev/null
+++ b/xos-profiles/rcord-fc/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 "rcord-fc.fullname" . }}-tosca-loader
+  labels:
+    app: {{ template "rcord-fc.name" . }}
+    chart: {{ template "rcord-fc.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  backoffLimit: 12
+  template:
+    metadata:
+      labels:
+        app: {{ template "rcord-fc.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: {{ tpl .Values.tosca_loaderImage . | quote }}
+          imagePullPolicy: {{ .Values.imagePullPolicy }}
+          env:
+            - name: XOS_USER
+              value: {{ .Values.xosAdminUser }}
+            - name: XOS_PASSWD
+              valueFrom:
+                secretKeyRef:
+                  name: xos-admin-passwd-secret
+                  key: password
+          volumeMounts:
+            - name: rcord-fc-tosca
+              mountPath: /opt/tosca
+      volumes:
+        - name: rcord-fc-tosca
+          configMap:
+            name: rcord-fc-tosca
diff --git a/xos-profiles/rcord-fc/values.yaml b/xos-profiles/rcord-fc/values.yaml
new file mode 100644
index 0000000..8e2bee4
--- /dev/null
+++ b/xos-profiles/rcord-fc/values.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.
+
+# Default values for the rcord-fc profile.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+replicaCount: 1
+
+nameOverride: ""
+fullnameOverride: ""
+
+imagePullPolicy: 'Always'
+
+tosca_loaderImage: "xosproject/tosca-loader:1.0.1"
+
+xos_api_testerImage: 'xosproject/xos-api-tester:2.0.1'
+
+xosAdminUser: "admin@opencord.org"
+xosAdminPassword: "letmein"
+