Refactor NEM charts to allow for multiple profiles
Change-Id: Ib98f1fc9ff9b7b0801a90edf4c8ec78cb4198014
diff --git a/helm-charts/profile/bng-in-fabric/.helmignore b/helm-charts/profile/bng-in-fabric/.helmignore
new file mode 100644
index 0000000..f0c1319
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/.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/helm-charts/profile/bng-in-fabric/Chart.yaml b/helm-charts/profile/bng-in-fabric/Chart.yaml
new file mode 100644
index 0000000..b98397b
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/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 NEM's "bng-in-fabric" profile
+name: bng-in-fabric
+version: 0.1.0
diff --git a/helm-charts/profile/bng-in-fabric/requirements.yaml b/helm-charts/profile/bng-in-fabric/requirements.yaml
new file mode 100644
index 0000000..d4c3a95
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/requirements.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.
+
+dependencies:
+- name: rcord
+ version: 1.0.0
+ repository: https://charts.opencord.org/master/
+- name: onos-service
+ version: 2.0.0
+ repository: https://charts.opencord.org/master/
+- name: fabric
+ version: 2.0.0
+ repository: https://charts.opencord.org/master/
+- name: volt
+ version: 2.0.0
+ repository: https://charts.opencord.org/master/
+- name: vsg-hw
+ version: 1.0.0
+ repository: https://charts.opencord.org/master/
+- name: vrouter
+ version: 2.0.0
+ repository: https://charts.opencord.org/master/
+- name: hippie-oss
+ version: 1.0.0
+ repository: https://charts.opencord.org/master/
diff --git a/helm-charts/profile/bng-in-fabric/templates/_helpers.tpl b/helm-charts/profile/bng-in-fabric/templates/_helpers.tpl
new file mode 100644
index 0000000..1cf7cbb
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/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 "bng-in-fabric.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 "bng-in-fabric.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 "bng-in-fabric.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/helm-charts/profile/bng-in-fabric/templates/_tosca.tpl b/helm-charts/profile/bng-in-fabric/templates/_tosca.tpl
new file mode 100644
index 0000000..cb6aebb
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/templates/_tosca.tpl
@@ -0,0 +1,255 @@
+{{/* 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 "bng-in-fabric.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 "bng-in-fabric.serviceGraphTosca" -}}
+tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+ - custom_types/fabricservice.yaml
+ - custom_types/onosservice.yaml
+ - custom_types/rcordservice.yaml
+ - custom_types/vrouterservice.yaml
+ - custom_types/voltservice.yaml
+ - custom_types/vsghwservice.yaml
+ - custom_types/servicedependency.yaml
+ - custom_types/servicegraphconstraint.yaml
+description: NEM's bng-in-fabric 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#vrouter:
+ type: tosca.nodes.VRouterService
+ properties:
+ name: vrouter
+ must-exist: true
+
+ service#volt:
+ type: tosca.nodes.VOLTService
+ properties:
+ name: volt
+ must-exist: true
+
+ service#vsg-hw:
+ type: tosca.nodes.VSGHWService
+ properties:
+ name: vsg-hw
+ must-exist: true
+
+# The 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#fabric_vrouter:
+ type: tosca.nodes.ServiceDependency
+ properties:
+ connect_method: None
+ requirements:
+ - subscriber_service:
+ node: service#fabric
+ relationship: tosca.relationships.BelongsToOne
+ - provider_service:
+ node: service#vrouter
+ relationship: tosca.relationships.BelongsToOne
+
+ service_dependency#volt_vsg-hw:
+ type: tosca.nodes.ServiceDependency
+ properties:
+ connect_method: None
+ requirements:
+ - subscriber_service:
+ node: service#volt
+ relationship: tosca.relationships.BelongsToOne
+ - provider_service:
+ node: service#vsg-hw
+ relationship: tosca.relationships.BelongsToOne
+
+ service_dependency#onos_fabric_vsg-hw:
+ type: tosca.nodes.ServiceDependency
+ properties:
+ connect_method: None
+ requirements:
+ - subscriber_service:
+ node: service#vsg-hw
+ 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", "vsg-hw"], ["fabric", null], ["vrouter", null]]'
+{{- end -}}
+
diff --git a/helm-charts/profile/bng-in-fabric/templates/tests/test-api.yaml b/helm-charts/profile/bng-in-fabric/templates/tests/test-api.yaml
new file mode 100644
index 0000000..94a3ab5
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/templates/tests/test-api.yaml
@@ -0,0 +1,45 @@
+---
+# 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: Pod
+metadata:
+ name: "{{ .Release.Name }}-api-test"
+ annotations:
+ "helm.sh/hook": test-success
+spec:
+ restartPolicy: Never
+ containers:
+ - name: {{ .Release.Name }}-api-test
+ image: {{ .Values.xos_api_testerImage }}
+ imagePullPolicy: {{ .Values.imagePullPolicy }}
+ volumeMounts:
+ - name: log-volume
+ mountPath: /src/cord-api/Tests/Log/
+ env:
+ - name: SERVER_IP
+ value: 'xos-chameleon'
+ - name: SERVER_PORT
+ value: '9101'
+ - name: XOS_USER
+ value: {{ .Values.xosAdminUser | quote }}
+ - name: XOS_PASSWD
+ value: {{ .Values.xosAdminPassword | quote}}
+ command: ["pybot", "-L", "TRACE", "-d", "Log", "-T", "VOLTDevice_Test.txt", "RCORDLite_E2ETest.txt"]
+ volumes:
+ - name: log-volume
+ hostPath:
+ path: /tmp/helm_test_bng-in-fabric_logs_{{ dateInZone "20060102T030405.00Z" (now) "UTC" }}
+ type: DirectoryOrCreate
diff --git a/helm-charts/profile/bng-in-fabric/templates/tosca-configmap.yaml b/helm-charts/profile/bng-in-fabric/templates/tosca-configmap.yaml
new file mode 100644
index 0000000..8efaeb7
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/templates/tosca-configmap.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.
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: bng-in-fabric-tosca
+data:
+ 010-fixtures.yaml: |
+{{ include "bng-in-fabric.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-vsg-hw-service.yaml: |
+{{ include "vsg-hw.serviceTosca" (index .Values "vsg-hw") | indent 4 }}
+ 050-vrouter-service.yaml: |
+{{ include "vrouter.serviceTosca" .Values.vrouter | 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 "bng-in-fabric.serviceGraphTosca" . | indent 4 }}
diff --git a/helm-charts/profile/bng-in-fabric/templates/tosca-job.yaml b/helm-charts/profile/bng-in-fabric/templates/tosca-job.yaml
new file mode 100644
index 0000000..a16ed0a
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/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 "bng-in-fabric.fullname" . }}-tosca-loader
+ labels:
+ app: {{ template "bng-in-fabric.name" . }}
+ chart: {{ template "bng-in-fabric.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+spec:
+ backoffLimit: 12
+ template:
+ metadata:
+ labels:
+ app: {{ template "bng-in-fabric.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: bng-in-fabric-tosca
+ mountPath: /opt/tosca
+ volumes:
+ - name: bng-in-fabric-tosca
+ configMap:
+ name: bng-in-fabric-tosca
diff --git a/helm-charts/profile/bng-in-fabric/values.yaml b/helm-charts/profile/bng-in-fabric/values.yaml
new file mode 100644
index 0000000..c436529
--- /dev/null
+++ b/helm-charts/profile/bng-in-fabric/values.yaml
@@ -0,0 +1,38 @@
+---
+# 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 bng-in-fabric 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"
+
+volt:
+ kafkaService: "nem-core-kafka.default.svc.cluster.local"
+onos-service:
+ kafkaService: "nem-core-kafka.default.svc.cluster.local"
+ onosFabricRestService: "seba-substrate-onos-fabric-ui.default.svc.cluster.local"