Skip to content

Commit

Permalink
Added srsran-5g charts (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpontongradiant authored Feb 28, 2024
1 parent e7221f2 commit 403cd01
Show file tree
Hide file tree
Showing 24 changed files with 2,657 additions and 0 deletions.
18 changes: 18 additions & 0 deletions charts/srsran-5g-zmq/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v2
appVersion: "23.10.1"
description: >
Helm chart to deploy srsRAN 5G gNB on Kubernetes.
sources:
- https://github.com/gradiant/5g-charts
- https://github.com/srsran/srsRAN_Project
maintainers:
- email: [email protected]
name: avrodriguez
name: srsran-5g-zmq
version: 1.0.0
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
tags:
- bitnami-common
version: 1.x.x
21 changes: 21 additions & 0 deletions charts/srsran-5g-zmq/resources/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -ex

if [ $# -lt 1 ]
then
echo "Usage : $0 [gnb]"
exit
fi

if [[ ! -z "$AMF_HOSTNAME" ]] ; then
export AMF_ADDR="$(host -4 $AMF_HOSTNAME |awk '/has.*address/{print $NF; exit}')"
fi

if [[ -z "${AMF_BIND_ADDR}" ]] ; then
export AMF_BIND_ADDR=$(ip addr show $AMF_BIND_INTERFACE | grep -Po 'inet \K[\d.]+')
fi

envsubst < /gnb-template.yml > gnb.yml

/opt/srsRAN_Project/target/bin/gnb -c gnb.yml
50 changes: 50 additions & 0 deletions charts/srsran-5g-zmq/resources/gnb-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This example configuration outlines how to configure the srsRAN Project gNB to create a single TDD cell
# transmitting in band 78, with 20 MHz bandwidth and 30 kHz sub-carrier-spacing. A USRP B200 is configured
# as the RF frontend using split 8. Note in this example an external clock source is not used, so the sync
# is not defined and the default is used.

amf:
addr: ${AMF_ADDR} # The address or hostname of the AMF.
bind_addr: ${AMF_BIND_ADDR} # A local IP that the gNB binds to for traffic from the AMF.

ru_sdr:
device_driver: {{ .Values.config.ru_sdr.device_driver }} # The RF driver name.
device_args: {{ .Values.config.ru_sdr.device_args }} # Optionally pass arguments to the selected RF driver.
srate: {{ .Values.config.ru_sdr.srate }}
tx_gain: {{ .Values.config.ru_sdr.tx_gain }} # Transmit gain of the RF might need to adjusted to the given situation.
rx_gain: {{ .Values.config.ru_sdr.rx_gain }} # Receive gain of the RF might need to adjusted to the given situation.

cell_cfg:
dl_arfcn: {{ .Values.config.cell_cfg.dl_arfcn }} # ARFCN of the downlink carrier (center frequency).
band: {{ .Values.config.cell_cfg.band }} # The NR band.
channel_bandwidth_MHz: {{ .Values.config.cell_cfg.channel_bandwidth_MHz }} # Bandwith in MHz. Number of PRBs will be automatically derived.
common_scs: {{ .Values.config.cell_cfg.common_scs }} # Subcarrier spacing in kHz used for data.
plmn: {{ .Values.config.cell_cfg.plmn }} # PLMN broadcasted by the gNB.
tac: {{ .Values.config.cell_cfg.tac }} # Tracking area code (needs to match the core configuration).
pdcch:
common:
ss0_index: 0 # Set search space zero index to match srsUE capabilities
coreset0_index: 12 # Set search CORESET Zero index to match srsUE capabilities
dedicated:
ss2_type: common # Search Space type, has to be set to common
dci_format_0_1_and_1_1: false # Set correct DCI format (fallback)
prach:
prach_config_index: 1 # Sets PRACH config to match what is expected by srsUE



slicing:
{{- range .Values.config.slicing }}
- {{- toYaml . | nindent 6 }}
{{- end }}


log:
filename: ./gnb.log # Path of the log file.
all_level: debug # Logging level applied to all layers.

pcap:
mac_enable: false # Set to true to enable MAC-layer PCAPs.
mac_filename: ./gnb_mac.pcap # Path where the MAC PCAP is stored.
ngap_enable: false # Set to true to enable NGAP PCAPs.
ngap_filename: ./gnb_ngap.pcap # Path where the NGAP PCAP is stored.
94 changes: 94 additions & 0 deletions charts/srsran-5g-zmq/resources/ue.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
[rf]
freq_offset = 0
tx_gain = 50
rx_gain = 40
srate = 23.04e6
nof_antennas = 1

device_name = zmq
device_args = tx_port=tcp://127.0.0.1:2001,rx_port=tcp://127.0.0.1:2000,id=ue,base_srate=23.04e6

[rat.eutra]
dl_earfcn = 2850
nof_carriers = 0

[rat.nr]
nof_prb = 106
max_nof_prb = 106
bands = 3
nof_carriers = 1

[pcap]
enable = none
mac_filename = /tmp/ue_mac.pcap
mac_nr_filename = /tmp/ue_mac_nr.pcap
nas_filename = /tmp/ue_nas.pcap

[log]
all_level = debug
phy_lib_level = none
all_hex_limit = 32
filename = /tmp/ue.log
file_max_size = -1

[usim]
mode = soft
algo = mil
opc = {{ .Values.ue.config.opc }}
k = {{ .Values.ue.config.k }}
imsi = {{ .Values.ue.config.imsi }}
imei = {{ .Values.ue.config.imei }}

[rrc]
release = 15
ue_category = 4

[nas]
apn = internet
apn_protocol = ipv4



[gw]
netns =
ip_devname = tun_srsue
ip_netmask = 255.255.255.0

[gui]
enable = false

[channel.dl]

[channel.dl.awgn]

[channel.dl.fading]

[channel.dl.delay]

[channel.dl.rlf]

[channel.dl.hst]

[channel.ul]

[channel.ul.awgn]

[channel.ul.fading]

[channel.ul.delay]

[channel.ul.rlf]

[channel.ul.hst]

[phy]



[phy.nr]

[cfr]

[sim]

[general]
107 changes: 107 additions & 0 deletions charts/srsran-5g-zmq/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{{/*
Return the proper srsran image name
*/}}
{{- define "srsran.image" -}}
{{- include "common.images.image" (dict "imageRoot" .Values.image.srsran "global" .Values.global) -}}
{{- end -}}


{{/*
Return the secret based on imageCredentials
*/}}
{{- define "srsran.dockerconfig" }}
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.imageCredentials.registry (printf "%s:%s" .Values.imageCredentials.username .Values.imageCredentials.password | b64enc) | b64enc }}
{{- end }}

{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "srsran.imagePullSecrets" -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
Also, we can not use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- range .Values.global.imagePullSecrets }}
- name: {{ . }}.Val
{{- end }}
{{- else if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- else if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- end -}}


{{/*
Create the name of the service account to use
*/}}
{{- define "srsran.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}


{{/*
Return the proper srsue image name
*/}}
{{- define "srsue.image" -}}
{{- include "common.images.image" (dict "imageRoot" .Values.ue.image "global" .Values.global) -}}
{{- end -}}


{{/*
Return the secret based on imageCredentials
*/}}
{{- define "srsue.dockerconfig" }}
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.ue.image.registry (printf "%s:%s" .Values.ue.image.username .Values.ue.image.password | b64enc) | b64enc }}
{{- end }}

{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "srsue.imagePullSecrets" -}}
{{- if .Values.global }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- range .Values.global.imagePullSecrets }}
- name: {{ . }}.Val
{{- end }}
{{- else if .Values.ue.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.ue.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- else if .Values.ue.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.ue.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- end -}}


{{/*
Create the name of the service account to use
*/}}
{{- define "srsue.serviceAccountName" -}}
{{- if .Values.ue.serviceAccount.create -}}
{{ default (include "common.names.fullname" .) .Values.ue.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.ue.serviceAccount.name }}
{{- end -}}
{{- end -}}
8 changes: 8 additions & 0 deletions charts/srsran-5g-zmq/templates/configmap-entrypoint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-entrypoint
labels: {{- include "common.labels.standard" . | nindent 4 }}
data:
entrypoint.sh: |
{{ tpl (.Files.Get "resources/entrypoint.sh") . | indent 4 }}
8 changes: 8 additions & 0 deletions charts/srsran-5g-zmq/templates/configmap-ue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-ue
labels: {{- include "common.labels.standard" . | nindent 4 }}
data:
ue.conf: |
{{ tpl (.Files.Get "resources/ue.conf") . | indent 4 }}
8 changes: 8 additions & 0 deletions charts/srsran-5g-zmq/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
data:
gnb-template.yml: |
{{ tpl (.Files.Get "resources/gnb-template.yml") . | indent 4 }}
Loading

0 comments on commit 403cd01

Please sign in to comment.