From a5087b4ee4d5eb56b036e9ab4fd0a6455a275364 Mon Sep 17 00:00:00 2001 From: pborla Date: Wed, 28 Aug 2024 15:07:45 +0530 Subject: [PATCH] [Epic-Id: ODUHIGH-611][Task-Id: ODUHIGH-626] | Containerization of DU, CU stub & RIC stub Change-Id: I896a89df47f7f54fe04124f271c0cf2e619df2d6 Signed-off-by: pborla --- Dockerfile.cu | 60 +++++++++++ Dockerfile.du | 61 +++++++++++ Dockerfile.ric | 60 +++++++++++ build/odu/makefile | 2 +- container/cu_helm/cu/.helmignore | 23 +++++ container/cu_helm/cu/Chart.yaml | 24 +++++ container/cu_helm/cu/templates/NOTES.txt | 22 ++++ container/cu_helm/cu/templates/_helpers.tpl | 62 +++++++++++ container/cu_helm/cu/templates/deployment.yaml | 76 ++++++++++++++ container/cu_helm/cu/templates/hpa.yaml | 32 ++++++ container/cu_helm/cu/templates/ingress.yaml | 61 +++++++++++ container/cu_helm/cu/templates/service.yaml | 15 +++ container/cu_helm/cu/templates/serviceaccount.yaml | 13 +++ .../cu/templates/tests/test-connection.yaml | 15 +++ container/cu_helm/cu/values.yaml | 110 ++++++++++++++++++++ container/du_helm/du/.helmignore | 23 +++++ container/du_helm/du/Chart.yaml | 24 +++++ container/du_helm/du/templates/NOTES.txt | 22 ++++ container/du_helm/du/templates/_helpers.tpl | 62 +++++++++++ container/du_helm/du/templates/deployment.yaml | 76 ++++++++++++++ container/du_helm/du/templates/hpa.yaml | 32 ++++++ container/du_helm/du/templates/ingress.yaml | 61 +++++++++++ container/du_helm/du/templates/service.yaml | 19 ++++ container/du_helm/du/templates/serviceaccount.yaml | 13 +++ .../du/templates/tests/test-connection.yaml | 15 +++ container/du_helm/du/values.yaml | 115 +++++++++++++++++++++ container/ric_helm/ric/.helmignore | 23 +++++ container/ric_helm/ric/Chart.yaml | 24 +++++ container/ric_helm/ric/templates/NOTES.txt | 22 ++++ container/ric_helm/ric/templates/_helpers.tpl | 62 +++++++++++ container/ric_helm/ric/templates/deployment.yaml | 76 ++++++++++++++ container/ric_helm/ric/templates/hpa.yaml | 32 ++++++ container/ric_helm/ric/templates/ingress.yaml | 61 +++++++++++ container/ric_helm/ric/templates/service.yaml | 15 +++ .../ric_helm/ric/templates/serviceaccount.yaml | 13 +++ .../ric/templates/tests/test-connection.yaml | 15 +++ container/ric_helm/ric/values.yaml | 114 ++++++++++++++++++++ cu-docker-entrypoint.sh | 22 ++++ du-docker-entrypoint.sh | 33 ++++++ ric-docker-entrypoint.sh | 21 ++++ src/cu_stub/cu_stub_sctp.c | 71 ++++++++++++- src/du_app/du_cfg.c | 4 +- src/ric_stub/ric_stub_sctp.c | 33 ++++++ 43 files changed, 1731 insertions(+), 8 deletions(-) create mode 100644 Dockerfile.cu create mode 100644 Dockerfile.du create mode 100644 Dockerfile.ric create mode 100644 container/cu_helm/cu/.helmignore create mode 100644 container/cu_helm/cu/Chart.yaml create mode 100644 container/cu_helm/cu/templates/NOTES.txt create mode 100644 container/cu_helm/cu/templates/_helpers.tpl create mode 100644 container/cu_helm/cu/templates/deployment.yaml create mode 100644 container/cu_helm/cu/templates/hpa.yaml create mode 100644 container/cu_helm/cu/templates/ingress.yaml create mode 100644 container/cu_helm/cu/templates/service.yaml create mode 100644 container/cu_helm/cu/templates/serviceaccount.yaml create mode 100644 container/cu_helm/cu/templates/tests/test-connection.yaml create mode 100644 container/cu_helm/cu/values.yaml create mode 100644 container/du_helm/du/.helmignore create mode 100644 container/du_helm/du/Chart.yaml create mode 100644 container/du_helm/du/templates/NOTES.txt create mode 100644 container/du_helm/du/templates/_helpers.tpl create mode 100644 container/du_helm/du/templates/deployment.yaml create mode 100644 container/du_helm/du/templates/hpa.yaml create mode 100644 container/du_helm/du/templates/ingress.yaml create mode 100644 container/du_helm/du/templates/service.yaml create mode 100644 container/du_helm/du/templates/serviceaccount.yaml create mode 100644 container/du_helm/du/templates/tests/test-connection.yaml create mode 100644 container/du_helm/du/values.yaml create mode 100644 container/ric_helm/ric/.helmignore create mode 100644 container/ric_helm/ric/Chart.yaml create mode 100644 container/ric_helm/ric/templates/NOTES.txt create mode 100644 container/ric_helm/ric/templates/_helpers.tpl create mode 100644 container/ric_helm/ric/templates/deployment.yaml create mode 100644 container/ric_helm/ric/templates/hpa.yaml create mode 100644 container/ric_helm/ric/templates/ingress.yaml create mode 100644 container/ric_helm/ric/templates/service.yaml create mode 100644 container/ric_helm/ric/templates/serviceaccount.yaml create mode 100644 container/ric_helm/ric/templates/tests/test-connection.yaml create mode 100644 container/ric_helm/ric/values.yaml create mode 100755 cu-docker-entrypoint.sh create mode 100755 du-docker-entrypoint.sh create mode 100755 ric-docker-entrypoint.sh diff --git a/Dockerfile.cu b/Dockerfile.cu new file mode 100644 index 000000000..770b0675b --- /dev/null +++ b/Dockerfile.cu @@ -0,0 +1,60 @@ +FROM ubuntu:22.04 + +LABEL description="This docker file isused to build CU Image" + + +WORKDIR /root + +# Update package lists and install required packages +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + git \ + libsctp-dev \ + libpcap-dev \ + libxml2-dev \ + vim \ + libxml2-utils \ + zip \ + unzip \ + lksctp-tools \ + python3-dev \ + python3-setuptools \ + libreadline-dev \ + python3-pip \ + build-essential \ + libffi6* \ + libssl-dev \ + python3-paramiko \ + apt-utils \ + openssh-client \ + iproute2 \ + libglib* \ + autoconf automake autotools-dev libtool \ + libhugetlbfs-dev* \ + numactl \ + libnuma-dev \ + python3 \ + iproute2 \ + net-tools \ + libnuma-dev \ + dnsutils \ + python3-pip \ + python3-paramiko \ + pciutils \ + libcurl4 \ + vim \ + net-tools \ + gdb \ + libjansson-dev \ + && rm -rf /var/lib/apt/lists/* + + +COPY . /root/l2 + +COPY cu-docker-entrypoint.sh /root/ + +RUN cd /root/ && chmod +x cu-docker-entrypoint.sh + +ENTRYPOINT ["/root/cu-docker-entrypoint.sh"] + + diff --git a/Dockerfile.du b/Dockerfile.du new file mode 100644 index 000000000..4fad68625 --- /dev/null +++ b/Dockerfile.du @@ -0,0 +1,61 @@ +FROM ubuntu:22.04 + +LABEL description="This docker file isused to build CU Image" + + +WORKDIR /root + +# Update package lists and install required packages +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + git \ + libsctp-dev \ + libpcap-dev \ + libxml2-dev \ + vim \ + libxml2-utils \ + zip \ + unzip \ + lksctp-tools \ + python3-dev \ + python3-setuptools \ + libreadline-dev \ + python3-pip \ + build-essential \ + libffi6* \ + libssl-dev \ + python3-paramiko \ + apt-utils \ + openssh-client \ + iproute2 \ + libglib* \ + autoconf automake autotools-dev libtool \ + libhugetlbfs-dev* \ + numactl \ + libnuma-dev \ + python3 \ + iproute2 \ + net-tools \ + libnuma-dev \ + dnsutils \ + python3-pip \ + python3-paramiko \ + pciutils \ + libcurl4 \ + vim \ + net-tools \ + gdb \ + libjansson-dev \ + && rm -rf /var/lib/apt/lists/* + + +COPY . /root/l2 + + +COPY du-docker-entrypoint.sh /root/ + +RUN cd /root/ && chmod +x du-docker-entrypoint.sh + +ENTRYPOINT ["/root/du-docker-entrypoint.sh"] + + diff --git a/Dockerfile.ric b/Dockerfile.ric new file mode 100644 index 000000000..6b7fcb79d --- /dev/null +++ b/Dockerfile.ric @@ -0,0 +1,60 @@ +FROM ubuntu:22.04 + +LABEL description="This docker file isused to build CU Image" + + +WORKDIR /root + +# Update package lists and install required packages +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + git \ + libsctp-dev \ + libpcap-dev \ + libxml2-dev \ + vim \ + libxml2-utils \ + zip \ + unzip \ + lksctp-tools \ + python3-dev \ + python3-setuptools \ + libreadline-dev \ + python3-pip \ + build-essential \ + libffi6* \ + libssl-dev \ + python3-paramiko \ + apt-utils \ + openssh-client \ + iproute2 \ + libglib* \ + autoconf automake autotools-dev libtool \ + libhugetlbfs-dev* \ + numactl \ + libnuma-dev \ + python3 \ + iproute2 \ + net-tools \ + libnuma-dev \ + dnsutils \ + python3-pip \ + python3-paramiko \ + pciutils \ + libcurl4 \ + vim \ + net-tools \ + gdb \ + libjansson-dev \ + && rm -rf /var/lib/apt/lists/* + + +COPY . /root/l2 + +COPY ric-docker-entrypoint.sh /root/ + +RUN cd /root/ && chmod +x ric-docker-entrypoint.sh + +ENTRYPOINT ["/root/ric-docker-entrypoint.sh"] + + diff --git a/build/odu/makefile b/build/odu/makefile index a6f9061be..2715660b1 100644 --- a/build/odu/makefile +++ b/build/odu/makefile @@ -74,7 +74,7 @@ endif # macro for output file name and makefile name # -PLTFRM_FLAGS=-UMSPD -DODU -DINTEL_FAPI -UODU_MEMORY_DEBUG_LOG -DDEBUG_ASN_PRINT -UDEBUG_PRINT -DERROR_PRINT -USTART_DL_UL_DATA -UNR_DRX -UCALL_FLOW_DEBUG_LOG -UODU_SLOT_IND_DEBUG_LOG -UNFAPI_ENABLED -UTHREAD_AFFINITY -UMEM_SIZE_CHECK -UFAPI_DECODER +PLTFRM_FLAGS=-UMSPD -DODU -DINTEL_FAPI -UODU_MEMORY_DEBUG_LOG -DDEBUG_ASN_PRINT -UDEBUG_PRINT -DERROR_PRINT -USTART_DL_UL_DATA -UNR_DRX -UCALL_FLOW_DEBUG_LOG -UODU_SLOT_IND_DEBUG_LOG -UNFAPI_ENABLED -UTHREAD_AFFINITY -UMEM_SIZE_CHECK -UFAPI_DECODER -UCONTAINERIZE ifeq ($(MODE),TDD) PLTFRM_FLAGS += -DNR_TDD diff --git a/container/cu_helm/cu/.helmignore b/container/cu_helm/cu/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/container/cu_helm/cu/.helmignore @@ -0,0 +1,23 @@ +# 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/ diff --git a/container/cu_helm/cu/Chart.yaml b/container/cu_helm/cu/Chart.yaml new file mode 100644 index 000000000..0d8cc34d2 --- /dev/null +++ b/container/cu_helm/cu/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: cu +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/container/cu_helm/cu/templates/NOTES.txt b/container/cu_helm/cu/templates/NOTES.txt new file mode 100644 index 000000000..3a8f95df8 --- /dev/null +++ b/container/cu_helm/cu/templates/NOTES.txt @@ -0,0 +1,22 @@ +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 "cu.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 the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "cu.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "cu.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 "cu.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 }} diff --git a/container/cu_helm/cu/templates/_helpers.tpl b/container/cu_helm/cu/templates/_helpers.tpl new file mode 100644 index 000000000..eb4e48086 --- /dev/null +++ b/container/cu_helm/cu/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "cu.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 "cu.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 "cu.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "cu.labels" -}} +helm.sh/chart: {{ include "cu.chart" . }} +{{ include "cu.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "cu.selectorLabels" -}} +app.kubernetes.io/name: {{ include "cu.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "cu.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "cu.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/container/cu_helm/cu/templates/deployment.yaml b/container/cu_helm/cu/templates/deployment.yaml new file mode 100644 index 000000000..8b4aa09f5 --- /dev/null +++ b/container/cu_helm/cu/templates/deployment.yaml @@ -0,0 +1,76 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "cu.fullname" . }} + labels: + {{- include "cu.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "cu.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "cu.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "cu.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: [ "/bin/bash", "-c", "--"] + #args: [ "sleep 60; /root/docker-entrypoint.sh" ] + args: [ "sleep 60000000000000000000;"] + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: {{ .Values.service.protocol }} + env: + {{- range .Values.env }} + - name: {{ .name }} + value: {{ .value | quote }} + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/container/cu_helm/cu/templates/hpa.yaml b/container/cu_helm/cu/templates/hpa.yaml new file mode 100644 index 000000000..b3428c5a9 --- /dev/null +++ b/container/cu_helm/cu/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "cu.fullname" . }} + labels: + {{- include "cu.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "cu.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/container/cu_helm/cu/templates/ingress.yaml b/container/cu_helm/cu/templates/ingress.yaml new file mode 100644 index 000000000..64e710fcb --- /dev/null +++ b/container/cu_helm/cu/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "cu.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "cu.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/container/cu_helm/cu/templates/service.yaml b/container/cu_helm/cu/templates/service.yaml new file mode 100644 index 000000000..f4dc11fb0 --- /dev/null +++ b/container/cu_helm/cu/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "cu.fullname" . }} + labels: + {{- include "cu.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetPort }} + protocol: {{ .Values.service.protocol }} + name: f1ap + selector: + {{- include "cu.selectorLabels" . | nindent 4 }} diff --git a/container/cu_helm/cu/templates/serviceaccount.yaml b/container/cu_helm/cu/templates/serviceaccount.yaml new file mode 100644 index 000000000..8ff8fd05f --- /dev/null +++ b/container/cu_helm/cu/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "cu.serviceAccountName" . }} + labels: + {{- include "cu.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/container/cu_helm/cu/templates/tests/test-connection.yaml b/container/cu_helm/cu/templates/tests/test-connection.yaml new file mode 100644 index 000000000..83e1eb5d0 --- /dev/null +++ b/container/cu_helm/cu/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "cu.fullname" . }}-test-connection" + labels: + {{- include "cu.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "cu.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/container/cu_helm/cu/values.yaml b/container/cu_helm/cu/values.yaml new file mode 100644 index 000000000..3e9afbcdb --- /dev/null +++ b/container/cu_helm/cu/values.yaml @@ -0,0 +1,110 @@ +# Default values for cu. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: new-cu-container + # pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: v1 + + #imagePullSecrets: +nameOverride: "" +fullnameOverride: "" + +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: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 38472 + protocol: SCTP + targetPort: 38472 + + +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 + + +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: {} + +env: + - name: CU_ADDRESS + value: ocu + - name: DU_ADDRESS + value: odu + diff --git a/container/du_helm/du/.helmignore b/container/du_helm/du/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/container/du_helm/du/.helmignore @@ -0,0 +1,23 @@ +# 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/ diff --git a/container/du_helm/du/Chart.yaml b/container/du_helm/du/Chart.yaml new file mode 100644 index 000000000..03620484d --- /dev/null +++ b/container/du_helm/du/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: du +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/container/du_helm/du/templates/NOTES.txt b/container/du_helm/du/templates/NOTES.txt new file mode 100644 index 000000000..3203f35e7 --- /dev/null +++ b/container/du_helm/du/templates/NOTES.txt @@ -0,0 +1,22 @@ +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 "du.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 the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "du.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "du.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 "du.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 }} diff --git a/container/du_helm/du/templates/_helpers.tpl b/container/du_helm/du/templates/_helpers.tpl new file mode 100644 index 000000000..99938f261 --- /dev/null +++ b/container/du_helm/du/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "du.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 "du.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 "du.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "du.labels" -}} +helm.sh/chart: {{ include "du.chart" . }} +{{ include "du.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "du.selectorLabels" -}} +app.kubernetes.io/name: {{ include "du.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "du.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "du.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/container/du_helm/du/templates/deployment.yaml b/container/du_helm/du/templates/deployment.yaml new file mode 100644 index 000000000..28e27bfd1 --- /dev/null +++ b/container/du_helm/du/templates/deployment.yaml @@ -0,0 +1,76 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "du.fullname" . }} + labels: + {{- include "du.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "du.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "du.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "du.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: [ "/bin/bash", "-c", "--"] + #args: [ "sleep 60; /root/docker-entrypoint.sh" ] + args: [ "sleep 60000000000000000000;"] + #ports: + #- name: http + # containerPort: {{ .Values.service.port }} + # protocol: {{ .Values.service.protocol }} + env: + {{- range .Values.env }} + - name: {{ .name }} + value: {{ .value | quote }} + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/container/du_helm/du/templates/hpa.yaml b/container/du_helm/du/templates/hpa.yaml new file mode 100644 index 000000000..68b06c67a --- /dev/null +++ b/container/du_helm/du/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "du.fullname" . }} + labels: + {{- include "du.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "du.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/container/du_helm/du/templates/ingress.yaml b/container/du_helm/du/templates/ingress.yaml new file mode 100644 index 000000000..3e136133a --- /dev/null +++ b/container/du_helm/du/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "du.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "du.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/container/du_helm/du/templates/service.yaml b/container/du_helm/du/templates/service.yaml new file mode 100644 index 000000000..77b713256 --- /dev/null +++ b/container/du_helm/du/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "du.fullname" . }} + labels: + {{- include "du.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.f1port }} + targetPort: {{ .Values.service.f1targetPort }} + protocol: {{ .Values.service.f1protocol }} + name: f1ap + - port: {{ .Values.service.e2port }} + targetPort: {{ .Values.service.e2targetPort }} + protocol: {{ .Values.service.e2protocol }} + name: e2ap + selector: + {{- include "du.selectorLabels" . | nindent 4 }} diff --git a/container/du_helm/du/templates/serviceaccount.yaml b/container/du_helm/du/templates/serviceaccount.yaml new file mode 100644 index 000000000..edb18b382 --- /dev/null +++ b/container/du_helm/du/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "du.serviceAccountName" . }} + labels: + {{- include "du.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/container/du_helm/du/templates/tests/test-connection.yaml b/container/du_helm/du/templates/tests/test-connection.yaml new file mode 100644 index 000000000..77256389f --- /dev/null +++ b/container/du_helm/du/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "du.fullname" . }}-test-connection" + labels: + {{- include "du.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "du.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/container/du_helm/du/values.yaml b/container/du_helm/du/values.yaml new file mode 100644 index 000000000..8b0a01996 --- /dev/null +++ b/container/du_helm/du/values.yaml @@ -0,0 +1,115 @@ +# Default values for du. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: new-du-container + # pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: v1 + + #imagePullSecrets: + #- name: local-registry +nameOverride: "" +fullnameOverride: "" + +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: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + f1port: 38472 + f1protocol: SCTP + f1targetPort: 38472 + e2port: 36421 + e2protocol: SCTP + e2targetPort: 36421 + + +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 + + +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: {} + +env: + - name: CU_ADDRESS + value: ocu + - name: DU_ADDRESS + value: odu + - name: RIC_ADDRESS + value: ric diff --git a/container/ric_helm/ric/.helmignore b/container/ric_helm/ric/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/container/ric_helm/ric/.helmignore @@ -0,0 +1,23 @@ +# 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/ diff --git a/container/ric_helm/ric/Chart.yaml b/container/ric_helm/ric/Chart.yaml new file mode 100644 index 000000000..a474c7c65 --- /dev/null +++ b/container/ric_helm/ric/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: ric +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/container/ric_helm/ric/templates/NOTES.txt b/container/ric_helm/ric/templates/NOTES.txt new file mode 100644 index 000000000..78d361667 --- /dev/null +++ b/container/ric_helm/ric/templates/NOTES.txt @@ -0,0 +1,22 @@ +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 "ric.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 the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "ric.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ric.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 "ric.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 }} diff --git a/container/ric_helm/ric/templates/_helpers.tpl b/container/ric_helm/ric/templates/_helpers.tpl new file mode 100644 index 000000000..759c70951 --- /dev/null +++ b/container/ric_helm/ric/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "ric.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 "ric.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 "ric.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "ric.labels" -}} +helm.sh/chart: {{ include "ric.chart" . }} +{{ include "ric.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "ric.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ric.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "ric.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "ric.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/container/ric_helm/ric/templates/deployment.yaml b/container/ric_helm/ric/templates/deployment.yaml new file mode 100644 index 000000000..8259473a4 --- /dev/null +++ b/container/ric_helm/ric/templates/deployment.yaml @@ -0,0 +1,76 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "ric.fullname" . }} + labels: + {{- include "ric.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "ric.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "ric.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "ric.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: [ "/bin/bash", "-c", "--"] + #args: [ "sleep 60; /root/docker-entrypoint.sh" ] + args: [ "sleep 60000000000000000000;"] + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: {{ .Values.service.protocol }} + env: + {{- range .Values.env }} + - name: {{ .name }} + value: {{ .value | quote }} + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/container/ric_helm/ric/templates/hpa.yaml b/container/ric_helm/ric/templates/hpa.yaml new file mode 100644 index 000000000..b0bab98b0 --- /dev/null +++ b/container/ric_helm/ric/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "ric.fullname" . }} + labels: + {{- include "ric.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "ric.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/container/ric_helm/ric/templates/ingress.yaml b/container/ric_helm/ric/templates/ingress.yaml new file mode 100644 index 000000000..37d14dfd2 --- /dev/null +++ b/container/ric_helm/ric/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "ric.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "ric.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/container/ric_helm/ric/templates/service.yaml b/container/ric_helm/ric/templates/service.yaml new file mode 100644 index 000000000..f0b5ddf9b --- /dev/null +++ b/container/ric_helm/ric/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "ric.fullname" . }} + labels: + {{- include "ric.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetPort }} + protocol: {{ .Values.service.protocol }} + name: e2ap + selector: + {{- include "ric.selectorLabels" . | nindent 4 }} diff --git a/container/ric_helm/ric/templates/serviceaccount.yaml b/container/ric_helm/ric/templates/serviceaccount.yaml new file mode 100644 index 000000000..b3f7d0839 --- /dev/null +++ b/container/ric_helm/ric/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "ric.serviceAccountName" . }} + labels: + {{- include "ric.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/container/ric_helm/ric/templates/tests/test-connection.yaml b/container/ric_helm/ric/templates/tests/test-connection.yaml new file mode 100644 index 000000000..a6d9d1651 --- /dev/null +++ b/container/ric_helm/ric/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "ric.fullname" . }}-test-connection" + labels: + {{- include "ric.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "ric.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/container/ric_helm/ric/values.yaml b/container/ric_helm/ric/values.yaml new file mode 100644 index 000000000..bb22be2b3 --- /dev/null +++ b/container/ric_helm/ric/values.yaml @@ -0,0 +1,114 @@ +# Default values for ric. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: new-ric-container + # pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: v1 + + #imagePullSecrets: +nameOverride: "" +fullnameOverride: "" + +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: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 36421 + protocol: SCTP + targetPort: 36421 + + +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 + + +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: {} + +env: + - name: CU_ADDRESS + value: ocu + - name: DU_ADDRESS + value: odu + - name: RIC_PORT + value: "36421" + - name: RIC_ADDRESS + value: ric + diff --git a/cu-docker-entrypoint.sh b/cu-docker-entrypoint.sh new file mode 100755 index 000000000..82f90f44b --- /dev/null +++ b/cu-docker-entrypoint.sh @@ -0,0 +1,22 @@ +export CU_LOCAL=`ifconfig eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}'` +echo CU_LOCAL IP address is "$CU_LOCAL" + + +DU_IP=`nslookup ${DU_ADDRESS} | grep Address | awk 'NR==2' | cut -d: -f2 | awk '{print $1}'` +if [ -z "$DU_IP" ] +then + echo "CU not able to fetch DU Service IP address" + echo "CU Stopped......!" + exit +else + echo DU Service IP address is "$DU_IP" +fi +DU_SVC_IP="$DU_IP" + +sed -i "s/192.168.130.82/$CU_LOCAL/g" l2/src/cu_stub/cu_stub.h +sed -i "s/192.168.130.81/$DU_IP/g" l2/src/cu_stub/cu_stub.h +cd /root/l2/build/odu/ +sed -i "s/UCONTAINERIZE/DCONTAINERIZE/g" makefile +make clean_cu cu_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD + + diff --git a/du-docker-entrypoint.sh b/du-docker-entrypoint.sh new file mode 100755 index 000000000..69b96a5f7 --- /dev/null +++ b/du-docker-entrypoint.sh @@ -0,0 +1,33 @@ +export DU_LOCAL=`ifconfig eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}'` +echo DU_F1C IP address is "$DU_LOCAL" + +CU_IP=`nslookup ${CU_ADDRESS} | grep Address | awk 'NR==2' | cut -d: -f2 | awk '{print $1}'` +if [ -z "$CU_IP" ] +then + echo "DU not able to fetch CU Service IP address" + echo "DU Stopped......!" + exit +else + echo CU Service IP address is "$CU_IP" +fi +CU_SVC_IP="$CU_IP" + +RIC_IP=`nslookup ${RIC_ADDRESS} | grep Address | awk 'NR==2' | cut -d: -f2 | awk '{print $1}'` +if [ -z "$RIC_IP" ] +then + echo "DU not able to fetch RIC Service IP address" + echo "DU Stopped......!" + exit +else + echo RIC Service IP address is "$RIC_IP" +fi +RIC_SVC_IP="$RIC_IP" + +sed -i "s/192.168.130.82/$CU_IP/g" l2/build/config/fdd_odu_config.xml l2/build/config/tdd_odu_config.xml +sed -i "s/192.168.130.80/$RIC_IP/g" l2/build/config/fdd_odu_config.xml l2/build/config/tdd_odu_config.xml +sed -i "s/192.168.130.81/$DU_LOCAL/g" l2/build/config/fdd_odu_config.xml l2/build/config/tdd_odu_config.xml +cd l2/build/odu +sed -i "s/UCONTAINERIZE/DCONTAINERIZE/g" makefile +make clean_odu odu MACHINE=BIT64 MODE=FDD + + diff --git a/ric-docker-entrypoint.sh b/ric-docker-entrypoint.sh new file mode 100755 index 000000000..d77f63293 --- /dev/null +++ b/ric-docker-entrypoint.sh @@ -0,0 +1,21 @@ +export RIC_LOCAL=`ifconfig eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}'` +echo RIC_LOCAL IP address is "$RIC_LOCAL" + +DU_IP=`nslookup ${DU_ADDRESS} | grep Address | awk 'NR==2' | cut -d: -f2 | awk '{print $1}'` +if [ -z "$DU_IP" ] +then + echo "RIC not able to fetch DU Service IP address" + echo "RIC Stopped......!" + exit +else + echo DU Service IP address is "$DU_IP" +fi +DU_SVC_IP="$DU_IP" + +sed -i "s/192.168.130.80/$RIC_LOCAL/g" l2/src/ric_stub/ric_stub.h +sed -i "s/192.168.130.81/$DU_IP/g" l2/src/ric_stub/ric_stub.h +cd /root/l2/build/odu/ +sed -i "s/UCONTAINERIZE/DCONTAINERIZE/g" makefile +make clean_ric ric_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD + + diff --git a/src/cu_stub/cu_stub_sctp.c b/src/cu_stub/cu_stub_sctp.c index 49ef03eee..794881cf4 100644 --- a/src/cu_stub/cu_stub_sctp.c +++ b/src/cu_stub/cu_stub_sctp.c @@ -178,12 +178,39 @@ uint8_t fillAddrLst(CmInetNetAddrLst *addrLstPtr, SctpIpAddr *ipAddr) *******************************************************************************/ uint8_t fillDestNetAddr(CmInetNetAddr *destAddrPtr, SctpIpAddr *dstIpPtr) { - /* Filling destination address */ - destAddrPtr->type = CM_INET_IPV4ADDR_TYPE; - destAddrPtr->u.ipv4NetAddr = CM_INET_NTOH_UINT32(dstIpPtr->ipV4Addr); - return ROK; + /* Filling destination address */ + destAddrPtr->type = CM_INET_IPV4ADDR_TYPE; + destAddrPtr->u.ipv4NetAddr = CM_INET_NTOH_UINT32(dstIpPtr->ipV4Addr); + return ROK; } +#ifdef CONTAINERIZE +/****************************************************************************** + * + * @brief in case of containerization the du ip recive only after completeing the + * sctp connection that's why updating the duip after sctpAccept. + * + * @details + * + * Function : updateDestAddrPtr + * + * Functionality: + * updating the destAddrPtr in database + * + * @params[in] DuSctpDestCb *paramPtr + * CmInetAddr *peerAddr + * @return ROK - success + * RFAILED - failure + * + *******************************************************************************/ + +void updateDestAddrPtr(CmInetNetAddr *destAddrPtr, CmInetAddr *peerAddr) +{ + destAddrPtr->type = CM_INET_IPV4ADDR_TYPE; + destAddrPtr->u.ipv4NetAddr = peerAddr->address; +} +#endif + /****************************************************************************** * * @brief Eastablishes the Assoc Req for the received interface type @@ -207,7 +234,40 @@ uint8_t sctpStartReq() uint8_t ret = ROK; CmInetFd sockFd; +#ifdef CONTAINERIZE socket_type = CM_INET_STREAM; + if((ret = cmInetSocket(socket_type, &sctpCb.f1LstnSockFd, IPPROTO_SCTP) != ROK)) + { + DU_LOG("\nERROR --> SCTP : Socket[%d] coudnt open for listening", sctpCb.f1LstnSockFd.fd); + } + else if((ret = cmInetSctpBindx(&sctpCb.f1LstnSockFd, &sctpCb.localAddrLst, sctpCb.sctpCfg.f1SctpInfo.port)) != ROK) + { + DU_LOG("\nERROR --> SCTP: Binding failed at CU"); + } + else if(ret = cmInetListen(&sctpCb.f1LstnSockFd, 1) != ROK) + { + DU_LOG("\nERROR --> SCTP : Listening on socket failed"); + cmInetClose(&sctpCb.f1LstnSockFd); + return RFAILED; + } + else + { + for(assocIdx=0; assocIdx < sctpCb.numAssoc; assocIdx++) + { + if(sctpCb.assocCb[assocIdx].intf == F1_INTERFACE) + { + if((ret = sctpAccept(&sctpCb.f1LstnSockFd, &sctpCb.assocCb[assocIdx])) != ROK) + { + DU_LOG("\nERROR --> SCTP: Unable to accept the connection at CU"); + } + else + { + updateDestAddrPtr(&sctpCb.assocCb[assocIdx].destIpNetAddr, &sctpCb.assocCb[assocIdx].peerAddr); + } + } + } + } +#else /* Establish SCTP association at XN interface */ if(sctpCb.sctpCfg.xnSctpInfo.numDestNode) @@ -314,7 +374,7 @@ uint8_t sctpStartReq() } } } - +#endif if(ret == ROK) { if(sctpSockPoll() != ROK) @@ -405,6 +465,7 @@ uint8_t sctpAccept(CmInetFd *lstnSockFd, CuSctpAssocCb *assocCb) break; } } + DU_LOG("\nINFO --> SCTP : Connection established"); return ROK; diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index 239285ab2..deef4c58b 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -5559,8 +5559,8 @@ void printDuConfig() egtp = &duCfgParam.egtpParams; DU_LOG("\n ** EGTP PARAMETER ** \n"); - DU_LOG("DU IP Address %d\n", egtp->localIp.ipV4Addr); - DU_LOG("CU IP Address %d\n", egtp->destIp.ipV4Addr); + DU_LOG("DU IP Address %u\n", egtp->localIp.ipV4Addr); + DU_LOG("CU IP Address %u\n", egtp->destIp.ipV4Addr); DU_LOG("EGTP Port at DU %d\n", egtp->localPort); DU_LOG("EGTP Port at CU %d\n", egtp->destPort); DU_LOG("Minimum Tunnel ID %d\n", egtp->minTunnelId); diff --git a/src/ric_stub/ric_stub_sctp.c b/src/ric_stub/ric_stub_sctp.c index a0a455a4b..bb5facea7 100644 --- a/src/ric_stub/ric_stub_sctp.c +++ b/src/ric_stub/ric_stub_sctp.c @@ -114,6 +114,33 @@ uint8_t fillDestNetAddr(CmInetNetAddr *destAddrPtr, SctpIpAddr *dstIpPtr) return ROK; } +#ifdef CONTAINERIZE +/****************************************************************************** + * + * @brief in case of containerization the du ip recive only after completeing the + * sctp connection that's why updating the duip after sctpAccept. + * + * @details + * + * Function : updateDestAddrPtr + * + * Functionality: + * updating the destAddrPtr in database + * + * @params[in] DuSctpDestCb *paramPtr + * CmInetAddr *peerAddr + * @return ROK - success + * RFAILED - failure + * + *******************************************************************************/ + +void updateDestAddrPtr(CmInetNetAddr *destAddrPtr, CmInetAddr *peerAddr) +{ + destAddrPtr->type = CM_INET_IPV4ADDR_TYPE; + destAddrPtr->u.ipv4NetAddr = peerAddr->address; +} +#endif + /****************************************************************************** * * @brief Eastablishes the Assoc Req for the received interface type @@ -164,6 +191,12 @@ uint8_t sctpStartReq() { DU_LOG("\nERROR --> SCTP: Unable to accept the connection at RIC"); } + else + { +#ifdef CONTAINERIZE + updateDestAddrPtr(&sctpCb.assocCb[assocIdx].destIpNetAddr, &sctpCb.assocCb[assocIdx].peerAddr); +#endif + } } } } -- 2.16.6