Initial commit of code 35/1235/1
authorwrider <lji@research.att.com>
Sun, 27 Oct 2019 21:48:47 +0000 (17:48 -0400)
committerwrider <lji@research.att.com>
Sun, 27 Oct 2019 21:48:59 +0000 (17:48 -0400)
Change-Id: I5c08c5cb1df17d3aadbe0073993d6bcd4b97b48f
Signed-off-by: wrider <lji@research.att.com>
16 files changed:
.gitreview [new file with mode: 0644]
LICENSES.txt [new file with mode: 0644]
README.md [new file with mode: 0644]
bin/onboard-xapps [new file with mode: 0755]
bin/prepull-xapp-charts [new file with mode: 0755]
ric-xapps/bin/install [new file with mode: 0755]
ric-xapps/etc/xapp.conf [new file with mode: 0644]
ric-xapps/helm/xapp-std/.helmignore [new file with mode: 0644]
ric-xapps/helm/xapp-std/Chart.yaml [new file with mode: 0644]
ric-xapps/helm/xapp-std/templates/_helpers.tpl [new file with mode: 0644]
ric-xapps/helm/xapp-std/templates/appconfig.yaml [new file with mode: 0644]
ric-xapps/helm/xapp-std/templates/appenv.yaml [new file with mode: 0644]
ric-xapps/helm/xapp-std/templates/deployment.yaml [new file with mode: 0644]
ric-xapps/helm/xapp-std/templates/service-http.yaml [new file with mode: 0644]
ric-xapps/helm/xapp-std/templates/service-rmr.yaml [new file with mode: 0644]
ric-xapps/helm/xapp-std/values.yaml [new file with mode: 0644]

