fabric-umbrella: initial version

Change-Id: I3347bd7c49c6f2a53f074fab05cfb1f2164c2fab
diff --git a/fabric-umbrella/Chart.yaml b/fabric-umbrella/Chart.yaml
new file mode 100644
index 0000000..298869c
--- /dev/null
+++ b/fabric-umbrella/Chart.yaml
@@ -0,0 +1,66 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: v2
+name: fabric-umbrella
+description: Fabric ROC Umbrella chart to deploy all Fabric ROC
+kubeVersion: ">=1.18.0"
+type: application
+version: 0.1.0
+appVersion: v0.0.0
+keywords:
+  - aether
+  - sdn
+home: https://opennetworking.org/sd-fabric/
+maintainers:
+  - name: Fabric Ops team
+    email: support@opennetworking.org
+dependencies:
+  - name: onos-topo
+    condition: import.onos-topo.enabled
+    repository: https://charts.onosproject.org
+    version: 1.3.3
+  - name: onos-config
+    condition: import.onos-config.enabled
+    repository: https://charts.onosproject.org
+    version: 1.7.7
+  - name: onos-cli
+    condition: import.onos-cli.enabled
+    repository: https://charts.onosproject.org
+    version: 1.3.2
+  - name: aether-roc-api
+    condition: import.fabric-roc-api.enabled
+    repository: "file://../aether-roc-api"
+    version: 1.7.7
+    alias: fabric-roc-api
+  - name: aether-roc-gui
+    condition: import.fabric-roc-gui.v0-1.enabled
+    repository: "file://../aether-roc-gui"
+    version: 2.1.12
+    alias: fabric-roc-gui
+#  - name: fabric-adapter
+#    condition: import.fabric-adapter.v0-1.enabled
+#    repository: "file://../fabric-adapter"
+#    version: 0.1.0
+#    alias: fabric-adapter-v0-1
+  - name: nginx
+    alias: fabric-test-dummy
+    condition: import.fabric-test-dummy.enabled
+    repository: https://charts.bitnami.com/bitnami
+    version: 8.9.0
+  - name: prometheus
+    condition: import.prometheus.false.enabled
+    repository: https://prometheus-community.github.io/helm-charts
+    version: 14.6.1
+    alias: prometheus-fabric
+  - name: prom-label-proxy
+    condition: import.prom-label-proxy.fabric.enabled
+    repository: "file://../prom-label-proxy"
+    version: 0.1.2
+    alias: prom-label-proxy-fabric
+  - name: aether-mock-exporter
+    condition: import.fabric-mock-exporter.enabled
+    repository: "file://../aether-mock-exporter"
+    version: 0.2.1
+    alias: fabric-mock-exporter
diff --git a/fabric-umbrella/README.md b/fabric-umbrella/README.md
new file mode 100644
index 0000000..2899961
--- /dev/null
+++ b/fabric-umbrella/README.md
@@ -0,0 +1,41 @@
+<!--
+SPDX-FileCopyrightText: 2022-present Intel Corporation
+
+SPDX-License-Identifier: Apache-2.0
+-->
+
+## Fabric ROC Umbrella chart
+
+First add repos to your Helm client
+```
+stable       	https://charts.helm.sh/stable
+cord         	https://charts.opencord.org
+atomix       	https://charts.atomix.io
+onosproject  	https://charts.onosproject.org
+aether       	https://charts.aetherproject.org
+cetic        	https://cetic.github.io/helm-charts
+bitnami      	https://charts.bitnami.com/bitnami
+```
+
+Provides a [Helm] chart for deploying
+
+* fabric-roc-gui (2 versions)
+* fabric-roc-api 
+* onos-topo
+* onos-config
+* fabric-adapter (2 versions)
+* fabric-test-dummy
+* prometheus
+
+to [Kubernetes].
+> See the [documentation] for more info.
+
+## Config models
+The Fabric ROC Umbrella chart controls the Config Model Plugins that are enabled in `onos-config`
+Currently 2 versions of the `Aether` model are loaded:
+
+* fabric-0.1.x
+
+[Kubernetes]: https://kubernetes.io/
+[Helm]: https://helm.sh/
+[documentation]: https://docs.onosproject.org/developers/deploy_with_helm/
diff --git a/fabric-umbrella/templates/NOTES.txt b/fabric-umbrella/templates/NOTES.txt
new file mode 100644
index 0000000..99e18ea
--- /dev/null
+++ b/fabric-umbrella/templates/NOTES.txt
@@ -0,0 +1,20 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+Thank you for installing {{ .Chart.Name }} Helm chart.
+
+Your release is named {{ .Release.Name }} in namespace {{.Release.Namespace}}.
+See https://docs.onosproject.org/developers/deploy_with_helm/
+
+To learn more about the release, try:
+  $ helm -n {{.Release.Namespace}} status {{ .Release.Name }}
+  $ helm -n {{.Release.Namespace}} get all {{ .Release.Name }}
+  $ watch kubectl -n {{.Release.Namespace}} get pods
+
+You can attach to:
+* Fabric CLI pod with
+$ kubectl -n {{.Release.Namespace}} exec -it deployment/onos-cli -- /bin/bash
+* Fabric Portal at http://<server_IP>:31194
+
+The fabric-roc-api is then available at http://<server_IP>:31194/aether-roc-api
diff --git a/fabric-umbrella/templates/_helpers.tpl b/fabric-umbrella/templates/_helpers.tpl
new file mode 100644
index 0000000..aeef6e9
--- /dev/null
+++ b/fabric-umbrella/templates/_helpers.tpl
@@ -0,0 +1,81 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+SPDX-FileCopyrightText: 2022-present Intel Corporation
+SPDX-License-Identifier: Apache-2.0
+
+Expand the name of the chart.
+*/}}
+{{- define "global.name" -}}
+{{- default .Chart.Name .Values.global.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 "global.fullname" -}}
+{{- if .Values.global.fullnameOverride -}}
+{{- .Values.global.fullnameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- $name := default .Chart.Name .Values.global.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 "global.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Common labels
+*/}}
+{{- define "global.labels" -}}
+helm.sh/chart: {{ include "global.chart" . }}
+{{ include "global.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end -}}
+
+{{/*
+Selector labels
+*/}}
+{{- define "global.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "global.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end -}}
+
+{{/*
+global consensus image name
+*/}}
+{{- define "global.store.consensus.imagename" -}}
+{{- if .Values.global.store.consensus.image.tag -}}
+{{- if .Values.global.store.consensus.image.registry -}}
+{{- printf "%s/" .Values.global.store.consensus.image.registry -}}
+{{- end -}}
+{{- printf "%s:" .Values.global.store.consensus.image.repository -}}
+{{- .Values.global.store.consensus.image.tag -}}
+{{- else -}}
+""
+{{- end -}}
+{{- end -}}
+
+{{/*
+global consensus store name
+*/}}
+{{- define "global.store.consensus.name" -}}
+{{- if .Values.global.store.consensus.name -}}
+{{- printf "%s" .Values.global.store.consensus.name -}}
+{{- else -}}
+{{- printf "%s-consensus-store" ( include "global.fullname" . ) -}}
+{{- end -}}
+{{- end -}}
\ No newline at end of file
diff --git a/fabric-umbrella/templates/opa-rbac-configmap.yaml b/fabric-umbrella/templates/opa-rbac-configmap.yaml
new file mode 100644
index 0000000..fe7057c
--- /dev/null
+++ b/fabric-umbrella/templates/opa-rbac-configmap.yaml
@@ -0,0 +1,16 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+{{ if ".Values.onos-config.openpolicyagent.enabled" }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ .Release.Name }}-opa-rbac
+  labels:
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    release: "{{ .Release.Name }}"
+    heritage: "{{ .Release.Service }}"
+data:
+{{ (.Files.Glob "files/opa-rbac/*.rego").AsConfig | indent 2 }}
+{{end}}
\ No newline at end of file
diff --git a/fabric-umbrella/templates/sdcore-test-dummy-config.yaml b/fabric-umbrella/templates/sdcore-test-dummy-config.yaml
new file mode 100644
index 0000000..553f215
--- /dev/null
+++ b/fabric-umbrella/templates/sdcore-test-dummy-config.yaml
@@ -0,0 +1,48 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ .Release.Name }}-sdcore-test-dummy
+  namespace: {{ .Release.Namespace }}
+data:
+  sdcore-test-dummy.conf: |-
+    log_format client '$remote_addr - $remote_user $request_time $upstream_response_time '
+                      '[$time_local] "$request" $status $body_bytes_sent $request_body "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    server {
+      listen 0.0.0.0:8080;
+      default_type application/json;
+      access_log /opt/bitnami/nginx/logs/access.log client;
+
+      # You can provide a special subPath or the root
+      location = /v1/config {
+        root /;
+        proxy_pass http://127.0.0.1:8080/post_dummy;
+      }
+      location = /v1/config/policies {
+        root /;
+        proxy_pass http://127.0.0.1:8080/post_dummy;
+      }
+      location = /v1/config/imsis {
+        root /;
+        proxy_pass http://127.0.0.1:8080/post_dummy;
+      }
+      location /v1/config/5g {
+        rewrite ^/v1/config/5g/.* /v1/config/5g break;
+        proxy_pass http://127.0.0.1:8080/post_dummy;
+      }
+      location /api/subscriber {
+        rewrite ^/api/subscriber/.* /api/subscriber break;
+        proxy_pass http://127.0.0.1:8080/post_dummy;
+      }
+      location = /post_dummy {
+        # turn off logging here to avoid double logging
+        access_log off;
+        return 200;
+      }
+      error_page  405     =200 $uri;
+    }
diff --git a/fabric-umbrella/templates/store.yaml b/fabric-umbrella/templates/store.yaml
new file mode 100644
index 0000000..8bd1180
--- /dev/null
+++ b/fabric-umbrella/templates/store.yaml
@@ -0,0 +1,42 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+{{- if .Values.global.store.consensus.enabled }}
+apiVersion: atomix.io/v2beta1
+kind: Store
+metadata:
+  name: {{ template "global.store.consensus.name" . }}
+  namespace: {{ .Release.Namespace }}
+spec:
+  protocol:
+    apiVersion: storage.atomix.io/v2beta2
+    kind: MultiRaftProtocol
+    spec:
+      replicas: {{ .Values.global.store.consensus.replicas }}
+      groups: {{ .Values.global.store.consensus.partitions }}
+      {{- with .Values.global.store.consensus.raft }}
+      raft:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      image: {{ template "global.store.consensus.imagename" . }}
+      imagePullPolicy: {{ .Values.global.store.consensus.image.pullPolicy }}
+      {{- with .Values.global.store.consensus.image.pullSecrets }}
+      imagePullSecrets:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.global.store.consensus.securityContext }}
+      securityContext:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- if .Values.global.store.consensus.persistence.storageClass }}
+      volumeClaimTemplate:
+        spec:
+          accessModes:
+          - ReadWriteOnce
+          storageClassName: {{ .Values.global.store.consensus.persistence.storageClass | quote }}
+          resources:
+            requests:
+              storage: {{ .Values.global.store.consensus.persistence.storageSize }}
+      {{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/fabric-umbrella/templates/topo.yaml b/fabric-umbrella/templates/topo.yaml
new file mode 100644
index 0000000..6b2f6a8
--- /dev/null
+++ b/fabric-umbrella/templates/topo.yaml
@@ -0,0 +1,37 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+# A topology kind representing an Aether Enterprise node
+apiVersion: topo.onosproject.org/v1beta1
+kind: Kind
+metadata:
+  name: fabric
+spec:
+  aspects: {}
+
+# Fabrics as targets
+{{- range .Values.fabrics }}
+---
+apiVersion: topo.onosproject.org/v1beta1
+kind: Entity
+metadata:
+  name: {{ .id }}
+spec:
+  uri: {{ .id }}
+  kind:
+    name: fabric
+  aspects:
+    onos.topo.Configurable:
+      address: fabric-adapter-v0-1:5150
+      version: 0.1.x
+      type: sdn-fabric
+    onos.topo.Location:
+      lat: {{ .lat }}
+      lng: {{ .long }}
+    onos.topo.TLSOptions:
+      insecure: true
+    onos.topo.Asset:
+      name: {{ .name }}
+    onos.topo.MastershipState: {}
+{{- end }}
diff --git a/fabric-umbrella/tests/fabric-roc-umbrella.go b/fabric-umbrella/tests/fabric-roc-umbrella.go
new file mode 100644
index 0000000..9ff7511
--- /dev/null
+++ b/fabric-umbrella/tests/fabric-roc-umbrella.go
@@ -0,0 +1,45 @@
+// SPDX-FileCopyrightText: 2022-present Intel Corporation
+//
+// SPDX-License-Identifier: Apache-2.0
+
+package tests
+
+import (
+	"testing"
+	"time"
+
+	"github.com/onosproject/helmit/pkg/helm"
+	"github.com/onosproject/helmit/pkg/input"
+	"github.com/onosproject/helmit/pkg/test"
+	"github.com/stretchr/testify/assert"
+)
+
+const aetherCharts = "https://charts.aetherproject.org/"
+
+// FabricUmbrellaSuite is the fabric-umbrella chart test suite
+type FabricUmbrellaSuite struct {
+	test.Suite
+	c *input.Context
+}
+
+// SetupTestSuite sets up the fabric-umbrella test suite
+func (s *FabricUmbrellaSuite) SetupTestSuite(c *input.Context) error {
+	s.c = c
+	return nil
+}
+
+// TestInstall tests installing the fabric-umbrella chart
+func (s *FabricUmbrellaSuite) TestInstall(t *testing.T) {
+	registry := s.c.GetArg("registry").String("")
+
+	onos := helm.Chart("fabric-umbrella", aetherCharts).
+		Release("fabric-umbrella").
+		WithTimeout(15*time.Minute).
+		Set("import.fabric-roc-gui.v0-1.enabled", false).
+		Set("import.fabric-adapter.v0-1.enabled", false).
+		Set("import.onos-cli.enabled", false).
+		Set("import.prometheus.fabric.enabled", false).
+		Set("fabric-roc-gui.service.type", "NodePort").
+		Set("global.image.registry", registry)
+	assert.NoError(t, onos.Install(true))
+}
diff --git a/fabric-umbrella/values.yaml b/fabric-umbrella/values.yaml
new file mode 100644
index 0000000..a14ed74
--- /dev/null
+++ b/fabric-umbrella/values.yaml
@@ -0,0 +1,129 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+# Default values for all Aether Helm charts.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+global:
+  fullnameOverride: "onos"
+  nameOverride: ""
+  image:
+    registry: ""
+    tag: ""
+  store:
+    consensus:
+      enabled: true
+      name: ""
+      image:
+        registry: ""
+        repository: atomix/atomix-raft-storage-node
+        tag: ""
+        pullPolicy: IfNotPresent
+        pullSecrets: []
+      clusters: 1
+      replicas: 1
+      partitions: 1
+      raft: {}
+      persistence:
+        storageClass: ""
+        storageSize: 1Gi
+
+import:
+  onos-topo:
+    enabled: true
+  onos-config:
+    enabled: true
+  onos-cli:
+    enabled: true
+  fabric-roc-api:
+    enabled: false
+  fabric-roc-gui:
+    v0-1:
+      enabled: false
+  fabric-adapter:
+    v0-1:
+      enabled: false
+  fabric-test-dummy:
+    enabled: false
+  prometheus:
+    fabric:
+      enabled: false # controls its plproxy too
+  prom-label-proxy:
+    fabric:
+      enabled: false
+  fabric-mock-exporter:
+    enabled: false
+
+# ONOS-TOPO
+onos-topo:
+  store:
+    consensus:
+      enabled: false
+
+# ONOS-CLI
+onos-cli: {}
+
+# Aether ROC API
+fabric-roc-api: {}
+
+# Fabric Adapter
+fabric-adapter-v2-1:
+  fullnameOverride: sdcore-adapter-v2-1
+  prometheusEnabled: false
+  partialUpdateEnabled: true  
+
+# Prom label Proxy
+prom-label-proxy-fabric:
+  nameOverride: prom-label-proxy-fabric
+  fullnameOverride: prom-label-proxy-fabric
+  prometheusEnabled: false
+  config:
+    upstream: http://fabric-umbrella-prometheus-fabric-server
+
+prometheus-fabric:
+  pushgateway:
+    enabled: false
+  nodeExporter:
+    enabled: false
+  kubeStateMetrics:
+    enabled: false
+  alertmanager:
+    enabled: false
+  serverFiles:
+    prometheus.yml:
+      scrape_configs:
+        - job_name: aether-mock-exporter
+          scrape_interval: 2s
+          static_configs:
+            - targets:
+                - aether-mock-exporter:2112
+
+# Fabric Test Dummy
+# proxy_pass has to be added or nginx will not log the $request_body
+fabric-test-dummy:
+  service:
+    type: ClusterIP
+  existingServerBlockConfigmap: fabric-umbrella-fabric-test-dummy
+
+# ONOS-CONFIG
+onos-config:
+  store:
+    consensus:
+      enabled: false
+  modelPlugins:
+    - name: fabric-0-1
+      image: onosproject/sdn-fabric-0.1.x:0.1.0-sdn-fabric-0.1.x
+      endpoint: localhost
+      port: 5152
+
+  openpolicyagent:
+    enabled: false
+    regoConfigMap: fabric-umbrella-opa-rbac
+
+fabrics:
+  - id: mars
+    name: Mars Fabric
+  - id: venus
+    name: Venus Fabric