[EDGEPOD-52] Initial version of RAN-CU Helm chart for Aether

Change-Id: Ie5c380ec70d0d4d97c87f1a176169320a779e5ad
diff --git a/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/_helpers.tpl b/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/_helpers.tpl
new file mode 100644
index 0000000..fccad55
--- /dev/null
+++ b/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/_helpers.tpl
@@ -0,0 +1,26 @@
+{{- /*
+# Copyright 2019-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.
+*/ -}}
+
+{{/*
+Render a set of standardised label
+*/}}
+{{- define "accelleran-cbrs-cu.metadata_labels" -}}
+{{- $application := index . 0 -}}
+{{- $context := index . 1 -}}
+release: {{ $context.Release.Name }}
+app: {{ $application }}
+{{- end -}}
+
diff --git a/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/configmap-accelleran-cbrs-cu.yaml b/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/configmap-accelleran-cbrs-cu.yaml
new file mode 100644
index 0000000..3c67926
--- /dev/null
+++ b/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/configmap-accelleran-cbrs-cu.yaml
@@ -0,0 +1,40 @@
+{{- /*
+# Copyright 2019-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: accelleran-cbrs-cu-{{ .Values.config.vranL3.instanceId }}-cm
+  labels:
+{{ tuple "accelleran-cbrs-cu-cm" . | include "accelleran-cbrs-cu.metadata_labels" | indent 4 }}
+data:
+  bootstrap: |
+    redis.hostname:accelleran-cbrs-redis
+    redis.port:{{ .Values.config.redis.ports.redisPort.port }}
+    instance.filter:{{ .Values.config.vranL3.instanceId }}
+
+  zlog.conf: |
+    [global]
+    strict init = true
+    buffer min = {{ .Values.config.vranL3.zlogConf.bufferMin }}
+    buffer max = {{ .Values.config.vranL3.zlogConf.bufferMax }}
+    rotate lock file = /tmp/zlog.lock
+
+    [formats]
+    printf_format = "%d(%b %d %H:%M:%S).%ms %8.8H %m%n"
+    [rules]
+    user.* >stdout ;printf_format
\ No newline at end of file
diff --git a/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/service-accelleran-cbrs-cu.yaml b/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/service-accelleran-cbrs-cu.yaml
new file mode 100644
index 0000000..bcb1da6
--- /dev/null
+++ b/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/service-accelleran-cbrs-cu.yaml
@@ -0,0 +1,47 @@
+{{- /*
+# Copyright 2019-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: Service
+metadata:
+  name: accelleran-cbrs-cu-{{ .Values.config.vranL3.instanceId }}
+  labels:
+{{ tuple "accelleran-cbrs-cu" . | include "accelleran-cbrs-cu.metadata_labels" | indent 4 }}
+spec:
+  selector:
+{{ tuple "accelleran-cbrs-cu" . | include "accelleran-cbrs-cu.metadata_labels" | indent 4 }}
+  ports:
+  - name: s1ap-port
+    port: {{ .Values.config.vranL3.ports.s1ap.port }}
+    protocol: {{ .Values.config.vranL3.ports.s1ap.protocol }}
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: accelleran-cbrs-cu-{{ .Values.config.vranL3.instanceId }}-exernal
+  labels:
+{{ tuple "accelleran-cbrs-cu" . | include "accelleran-cbrs-cu.metadata_labels" | indent 4 }}
+spec:
+  selector:
+{{ tuple "accelleran-cbrs-cu" . | include "accelleran-cbrs-cu.metadata_labels" | indent 4 }}
+  type: NodePort
+  ports:
+  - name: s1ap-port
+    port: {{ .Values.config.vranL3.ports.s1ap.port }}
+    nodePort: {{ .Values.config.vranL3.ports.s1ap.nodePort }}
+    protocol: {{ .Values.config.vranL3.ports.s1ap.protocol }}
\ No newline at end of file
diff --git a/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/statefulset-accelleran-cbrs-cu.yaml b/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/statefulset-accelleran-cbrs-cu.yaml
new file mode 100644
index 0000000..7a8d622
--- /dev/null
+++ b/ran/accelleran-cbrs/accelleran-cbrs-cu/templates/statefulset-accelleran-cbrs-cu.yaml
@@ -0,0 +1,116 @@
+{{- /*
+# Copyright 2019-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/v1
+kind: StatefulSet
+metadata:
+  name: accelleran-cbrs-cu-{{ .Values.config.vranL3.instanceId }}
+  labels:
+    deployedCellId: {{ .Values.config.vranL3.instanceId }}
+{{ tuple "accelleran-cbrs-cu" . | include "accelleran-cbrs-cu.metadata_labels" | indent 4 }}
+spec:
+  selector:
+    matchLabels:
+{{ tuple "accelleran-cbrs-cu" . | include "accelleran-cbrs-cu.metadata_labels" | indent 6 }}
+  serviceName: accelleran-cbrs-cu-{{ .Values.config.vranL3.instanceId }}
+  template:
+    metadata:
+      labels:
+        deployedCellId: {{ .Values.config.vranL3.instanceId }}
+{{ tuple "accelleran-cbrs-cu" . | include "accelleran-cbrs-cu.metadata_labels" | indent 8 }}
+    spec:
+    {{- if .Values.nodeSelectors.enabled }}
+      nodeSelector:
+        {{ .Values.nodeSelectors.accelleranCBRSCU.label }}: {{ .Values.nodeSelectors.accelleranCBRSCU.value }}
+    {{- end }}
+      initContainers:
+      - name: cu-init
+        image: {{ .Values.images.tags.initCU }}
+        imagePullPolicy: {{ .Values.images.pullPolicy }}
+        securityContext:
+          privileged: true
+          runAsUser: 0
+        command: [ "sh",  "-c"]
+        args:
+        - >
+          iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
+          if chroot /mnt/host-rootfs modinfo nf_conntrack_proto_sctp > /dev/null 2>&1; then \
+              chroot /mnt/host-rootfs modprobe nf_conntrack_proto_sctp; \
+          fi; \
+        volumeMounts:
+        - name: host-rootfs
+          mountPath: /mnt/host-rootfs
+      containers:
+      - name: vran-l3
+        image: {{ .Values.images.tags.vranL3 }}
+        imagePullPolicy: {{ .Values.images.pullPolicy }}
+        env:
+        - name: ZLOG_CONF_PATH
+          value: /zlog.conf
+        - name: BOOTSTRAP_FILENAME
+          value: /bootstrap
+        - name: LD_LIBRARY_PATH
+          value: /data/
+        - name: FAP_DB_PATH
+          value: /data/
+        command: ["sh", "-c"]
+        args:
+        - sqlite3 /data/datastoreRemRw.db "update FapServiceCellConfigLteEpcPlmnList set PLMNID='{{ .Values.config.vranL3.plmnId }}';";
+          sqlite3 /data/datastoreRemRw.db "update FapServiceFapControlLteGateway set SecGWServer1='{{ .Values.config.mme.ip }}';";
+          sqlite3 /data/datastoreRemRw.db "update FapServiceFapControlLteGateway set SecGWServer2='{{ .Values.config.mme.ip }}';";
+          sqlite3 /data/datastoreRemRw.db "update FapServiceFapControlLteGateway set SecGWServer3='{{ .Values.config.mme.ip }}';";
+          sqlite3 /data/datastoreRemRw.db "update FapServiceFapControlLteGateway_S1SigLinkServerListList set S1SigLinkServerList='{{ .Values.config.mme.ip }}';";
+          sqlite3 /data/datastoreRemRw.db "update FapServiceCellConfigLteRanRf set FreqBandIndicator='{{ .Values.config.vranL3.freqBand }}';";
+          sqlite3 /data/datastore.db "update featureActivation set good1PPSRequired=0;";
+          sqlite3 /data/datastoreRemRw.db "update FapServiceCellConfigLteRanRf_EARFCNDLList set EARFCNDL='{{ .Values.config.vranL3.earfcnDl }}';";
+          sqlite3 /data/datastoreRemRw.db "update FapServiceCellConfigLteRanRf_EARFCNULList set EARFCNUL='{{ .Values.config.vranL3.earfcnUl }}';";
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hset ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICEFAPCONTROLLTEGATEWAYS1SIGLINKSERVERLIST[0] S1SIGLINKSERVERLIST {{ .Values.config.mme.ip }};
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hset ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICEFAPCONTROLLTEGATEWAY_S1SIGLINKSERVERLISTLIST[0] S1SIGLINKSERVERLIST {{ .Values.config.mme.ip }};
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hset ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICECELLCONFIGLTERANRF FREQBANDINDICATOR {{ .Values.config.vranL3.freqBand }};
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hset ENB_{{ .Values.config.vranL3.instanceId }}_FEATUREACTIVATION GOOD1PPSREQUIRED False;
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hset ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICECELLCONFIGLTEEPCPLMNLIST[0] PLMNID {{ .Values.config.vranL3.plmnId }};
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hset ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICECELLCONFIGLTERANRF_EARFCNDLLIST EARFCNDL {{ .Values.config.vranL3.earfcnDl }};
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hset ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICECELLCONFIGLTERANRF_EARFCNULLIST EARFCNUL {{ .Values.config.vranL3.earfcnUl }};
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hgetall ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICEFAPCONTROLLTEGATEWAYS1SIGLINKSERVERLIST[0];
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hgetall ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICEFAPCONTROLLTEGATEWAY_S1SIGLINKSERVERLISTLIST[0];
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hgetall ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICECELLCONFIGLTERANRF;
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hgetall ENB_{{ .Values.config.vranL3.instanceId }}_FEATUREACTIVATION;
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hgetall ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICECELLCONFIGLTEEPCPLMNLIST[0];
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hgetall ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICECELLCONFIGLTERANRF_EARFCNDLLIST;
+          redis-cli -h accelleran-cbrs-redis -p {{ .Values.config.redis.ports.redisPort.port }} hgetall ENB_{{ .Values.config.vranL3.instanceId }}_FAPSERVICECELLCONFIGLTERANRF_EARFCNULLIST;
+          sleep 30;
+          /data/l3service;
+        securityContext:
+          privileged: true
+        {{- if .Values.resources.enabled }}
+        resources:
+{{ toYaml .Values.resources.accelleranCBRSCU | indent 10 }}
+        {{- end }}
+        volumeMounts:
+        - name: l3-config-volume
+          mountPath: /bootstrap
+          subPath: bootstrap
+        - name: l3-config-volume
+          mountPath: /zlog.conf
+          subPath: zlog.conf
+      volumes:
+      - name: l3-config-volume
+        configMap:
+          name: accelleran-cbrs-cu-{{ .Values.config.vranL3.instanceId }}-cm
+      - name: host-rootfs
+        hostPath:
+          path: /