diff --git a/.gitreview b/.gitreview
new file mode 100644 (file)
index 0000000..a06daa3
--- /dev/null
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.o-ran-sc.org
+port=29418
+project=it/dev
+defaultbranch=master
diff --git a/LICENSES.txt b/LICENSES.txt
new file mode 100644 (file)
index 0000000..2a3dd5c
--- /dev/null
@@ -0,0 +1,32 @@
+LICENSES.txt
+
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the "Software License");
+you may not use this software except in compliance with the Software
+License. You may obtain a copy of the Software License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the Software License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the Software License for the specific language governing permissions
+and limitations under the Software License.
+
+
+
+Unless otherwise specified, all documentation contained herein is licensed
+under the Creative Commons License, Attribution 4.0 Intl. (the
+"Documentation License"); you may not use this documentation except in
+compliance with the Documentation License. You may obtain a copy of the
+Documentation License at
+
+https://creativecommons.org/licenses/by/4.0/
+
+Unless required by applicable law or agreed to in writing, documentation
+distributed under the Documentation License is distributed on an "AS IS"
+BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied. See the Documentation License for the specific language governing
+permissions and limitations under the Documentation License.
+
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..dcc8ab0
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+This repo holds various integration and testing development codes.
diff --git a/bin/onboard-xapps b/bin/onboard-xapps
new file mode 100755 (executable)
index 0000000..b38699f
--- /dev/null
@@ -0,0 +1,118 @@
+#!/bin/bash
+##############################################################################
+#
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#
+#   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.
+#
+##############################################################################
+
+# Installs well-known RIC charts then verifies specified helm chart
+# Requires chart tgz archives in /tmp
+
+
+while [ -n "$1" ]; do # while loop starts
+
+    case "$1" in
+
+    -d) DOCKER_REGISTRY=$2
+        shift
+        ;;
+
+    -p) CHART_DIRECTORY_PATH=$2
+       shift
+       ;;
+
+    -h) HELM_REPO=$2
+       shift
+       ;;
+
+    *) echo "Option $1 not recognized. Please specify the docker registry path with the -d option and specify the xApp directory path with the -p option."
+       ;; # In case you typed a different option other than -d or -p
+
+    esac
+
+    shift
+
+done
+
+if [ -z "$DOCKER_REGISTRY" ]; then
+   echo "Please specify the docker registry path with the -d option."
+   exit 1
+fi
+
+if [ -z "$CHART_DIRECTORY_PATH" ]; then
+   echo "Please specify the xApp directory path with the -p option."
+   exit 1
+fi
+
+if [ -z "$HELM_REPO" ]; then
+   echo "Please specify the helm repo uploading URL with the -h option."
+   exit 1
+fi
+
+
+echo "************************************************************"
+
+for image in $CHART_DIRECTORY_PATH/docker_images/*/*; do
+       echo "Loading image $image"
+       OUTPUT=$(docker load -i $image)
+       IMAGE_PATH_ORIGINAL=$(echo $OUTPUT | grep image: | awk '{print $3}' )
+       IMAGENAME=$(echo $IMAGE_PATH_ORIGINAL | awk '{ n=split($0, a, "/"); print a[n] }')
+       echo "Pushing image $DOCKER_REGISTRY/$IMAGENAME"
+        docker tag $IMAGE_PATH_ORIGINAL $DOCKER_REGISTRY/$IMAGENAME
+       docker push $DOCKER_REGISTRY/$IMAGENAME || { echo "Failed to push the docker image." ; exit 1; }
+
+done
+
+rm -rf $CHART_DIRECTORY_PATH/chart_packages
+mkdir -p $CHART_DIRECTORY_PATH/chart_packages
+
+echo "************************************************************"
+for chart in $CHART_DIRECTORY_PATH/helm_charts/*; do
+        echo "Onboard Helm Charts"
+
+       sed -i "s/^    repository: .*/    repository: $DOCKER_REGISTRY/" $chart/values.yaml
+        helm package $chart -d $CHART_DIRECTORY_PATH/chart_packages
+
+done
+
+
+
+echo "************************************************************"
+for tarball in $CHART_DIRECTORY_PATH/chart_packages/*; do
+       TARBALL_FILE_NAME=$(echo $tarball | awk -F '/' '{print $NF}')
+       CHART_NAME=$(echo $TARBALL_FILE_NAME |  awk -F '-' '{gsub($NF, ""); print substr($0,1,length($0)-1)}')
+       CHART_VERSION=$(echo $TARBALL_FILE_NAME |  awk -F '-' '{print substr ($NF,1,length($NF)-4)}')
+
+       DELETE_MESSAGE=$(curl -X DELETE --connect-timeout 2 $HELM_REPO/api/charts/$CHART_NAME/$CHART_VERSION 2>/dev/null)
+       LOCATE_CHART=$(curl --connect-timeout 2 $HELM_REPO/index.yaml |& grep $TARBALL_FILE_NAME)
+
+       if [ ! -z "$LOCATE_CHART" ]; then
+           echo "ERROR: Helm chart delete fail."
+           echo $DELETE_MESSAGE
+           exit 1
+        fi
+
+       UPLOAD_MESSAGE=$(curl --data-binary "@$tarball" --connect-timeout 2 $HELM_REPO/api/charts  2>/dev/null)
+       LOCATE_CHART=$(curl --connect-timeout 2 $HELM_REPO/index.yaml |& grep $TARBALL_FILE_NAME )
+
+       if [ -z "$LOCATE_CHART" ]; then
+           echo "ERROR: Helm chart upload failed."
+           echo $UPLOAD_MESSAGE
+           exit 1
+        fi
+
+       echo "Helm chart $CHART_NAME version $CHART_VERSION uploaded successfully."
+
+done
diff --git a/bin/prepull-xapp-charts b/bin/prepull-xapp-charts
new file mode 100755 (executable)
index 0000000..1ad05ff
--- /dev/null
@@ -0,0 +1,108 @@
+#!/bin/bash
+##############################################################################
+#
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#
+#   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.
+#
+##############################################################################
+
+# Installs well-known RIC charts then verifies specified helm chart
+# Requires chart tgz archives in /tmp
+
+
+while [ -n "$1" ]; do # while loop starts
+
+    case "$1" in
+
+    -f) XAPPLISTFILE=$2
+        shift
+        ;; 
+
+    -d) CHART_DIRECTORY_PATH=$2
+        shift
+        ;;
+
+
+    *) echo "Option $1 not recognized. Please use -f to specify the recipe path." ;; # In case you typed a different option other than a,b,c
+
+    esac
+
+    shift
+
+done
+
+if [ -z "$XAPPLISTFILE" ]; then
+   echo "xApp list file is missing. Please use -f to specify the path."
+   exit 1
+fi
+
+if [ -z "$CHART_DIRECTORY_PATH" ]; then
+    CHART_DIRECTORY_PATH=/tmp/xapp_charts
+fi
+
+
+rm -rf $CHART_DIRECTORY_PATH
+mkdir -p $CHART_DIRECTORY_PATH/helm_charts
+mkdir -p $CHART_DIRECTORY_PATH/docker_images
+
+
+while IFS= read -r chart
+do
+    CHARTNAME=$(echo $chart | awk '{ n=split($0, a, "/"); split(a[n],b,":"); print b[1] }')
+    CHARTVERSION=$(echo $chart | awk '{ n=split($0, a, "/"); split(a[n],b,":"); print b[2] }')
+    HELM_REPO=$(echo $chart | awk -F'/' '{gsub($NF,""); print substr($0,1,length($0)-1)}')
+     
+    echo "Fetching helm charts $CHARTNAME version $CHARTVERSION from repo $HELM_REPO"
+    helm repo add temp $HELM_REPO > /dev/null
+    helm fetch temp/$CHARTNAME --version $CHARTVERSION -d $CHART_DIRECTORY_PATH/helm_charts --untar
+    helm repo remove temp > /dev/null
+
+
+done < "$XAPPLISTFILE"
+
+echo "************************************************************"
+for chart in $CHART_DIRECTORY_PATH/helm_charts/*; do
+
+
+    CHART_NAME=$(echo $chart | awk -F '/' '{print $NF}')
+    mkdir -p $CHART_DIRECTORY_PATH/docker_images/$CHART_NAME
+
+    IMAGE_ARRAY=$(helm template $chart | grep "image:" | awk '{ gsub(/.*image: /, "", $0); gsub(/"/, "", $0); print $0}' )
+
+    while read -r image; do
+
+        IMAGENAME=$(echo $image | awk '{ n=split($0, a, "/"); print a[n] }')
+        echo "Pulling image $image"
+        RESULT=$(docker pull $image |& grep "no basic auth credentials" )
+        if [ ! -z "$RESULT" ]; then
+            echo "You are not logined to docker registry. Please login by running \"docker login DOCKER_REGISTRY\""
+            exit 1
+        fi
+    
+        echo "Saving image $image"
+        docker save $image -o $CHART_DIRECTORY_PATH/docker_images/$CHART_NAME/$IMAGENAME
+
+
+
+
+    done <<< "$IMAGE_ARRAY"
+
+
+done
+
+
+
+
+echo "************************************************************"
+echo "xApp helm charts are downloaded to: $CHART_DIRECTORY_PATH"
diff --git a/ric-xapps/bin/install b/ric-xapps/bin/install
new file mode 100755 (executable)
index 0000000..cfb81d7
--- /dev/null
@@ -0,0 +1,169 @@
+#!/bin/bash
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   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.                                             #
+################################################################################
+
+
+while [ -n "$1" ]; do # while loop starts
+
+    case "$1" in
+
+    -n) 
+       CHART_NAME=$2
+       shift
+       ;; 
+
+    -v) CHART_VERSION=$2
+       shift
+               ;; # Message for -b option
+
+    -f) OVERRIDEYAML=$2
+       shift
+       ;; # Message for -c option
+    
+    -i) FULLIMAGE=$2
+       shift
+       ;;
+
+    -d) DESCRIPTOR_PATH=$2
+       shift
+       ;;
+
+    -c) CONFIG_JSON_PATH=$2
+       shift
+       ;;
+
+    -h) HELM_REPO_USERNAME=$2
+        shift
+        ;;
+    
+    -p) HELM_REPO_PASSWORD=$2
+        shift
+        ;;
+
+    *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c
+
+    esac
+
+    shift
+
+done
+
+
+
+
+if [ -z $CHART_NAME ]; then
+  echo "Please specify chart name using -n option."
+  exit 1
+fi
+if [ -z $CHART_VERSION ]; then
+  echo "Please specify chart version using -v option."
+  exit 1
+fi
+if [ -z $FULLIMAGE ]; then
+  echo "Please specify image using -i option."
+  exit 1
+fi
+if [ -z $DESCRIPTOR_PATH ]; then
+  echo "Please specify descriptor file using -d option."
+  exit 1
+fi
+if [ -z $CONFIG_JSON_PATH ]; then
+  echo "Please specify config json file using -c option."
+  exit 1
+fi
+
+
+if [ ! -f $DESCRIPTOR_PATH ]; then
+  echo "Descriptor file cannot be founded at $DESCRIPTOR_PATH"
+  exit 1
+fi
+if [ ! -f $CONFIG_JSON_PATH ]; then
+  echo "Config json file cannot be founded at $CONFIG_JSON_PATH"
+  exit 1
+fi
+
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+
+source $DIR/../etc/xapp.conf
+
+if [ -z $OVERRIDEYAML ]; then
+  HELM_REPO=$default_helm_repo
+  DOCKER_REGISTRY=$default_docker_registry
+else
+  helm_repo_override=$(grep "^ *helmRepository:" $OVERRIDEYAML |  awk '{gsub(/ /,""); gsub(/\"/,""); split($0, b, "tory:");split(b[2],c,"#"); print c[1]}')
+  docker_reg_override=$(grep "^ *repository:" $OVERRIDEYAML |  awk '{ gsub(/ /,""); gsub(/\"/,""); split($0, b, "tory:");split(b[2],c,"#"); print c[1]}')
+  if [ -z $helm_repo_override ]; then
+    HELM_REPO=$default_helm_repo
+  else
+    HELM_REPO=$helm_repo_override
+  fi
+
+  if [ -z $docker_reg_override ]; then
+    DOCKER_REGISTRY=$default_docker_registry
+  else
+    DOCKER_REGISTRY=$docker_reg_override
+  fi
+fi
+
+
+
+
+rm -rf /tmp/$CHART_NAME
+
+cp -r $DIR/../helm/xapp-std/ /tmp/$CHART_NAME
+
+
+
+sed -i "s/^name: xapp-std/name: $CHART_NAME/" /tmp/$CHART_NAME/Chart.yaml
+sed -i "s/^version: 0.0.1/version: $CHART_VERSION/" /tmp/$CHART_NAME/Chart.yaml
+
+
+registry_path=$(echo $FULLIMAGE | awk '{n=split($0, a, "/"); if(n>1) print a[1]}')
+
+
+
+tag=$(echo $FULLIMAGE | awk '{n=split($0, a, "/"); split(a[n], b, ":"); print b[2]}')
+
+image=$(echo $FULLIMAGE | awk -v head="$registry_path/" -v tail=":$tag" '{gsub (head, ""); gsub(tail,""); gsub(/\//,"\\/"); print $0}') 
+
+
+sed -i "s/^  name: xapp-std/  name: $CHART_NAME/" /tmp/$CHART_NAME/values.yaml
+sed -i "s/^    name: xapp-std/    name: $image/" /tmp/$CHART_NAME/values.yaml
+sed -i "s/^    tag: latest/    tag: $tag/" /tmp/$CHART_NAME/values.yaml
+
+
+if [ -z $registry_path ]; then
+  sed -i "s/^    repository: xapp-std-reg/    repository: $DOCKER_REGISTRY/" /tmp/$CHART_NAME/values.yaml
+else
+  sed -i "s/^    repository: xapp-std-reg/    repository: $registry_path/" /tmp/$CHART_NAME/values.yaml
+fi
+
+
+mkdir /tmp/$CHART_NAME/config/
+mkdir /tmp/$CHART_NAME/descriptors/
+
+cp $CONFIG_JSON_PATH /tmp/$CHART_NAME/config/
+cp $DESCRIPTOR_PATH /tmp/$CHART_NAME/descriptors/
+
+
+helm package -d /tmp /tmp/$CHART_NAME
+
+
+echo $HELM_REPO
+#curl -k -u $HELM_REPO_USERNAME:$HELM_REPO_PASSWORD $HELM_REPO --upload-file /tmp/$CHART_NAME-$CHART_VERSION.tgz -v
+curl -Lk -u $HELM_REPO_USERNAME:$HELM_REPO_PASSWORD "$HELM_REPO"/api/charts --data-binary "@/tmp/$CHART_NAME-$CHART_VERSION.tgz"
diff --git a/ric-xapps/etc/xapp.conf b/ric-xapps/etc/xapp.conf
new file mode 100644 (file)
index 0000000..2514728
--- /dev/null
@@ -0,0 +1,21 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   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_helm_repo=https://$(hostname):32080/helm
+
+default_docker_registry=docker-entry
+
+
diff --git a/ric-xapps/helm/xapp-std/.helmignore b/ric-xapps/helm/xapp-std/.helmignore
new file mode 100644 (file)
index 0000000..50af031
--- /dev/null
@@ -0,0 +1,22 @@
+# 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
+.vscode/
diff --git a/ric-xapps/helm/xapp-std/Chart.yaml b/ric-xapps/helm/xapp-std/Chart.yaml
new file mode 100644 (file)
index 0000000..2fb8da8
--- /dev/null
@@ -0,0 +1,20 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   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: Standard xApp Helm Chart
+name: xapp-std
+version: 0.0.1
diff --git a/ric-xapps/helm/xapp-std/templates/_helpers.tpl b/ric-xapps/helm/xapp-std/templates/_helpers.tpl
new file mode 100644 (file)
index 0000000..bb715fd
--- /dev/null
@@ -0,0 +1,76 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   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.                                             #
+################################################################################
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "ricxapp.name" -}}
+  {{- default .Chart.Name .Values.ricxapp.name | 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 "ricxapp.fullname" -}}
+  {{- $name := ( include "ricxapp.name" . ) -}}
+  {{- $fullname := ( printf "%s-%s" .Release.Namespace $name ) -}}
+  {{- default $fullname .Values.ricxapp.fullname | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "ricxapp.chart" -}}
+  {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "ricxapp.namespace" -}}
+  {{- default .Release.Namespace .Values.nsPrefix -}}
+{{- end -}}
+
+
+
+{{- define "ricxapp.servicename.rmr" -}}
+  {{- $name := ( include "ricxapp.fullname" . ) -}}
+  {{- printf "service-%s-rmr" $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "ricxapp.servicename.http" -}}
+  {{- $name := ( include "ricxapp.fullname" . ) -}}
+  {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "ricxapp.configmapname" -}}
+  {{- $name := ( include "ricxapp.fullname" . ) -}}
+  {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "ricxapp.deploymentname" -}}
+  {{- $name := ( include "ricxapp.fullname" . ) -}}
+  {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+
+{{- define "ricxapp.containername" -}}
+  {{- $name := ( include "ricxapp.fullname" . ) -}}
+  {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "ricxapp.imagepullsecret" -}}
+  {{- printf "docker-reg-cred" -}}
+{{- end -}}
diff --git a/ric-xapps/helm/xapp-std/templates/appconfig.yaml b/ric-xapps/helm/xapp-std/templates/appconfig.yaml
new file mode 100644 (file)
index 0000000..5e5463c
--- /dev/null
@@ -0,0 +1,31 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   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: {{ include "ricxapp.configmapname" . }}-appconfig
+data:
+{{- $dbaasservice := .Values.ricplt.dbaasService | quote -}}
+{{- $pltingressurl := .Values.ricplt.pltIngressUrl | quote -}}
+{{- $xappingressurl := .Values.ricplt.xappIngressUrl | quote -}}
+{{- $appmgrrmrservice := .Values.ricplt.appmgrRMRService | quote -}}
+{{- $e2mgrrmrservice := .Values.ricplt.e2mgrRMRService | quote -}}
+{{- $e2termrmrservice := .Values.ricplt.e2termRMRService | quote -}}
+{{- $rtmgrrmrservice := .Values.ricplt.rtmgrRMRService | quote -}}
+{{- $a1mediatorrmrservice := .Values.ricplt.a1mediatorRMRService | quote -}}
+
+{{- (.Files.Glob "config/*").AsConfig | replace "__DBAAS_SERVICE__" $dbaasservice | replace "__PLT_INGRESS_URL__" $pltingressurl | replace "__XAPP_INGRESS_URL__" $xappingressurl | replace "__APPMGR_RMR_SERVICE__" $appmgrrmrservice | replace "__E2MGR_RMR_SERVICE__" $e2mgrrmrservice | replace "__E2TERM_RMR_SERVICE__" $e2termrmrservice | replace "__RTMGR_RMR_SERVICE__" $rtmgrrmrservice | replace "__A1MEDIATOR_RMR_SERVICE__" $a1mediatorrmrservice | nindent 2 }}
diff --git a/ric-xapps/helm/xapp-std/templates/appenv.yaml b/ric-xapps/helm/xapp-std/templates/appenv.yaml
new file mode 100644 (file)
index 0000000..b8fb4bc
--- /dev/null
@@ -0,0 +1,28 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   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: {{ include "ricxapp.configmapname" . }}-appenv
+data:
+  {{- if .Values.ricxapp.appenv }}
+    {{- toYaml .Values.ricxapp.appenv | nindent 2 }}
+  {{- end }}
+  DBAAS_SERVICE_HOST: "{{ .Values.ricplt.dbaasService }}"
+  DBAAS_SERVICE_PORT: "6379"
+  DBAAS_PORT_6379_TCP_ADDR: "{{ .Values.ricplt.dbaasService }}"
+  DBAAS_PORT_6379_TCP_PORT: "6379"
+  RMR_RTG_SVC: "{{ .Values.ricxapp.service.rmr.route.port }}"
diff --git a/ric-xapps/helm/xapp-std/templates/deployment.yaml b/ric-xapps/helm/xapp-std/templates/deployment.yaml
new file mode 100644 (file)
index 0000000..5afa126
--- /dev/null
@@ -0,0 +1,72 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   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: Deployment
+metadata:
+  name: {{ include "ricxapp.fullname" . }}
+  labels:
+    app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  replicas: {{ .Values.ricxapp.replicaCount }}
+  selector:
+    matchLabels:
+      app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }}
+      release: {{ .Release.Name }}
+  template:
+    metadata:
+      labels:
+        app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }}
+        release: {{ .Release.Name }}
+    spec:
+      hostname: {{ include "ricxapp.name" . }}
+      imagePullSecrets:
+        - name: {{ include "ricxapp.imagepullsecret" . }}
+      containers:
+        - name: {{ include "ricxapp.containername" . }}
+          image: "{{ .Values.ricxapp.image.repository }}/{{ .Values.ricxapp.image.name }}:{{ .Values.ricxapp.image.tag }}"
+          imagePullPolicy: {{ .Values.ricxapp.image.pullPolicy }}
+          ports:
+            - name: http
+              containerPort: {{ .Values.ricxapp.service.http.containerPort }}
+              protocol: TCP
+            - name: rmrroute
+              containerPort: {{ .Values.ricxapp.service.rmr.route.port }}
+              protocol: TCP
+            - name: rmrdata
+              containerPort: {{ .Values.ricxapp.service.rmr.data.port }}
+              protocol: TCP
+          volumeMounts:
+            - name: config-volume
+              mountPath: {{ .Values.ricxapp.appconfig.path }}
+          envFrom:
+            - configMapRef:
+                name: {{ include "ricxapp.configmapname" . }}-appenv
+          {{- if .Values.ricxapp.livenessProbe }}
+          livenessProbe:
+            {{- .Values.ricxapp.livenessProbe | nindent 12 -}}
+          {{ end }}
+          {{- if .Values.ricxapp.readinessProbe }}
+          readinessProbe:
+            {{- .Values.ricxapp.readinessProbe | nindent 12 -}}
+          {{ end }}
+          restartPolicy: Always
+      volumes:
+        - name: config-volume
+          configMap:
+            name: {{ include "ricxapp.configmapname" . }}-appconfig
diff --git a/ric-xapps/helm/xapp-std/templates/service-http.yaml b/ric-xapps/helm/xapp-std/templates/service-http.yaml
new file mode 100644 (file)
index 0000000..62a6a40
--- /dev/null
@@ -0,0 +1,36 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   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: {{ include "ricxapp.servicename.http" . }}
+  namespace: {{ include "ricxapp.namespace" . }}
+  labels:
+    app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  type: ClusterIP
+  ports:
+    - port: {{ .Values.ricxapp.service.http.port }}
+      targetPort: http
+      protocol: TCP
+      name: http
+  selector:
+    app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }}
+    release: {{ .Release.Name }}
diff --git a/ric-xapps/helm/xapp-std/templates/service-rmr.yaml b/ric-xapps/helm/xapp-std/templates/service-rmr.yaml
new file mode 100644 (file)
index 0000000..54bd985
--- /dev/null
@@ -0,0 +1,40 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   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: {{ include "ricxapp.servicename.rmr" . }}
+  namespace: {{ include "ricxapp.namespace" . }}
+  labels:
+    app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  type: ClusterIP
+  ports:
+    - port: {{ .Values.ricxapp.service.rmr.data.port }}
+      targetPort: rmrdata
+      protocol: TCP
+      name: rmrdata
+    - port: {{ .Values.ricxapp.service.rmr.route.port }}
+      targetPort: rmrroute
+      protocol: TCP
+      name: rmrroute
+  selector:
+    app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }}
+    release: {{ .Release.Name }}
diff --git a/ric-xapps/helm/xapp-std/values.yaml b/ric-xapps/helm/xapp-std/values.yaml
new file mode 100644 (file)
index 0000000..1689a6a
--- /dev/null
@@ -0,0 +1,73 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   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.                                             #
+################################################################################'
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+ricplt:
+  # This section is reserved for values imported from RIC Platform charts
+  dbaasService: "service-ricplt-dbaas-tcp.ricplt.svc.cluster.local"
+  pltIngressUrl: "ricplt-entry"
+  xappIngressUrl: "ricxapp-entry"
+
+  appmgrRMRService: "service-ricplt-appmgr-rmr.ricplt.svc.cluster.local"
+  e2mgrRMRService: "service-ricplt-e2mgr-rmr.ricplt.svc.cluster.local"
+  e2termRMRService: "service-ricplt-e2term-rmr.ricplt.svc.cluster.local"
+  rtmgrRMRService: "service-ricplt-rtmgr-rmr.ricplt.svc.cluster.local"
+  a1mediatorRMRService: "service-ricplt-a1mediator-rmr.ricplt.svc.cluster.local"
+
+  
+
+ricxapp:
+  # This section is for xapp. Templates to be resolved from xApp descriptor
+  replicaCount: 1
+  name: xapp-std
+  # Your can specify the chart fullname by using the following option
+  #fullname: xapp-std
+
+  image:
+    pullPolicy: IfNotPresent
+    repository: xapp-std-reg
+    name: xapp-std
+    tag: latest
+
+  service:
+    http:
+      port: 8080
+      containerPort: 8080
+    rmr:
+      route:
+        port: 4561
+      data:
+        port: 4560
+
+  livenessProbe: |-
+    httpGet:
+      path: ric/v1/health/alive
+      port: 8080
+    initialDelaySeconds: 5
+    periodSeconds: 15
+
+  readinessProbe: |-
+    httpGet:
+      path: ric/v1/health/ready
+      port: 8080
+    initialDelaySeconds: 5
+    periodSeconds: 15
+
+
+  appconfig:
+    path: /opt/ric/config
+
+  appenv: