From ad6f3b84deffee8a75ac430c9bd9ca3b645aa1cc Mon Sep 17 00:00:00 2001 From: Niloy Saha Date: Sat, 14 Oct 2023 12:04:07 -0400 Subject: [PATCH] Add ueransim --- ueransim/ueransim-gnb/config/free5gc-gnb.yaml | 25 +++++ ueransim/ueransim-gnb/gnb-configmap.yaml | 40 ++++++++ ueransim/ueransim-gnb/gnb-deployment.yaml | 58 +++++++++++ ueransim/ueransim-gnb/gnb-service.yaml | 17 ++++ ueransim/ueransim-gnb/kustomization.yaml | 7 ++ .../ueransim-ue/config/kustomization.yaml | 3 + ueransim/ueransim-ue/config/ue1.yaml | 72 ++++++++++++++ ueransim/ueransim-ue/config/ue2.yaml | 72 ++++++++++++++ ueransim/ueransim-ue/config/ue3.yaml | 72 ++++++++++++++ ueransim/ueransim-ue/ue1/kustomization.yaml | 3 + ueransim/ueransim-ue/ue1/ue-configmap.yaml | 98 +++++++++++++++++++ ueransim/ueransim-ue/ue1/ue-deployment.yaml | 66 +++++++++++++ ueransim/ueransim-ue/ue2/kustomization.yaml | 3 + ueransim/ueransim-ue/ue2/ue-configmap.yaml | 93 ++++++++++++++++++ ueransim/ueransim-ue/ue2/ue-deployment.yaml | 55 +++++++++++ 15 files changed, 684 insertions(+) create mode 100644 ueransim/ueransim-gnb/config/free5gc-gnb.yaml create mode 100644 ueransim/ueransim-gnb/gnb-configmap.yaml create mode 100644 ueransim/ueransim-gnb/gnb-deployment.yaml create mode 100644 ueransim/ueransim-gnb/gnb-service.yaml create mode 100644 ueransim/ueransim-gnb/kustomization.yaml create mode 100644 ueransim/ueransim-ue/config/kustomization.yaml create mode 100644 ueransim/ueransim-ue/config/ue1.yaml create mode 100644 ueransim/ueransim-ue/config/ue2.yaml create mode 100644 ueransim/ueransim-ue/config/ue3.yaml create mode 100644 ueransim/ueransim-ue/ue1/kustomization.yaml create mode 100644 ueransim/ueransim-ue/ue1/ue-configmap.yaml create mode 100644 ueransim/ueransim-ue/ue1/ue-deployment.yaml create mode 100644 ueransim/ueransim-ue/ue2/kustomization.yaml create mode 100644 ueransim/ueransim-ue/ue2/ue-configmap.yaml create mode 100644 ueransim/ueransim-ue/ue2/ue-deployment.yaml diff --git a/ueransim/ueransim-gnb/config/free5gc-gnb.yaml b/ueransim/ueransim-gnb/config/free5gc-gnb.yaml new file mode 100644 index 0000000..680265f --- /dev/null +++ b/ueransim/ueransim-gnb/config/free5gc-gnb.yaml @@ -0,0 +1,25 @@ +mcc: '001' # Mobile Country Code value +mnc: '01' # Mobile Network Code value (2 or 3 digits) + +nci: '0x000000010' # NR Cell Identity (36-bit) +idLength: 32 # NR gNB ID length in bits [22...32] +tac: 1 # Tracking Area Code + +linkIp: 129.97.168.65 # gNB's local IP address for Radio Link Simulation (Usually same with local IP) +ngapIp: 10.10.2.22 # gNB's local IP address for N2 Interface (Usually same with local IP) +gtpIp: 10.10.3.22 # gNB's local IP address for N3 Interface (Usually same with local IP) + +# List of AMF address information +amfConfigs: + - address: 10.10.2.1 + port: 38412 + +# List of supported S-NSSAIs by this gNB +slices: + - sst: 1 + sd: 000001 + - sst: 1 + sd: 000002 + +# Indicates whether or not SCTP stream number errors should be ignored. +ignoreStreamIds: true diff --git a/ueransim/ueransim-gnb/gnb-configmap.yaml b/ueransim/ueransim-gnb/gnb-configmap.yaml new file mode 100644 index 0000000..cd6bd64 --- /dev/null +++ b/ueransim/ueransim-gnb/gnb-configmap.yaml @@ -0,0 +1,40 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: gnb-configmap + labels: + app: ueransim + component: gnb +data: + gnb-config.yaml: | + mcc: '001' # Mobile Country Code value + mnc: '01' # Mobile Network Code value (2 or 3 digits) + + nci: '0x000000010' # NR Cell Identity (36-bit) + idLength: 32 # NR gNB ID length in bits [22...32] + tac: 1 # Tracking Area Code + + linkIp: 0.0.0.0 # gNB's local IP address for Radio Link Simulation (Usually same with local IP) + ngapIp: 10.10.2.31 # gNB's local IP address for N2 Interface (Usually same with local IP) + gtpIp: 10.10.3.31 # gNB's local IP address for N3 Interface (Usually same with local IP) + + # List of AMF address information + amfConfigs: + - address: 10.10.2.1 + port: 38412 + + # List of supported S-NSSAIs by this gNB + slices: + - sst: 1 + sd: 000001 + - sst: 2 + sd: 000002 + + # Indicates whether or not SCTP stream number errors should be ignored. + ignoreStreamIds: true + + wrapper.sh: | + #!/bin/bash + /ueransim/nr-gnb --config /ueransim/config/gnb-config.yaml + diff --git a/ueransim/ueransim-gnb/gnb-deployment.yaml b/ueransim/ueransim-gnb/gnb-deployment.yaml new file mode 100644 index 0000000..1ad15ee --- /dev/null +++ b/ueransim/ueransim-gnb/gnb-deployment.yaml @@ -0,0 +1,58 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ueransim-gnb + labels: + app: ueransim + component: gnb +spec: + selector: + matchLabels: + app: ueransim + component: gnb + replicas: + template: + metadata: + labels: + app: ueransim + component: gnb + annotations: + k8s.v1.cni.cncf.io/networks: '[ + { "name": "n2network", "interface": "n2", "ips": [ "10.10.2.31/24" ] }, + { "name": "n3network", "interface": "n3", "ips": [ "10.10.3.31/24" ] } + ]' + spec: + containers: + - image: ghcr.io/niloysh/ueransim:v3.2.6 + name: gnb + ports: + - name: gnb-ue + containerPort: 4997 + protocol: UDP + securityContext: + capabilities: + add: ["NET_ADMIN"] + command: [ "/ueransim/config/wrapper.sh" ] + volumeMounts: + - mountPath: /ueransim/config + name: gnb-volume + resources: + requests: + memory: "1024Mi" + cpu: "1000m" + limits: + memory: "2048Mi" + cpu: "2000m" + dnsPolicy: ClusterFirst + restartPolicy: Always + volumes: + - name: gnb-volume + configMap: + name: gnb-configmap + items: + - key: gnb-config.yaml + path: gnb-config.yaml + - key: wrapper.sh + path: wrapper.sh + mode: 0777 diff --git a/ueransim/ueransim-gnb/gnb-service.yaml b/ueransim/ueransim-gnb/gnb-service.yaml new file mode 100644 index 0000000..f3bb177 --- /dev/null +++ b/ueransim/ueransim-gnb/gnb-service.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: gnb-service + labels: + app: ueransim + component: gnb +spec: + type: ClusterIP + ports: + - port: 4997 + nodePort: null + protocol: UDP + selector: + app: ueransim + component: gnb diff --git a/ueransim/ueransim-gnb/kustomization.yaml b/ueransim/ueransim-gnb/kustomization.yaml new file mode 100644 index 0000000..fb0a7dd --- /dev/null +++ b/ueransim/ueransim-gnb/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- gnb-configmap.yaml +- gnb-deployment.yaml +- gnb-service.yaml \ No newline at end of file diff --git a/ueransim/ueransim-ue/config/kustomization.yaml b/ueransim/ueransim-ue/config/kustomization.yaml new file mode 100644 index 0000000..86ee075 --- /dev/null +++ b/ueransim/ueransim-ue/config/kustomization.yaml @@ -0,0 +1,3 @@ +resources: +- ue1 +- ue2 \ No newline at end of file diff --git a/ueransim/ueransim-ue/config/ue1.yaml b/ueransim/ueransim-ue/config/ue1.yaml new file mode 100644 index 0000000..3e50005 --- /dev/null +++ b/ueransim/ueransim-ue/config/ue1.yaml @@ -0,0 +1,72 @@ +# IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 digits) +supi: 'imsi-001010000000001' +# Mobile Country Code value of HPLMN +mcc: '001' +# Mobile Network Code value of HPLMN (2 or 3 digits) +mnc: '01' + +# Permanent subscription key +key: '465B5CE8B199B49FAA5F0A2EE238A6BC' +# Operator code (OP or OPC) of the UE +op: 'E8ED289DEBA952E4283B54E88E6183CA' +# This value specifies the OP type and it can be either 'OP' or 'OPC' +opType: 'OPC' +# Authentication Management Field (AMF) value +amf: '8000' +# IMEI number of the device. It is used if no SUPI is provided +imei: '356938035643803' +# IMEISV number of the device. It is used if no SUPI and IMEI is provided +imeiSv: '4370816125816151' + +# List of gNB IP addresses for Radio Link Simulation +gnbSearchList: + - 129.97.168.65 + +# UAC Access Identities Configuration +uacAic: + mps: false + mcs: false + +# UAC Access Control Class +uacAcc: + normalClass: 0 + class11: false + class12: false + class13: false + class14: false + class15: false + +# Initial PDU sessions to be established +sessions: + - type: 'IPv4' + apn: 'internet' + slice: + sst: 1 + sd: 000001 + +# Configured NSSAI for this UE by HPLMN +configured-nssai: + - sst: 1 + sd: 000001 + +# Default Configured NSSAI for this UE +default-nssai: + - sst: 1 + sd: 000001 + +# Supported integrity algorithms by this UE +integrity: + IA1: true + IA2: true + IA3: true + +# Supported encryption algorithms by this UE +ciphering: + EA1: true + EA2: true + EA3: true + +# Integrity protection maximum data rate for user plane +integrityMaxRate: + uplink: 'full' + downlink: 'full' diff --git a/ueransim/ueransim-ue/config/ue2.yaml b/ueransim/ueransim-ue/config/ue2.yaml new file mode 100644 index 0000000..86f8417 --- /dev/null +++ b/ueransim/ueransim-ue/config/ue2.yaml @@ -0,0 +1,72 @@ +# IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 digits) +supi: 'imsi-001010000000002' +# Mobile Country Code value of HPLMN +mcc: '001' +# Mobile Network Code value of HPLMN (2 or 3 digits) +mnc: '01' + +# Permanent subscription key +key: 'B199B49F465B5CE8E238A6BCAA5F0A2E' +# Operator code (OP or OPC) of the UE +op: '283B54E8E8ED289D8E6183CAEBA952E4' +# This value specifies the OP type and it can be either 'OP' or 'OPC' +opType: 'OPC' +# Authentication Management Field (AMF) value +amf: '8000' +# IMEI number of the device. It is used if no SUPI is provided +imei: '356938035643803' +# IMEISV number of the device. It is used if no SUPI and IMEI is provided +imeiSv: '4370816125816151' + +# List of gNB IP addresses for Radio Link Simulation +gnbSearchList: + - 129.97.168.65 + +# UAC Access Identities Configuration +uacAic: + mps: false + mcs: false + +# UAC Access Control Class +uacAcc: + normalClass: 0 + class11: false + class12: false + class13: false + class14: false + class15: false + +# Initial PDU sessions to be established +sessions: + - type: 'IPv4' + apn: 'streaming' + slice: + sst: 1 + sd: 000002 + +# Configured NSSAI for this UE by HPLMN +configured-nssai: + - sst: 1 + sd: 000002 + +# Default Configured NSSAI for this UE +default-nssai: + - sst: 1 + sd: 000002 + +# Supported integrity algorithms by this UE +integrity: + IA1: true + IA2: true + IA3: true + +# Supported encryption algorithms by this UE +ciphering: + EA1: true + EA2: true + EA3: true + +# Integrity protection maximum data rate for user plane +integrityMaxRate: + uplink: 'full' + downlink: 'full' diff --git a/ueransim/ueransim-ue/config/ue3.yaml b/ueransim/ueransim-ue/config/ue3.yaml new file mode 100644 index 0000000..089ed98 --- /dev/null +++ b/ueransim/ueransim-ue/config/ue3.yaml @@ -0,0 +1,72 @@ +# IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 digits) +supi: 'imsi-001010000000003' +# Mobile Country Code value of HPLMN +mcc: '001' +# Mobile Network Code value of HPLMN (2 or 3 digits) +mnc: '01' + +# Permanent subscription key +key: 'B199B49F465B5CE8E238A6BCAA5F0A2E' +# Operator code (OP or OPC) of the UE +op: '283B54E8E8ED289D8E6183CAEBA952E4' +# This value specifies the OP type and it can be either 'OP' or 'OPC' +opType: 'OPC' +# Authentication Management Field (AMF) value +amf: '8000' +# IMEI number of the device. It is used if no SUPI is provided +imei: '356938035643803' +# IMEISV number of the device. It is used if no SUPI and IMEI is provided +imeiSv: '4370816125816151' + +# List of gNB IP addresses for Radio Link Simulation +gnbSearchList: + - 129.97.168.65 + +# UAC Access Identities Configuration +uacAic: + mps: false + mcs: false + +# UAC Access Control Class +uacAcc: + normalClass: 0 + class11: false + class12: false + class13: false + class14: false + class15: false + +# Initial PDU sessions to be established +sessions: + - type: 'IPv4' + apn: 'internet' + slice: + sst: 1 + sd: 000001 + +# Configured NSSAI for this UE by HPLMN +configured-nssai: + - sst: 1 + sd: 000001 + +# Default Configured NSSAI for this UE +default-nssai: + - sst: 1 + sd: 000001 + +# Supported integrity algorithms by this UE +integrity: + IA1: true + IA2: true + IA3: true + +# Supported encryption algorithms by this UE +ciphering: + EA1: true + EA2: true + EA3: true + +# Integrity protection maximum data rate for user plane +integrityMaxRate: + uplink: 'full' + downlink: 'full' diff --git a/ueransim/ueransim-ue/ue1/kustomization.yaml b/ueransim/ueransim-ue/ue1/kustomization.yaml new file mode 100644 index 0000000..a30a1d3 --- /dev/null +++ b/ueransim/ueransim-ue/ue1/kustomization.yaml @@ -0,0 +1,3 @@ +resources: +- ue-configmap.yaml +- ue-deployment.yaml \ No newline at end of file diff --git a/ueransim/ueransim-ue/ue1/ue-configmap.yaml b/ueransim/ueransim-ue/ue1/ue-configmap.yaml new file mode 100644 index 0000000..1b6a04c --- /dev/null +++ b/ueransim/ueransim-ue/ue1/ue-configmap.yaml @@ -0,0 +1,98 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: ue1-configmap + labels: + app: ueransim + component: ue + name: ue1 +data: + free5gc-ue.yaml: | + # IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 digits) + supi: 'imsi-001010000000001' + # Mobile Country Code value of HPLMN + mcc: '001' + # Mobile Network Code value of HPLMN (2 or 3 digits) + mnc: '01' + + # Permanent subscription key + key: '465B5CE8B199B49FAA5F0A2EE238A6BC' + # Operator code (OP or OPC) of the UE + op: 'E8ED289DEBA952E4283B54E88E6183CA' + # This value specifies the OP type and it can be either 'OP' or 'OPC' + opType: 'OPC' + # Authentication Management Field (AMF) value + amf: '8000' + # IMEI number of the device. It is used if no SUPI is provided + imei: '356938035643803' + # IMEISV number of the device. It is used if no SUPI and IMEI is provided + imeiSv: '4370816125816151' + + # List of gNB IP addresses for Radio Link Simulation + gnbSearchList: + - gnb-service + + # UAC Access Identities Configuration + uacAic: + mps: false + mcs: false + + # UAC Access Control Class + uacAcc: + normalClass: 0 + class11: false + class12: false + class13: false + class14: false + class15: false + + # Initial PDU sessions to be established + sessions: + - type: 'IPv4' + apn: 'internet' + slice: + sst: 1 + sd: 000001 + + # Configured NSSAI for this UE by HPLMN + configured-nssai: + - sst: 1 + sd: 000001 + + # Default Configured NSSAI for this UE + default-nssai: + - sst: 1 + sd: 000001 + + # Supported integrity algorithms by this UE + integrity: + IA1: true + IA2: true + IA3: true + + # Supported encryption algorithms by this UE + ciphering: + EA1: true + EA2: true + EA3: true + + # Integrity protection maximum data rate for user plane + integrityMaxRate: + uplink: 'full' + downlink: 'full' + + wrapper.sh: | + #!/bin/bash + + mkdir /dev/net + mknod /dev/net/tun c 10 200 + + /ueransim/nr-ue -c /ueransim/config/free5gc-ue.yaml + + wrapper-debug.sh: | + #!/bin/bash + + mkdir /dev/net + mknod /dev/net/tun c 10 200 + diff --git a/ueransim/ueransim-ue/ue1/ue-deployment.yaml b/ueransim/ueransim-ue/ue1/ue-deployment.yaml new file mode 100644 index 0000000..38f72c7 --- /dev/null +++ b/ueransim/ueransim-ue/ue1/ue-deployment.yaml @@ -0,0 +1,66 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ueransim-ue1 + labels: + app: ueransim + component: ue + name: ue1 +spec: + selector: + matchLabels: + app: ueransim + component: ue + name: ue1 + replicas: + template: + metadata: + labels: + app: ueransim + component: ue + name: ue1 + spec: + containers: + - image: ghcr.io/niloysh/ueransim:v3.2.6 + imagePullPolicy: Always + name: ue + securityContext: + capabilities: + add: ["NET_ADMIN"] + command: [ "/bin/bash", "-c", "--" ] + args: + - | + if [ "$DEBUG_MODE" = "true" ]; then + while true; do sleep 30; done; + else + /ueransim/config/wrapper.sh + fi + env: + - name: DEBUG_MODE + value: "false" + volumeMounts: + - mountPath: /ueransim/config + name: ue-volume + resources: + requests: + memory: "1024Mi" + cpu: "1000m" + limits: + memory: "2048Mi" + cpu: "2000m" + dnsPolicy: ClusterFirst + restartPolicy: Always + volumes: + - name: ue-volume + configMap: + name: ue1-configmap + items: + - key: free5gc-ue.yaml + path: free5gc-ue.yaml + - key: wrapper.sh + path: wrapper.sh + mode: 0755 + - key: wrapper-debug.sh + path: wrapper-debug.sh + mode: 0755 \ No newline at end of file diff --git a/ueransim/ueransim-ue/ue2/kustomization.yaml b/ueransim/ueransim-ue/ue2/kustomization.yaml new file mode 100644 index 0000000..a30a1d3 --- /dev/null +++ b/ueransim/ueransim-ue/ue2/kustomization.yaml @@ -0,0 +1,3 @@ +resources: +- ue-configmap.yaml +- ue-deployment.yaml \ No newline at end of file diff --git a/ueransim/ueransim-ue/ue2/ue-configmap.yaml b/ueransim/ueransim-ue/ue2/ue-configmap.yaml new file mode 100644 index 0000000..504f934 --- /dev/null +++ b/ueransim/ueransim-ue/ue2/ue-configmap.yaml @@ -0,0 +1,93 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: ue2-configmap + labels: + app: ueransim + component: ue + name: ue2 +data: + free5gc-ue.yaml: | + # IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 digits) + supi: 'imsi-001010000000002' + # Mobile Country Code value of HPLMN + mcc: '001' + # Mobile Network Code value of HPLMN (2 or 3 digits) + mnc: '01' + + # Permanent subscription key + key: 'B199B49F465B5CE8E238A6BCAA5F0A2E' + # Operator code (OP or OPC) of the UE + op: '283B54E8E8ED289D8E6183CAEBA952E4' + # This value specifies the OP type and it can be either 'OP' or 'OPC' + opType: 'OPC' + # Authentication Management Field (AMF) value + amf: '8000' + # IMEI number of the device. It is used if no SUPI is provided + imei: '356938035643803' + # IMEISV number of the device. It is used if no SUPI and IMEI is provided + imeiSv: '4370816125816151' + + # List of gNB IP addresses for Radio Link Simulation + gnbSearchList: + - gnb-service + + # UAC Access Identities Configuration + uacAic: + mps: false + mcs: false + + # UAC Access Control Class + uacAcc: + normalClass: 0 + class11: false + class12: false + class13: false + class14: false + class15: false + + # Initial PDU sessions to be established + sessions: + - type: 'IPv4' + apn: 'internet' + slice: + sst: 2 + sd: 000002 + + # Configured NSSAI for this UE by HPLMN + configured-nssai: + - sst: 2 + sd: 000002 + + # Default Configured NSSAI for this UE + default-nssai: + - sst: 2 + sd: 000002 + + # Supported integrity algorithms by this UE + integrity: + IA1: true + IA2: true + IA3: true + + # Supported encryption algorithms by this UE + ciphering: + EA1: true + EA2: true + EA3: true + + # Integrity protection maximum data rate for user plane + integrityMaxRate: + uplink: 'full' + downlink: 'full' + + + wrapper.sh: | + #!/bin/bash + + mkdir /dev/net + mknod /dev/net/tun c 10 200 + + /ueransim/nr-ue -c /ueransim/config/free5gc-ue.yaml + \ No newline at end of file diff --git a/ueransim/ueransim-ue/ue2/ue-deployment.yaml b/ueransim/ueransim-ue/ue2/ue-deployment.yaml new file mode 100644 index 0000000..9eed332 --- /dev/null +++ b/ueransim/ueransim-ue/ue2/ue-deployment.yaml @@ -0,0 +1,55 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ueransim-ue2 + labels: + app: ueransim + component: ue + name: ue2 +spec: + selector: + matchLabels: + app: ueransim + component: ue + name: ue2 + replicas: + template: + metadata: + labels: + app: ueransim + component: ue + name: ue2 + spec: + containers: + - image: ghcr.io/niloysh/ueransim:v3.2.6 + imagePullPolicy: Always + name: ue + securityContext: + capabilities: + add: ["NET_ADMIN"] + # command: [ "/bin/bash", "-c", "--" ] + # args: [ "while true; do sleep 30; done;" ] + command: [ "/ueransim/config/wrapper.sh" ] + volumeMounts: + - mountPath: /ueransim/config + name: ue-volume + resources: + requests: + memory: "512Mi" + cpu: "500m" + limits: + memory: "1024Mi" + cpu: "1000m" + dnsPolicy: ClusterFirst + restartPolicy: Always + volumes: + - name: ue-volume + configMap: + name: ue2-configmap + items: + - key: free5gc-ue.yaml + path: free5gc-ue.yaml + - key: wrapper.sh + path: wrapper.sh + mode: 0755 \ No newline at end of file