Giter Club home page Giter Club logo

gnbsim's Introduction

Go Report Card GitHub latest release (SemVer)

Table Of Contents

Introduction

This repository is part of the SD-Core project. SD-Core is open source 5G implementation of 5G Core Network. SD-Core provides a tool to simulate gNodeB and UE by generating NAS and NGAP messages for the configured UEs and call flows.

gNBSim Simulator Block Diagram

gNBSim

Supported features

Supported 3gpp procedures:

  • UE Registration
  • UE Initiated PDU Session Establishment
  • UE Initiated De-registration
  • AN Release
  • UE Initiated Service Request
  • N/W triggered PDU Session Release
  • UE Requested PDU Session Release
  • N/W triggered UE Deregistration

Supported System level features

  • Gnbsim can generate and send user data packets (ICMP echo request) and process downlink user data (ICMP echo response) over the established data plane path (N3 Tunnel)
  • Executing all enabled profiles in parallel or in sequential order
  • Timeout for each call flow within profile
  • Logging summary result
  • HTTP API to execute profile
  • Configure number of data packets to be sent and time interval between consecutive packets
  • Configure AS (Application Server) address. This is used to send data packets
  • Run gNBSim with single Interface or multi interface
  • Support of Custom Profiles
  • Delay between Procedures
  • Timeout for every profile
  • Logic to calculate latency per transaction/ operation
  • Support retransmission of Service Request Message
  • Support deployment of gNBSim as standalone container
  • Reporting profile errors from all levels

Pending Features

  • Provision data interface to gNBSim Container/POD/executable for data traffic testing
  • [3gpp] Generating GTPU echo request & handle incoming GTPU response
  • [3gpp] Handle incoming GTPu echo request & generate GTPu echo response
  • [3gpp] Support to send Error indication Message
  • [3gpp] Adding support for handling End Marker packet
  • [3gpp] GUTI based registration
  • [3gpp] Adding support for Resynchronization Profile
  • [3gpp] Adding Support for N2 handover profile
  • Support to handle Paging Request
  • Controlling Profiles - Adding support for aborting profile
  • Controlling Profiles - Suspend & resume profiles
  • Adding support for configurable rate of events
  • HTTP APIs to fetch subscriber/profile status from gNBSim
  • Adding Support for Xn Handover profile
  • Dropping incoming messages based on configuration
  • Sending negative responses to request/command type messages based on configuration
  • Handling security mode failure message
  • Triggering downlink data from gNB Sim (CI/CD feature as well)
  • UI Support
  • 3gpp Release Upgrade
  • Extensive gnbsim documentation
  • Command line options to send logs and/or events to file in specific format for post processing.

Support and Contributions

The gnbsim project welcomes new contributors. Feel free to propose a new feature or fix bugs!

Before contributing, please follow these guidelines:

  1. gNBSim documentation details here
  2. Please refer to the official SD-Core documentation for more details.
  3. #sdcore-dev channel in ONF Community Slack
  4. Raise Github issues

License

The project is licensed under the Apache License, version 2.0.

gnbsim's People

Contributors

badhrinathpa avatar dependabot[bot] avatar gab-arrobo avatar gajjarvini avatar gatici avatar ghislainbourgeois avatar gmerold avatar mbilal92 avatar onf-bot avatar orion-belt avatar patriciareinoso avatar thakurajayl avatar upadhyayaankur avatar vthiruveedula avatar yoursunny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gnbsim's Issues

Remove dependency from the `amf` module

Currently, the gnbsim module has the amf module as its dependency because of the use of one struct (PlmnSupportItem), one function (NewPlmnSupportItem) and two variables (MaxNumOfServedGuamiList, MaxNumOfPLMNs) in gnodeb/context/gnbamf.go and gnodeb/worker/gnbamfworker/handler.go. The gnsim should not depend on the amf module

5G-S-TMSI missing in ServiceRequest

When testing UE Initiated Service Request procedure with free5GC, the free5GC AMF replies with Error Indication and logs this error:

