-RICAUX_COMPONENTS="dashboard ves message-router"
+RICAUX_COMPONENTS="dashboard ves message-router mrsub"
echo "Deploying RIC AUX components [$RICAUX_COMPONENTS]"
echo "Helm Release Name: $RELEASE_NAME"
RELEASE_NAME=$RICAUX_RELEASE_NAME
fi
-RICAUX_COMPONENTS="dashboard message-router ves"
+RICAUX_COMPONENTS="dashboard message-router ves mrsub"
echo "Undeploying RIC AUX components [$RICAUX_COMPONENTS]"
echo "Helm Release Name: $RELEASE_NAME"
--- /dev/null
+# 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/
--- /dev/null
+apiVersion: v1
+appVersion: "1.0"
+description: A Helm chart for Kubernetes
+name: mrsub
+version: 0.1.0
--- /dev/null
+#!/bin/bash
+
+MR_HOSTPORT="$_MR_HOSTPORT"
+MR_TOPIC="$_MR_TOPIC"
+LOGSTASH_URL="$_LOGSTASH_URL"
+
+if ! jq --version > /dev/null 2&>1 ; then
+ apt-get update
+ apt-get install -y jq curl
+fi
+
+echo "IN SCRIPT"
+echo "$MR_HOSTPORT $MR_TOPIC $LOGSTASH_URL"
+
+while true; do
+ # if dmaap returns single JSON structure
+ DATA=$(curl -s -H "Accept: application/json" -X GET http://${MR_HOSTPORT}/events/${MR_TOPIC}/elk-plotter/elk-plotter?timeout=60000)
+ DATA=$(echo $DATA| sed -e 's/\\"/"/g' -e 's/"{/{/g' -e 's/}"/}/g')
+ echo "Getting data: $DATA"
+
+ #VESEVENT=$(echo $DATA |jq -r '((.event.commonEventHeader.lastEpochMicrosec)|tostring) + "," + ((.event.measurementsForVfScalingFields.vNicUsageArray[0].receivedTotalPacketsDelta) | tostring)')
+ #curl -i -XPUT 'http://127.0.0.1:8080/onenumber/onenumebr' -d "${VESEVENT}"
+
+ # dmaap returns json array
+ # echo "Reading source: $.event.commonEventHeader.reportingEntityName"
+ source=$(echo $DATA |jq -r '.[] | ((.event.commonEventHeader.reportingEntityName) | tostring)')
+ echo "Source name: $source"
+ if [ "$source" == "GS_LITE MC" ]
+ then
+ DATA=$(echo $DATA |jq -r --arg source "$source" '.[] | $source+","+((.event.measurementsForVfScalingFields.additionalFields[1].value) | tostring)+ ","+ ((.event.measurementsForVfScalingFields.additionalFields[2].value) | tostring)')
+ #EVENTS=$(echo $DATA |jq -r '.event.measurementFields.additionalFields.SgNBRequestRate')
+ #for EVENT in $EVENTS; do
+ elif [ "$source" == "AC xAPP" ]
+ then
+ DATA=$(echo $DATA |jq -r --arg source "$source" '.[] | $source+","+((.event.measurementsForVfScalingFields.additionalFields[0].value) | tostring)')
+ else
+ DATA="No supportive reporting entity provided"
+ fi
+ echo "Injecting VES event: $DATA"
+ curl -i -XPUT "${LOGSTASH_URL}" -d "${DATA}"
+ #done
+done
+
--- /dev/null
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "mrsub.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 "mrsub.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 "mrsub.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+{{- define "mrsub.configmapname" -}}
+ {{- $name := ( include "mrsub.fullname" . ) -}}
+ {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
--- /dev/null
+################################################################################
+# Copyright (c) 2019 AT&T Intellectual Property. #
+# Copyright (c) 2019 Nokia. #
+# #
+# 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 "mrsub.configmapname" . }}-bin
+data:
+ {{- (.Files.Glob "resources/mrsub.sh").AsConfig |nindent 2 }}
+
--- /dev/null
+################################################################################
+# Copyright (c) 2019 AT&T Intellectual Property. #
+# Copyright (c) 2019 Nokia. #
+# #
+# 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 "mrsub.configmapname" . }}-env
+data:
+ {{- if .Values.mrsub.appenv }}
+ {{- toYaml .Values.mrsub.appenv | nindent 2 }}
+ {{- end }}
+ _MR_HOSTPORT: "{{ .Values.mrsub.mrhostport }}"
+ _MR_TOPIC: "{{ .Values.mrsub.mrtopic }}"
+ _LOGSTASH_URL: "{{ .Values.mrsub.logstashurl }}"
+
--- /dev/null
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ include "mrsub.fullname" . }}
+ labels:
+ app.kubernetes.io/name: {{ include "mrsub.name" . }}
+ helm.sh/chart: {{ include "mrsub.chart" . }}
+ app.kubernetes.io/instance: {{ .Release.Name }}
+ app.kubernetes.io/managed-by: {{ .Release.Service }}
+spec:
+ replicas: {{ .Values.replicaCount }}
+ selector:
+ matchLabels:
+ app.kubernetes.io/name: {{ include "mrsub.name" . }}
+ app.kubernetes.io/instance: {{ .Release.Name }}
+ template:
+ metadata:
+ labels:
+ app.kubernetes.io/name: {{ include "mrsub.name" . }}
+ app.kubernetes.io/instance: {{ .Release.Name }}
+ spec:
+ containers:
+ - name: {{ .Chart.Name }}
+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ command: ["/scripts/mrsub.sh"]
+ #command: ["sleep"]
+ #args: ["3600"]
+ volumeMounts:
+ - mountPath: /scripts
+ name: script
+ envFrom:
+ - configMapRef:
+ name: {{ include "mrsub.configmapname" . }}-env
+ volumes:
+ - name: script
+ configMap:
+ name: {{ include "mrsub.configmapname" . }}-bin
+ defaultMode: 0744
+
+ {{- with .Values.nodeSelector }}
+ nodeSelector:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.affinity }}
+ affinity:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.tolerations }}
+ tolerations:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
--- /dev/null
+# Default values for mrsub.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+replicaCount: 1
+
+image:
+ repository: ubuntu
+ tag: 16.04
+ pullPolicy: IfNotPresent
+
+
+mrsub:
+ mrhostport: "10.1.0.26:30227"
+ mrtopic: "unauthenticated.SEC_MEASUREMENT_OUTPUT"
+ logstashurl: "http://192.168.130.77:8081/ves/ves"
+