- `ran_nssmf_client.py` - RAN Network Slice Subnet Management Function client
- `models/` - directory for trained AI/ML models and scalers
- `data_generator.py` - generates data for training and testing the model
-- `Dockerfile` - contains instructions to build a Docker image for the Rapp
+- `slice-prb-prediction-rapp/` - Kubernetes deployment artifacts
+ - `Artifacts/Deployment/HELM/slice-prb-prediction-rapp/` - Helm chart for containerized deployment
+ - `Chart.yaml` - Helm chart metadata
+ - `values.yaml` - Default configuration values
+ - `templates/` - Kubernetes resource templates
+ - `deployment.yaml` - Pod deployment configuration
+ - `service.yaml` - Service exposure configuration
+ - `configmap.yaml` - Configuration management
+ - `serviceaccount.yaml` - Service account configuration
## Data Generator (`data_generator.py`)
# Run with Service Management Environment discovery
python src/main.py --use_sme True
```
+
+## Kubernetes Deployment
+
+### Helm Chart Deployment
+
+The application includes a complete Helm chart for containerized deployment in Kubernetes clusters.
+
+#### Prerequisites
+- Kubernetes cluster (v1.16+)
+- Helm 3.x installed
+- Container registry access
+
+#### Deployment Steps
+
+1. **Build and Push Docker Image**:
+ ```bash
+ # Build container image
+ docker build -t slice-prb-prediction-rapp:1.0.0 .
+
+ # Push to registry
+ docker push slice-prb-prediction-rapp:1.0.0
+ ```
+
+2. **Configure Helm Values**:
+ Edit `slice-prb-prediction-rapp/Artifacts/Deployment/HELM/slice-prb-prediction-rapp/values.yaml`:
+ ```yaml
+ image:
+ repository: your-registry.com
+ tag: "1.0.0"
+
+ influxdb:
+ address: "http://influxdb2.smo:8086"
+ token: "your-influxdb-token"
+ org: "your-org"
+ bucket: "nssi_pm_bucket"
+
+ environment:
+ smeDiscoveryEndpoint: "http://servicemanager.nonrtric.svc.cluster.local:8095/service-apis/v1/allServiceAPIs"
+ ```
+
+3. **Deploy with Helm**:
+ ```bash
+ # Install the Helm chart
+ helm install slice-prb-prediction-rapp \
+ ./slice-prb-prediction-rapp/Artifacts/Deployment/HELM/slice-prb-prediction-rapp \
+ --namespace nonrtric \
+ --create-namespace
+
+ # Upgrade existing deployment
+ helm upgrade slice-prb-prediction-rapp \
+ ./slice-prb-prediction-rapp/Artifacts/Deployment/HELM/slice-prb-prediction-rapp
+ ```
+
+#### Kubernetes Resources
+
+The Helm chart creates the following resources:
+- **Deployment**: Pod with the PRB prediction application
+- **Service**: ClusterIP service exposing port 8080
+- **ConfigMap**: Application configuration from `values.yaml`
+- **ServiceAccount**: Dedicated service account for the application
+- **Secret**: InfluxDB token management (if configured)
+
+#### Configuration Management
+
+- **ConfigMap**: Automatically generated from Helm values
+- **Secrets**: Secure management of InfluxDB tokens
+- **Environment Variables**: Runtime configuration via Kubernetes secrets
+- **Volume Mounts**: Configuration file mounted at `/app/config.json`
+
+#### Monitoring and Scaling
+
+- **Health Checks**: Configurable liveness and readiness probes
+- **Resource Limits**: CPU and memory constraints
+- **Auto-scaling**: Horizontal Pod Autoscaler support (optional)
+- **Logging**: Structured logs for Kubernetes monitoring
--- /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
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
--- /dev/null
+apiVersion: v2
+appVersion: 1.16.0
+description: A Helm chart for Kubernetes
+name: slice-prb-prediction-rapp
+type: application
+version: 0.1.0
--- /dev/null
+{
+ "DB": {
+ "address": "{{ .Values.influxdb.address }}",
+ "token": "{{ .Values.influxdb.token }}",
+ "org": "{{ .Values.influxdb.org }}",
+ "bucket": "{{ .Values.influxdb.bucket }}",
+ "time_range": "{{ .Values.influxdb.timeRange }}",
+ "measurements": "{{ .Values.influxdb.measurements }}",
+ "window_size" : "{{ .Values.influxdb.window_size }}",
+ "field_names": ["RRU.PrbDl.SNSSAI", "DRB.PdcpSduVolumeDL.SNSSAI", "RRC.ConnEstabSucc.Cause"],
+ "tag_slice_type": "sliceType",
+ "tag_nssi_id": "measObjLdn"
+ },
+ "RAPP": {
+ "interval": "{{ .Values.rapp.interval }}",
+ "ran_nssmf_address": "http://ran-nssmf-simulator-rapp.smo:8080",
+ "callback_uri": "http://slice-prb-prediction-rapp.smo:8080/handleFileReadyNotification"
+ },
+ "SME": {
+ "sme_discovery_endpoint": "{{ .Values.environment.smeDiscoveryEndpoint }}",
+ "influxdb_invoker_id": "{{ .Values.environment.appId }}",
+ "influxdb_api_name": "{{ .Values.influxdb.apiName }}",
+ "influxdb_resource_name": "{{ .Values.influxdb.resourceName }}",
+ "ran_nssmf_api_name": "",
+ "ran_nssmf_resource_name": ""
+ }
+}
\ No newline at end of file
--- /dev/null
+1. Get the application URL by running these commands:
+{{- if .Values.ingress.enabled }}
+{{- range $host := .Values.ingress.hosts }}
+ {{- range .paths }}
+ http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
+ {{- end }}
+{{- end }}
+{{- else if contains "NodePort" .Values.service.type }}
+ export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "slice-prb-prediction-rapp.fullname" . }})
+ export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
+ echo http://$NODE_IP:$NODE_PORT
+{{- else if contains "LoadBalancer" .Values.service.type }}
+ NOTE: It may take a few minutes for the LoadBalancer IP to be available.
+ You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "slice-prb-prediction-rapp.fullname" . }}'
+ export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "slice-prb-prediction-rapp.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
+ echo http://$SERVICE_IP:{{ .Values.service.port }}
+{{- else if contains "ClusterIP" .Values.service.type }}
+ export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "slice-prb-prediction-rapp.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
+ export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
+ echo "Visit http://127.0.0.1:8080 to use your application"
+ kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
+{{- end }}
--- /dev/null
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "slice-prb-prediction-rapp.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 "slice-prb-prediction-rapp.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 "slice-prb-prediction-rapp.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Common labels
+*/}}
+{{- define "slice-prb-prediction-rapp.labels" -}}
+helm.sh/chart: {{ include "slice-prb-prediction-rapp.chart" . }}
+{{ include "slice-prb-prediction-rapp.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "slice-prb-prediction-rapp.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "slice-prb-prediction-rapp.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+{{/*
+Create the name of the service account to use
+*/}}
+{{- define "slice-prb-prediction-rapp.serviceAccountName" -}}
+{{- if .Values.serviceAccount.create }}
+{{- default (include "slice-prb-prediction-rapp.fullname" .) .Values.serviceAccount.name }}
+{{- else }}
+{{- default "default" .Values.serviceAccount.name }}
+{{- end }}
+{{- end }}
--- /dev/null
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "slice-prb-prediction-rapp.name" . }}-configmap
+ labels:
+ {{- include "slice-prb-prediction-rapp.labels" . | nindent 4 }}
+data:
+{{ tpl (.Files.Glob "resources/config/config.json").AsConfig . | indent 2 }}
\ No newline at end of file
--- /dev/null
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ include "slice-prb-prediction-rapp.fullname" . }}
+ labels:
+ {{- include "slice-prb-prediction-rapp.labels" . | nindent 4 }}
+spec:
+ {{- if not .Values.autoscaling.enabled }}
+ replicas: {{ .Values.replicaCount }}
+ {{- end }}
+ selector:
+ matchLabels:
+ {{- include "slice-prb-prediction-rapp.selectorLabels" . | nindent 6 }}
+ template:
+ metadata:
+ {{- with .Values.podAnnotations }}
+ annotations:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ labels:
+ {{- include "slice-prb-prediction-rapp.labels" . | nindent 8 }}
+ {{- with .Values.podLabels }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ spec:
+ {{- with .Values.imagePullSecrets }}
+ imagePullSecrets:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ serviceAccountName: {{ include "slice-prb-prediction-rapp.serviceAccountName" . }}
+ {{- with .Values.podSecurityContext }}
+ securityContext:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ containers:
+ - name: {{ .Chart.Name }}
+ {{- with .Values.securityContext }}
+ securityContext:
+ {{- toYaml . | nindent 12 }}
+ {{- end }}
+ image: "{{ .Values.image.registry }}/{{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ ports:
+ - name: http
+ containerPort: {{ .Values.service.port }}
+ protocol: TCP
+ {{- with .Values.livenessProbe }}
+ livenessProbe:
+ {{- toYaml . | nindent 12 }}
+ {{- end }}
+ {{- with .Values.readinessProbe }}
+ readinessProbe:
+ {{- toYaml . | nindent 12 }}
+ {{- end }}
+ {{- with .Values.resources }}
+ resources:
+ {{- toYaml . | nindent 12 }}
+ {{- end }}
+ env:
+ - name: APP_ID
+ value: {{ .Values.environment.appId | quote }}
+ - name: SME_DISCOVERY_ENDPOINT
+ value: {{ .Values.environment.smeDiscoveryEndpoint | quote }}
+ - name: INFLUX_TOKEN
+ valueFrom:
+ secretKeyRef:
+ key: token
+ name: {{ .Values.influxdb.tokenSecretName | quote }}
+ volumeMounts:
+ - mountPath: /app/config.json
+ name: config
+ subPath: config.json
+ volumes:
+ - name: config
+ configMap:
+ name: {{ include "slice-prb-prediction-rapp.name" . }}-configmap
+ defaultMode: 0755
+ items:
+ - key: config.json
+ path: config.json
+ {{- 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
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "slice-prb-prediction-rapp.fullname" . }}
+ labels:
+ {{- include "slice-prb-prediction-rapp.labels" . | nindent 4 }}
+spec:
+ type: {{ .Values.service.type }}
+ ports:
+ - port: {{ .Values.service.port }}
+ targetPort: http
+ protocol: TCP
+ name: http
+ selector:
+ {{- include "slice-prb-prediction-rapp.selectorLabels" . | nindent 4 }}
--- /dev/null
+{{- if .Values.serviceAccount.create -}}
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: {{ include "slice-prb-prediction-rapp.serviceAccountName" . }}
+ labels:
+ {{- include "slice-prb-prediction-rapp.labels" . | nindent 4 }}
+ {{- with .Values.serviceAccount.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
+{{- end }}
--- /dev/null
+apiVersion: v1
+kind: Pod
+metadata:
+ name: "{{ include "slice-prb-prediction-rapp.fullname" . }}-test-connection"
+ labels:
+ {{- include "slice-prb-prediction-rapp.labels" . | nindent 4 }}
+ annotations:
+ "helm.sh/hook": test
+spec:
+ containers:
+ - name: wget
+ image: busybox
+ command: ['wget']
+ args: ['{{ include "slice-prb-prediction-rapp.fullname" . }}:{{ .Values.service.port }}']
+ restartPolicy: Never
--- /dev/null
+# Default values for slice-prb-prediction-rapp.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
+replicaCount: 1
+
+# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
+image:
+ repository: localhost:5001
+ name: slice-prb-prediction-rapp
+ # This sets the pull policy for images.
+ pullPolicy: Always
+ # Overrides the image tag whose default is the chart appVersion.
+ tag: "1.0.0"
+
+# This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
+imagePullSecrets: []
+# This is to override the chart name.
+nameOverride: ""
+fullnameOverride: ""
+
+# This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/
+serviceAccount:
+ # Specifies whether a service account should be created
+ create: true
+ # Automatically mount a ServiceAccount's API credentials?
+ automount: true
+ # Annotations to add to the service account
+ annotations: {}
+ # The name of the service account to use.
+ # If not set and create is true, a name is generated using the fullname template
+ name: ""
+
+# This is for setting Kubernetes Annotations to a Pod.
+# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
+podAnnotations: {}
+# This is for setting Kubernetes Labels to a Pod.
+# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
+podLabels: {}
+
+podSecurityContext: {}
+ # fsGroup: 2000
+
+securityContext: {}
+ # capabilities:
+ # drop:
+ # - ALL
+ # readOnlyRootFilesystem: true
+ # runAsNonRoot: true
+ # runAsUser: 1000
+
+# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/
+service:
+ # This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
+ type: ClusterIP
+ # This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports
+ port: 8080
+
+# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/
+ingress:
+ enabled: false
+ className: ""
+ annotations: {}
+ # kubernetes.io/ingress.class: nginx
+ # kubernetes.io/tls-acme: "true"
+ hosts:
+ - host: chart-example.local
+ paths:
+ - path: /
+ pathType: ImplementationSpecific
+ tls: []
+ # - secretName: chart-example-tls
+ # hosts:
+ # - chart-example.local
+
+resources: {}
+ # We usually recommend not to specify default resources and to leave this as a conscious
+ # choice for the user. This also increases chances charts run on environments with little
+ # resources, such as Minikube. If you do want to specify resources, uncomment the following
+ # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
+ # limits:
+ # cpu: 100m
+ # memory: 128Mi
+ # requests:
+ # cpu: 100m
+ # memory: 128Mi
+
+# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
+# livenessProbe:
+# httpGet:
+# path: /
+# port: http
+# readinessProbe:
+# httpGet:
+# path: /
+# port: http
+
+# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
+autoscaling:
+ enabled: false
+ minReplicas: 1
+ maxReplicas: 100
+ targetCPUUtilizationPercentage: 80
+ # targetMemoryUtilizationPercentage: 80
+
+# Additional volumes on the output Deployment definition.
+volumes: []
+# - name: foo
+# secret:
+# secretName: mysecret
+# optional: false
+
+# Additional volumeMounts on the output Deployment definition.
+volumeMounts: []
+# - name: foo
+# mountPath: "/etc/foo"
+# readOnly: true
+
+nodeSelector: {}
+
+tolerations: []
+
+affinity: {}
+
+environment:
+ appId: ""
+ smeDiscoveryEndpoint: "http://servicemanager.nonrtric.svc.cluster.local:8095/service-apis/v1/allServiceAPIs"
+
+influxdb:
+ address: "http://influxdb2.smo:8086"
+ token: "YXZJb09WZDVtb3BPQVlDRFFZeFprM0dtSHpUaTlxdVU="
+ org: "est"
+ bucket: "nssi_pm_bucket"
+ timeRange: "-0"
+ measurements: "nssi_pm_bucket"
+ window_size: 672
+ tokenSecretName: influxdb-api-token
+ apiName: "influxdb2-http"
+ resourceName: "root"
+
+rapp:
+ interval: 1
+
+