2024-01-24T15:55:40.276314287Z�[36m [INFO][AMF][Ngap][ran_addr:172.25.199.1:9487] �[0mHandle InitialUEMessage
2024-01-24T15:55:40.276361206Z�[36m [INFO][AMF][Ngap][amf_ue_ngap_id:RU:2701131778,AU:2(3GPP)][ran_addr:172.25.199.1:9487] �[0mNew RanUe [RanUeNgapID:2701131778][AmfUeNgapID:2]
2024-01-24T15:55:40.276384089Z�[33m [WARN][AMF][Ngap][amf_ue_ngap_id:RU:2701131778,AU:2(3GPP)][ran_addr:172.25.199.1:9487] �[0mMissing 5G-S-TMSI IE in InitialUEMessage; send ErrorIndication
2024-01-24T15:55:40.276396723Z�[36m [INFO][AMF][Ngap][ran_addr:172.25.199.1:9487] �[0mSend Error Indication
2024-01-24T15:55:40.276926735Z�[36m [INFO][AMF][Ngap][amf_ue_ngap_id:RU:2701131778,AU:2(3GPP)][ran_addr:172.25.199.1:9487] �[0mSend UE Context Release Command

Test log with packet traces: free5gc.zip

According to ETSI TS 123.502 V16.7.0 section 4.2.3.2:

In the case of NG-RAN:
The AN parameters include 5G-S-TMSI, Selected PLMN ID, Establishment cause and may also include NSSAI information

The message generated by gNBSim (frame 41 in the packet sample) is:

initiatingMessage
    procedureCode: id-InitialUEMessage (15)
    criticality: ignore (1)
    value
        InitialUEMessage
            protocolIEs: 5 items
                Item 0: id-RAN-UE-NGAP-ID
                Item 1: id-NAS-PDU
                Item 2: id-UserLocationInformation
                Item 3: id-RRCEstablishmentCause
                Item 4: id-UEContextRequest

As a comparison, the message generated by Open5GCore RAN simulator for this procedure has an id-FiveG-S-TMSI IE:

InitialUEMessage
    protocolIEs: 6 items
        Item 0: id-RAN-UE-NGAP-ID
        Item 1: id-NAS-PDU
        Item 2: id-UserLocationInformation
        Item 3: id-RRCEstablishmentCause
        Item 4: id-FiveG-S-TMSI
            ProtocolIE-Field
                id: id-FiveG-S-TMSI (26)
                criticality: reject (0)
                value
                    FiveG-S-TMSI
                        aMFSetID: 0040 [bit length 10, 6 LSB pad bits, 0000 0000  01.. .... decimal value 1]
                        aMFPointer: 00 [bit length 6, 2 LSB pad bits, 0000 00.. decimal value 0]
                        fiveG-TMSI: 2130706433 (0x7f000001)
        Item 5: id-UEContextRequest

Pending features mapping to timeline

Hello gnbsim team
Thank you for creating such a flexible tool, first of all. I can use this tool to complete the necessary testing. I can't wait to see when the new features become accessible. Could you kindly provide us with a schedule for the currently unfinished features?

Thanks
Matt

Hardcoded values

Hello

I have seen that following values are hardcoded in the message, and it will be great if we can configure them in the config file.

  1. TAC in the UplinkNASTransport(RegistrationRequest)
    Screenshot from 2022-08-02 15-18-41

  1. SNSSAI, DNN in PDUSessionEstablishment request
    Screenshot from 2022-08-02 15-27-52

  1. Procedure transaction id, it should be > =1 in PDUSessionEstablishment request
    Screenshot from 2022-08-02 16-12-03

Multiple QoS flows

Hi! I would like to know if gnbsim is prepared to handle multiple QoS flows in a single PDU session. Thanks in advance.

go.mod checksum mismatch

I'm suddenly getting "security error" regarding mismatched checksum in go.mod.

ubuntu@N1:~/gnbsim$ go version
go version go1.22.2 linux/amd64

ubuntu@N1:~/gnbsim$ git log | head -4
commit fc97de690d353d56ab0f9163d27d93766c6543c6
Author: gab-arrobo <[email protected]>
Date:   Tue Apr 9 17:39:03 2024 -0700

ubuntu@N1:~/gnbsim$ go mod download
verifying github.com/omec-project/[email protected]/go.mod: checksum mismatch
        downloaded: h1:jDWasZ2XLFL2uSEWhgGlT/ELyrpwCJd/2kE/VEGG8Ew=
        go.sum:     h1:oOkKRI2BIo8SHpCsEzNbo9qiowEtEy3q+wmO7TuDrx4=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

Was there a force-push in one of the dependencies?

Invalid S-NSSAI

Standardized S-NSSAI (SST= 1 to 127) has only SST and no SD value (TS 23.501, R16.0.0., 5.15.2.1).
Hence S-NSSAI with SST, SD = 1, 010203 in sample config file is invalid actually.

context.GetSimUe - fatal error: concurrent map read and map write

I have a sighting of a crash in simue/context package when a large number of profiles are starting/running in parallel.
This error only occurred once and does not reproduce reliably.
Nevertheless, I'm reporting it here so that this race condition can be reviewed.

Configuration

1 gNB, 40 UEs, 40 profiles running in parallel
---
info:
  version: 1.0.0
  description: GNBSIM initial local configuration
configuration:
  runConfigProfilesAtStart: true
  singleInterface: false #default value
  execInParallel: true #run all profiles in parallel
  httpServer: # Serves APIs to create/control profiles on the go
    enable: true
    ipAddr: 172.25.192.50
    port: 8080
  gnbs:
    gnb0:
      defaultAmf:
        hostName: 172.25.199.44
        ipAddr: 172.25.199.44
        port: 38412
      globalRanId:
        gNbId:
          bitLength: 24
          gNBValue: "000000"
        plmnId: &ref_0
          mcc: "001"
          mnc: "01"
      n2IpAddr: 172.25.199.50
      n2Port: 9487
      n3IpAddr: 172.25.195.50
      n3Port: 2152
      name: gnb0
      supportedTaList:
        - broadcastPlmnList:
            - plmnId: *ref_0
              taiSliceSupportList:
                - sd: "000000"
                  sst: 128
                - sd: "000000"
                  sst: 129
                - sd: "000000"
                  sst: 130
                - sd: "000000"
                  sst: 131
                - sd: "000000"
                  sst: 132
                - sd: "000000"
                  sst: 133
                - sd: "000000"
                  sst: 134
                - sd: "000000"
                  sst: 135
                - sd: "000000"
                  sst: 136
                - sd: "000000"
                  sst: 137
                - sd: "000000"
                  sst: 138
                - sd: "000000"
                  sst: 139
                - sd: "000000"
                  sst: 140
                - sd: "000000"
                  sst: 141
                - sd: "000000"
                  sst: 142
                - sd: "000000"
                  sst: 143
                - sd: "000000"
                  sst: 144
                - sd: "000000"
                  sst: 145
                - sd: "000000"
                  sst: 146
                - sd: "000000"
                  sst: 147
                - sd: "000000"
                  sst: 148
                - sd: "000000"
                  sst: 149
                - sd: "000000"
                  sst: 150
                - sd: "000000"
                  sst: 151
                - sd: "000000"
                  sst: 152
                - sd: "000000"
                  sst: 153
                - sd: "000000"
                  sst: 154
                - sd: "000000"
                  sst: 155
                - sd: "000000"
                  sst: 156
                - sd: "000000"
                  sst: 157
                - sd: "000000"
                  sst: 158
                - sd: "000000"
                  sst: 159
                - sd: "000000"
                  sst: 160
                - sd: "000000"
                  sst: 161
                - sd: "000000"
                  sst: 162
                - sd: "000000"
                  sst: 163
                - sd: "000000"
                  sst: 164
                - sd: "000000"
                  sst: 165
                - sd: "000000"
                  sst: 166
                - sd: "000000"
                  sst: 167
          tac: "000005"
  profiles:
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n00
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551000
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 128
      sequenceNumber: "000000000020"
      startImsi: "001017005551000"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n01
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551001
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 129
      sequenceNumber: "000000000020"
      startImsi: "001017005551001"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n02
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551002
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 130
      sequenceNumber: "000000000020"
      startImsi: "001017005551002"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n03
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551003
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 131
      sequenceNumber: "000000000020"
      startImsi: "001017005551003"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n04
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551004
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 132
      sequenceNumber: "000000000020"
      startImsi: "001017005551004"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n05
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551005
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 133
      sequenceNumber: "000000000020"
      startImsi: "001017005551005"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n06
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551006
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 134
      sequenceNumber: "000000000020"
      startImsi: "001017005551006"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n07
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551007
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 135
      sequenceNumber: "000000000020"
      startImsi: "001017005551007"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n08
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551008
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 136
      sequenceNumber: "000000000020"
      startImsi: "001017005551008"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n09
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551009
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 137
      sequenceNumber: "000000000020"
      startImsi: "001017005551009"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n10
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551010
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 138
      sequenceNumber: "000000000020"
      startImsi: "001017005551010"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n11
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551011
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 139
      sequenceNumber: "000000000020"
      startImsi: "001017005551011"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n12
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551012
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 140
      sequenceNumber: "000000000020"
      startImsi: "001017005551012"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n13
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551013
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 141
      sequenceNumber: "000000000020"
      startImsi: "001017005551013"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n14
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551014
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 142
      sequenceNumber: "000000000020"
      startImsi: "001017005551014"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n15
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551015
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 143
      sequenceNumber: "000000000020"
      startImsi: "001017005551015"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n16
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551016
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 144
      sequenceNumber: "000000000020"
      startImsi: "001017005551016"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n17
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551017
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 145
      sequenceNumber: "000000000020"
      startImsi: "001017005551017"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n18
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551018
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 146
      sequenceNumber: "000000000020"
      startImsi: "001017005551018"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n19
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551019
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 147
      sequenceNumber: "000000000020"
      startImsi: "001017005551019"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n20
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551020
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 148
      sequenceNumber: "000000000020"
      startImsi: "001017005551020"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n21
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551021
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 149
      sequenceNumber: "000000000020"
      startImsi: "001017005551021"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n22
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551022
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 150
      sequenceNumber: "000000000020"
      startImsi: "001017005551022"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n23
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551023
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 151
      sequenceNumber: "000000000020"
      startImsi: "001017005551023"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n24
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551024
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 152
      sequenceNumber: "000000000020"
      startImsi: "001017005551024"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n25
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551025
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 153
      sequenceNumber: "000000000020"
      startImsi: "001017005551025"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n26
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551026
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 154
      sequenceNumber: "000000000020"
      startImsi: "001017005551026"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n27
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551027
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 155
      sequenceNumber: "000000000020"
      startImsi: "001017005551027"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n28
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551028
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 156
      sequenceNumber: "000000000020"
      startImsi: "001017005551028"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n29
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551029
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 157
      sequenceNumber: "000000000020"
      startImsi: "001017005551029"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n30
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551030
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 158
      sequenceNumber: "000000000020"
      startImsi: "001017005551030"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n31
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551031
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 159
      sequenceNumber: "000000000020"
      startImsi: "001017005551031"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n32
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551032
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 160
      sequenceNumber: "000000000020"
      startImsi: "001017005551032"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n33
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551033
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 161
      sequenceNumber: "000000000020"
      startImsi: "001017005551033"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n34
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551034
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 162
      sequenceNumber: "000000000020"
      startImsi: "001017005551034"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n35
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551035
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 163
      sequenceNumber: "000000000020"
      startImsi: "001017005551035"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n36
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551036
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 164
      sequenceNumber: "000000000020"
      startImsi: "001017005551036"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n37
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551037
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 165
      sequenceNumber: "000000000020"
      startImsi: "001017005551037"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n38
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551038
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 166
      sequenceNumber: "000000000020"
      startImsi: "001017005551038"
      ueCount: 1
    - dataPktCount: 5
      defaultAs: 172.25.193.42
      dnn: n39
      enable: true
      execInParallel: true
      gnbName: gnb0
      key: c5dabfd66406eeb9871f18eacf1f8864
      opc: efb1b89d8759b701a681875d09e322eb
      plmnId:
        mcc: "001"
        mnc: "01"
      profileName: deregister-001017005551039
      profileType: deregister
      sNssai:
        sd: "000000"
        sst: 167
      sequenceNumber: "000000000020"
      startImsi: "001017005551039"
      ueCount: 1
logger:
  logLevel: info # how detailed the log will be, values: trace, debug, info, warn, error, fatal, panic

gNBSim crashes upon receiving NAS Configuration update command

After UE registration, if the core network sends a NAS PDU with Message type: Configuration update command (0x54), gNBSim process crashes with a fatal error.
Packet capture and gNBSim logs: gnbsim54.zip

The offending packet was generated by Open5GCore and looks like this:

NG Application Protocol (DownlinkNASTransport)
    NGAP-PDU: initiatingMessage (0)
        initiatingMessage
            procedureCode: id-DownlinkNASTransport (4)
            criticality: ignore (1)
            value
                DownlinkNASTransport
                    protocolIEs: 3 items
                        Item 0: id-AMF-UE-NGAP-ID
                        Item 1: id-RAN-UE-NGAP-ID
                        Item 2: id-NAS-PDU
                            ProtocolIE-Field
                                id: id-NAS-PDU (38)
                                criticality: reject (0)
                                value
                                    NAS-PDU: 7e0232960dbd027e0054431510004f00700065006e003500470063006f00720065450910006f0035004700634742105241529000
                                        Non-Access-Stratum 5GS (NAS)PDU
                                            Security protected NAS 5GS message
                                            Plain NAS 5GS Message
                                                Extended protocol discriminator: 5G mobility management messages (126)
                                                0000 .... = Spare Half Octet: 0
                                                .... 0000 = Security header type: Plain NAS message, not security protected (0)
                                                Message type: Configuration update command (0x54)
                                                Network Name - Full name for network
                                                Network Name - Short Name
                                                Time Zone and Time - Universal Time and Local Time Zone

gNBSim log: (84 is decimal of 0x54)

time="2024-01-25T14:25:09Z" level=info msg="Received Message Type: 84" category=RealUe component=GNBSIM supi=imsi-001017005551000
time="2024-01-25T14:25:09Z" level=fatal msg="Invalid Event ID: 0x2000054" category=App component=GNBSIM

QFI is hard-coded to 9

After PDU session establishment, USER-DATA-PACKET-GENERATION-PROCEDURE transmits an ICMP packet in GTP-U tunnel on the N3 interface.
This packet contains a hard-coded QoS Flow Identifier (QFI) value of 9.
If a UPF is checking QFI (e.g. Open5GCore), the packet would be rejected by the core network.
Consequently, the profile eventually times out.
Packet capture and gNBSim logs: gtp-qfi.zip

The uplink QFI 1 was assigned by the RAN in PDUSessionResourceSetupRequest packet:

PDUSessionResourceSetupListSUReq: 1 item
    Item 0
        PDUSessionResourceSetupItemSUReq
            pDUSessionID: 10
            pDUSessionNAS-PDU: 7e02d63eeb7f037e006801005b2e0a01c211000901000631310101ff01060606d60604e22905010a0100012204010000007900060120410101097b000d80000d040101010100100205b0251c08696e7465726e6574066d6e63303031066d63633030310467707273120a
            s-NSSAI
            pDUSessionResourceSetupRequestTransfer: 0000050082000a0c684ee180304a817c80008b000a01f0ac19c40510000001007f00010000860001000088000700010000090400
                PDUSessionResourceSetupRequestTransfer
                    protocolIEs: 5 items
                        Item 0: id-PDUSessionAggregateMaximumBitRate
                        Item 1: id-UL-NGU-UP-TNLInformation
                        Item 2: id-DataForwardingNotPossible
                        Item 3: id-PDUSessionType
                        Item 4: id-QosFlowSetupRequestList
                            ProtocolIE-Field
                                id: id-QosFlowSetupRequestList (136)
                                criticality: reject (0)
                                value
                                    QosFlowSetupRequestList: 1 item
                                        Item 0
                                            QosFlowSetupRequestItem
                                                qosFlowIdentifier: 1
                                                qosFlowLevelQosParameters

However, it is 9 in the GTP-U header:

Frame 42: 134 bytes on wire (1072 bits), 134 bytes captured (1072 bits) on interface br-n3, id 1
Ethernet II, Src: 52:de:ac:19:c4:0d (52:de:ac:19:c4:0d), Dst: 52:de:ac:19:c4:05 (52:de:ac:19:c4:05)
Internet Protocol Version 4, Src: 172.25.196.13, Dst: 172.25.196.5
User Datagram Protocol, Src Port: 2152, Dst Port: 2152
GPRS Tunneling Protocol
    Flags: 0x34
    Message Type: T-PDU (0xff)
    Length: 84
    TEID: 0x10000001 (268435457)
    Next extension header type: PDU Session container (0x85)
    Extension header (PDU Session container)
        Extension Header Length: 1
        PDU Session Container
            0001 .... = PDU Type: UL PDU SESSION INFORMATION (1)
            .... 0000 = Spare: 0x0
            00.. .... = Spare: 0x0
            ..00 1001 = QoS Flow Identifier (QFI): 9
        Next extension header type: No more extension headers (0x00)
Internet Protocol Version 4, Src: 10.1.0.1, Dst: 172.25.193.2
Internet Control Message Protocol

I see the hard-coded value comes from here:

pduSessContainer := BuildPduSessContainerExtHeader(9)

It's invoked by:
userDataMsg := msg.(*common.UserDataMessage)
encodedMsg, err := test.BuildGpduMessage(userDataMsg.Payload, gnbue.UlTeid)

The data structure does have a QFI field:

gnbsim/common/messages.go

Lines 98 to 102 in b8819f1

type UserDataMessage struct {
DefaultMessage
Qfi *uint8
Payload []byte
}

But it wasn't assigned in the UE:
userDataMsg := &common.UserDataMessage{}
userDataMsg.Event = common.UL_UE_DATA_TRANSFER_EVENT
userDataMsg.Payload = payload
pduSess.WriteGnbChan <- userDataMsg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.