diff --git a/.gitmodules b/.gitmodules index 83f3b28090a345d806304d048bb1d4b355347e9c..a324ae61e48baaa0ea05472ae7c735736839a837 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,3 +8,5 @@ [submodule "ttcn/LibCommon"] path = ttcn/LibCommon url = https://forge.etsi.org/rep/LIBS/LibCommon.git +[submodule "./titan-test-system-framework/"] + branch = dev diff --git a/Makefile b/Makefile index a41f49226d8274ed4a71b39f919adafceb94ca7f..ad634f1a35cb5d5d53f01b12be53d06734bf34be 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,10 @@ ifeq (,$(ATS)) $(error ATS shall be defined) +else + y := $(subst ., ,$(ATS)) + override ATS := $(word 1, $(y)) + override SUB_ATS := $(word 2, $(y)) endif ifeq (,$(TOPDIR)) @@ -25,7 +29,7 @@ $$(foreach M, $$(modules), $$(eval $$(call IncludeModule, $$(if $$(filter /%, $ endef all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp /usr/include/libxml2 -defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL _GNU_SOURCE +defines += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) $(SUB_ATS) AS_USE_SSL _GNU_SOURCE libs += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs ifeq (Windows_NT,$(OS)) @@ -40,7 +44,7 @@ defines += LINUX libs += -lpcap -lrt -lpthread endif -libs += -lssl -lcrypto -lxml2 -ljsoncpp -L$(OSIP_LIB) -losipparser2 -lsctp +libs += -lssl -lcrypto -lxml2 -ljsoncpp -L$(OSIP_LIB) -lsctp $(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS))) @@ -77,9 +81,11 @@ gen_headers := $(gen_ttcn_headers) $(gen_ttcn3_headers) $(gen_asn_headers) $(gen gen_objects := $(patsubst %.cc, %.o, $(gen_sources)) cc_objects := $(patsubst %.cc, $(outdir)/%.o, $(cc_sources)) +outbin = $(bindir)/$(ATS)$(SUB_ATS)$(EXE) + .PHONY: all FORCE echo -all: $(bindir) $(outdir) $(bindir)/$(ATS)$(EXE) +all: $(bindir) $(outdir) $(outbin) echo_sources: @echo -e "$(addsuffix \n,$(all_sources))" @@ -118,11 +124,11 @@ $(bindir)/$(ATS)$(EXE): $(gen_objects) $(cc_objects) g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(libs) $(gen_objects) :%.o :%.cc - g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< + g++ -g -O0 -std=c++17 -Wno-long-long -flarge-source-files -Wmisleading-indentation -fPIC -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< $(cc_objects) : $(outdir)/%.o : %.cc mkdir -p $(dir $@) - g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< + g++ -g -O0 -std=c++17 -Wno-long-long -flarge-source-files -Wmisleading-indentation -fPIC -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< #$(gen_sources): # $(TTCN3_DIR)/bin/asn1_compiler $(TTCN3_COMPILER_OPTIONS) -o $(outdir) $(tt_sources) diff --git a/NAS_ETSI.code-workspace b/NAS_ETSI.code-workspace index e2a5ee7e96b9364d80101f3adcb07ff35a3b2e68..a72cd0fc4efb1d59e4b35fd1d6e12346c580d986 100644 --- a/NAS_ETSI.code-workspace +++ b/NAS_ETSI.code-workspace @@ -4,13 +4,13 @@ "path": "." }, { - "path": "../ngap" + "path": "../../frameworks/titan/titan.core" }, { - "path": "../../frameworks/titan/titan.core" + "path": "../open5gs" }, { - "path": "../5G-AKA-simulation-in-C" + "path": "../UERANSIM" } ], "settings": { diff --git a/README.md b/README.md index 29d516e7efc0ff6c2dd18d7e36b152d7b5c7a5fb..0c3c76fa0301687887f96e49b9f3cb1dbe5ab98d 100644 --- a/README.md +++ b/README.md @@ -1,92 +1,359 @@ -# NG_NAS +# ETSI 5G NGAP and 5G NAS protocol project +## Introduction -## Getting started +This repositorie contains Abstract Test Suite (ATS) developed in TTCN-3 source code based on test specifications for ETSI 5G NGAP and 5G NAS conformance protocol testing, Release 16: +- [ETSI TS 103 920-1](https://www.etsi.org/deliver/etsi_ts/103900_103999/10392001/) : "5G NGAP Conformance Testing for the N2 interface; Part 1: Protocol Implementation Conformance Statement (PICS) (version 1.2.1)" +- [ETSI TS 103 920-2](https://www.etsi.org/deliver/etsi_ts/103900_103999/10392002/) : "5G NGAP Conformance Testing for the N2 interface; Part 2: Test Suite Structure (TSS) and Test Purposes (TP) (version 1.2.1)" +- [ETSI TS 103 920-3](https://www.etsi.org/deliver/etsi_ts/103900_103999/10392003/) : "5G NGAP Conformance Testing for the N2 interface; Part 3: Abstract Test Suite (ATS) and partial Protocol Implementation eXtra Information for Testing (PIXIT) proforma specification (version 1.2.1)" +- [ETSI TS 103 921-1](https://www.etsi.org/deliver/etsi_ts/103900_103999/10392101/) : "5G NAS Conformance Testing for the N1 interface; Part 1: Protocol Implementation Conformance Statement (PICS) (version 1.2.1)" +- [ETSI TS 103 921-2](https://www.etsi.org/deliver/etsi_ts/103900_103999/10392102/) : "5G NAS Conformance Testing for the N1 interface; Part 2: Test Suite Structure (TSS) and Test Purposes (TP) (version 1.2.1)" +- [ETSI TS 103 921-3](https://www.etsi.org/deliver/etsi_ts/103900_103999/10392103/) : "5G NAS Conformance Testing for the N1 interface; Part 3: Abstract Test Suite (ATS) and partial Protocol Implementation eXtra Information for Testing (PIXIT) proforma specification (version 1.2.1)" -To make it easy for you to get started with GitLab, here's a list of recommended next steps. +Following 3GPP library [Lib3GPP-IWD_23wk37](https://www.3gpp.org/ftp/tsg_ran/WG5_Test_ex-T1/TTCN/Deliveries/TTCN3/iwd-TTCN3-B2022-09_D23wk37.zip) was used. -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! +ETSI 5G NGAP and 5G NAS conformance test specifications are based on following base specifications: +- [ETSI TS 123 501](https://www.etsi.org/deliver/etsi_ts/123500_123599/123501/16.20.00_60/ts_123501v162000p.pdf): "5G; System architecture for the 5G System (5GS) (3GPP TS 23.501 version 16.20.0 Release 16)" +- [ETSI TS 123 502](https://www.etsi.org/deliver/etsi_ts/123500_123599/123502/16.19.00_60/ts_123502v161900p.pdf): "5G; Procedures for the 5G System (5GS) (3GPP TS 23.502 version 16.19.0 Release 16)" +- [ETSI TS 124 501](https://www.etsi.org/deliver/etsi_ts/124500_124599/124501/16.15.00_60/ts_124501v161500p.pdf): "5G; Non-Access-Stratum (NAS) protocol for 5G System (5GS); Stage 3 (3GPP TS 24.501 version 16.15.0 Release 16)" +- [ETSI TS 138 413](https://www.etsi.org/deliver/etsi_ts/138400_138499/138413/16.17.00_60/ts_138413v161700p.pdf): "5G; NG-RAN; NG Application Protocol (NGAP) (3GPP TS 38.413 version 16.17.0 Release 16)" -## Add your files -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: +## Contact information +Email at `cti_support` at `etsi` dot `org`. + +## License + +Unless specified otherwise, the content of this repository and the files contained are released under the BSD-3-Clause license. +See the attached LICENSE file or visit https://forge.etsi.org/legal-matters. + +## STFs/TTFs + +The following STFs/TTFs were or are currently involved in the evolutions of the ETSI 5G NGAP and 5G NAS protocols project: +- TTF T033, TTF T041, TTF T048 + + +# Installation + +The NGAP/NAS Conformance Test System project builds and tests regularly on the following platforms: + + - Linux (Ubuntu) + - Windows ([Cygwin x64](https://cygwin.com/install.html), [Npcap SDK x64](https://nmap.org/npcap/#download) and [OpenSSL-Windows x64](https://www.openssl.org) are required) + +Note: The [OpenSSL](https://www.openssl.org) version >= 1.1.1 is also required. + +## How to do it? + +They are three different methods: +- Using [Vagrant](https://www.vagrantup.com/) +- Using [Docker](https://www.docker.com/) +- Using [Eclipse TITAN on Windows or Linux](https://projects.eclipse.org/projects/tools.titan/downloads) + +How to choose one of these methods is depending of your host system. + +NOTE: In all case, if you want to setup an continuous integration process (e.g. Jenkins), Docker is the best choice. + + +### The host system is Windows +The both methods require a virtual machine. You can use either VirtualBox or WMware. +In this case, the easiest way is to use Vagrant. + + +### The host system is Linux +Vagrant requires a virtual machine. You can use either VirtualBox or WMware. +Docker does not need a virtual machine, so it is the more efficant way. + +The following clauses describes four ways to build and deploy the CISE Test System: +- [Using TITAN compiler on a Docker image](#using-titan-compiler-on-a-docker-image) +- [Using development Docker image](#using-development-docker-image) +- [Using Vagrant](#using-vagrant) +- [From scratch](#from-scratch) + + +## Using TITAN compiler on a Docker image + +In this configuration, TITAN compiler is located on a Docker image and the sources and the outputs are located on the host. + +Pre-requisites on your host machine: +- Install Docker + +Procedure on the host machine: +- Open a Terminal +- Clone the project + +```sh +$ git clone --recurse-submodules --remote-submodules https://forge.etsi.org/rep/int/5g-core/nas.git ``` -cd existing_repo -git remote add origin https://forge.etsi.org/rep/int/5g-core/nas.git -git branch -M main -git push -uf origin main + +- Select the branch you need: + + devel + +```sh +$ git checkout TTF_T048 ``` -## Integrate with your tools +- Execute the installation script to setup the correct environment: -- [ ] [Set up project integrations](https://forge.etsi.org/rep/int/5g-core/nas/-/settings/integrations) +```sh +$ cd ./nas +& ./install.sh +``` -## Collaborate with your team +- From the NGAP/NAS Conformance Test System root directory, build the Docker image executing the following commands: -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) +```sh +$ cd ./virtualization/docker +$ docker build --no-cache --tag alpine-nas -f Dockerfile --force-rm . +$ docker images +``` -## Test and Deploy +To build the NGAP/NAS Test Suite, execute the following command: -Use the built-in continuous integration in GitLab. +```sh +$ ./docker-run.sh build +``` -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) +Possble other options are 'clean' to remove all the build outputs or 'rebuild' to force a build of the Test Suite after a 'clean'. -*** +Before to execute the NGAP/NAS Test Suite, prepare, edit and update the configuration file (e.g. AtsNGAP Test Suite): +- Update the following fields: + - system.NGAP_AMF.params + - system.N2_gNBaMF_P.params +- Update the PICS and PIXITs accordingly -# Editing this README +```sh +$ ln -sf ../../etc/AtsNGAP/AtsNGAP_AMF_open5gs.cfg_ ../../etc/AtsNGAP/AtsNGAP.cfg +$ vi ../../etc/AtsNGAP/AtsNGAP.cfg # To update it +``` -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template. +To run the NGAP/NAS Test Suite, execute the following command: -## Suggestions for a good README -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. +```sh +$ ./docker-run.sh run +``` -## Name -Choose a self-explaining name for your project. +Notes: +- The NGAP/NAS Conformance Test System is listening on port 38412 +- Updating the file etc/AtsNGAP.cfg is about: +. Selecting the test(s) to be executed +. Updating value of PICs and PIXITs +. Updating HTTP port setting -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. +## Using development Docker image -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. +In this configuration, the TITAN compiler, the sources and the outputs are located on the Docker image. -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. +Pre-requisites on your host machine: +- Install Docker -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. +Procedure for a Windows host machine: +- On your host machine, open a the Docker Quickstart Terminal and change to a working folder such as ./temp/docker_its -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. +Procedure for a Linux host machine: +- On your host machine, open a terminal and change to a working folder such as $HOME/temp/docker_its -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. +On your host machine, download the following items from NGAP/NAS Conformance Test System project: +- The docker folder +- The .jenkins.sh script file (hidden file) and add the execution rights on it +- Check the rights of the script files and the folders -## Contributing -State if you are open to contributions and what your requirements are for accepting them. +From the your current directory, execute the following commands: -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. +```sh +$ ./.jenkins.sh +... +``` -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. +NOTE The creation and the installations will take some time to achieve +- Start the container -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. +```sh +$ ./virtualization/docker/run-container.sh +... +``` -## License -For open source projects, say how it is licensed. +- Switch to the next clause (Usage) + + +## Using Vagrant + +Pre-requisites on your host machine: +- Install [Virtualbox](https://www.virtualbox.org/manual/ch01.html) +- Install [Vagrant](https://www.vagrantup.com/intro/getting-started/) +- Install Vagrant plugin vagrant-vbguest +- Credentials to access [ETSI forge](https://forge.etsi.org/gitlab/users/sign_in) + - Set the environment variable USERNAME to your ETSI EOL account user name + - Set the environment variable PASSWORD to your ETSI EOL account password + +Procedure: +- On your host machine, open a command line session (PuTTY, DOS window...) +- From the NGAP/NAS Conformance Test System project, clone the Vagrant folder +- In the file Vagrantfile, modify the tag config.vm.provision replacing & strings by your ETSI credentials +- In the Vagrant folder (./virtualization/vagrant), execute the following commands: + +```sh +$ vagrant up --provider virtualbox --provision +... +``` + +NOTE The creation and the installations will take some time to achieve +- Stop vagrant virtual machine + +```sh +$ vagrant halt +... +``` + +- Update the file 'Vagrantfile' to match with your networks configuration +- Re-start the vagrant virtual machine and log to to the machine + +```sh +$ vagrant up +... +$ vagrant ssh +``` + +- Switch to the next clause (Usage) + +NOTE The user password is vagrant. + + +## From scratch + +Pre-requisites: +- Install Virtualbox + +Procedure: +- Install a new Linux Virtual machine (Mint, Debian...) +- Update your system with the latest version of kernel and security packages +- Install the following packages (According to the Linux chosen, the package naming can be different) + autoconf + bison + build-essential + cmake + curl + dos2unix + doxygen + emacs + expect + flex + g++:latest + gcc:latest + graphviz + gdb + git-core + gnutls-bin + libglib2.0-dev + libpcap-dev + libgcrypt-dev + libncurses5-dev + libjsoncpp-dev + libssl-dev + libtool-bin + libtool + libwireshark-dev + libxml2-dev + lsof + ntp + pkg-config + qt5-default + qtmultimedia5-dev + libqt5svg5-dev + subversion + sudo + sshpass + tcpdump + texlive-font-utils + tshark + valgrind + vim + vsftpd + xutils-dev + tree + tzdata + unzip + wget + xsltproc + +- Clone the NGAP/NAS Conformance Test System project into $HOME/dev folder + +```sh +$ git clone --branch=devel --recurse-submodules --remote-submodules https://forge.etsi.org/rep/int/5g-core/nas.git +``` + +- Execute the script install.sh + +```sh +$ ./install.sh +``` + +- Build a test suite (e.g. AtsNGAP) + +```sh +$ export ATS=AtsNGAP && make +``` + +- Switch to the next clause (Usage) + + +# Usage + +This clause describes how to compile and execute an Abstract Test Suite. +The procedures below illustrate how to run the AtsNGAP test suite. The same procedures will apply for any other NGAP/NAS Test Suite. + + +Pre-requisites: +- Your machine is installed following one of the installation method describes in the previous clause +- Your are logged as 'etsi' or 'vagrant' user +- Procedure using TITAN command line (only): + - Open several SSH session (PuTTY...) + - Change to the directory ~/dev/nas/ + - Modify the file config.mk according to your system: + - On Linux, comment all the lines using the '#' character + - On Windows, update the path accordingly + - Build the test suite AtsNGAP using the following command: + +```sh +$ export ATS=AtsNGAP # The Abstract Test Suite you want to build, such as AtsNGAP... +$ make +... +``` + +Before to execute the NGAP/NAS Test Suite, prepare, edit and update the configuration file (e.g. AtsNGAP Test Suite): +- Update the following fields: + - system.NGAP_AMF.params + - system.N2_gNBaMF_P.params +- Update the PICS and PIXITs accordingly + +```sh +$ ln -sf ../../etc/AtsNGAP/AtsNGAP_AMF_open5gs.cfg_ ../../etc/AtsNGAP/AtsNGAP.cfg +$ vi ../../etc/AtsNGAP/AtsNGAP.cfg # To update it +``` + +To run the NGAP/NAS Test Suite, execute the following command: + +```sh +$ cd ~/dev/nas/scripts +$ ../run_all.bash +... +``` + +- The log files are located in ../logs/AtsNGAP folder for this example. You can edit them using any editor or using the Eclipse TITAN log plugins + +# Limitations + +The following limitations apply: +- AE test suite was not validated; +- CBOR is not supported; +- XML is not supported; +- Subscription/notification mechanism testing not implemented yet. + +# How to Report a Bug + +The NGAP/NAS Conformance Test System project is under constant development, so it is possible that you will +encounter a bug while using it. Please report bugs at cti_support at etsi dot org. -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. diff --git a/TP_ideas_and_status.md b/TP_ideas_and_status.md index 2502fba4c8071f469fdbb5cfde917544567976e8..074d687c237aaa5287ac06ddf9cedced42d04c47 100644 --- a/TP_ideas_and_status.md +++ b/TP_ideas_and_status.md @@ -332,5 +332,9 @@ Potential Procedures to be tested - for the sake of total test coverage - 5.6.2 Paging procedure - 5.6.3 Notification procedure - 6.3.2 Network-requested PDU session modification +- 7 Handling of unknown, unforeseen, and erroneous protocol data + +## +[BPIN] Another test might be added based on TP_5GNAS_AMF_AUT_REQ_02 but to check option "when the UE was identified with GUTI" diff --git a/UE_Reg_Failure_HMAC.plantuml b/UE_Reg_Failure_HMAC.plantuml new file mode 100644 index 0000000000000000000000000000000000000000..5426b295966503782ffd8981b0e71a5648c164cb --- /dev/null +++ b/UE_Reg_Failure_HMAC.plantuml @@ -0,0 +1,363 @@ +@startuml +title 5G UE Registration with HMAC-A Failure and gNodeB Session Termination\n(3GPP Release 16) + +skinparam backgroundColor #FEFEFE +skinparam sequenceArrowThickness 2 +skinparam roundcorner 10 +skinparam maxmessagesize 200 +skinparam sequenceParticipant underline + +actor UE +participant "gNB" as RAN +participant AMF +participant AUSF +participant UDM + +== RRC Connection Establishment == +UE -> RAN: RRC Setup Request +activate RAN +RAN -> UE: RRC Setup +deactivate RAN +UE -> RAN: RRC Setup Complete\n(NAS: Registration Request attached) + +note right of UE +UE enters RRC_CONNECTED state +RRC connection is established +end note + +== Initial Registration Request == +UE -> RAN: NAS: Registration Request\n(Registration Type: Initial,\n5G-GUTI/SUCI, Requested NSSAI,\nUE Security Capability) +activate RAN + +RAN -> RAN: Store UE context\nAllocate RAN UE NGAP ID + +RAN -> AMF: INITIAL UE MESSAGE\n(Registration Request, RAN UE NGAP ID,\nUser Location Info, RRC Establishment Cause) +activate AMF + +AMF -> AMF: Allocate AMF UE NGAP ID\nCreate UE context +deactivate RAN + +note over RAN, AMF +UE-associated logical NG connection +is now established between gNB and AMF +end note + +== UE Identity Retrieval == +alt SUCI provided + AMF -> UDM: Nudm_UECM_Registration (SUCI) + activate UDM + UDM -> UDM: De-conceal SUCI\nRetrieve SUPI + UDM -> AMF: SUPI, Subscription Data + deactivate UDM +else 5G-GUTI provided + note over AMF + AMF resolves SUPI + from 5G-GUTI mapping + end note +end + +== Authentication Vector Request == +AMF -> AUSF: Nausf_UEAuthentication_Authenticate Request\n(SUPI, Serving Network Name) +activate AUSF + +AUSF -> UDM: Nudm_Authentication_Get Request\n(SUPI, Serving Network Name) +activate UDM + +UDM -> UDM: Generate 5G Authentication Vector:\n1. Retrieve permanent key K for SUPI\n2. Generate RAND (128 bits)\n3. Compute MAC-A = f1(K, SQN || RAND || AMF)\n4. Compute AUTN = SQN ⊕ AK || AMF || MAC-A\n5. Compute RES, CK, IK\n6. Derive XRES* = KDF(CK||IK, ...)\n7. Derive KAUSF + +note right of UDM +5G AKA Authentication Vector: +- RAND: Random challenge +- AUTN: Authentication token +- XRES*: Expected response +- KAUSF: Key for AUSF +MAC-A = f1(K, SQN || RAND || AMF) +is critical for authentication +end note + +UDM -> AUSF: 5G AV\n(RAND, AUTN, XRES*, KAUSF) +deactivate UDM + +AUSF -> AUSF: Store XRES* and KAUSF\nDerive HXRES* = SHA-256(RAND || XRES*) + +AUSF -> AMF: Authentication Material\n(RAND, AUTN, HXRES*) +deactivate AUSF + +AMF -> AMF: Store HXRES*\nAllocate ngKSI\nStart authentication timer + +== Authentication Request to UE == +AMF -> RAN: DOWNLINK NAS TRANSPORT\n(AMF UE NGAP ID, RAN UE NGAP ID,\nNAS: Authentication Request: RAND, AUTN, ngKSI) +activate RAN +RAN -> UE: NAS: Authentication Request\n(RAND, AUTN, ngKSI, ABBA) +deactivate RAN + +note right of UE +UE stores ngKSI and ABBA +Prepares to verify authentication +end note + +== UE Authentication Processing - HMAC-A FAILURE == +UE -> UE: Process AUTN\n1. Extract AK from AUTN\n2. Compute AK = f5(K, RAND)\n3. Retrieve SQN = (SQN ⊕ AK) ⊕ AK\n4. Extract AMF from AUTN\n5. Extract MAC-A from AUTN + +UE -> UE: Verify MAC-A:\nCompute XMAC-A = f1(K, SQN || RAND || AMF) + +note right of UE #FFB6C1 +**CRITICAL FAILURE DETECTED** +XMAC-A ≠ MAC-A + +Root Causes: +1. Key mismatch: K in USIM ≠ K in UDM +2. USIM malfunction or corruption +3. Incorrect subscription provisioning +4. Security breach attempt +5. SIM card authentication failure + +Result: UE cannot authenticate network +Cannot derive security keys +Cannot proceed with registration +end note + +UE -> UE: **AUTHENTICATION FAILED**\nDo NOT compute RES*\nDo NOT derive security keys + +== Authentication Failure Reporting == +UE -> RAN: NAS: Authentication Failure\n(Cause: "MAC failure",\nNo RES* included) +activate RAN + +note right of UE +Authentication Failure Message: +- Cause: "MAC failure" (0x14) +- Indicates HMAC-A verification failed +- No RES* is computed or sent +- No security keys derived +end note + +RAN -> AMF: UPLINK NAS TRANSPORT\n(AMF UE NGAP ID, RAN UE NGAP ID,\nNAS: Authentication Failure, Cause = "MAC failure") +deactivate RAN + +AMF -> AMF: **Authentication Failed**\nStop authentication timer\nVerification impossible + +note over AMF #FFB6C1 +AMF cannot verify RES* +Authentication procedure failed +Cannot establish security context +Registration must be rejected +end note + +== Failure Notification to AUSF/UDM == +AMF -> AUSF: Nausf_UEAuthentication_Authenticate Response\n(SUPI, Result: FAILURE,\nFailure Cause: "MAC failure") +activate AUSF + +AUSF -> AUSF: Record authentication failure\nIncrement failure counter for SUPI\nPrepare security alert + +AUSF -> UDM: Nudm_Authentication_ResultConfirmation\n(SUPI, Auth Result: FAILURE) +activate UDM + +UDM -> UDM: Log authentication failure:\n- Timestamp\n- SUPI\n- Failure type: MAC failure\n- Increment failure counter\n- Check threshold for blocking + +note right of UDM #FFB6C1 +Security Actions: +1. Log failure in security database +2. Increment failure counter +3. If threshold exceeded: + - Temporary SUPI blocking + - Security investigation trigger + - Operator notification +4. Check for fraud patterns +end note + +UDM -> AUSF: Confirmation\n(Failure recorded) +deactivate UDM + +AUSF -> AMF: Authentication Failure Confirmed +deactivate AUSF + +== Registration Rejection == +AMF -> AMF: Prepare Registration Reject:\n- Clear temporary UE context\n- Select reject cause\n- Optionally set T3346 timer + +note over AMF +Registration Reject Cause Options: +- #20: "MAC failure" +- #23: "Illegal UE" +- #3: "Illegal MS" +T3346 controls retry attempts +end note + +AMF -> RAN: DOWNLINK NAS TRANSPORT\n(AMF UE NGAP ID, RAN UE NGAP ID,\nNAS: Registration Reject,\nCause = "MAC failure",\nT3346 = 1800 seconds) +activate RAN + +RAN -> RAN: Forward NAS message\nStore reject information\nPrepare for cleanup + +RAN -> UE: NAS: Registration Reject\n(Cause: "MAC failure",\nT3346 = 1800 seconds) +deactivate RAN + +UE -> UE: **Registration REJECTED**\n- Delete temporary context\n- Start T3346 timer (30 min)\n- Enter limited service state + +note right of UE #FFB6C1 +UE Actions after Rejection: +1. Delete 5G-GUTI (if temporary) +2. Start T3346 timer +3. Disable 5G registration until: + - T3346 expires + - Power cycle + - USIM removed/reinserted + - Manual PLMN selection +4. May attempt EPS fallback +5. Inform user of failure +end note + +== gNodeB Initiated Session Termination == +note over RAN #FFFFE0 +gNB Decision to Terminate Session: +- Authentication failed +- No security context established +- UE rejected by core network +- Resources need to be released +- No valid UE context to maintain +end note + +RAN -> RAN: **Decision: Terminate UE session**\n- Release radio resources\n- Clear UE context\n- Prepare UE Context Release Request + +== UE Context Release Request (gNB → AMF) == +RAN -> AMF: UE CONTEXT RELEASE REQUEST\n(AMF UE NGAP ID, RAN UE NGAP ID,\nCause: "authentication-failure" or\n"unspecified-failure") +activate AMF + +note over RAN, AMF +gNB requests AMF to release +UE-associated logical NG connection +and all related context +end note + +AMF -> AMF: Receive release request\nValidate UE NGAP IDs\nPrepare context release + +note over AMF +AMF verifies: +- UE context exists +- No active PDU sessions (none exist) +- No ongoing procedures +- Safe to release +end note + +== UE Context Release Command (AMF → gNB) == +AMF -> RAN: UE CONTEXT RELEASE COMMAND\n(UE NGAP ID pair,\nCause: "nas-normal-release") +deactivate AMF +activate RAN + +note over AMF, RAN +AMF authorizes the release +All AMF-side UE context will be deleted +upon receiving release complete +end note + +RAN -> RAN: Process release command:\n1. Validate UE context\n2. Prepare RRC release\n3. Stop all UE-related timers\n4. Prepare to release radio resources + +== RRC Connection Release (gNB → UE) == +RAN -> UE: RRC Release\n(Release Cause: "other",\nWait Time: optional,\nRedirection Info: optional) + +note over RAN, UE +RRC Release message: +- Releases all radio bearers (SRBs) +- Releases RRC connection +- UE returns to RRC_IDLE state +- May include redirection to other RAT +- May include wait time before retry +end note + +UE -> UE: **Process RRC Release:**\n1. Stop all RRC timers\n2. Release all radio resources\n3. Release SRB1, SRB2\n4. Clear RRC configuration\n5. Enter RRC_IDLE state\n6. Start cell selection + +note right of UE +UE State Transition: +RRC_CONNECTED → RRC_IDLE + +Actions: +- Release all radio bearers +- Stop T300, T301, T310, T311 +- Clear RRC configuration +- Start cell reselection +- Remain in limited service + (due to T3346 running) +end note + +== Radio Resource Cleanup == +RAN -> RAN: **Release Radio Resources:**\n1. De-allocate physical resources\n2. Release C-RNTI\n3. Clear UE scheduling\n4. Free RRC connection\n5. Clear RRM measurements\n6. Release PDCP/RLC/MAC entities + +note over RAN #FFFFE0 +Radio Resource Cleanup: +- C-RNTI released +- Physical resource blocks freed +- Scheduling contexts deleted +- L2 (PDCP/RLC/MAC) released +- L1 resources freed +- UE monitoring stopped +end note + +== UE Context Release Complete (gNB → AMF) == +RAN -> AMF: UE CONTEXT RELEASE COMPLETE\n(AMF UE NGAP ID, RAN UE NGAP ID,\nUser Location Info: final cell location,\nOptional: Information on Recommended Cells) +activate AMF +deactivate RAN + +note over RAN, AMF +gNB confirms successful release +All NG-RAN resources released +UE-associated NG connection terminated +end note + +== AMF Context Cleanup == +AMF -> AMF: **Complete UE Context Release:**\n1. Delete UE NGAP context\n2. Delete AMF UE NGAP ID\n3. Delete temporary 5G-GUTI (if any)\n4. Clear security context\n5. Clear subscription data cache\n6. Release allocated resources\n7. Update UE reachability status + +note over AMF #FFFFE0 +AMF Cleanup Actions: +- Free AMF UE NGAP ID +- Delete UE-associated logical + NG connection +- Clear all temporary UE data +- No PDU sessions to release +- Update analytics/statistics +- Log complete transaction +end note + +AMF -> AMF: UE context fully deleted\nNG connection terminated +deactivate AMF + +== Final State == +note over UE #FFB6C1 +**UE Final State:** +- RRC_IDLE mode +- No NAS security context +- No RRC connection +- T3346 timer running +- Limited service state +- 5G registration blocked until: + * T3346 expires (30 min) + * Power cycle + * USIM change + * Manual intervention + +**User Actions Required:** +1. Check USIM/SIM card +2. Contact operator +3. Verify subscription status +4. Check for account issues +5. May need SIM replacement +end note + +note over RAN #FFFFE0 +**gNB Final State:** +- All UE resources released +- C-RNTI freed +- No UE context maintained +- Ready for new connections +- Resources available for other UEs +end note + +note over AMF #FFFFE0 +**AMF Final State:** +- No UE context stored +- UE not registered +- NG connection released +- Failure logged for analytics +- Security alert may be active +- Ready for new registration attempt + after T3346 expires +end note + +@enduml diff --git a/UE_Registration.plantuml b/UE_Registration.plantuml new file mode 100644 index 0000000000000000000000000000000000000000..0728269bb8b3144f8e55ef5d052565105e7348b1 --- /dev/null +++ b/UE_Registration.plantuml @@ -0,0 +1,256 @@ +@startuml +title 5G UE Registration Procedure for Voice and Data Access (3GPP Release 16) + +skinparam backgroundColor #FEFEFE +skinparam sequenceArrowThickness 2 +skinparam roundcorner 10 +skinparam maxmessagesize 200 +skinparam sequenceParticipant underline + +actor UE +participant "gNB/ng-eNB (TA) 242.39" as RAN +participant "AMF (IUT) 242.37" as AMF +participant AUSF +participant UDM +participant PCF +participant SMF +participant UPF +participant DN + +== RRC Connection Establishment == +UE -> RAN: RRC Setup Request +activate RAN +RAN -> UE: RRC Setup +deactivate RAN +UE -> RAN: RRC Setup Complete + +== Initial Registration Request == +UE -> RAN: NAS: Registration Request\n(Registration Type: Initial,\n5G-GUTI/SUCI, Requested NSSAI,\nUE Security Capability) +activate RAN +RAN -> AMF: INITIAL UE MESSAGE\n(Registration Request, User Location Info,\nRRC Establishment Cause, 5G-S-TMSI) +activate AMF +deactivate RAN + +== UE Identity Retrieval (if SUCI provided) == +AMF -> UDM: Nudm_UECM_Registration (SUCI) +activate UDM +UDM -> AMF: SUPI, Subscription Data +deactivate UDM + +== Authentication == +AMF -> AUSF: Nausf_UEAuthentication_Authenticate Request (SUPI) +activate AUSF +AUSF -> UDM: Nudm_Authentication_Get Request +activate UDM +UDM -> AUSF: Authentication Vector (5G AV) +deactivate UDM +AUSF -> AMF: 5G AV (RAND, AUTN, HXRES*) +deactivate AUSF + +AMF -> RAN: DOWNLINK NAS TRANSPORT\n(Authentication Request: RAND, AUTN) +activate RAN +RAN -> UE: NAS: Authentication Request +deactivate RAN + +UE -> UE: Compute RES*\nDerive KAUSF, KSEAF +UE -> RAN: NAS: Authentication Response (RES*) +activate RAN +RAN -> AMF: UPLINK NAS TRANSPORT\n(Authentication Response: RES*) +deactivate RAN + +AMF -> AMF: Verify RES* vs HXRES*\nDerive KAMF +AMF -> AUSF: Nausf_UEAuthentication_Authenticate Response (RES*) +activate AUSF +AUSF -> AMF: Authentication Result (Success) +deactivate AUSF + +== NAS Security Mode Command == +AMF -> AMF: Derive NAS Keys\n(KNASenc, KNASint) +AMF -> RAN: DOWNLINK NAS TRANSPORT\n(Security Mode Command:\nNAS Security Algorithms,\nngKSI, Replayed UE Security Capabilities) +activate RAN +RAN -> UE: NAS: Security Mode Command +deactivate RAN + +UE -> UE: Derive NAS Keys\nVerify Security Algorithms +UE -> RAN: NAS: Security Mode Complete\n[NAS Protected with Integrity & Ciphering] +activate RAN +RAN -> AMF: UPLINK NAS TRANSPORT\n(Security Mode Complete) +deactivate RAN + +note over UE, AMF: All subsequent NAS messages are integrity protected and ciphered + +== Subscription Data Retrieval == +AMF -> UDM: Nudm_SDM_Get (Access and Mobility Subscription Data) +activate UDM +UDM -> AMF: Subscription Data\n(Subscribed S-NSSAIs, DNN Configuration,\nSubscribed UE-AMBR, RFSP Index) +deactivate UDM + +AMF -> UDM: Nudm_SDM_Subscribe (SDM Subscription) +activate UDM +UDM -> AMF: SDM Subscription Confirmation +deactivate UDM + +== Policy Association == +AMF -> PCF: Npcf_AMPolicyControl_Create\n(SUPI, DNN, S-NSSAI) +activate PCF +PCF -> UDM: Nudm_SDM_Get (Policy Data) +activate UDM +UDM -> PCF: Policy Data +deactivate UDM +PCF -> AMF: AM Policy (Access and Mobility Policy,\nUE-AMBR, RFSP Index) +deactivate PCF + +== Registration Accept == +AMF -> AMF: Allocate 5G-GUTI,\nSelect Allowed NSSAI,\nDetermine Registration Area + +AMF -> RAN: INITIAL CONTEXT SETUP REQUEST\n(5G-GUTI, Allowed NSSAI, UE Security Capability,\nSecurity Key, UE Aggregate Maximum Bit Rate,\nMobility Restrictions, Registration Accept) +activate RAN + +RAN -> RAN: Generate gNB Security Keys\n(KgNBenc, KgNBint)\nfrom KAMF + +== AS Security Mode Command == +RAN -> UE: RRC: Security Mode Command\n(AS Security Algorithms) +UE -> UE: Derive AS Keys\n(KgNBenc, KgNBint) +UE -> RAN: RRC: Security Mode Complete + +note over UE, RAN: All subsequent RRC and UP messages are protected + +== Registration Accept Delivery == +RAN -> UE: NAS: Registration Accept\n(5G-GUTI, Registration Area,\nAllowed NSSAI, TAI List,\nMobility Restrictions, T3512) + +UE -> UE: Store 5G-GUTI,\nAllowed NSSAI,\nRegistration Area + +UE -> RAN: NAS: Registration Complete +RAN -> AMF: UPLINK NAS TRANSPORT\n(Registration Complete) + +RAN -> AMF: INITIAL CONTEXT SETUP RESPONSE\n(PDU Session Resource Setup List) +deactivate RAN +deactivate AMF + +note over UE, AMF: UE is now registered for mobility management + +== PDU Session Establishment for Data == +UE -> RAN: NAS: UL NAS Transport\n(PDU Session Establishment Request:\nPDU Session ID, S-NSSAI, DNN="internet",\nPDU Session Type=IPv4v6) +activate RAN +RAN -> AMF: UPLINK NAS TRANSPORT\n(PDU Session Establishment Request) +activate AMF +deactivate RAN + +== SMF Selection and Session Creation == +AMF -> SMF: Nsmf_PDUSession_CreateSMContext\n(SUPI, DNN, S-NSSAI, PDU Session ID) +activate SMF + +SMF -> UDM: Nudm_SDM_Get (Session Management Subscription Data) +activate UDM +UDM -> SMF: SM Subscription Data\n(Subscribed DNN Configuration,\nSession-AMBR, 5QI, ARP) +deactivate UDM + +SMF -> PCF: Npcf_SMPolicyControl_Create\n(SUPI, DNN, S-NSSAI, IP Address) +activate PCF +PCF -> SMF: SM Policy\n(PCC Rules, QoS, Charging Rules) +deactivate PCF + +SMF -> SMF: Select UPF,\nAllocate IP Address,\nCreate QoS Rules + +== N2 PDU Session Resource Setup == +SMF -> AMF: Namf_Communication_N1N2MessageTransfer\n(N2 SM Information: QoS Flows, UL/DL Tunnels) +AMF -> RAN: PDU SESSION RESOURCE SETUP REQUEST\n(PDU Session ID, S-NSSAI, QoS Flows,\nUL NG-U TNL Info, NAS: PDU Session Establishment Accept) +activate RAN + +RAN -> RAN: Establish DRBs,\nMap QoS Flows to DRBs + +== PDU Session Accept Delivery == +RAN -> UE: RRC: RRC Reconfiguration\n(DRB Configuration, QoS Flow Mapping) +RAN -> UE: NAS: DL NAS Transport\n(PDU Session Establishment Accept:\nPDU Session ID, PDU Session Type,\nSSC Mode, QoS Rules, QoS Flow Descriptions,\nAllocated IPv4/IPv6 Address) + +UE -> UE: Configure DRBs,\nConfigure IP Address,\nStore QoS Rules + +UE -> RAN: RRC: RRC Reconfiguration Complete +UE -> RAN: NAS: UL NAS Transport\n(PDU Session Establishment Accept Ack) + +== N3 Tunnel Setup == +RAN -> AMF: PDU SESSION RESOURCE SETUP RESPONSE\n(DL NG-U TNL Info, QoS Flows Setup List) +deactivate RAN + +AMF -> SMF: Nsmf_PDUSession_UpdateSMContext\n(N2 SM Information: DL Tunnel Info) + +SMF -> UPF: N4 Session Establishment Request\n(PDR, FAR, QER, URR for UL/DL) +activate UPF +UPF -> SMF: N4 Session Establishment Response +deactivate UPF + +SMF -> AMF: Nsmf_PDUSession_UpdateSMContext Response +deactivate SMF +deactivate AMF + +note over UE, UPF: User Plane is established for data services + +== PDU Session Establishment for IMS (Voice) == +UE -> RAN: NAS: UL NAS Transport\n(PDU Session Establishment Request:\nPDU Session ID, S-NSSAI, DNN="ims",\nPDU Session Type=IPv4v6, Request Type=Initial) +activate RAN +RAN -> AMF: UPLINK NAS TRANSPORT\n(PDU Session Establishment Request) +activate AMF +deactivate RAN + +AMF -> SMF: Nsmf_PDUSession_CreateSMContext\n(SUPI, DNN="ims", S-NSSAI, PDU Session ID) +activate SMF + +SMF -> UDM: Nudm_SDM_Get (IMS Session Management Data) +activate UDM +UDM -> SMF: IMS SM Subscription Data +deactivate UDM + +SMF -> PCF: Npcf_SMPolicyControl_Create\n(SUPI, DNN="ims", S-NSSAI) +activate PCF +PCF -> SMF: IMS SM Policy\n(QoS for IMS Signaling and Media) +deactivate PCF + +SMF -> SMF: Select UPF for IMS,\nAllocate IP Address for IMS,\nCreate QoS Rules for VoNR + +SMF -> AMF: Namf_Communication_N1N2MessageTransfer\n(N2 SM Information for IMS Session) +AMF -> RAN: PDU SESSION RESOURCE SETUP REQUEST\n(PDU Session ID, QoS Flows for IMS,\nUL NG-U TNL Info, PDU Session Establishment Accept) +activate RAN + +RAN -> UE: NAS: DL NAS Transport\n(PDU Session Establishment Accept for IMS:\nAllocated IP Address, QoS Rules for Voice) + +UE -> UE: Configure IMS PDU Session,\nStore P-CSCF Address + +UE -> RAN: NAS: UL NAS Transport\n(PDU Session Establishment Accept Ack) + +RAN -> AMF: PDU SESSION RESOURCE SETUP RESPONSE\n(DL NG-U TNL Info for IMS) +deactivate RAN + +AMF -> SMF: Nsmf_PDUSession_UpdateSMContext\n(N2 SM Information for IMS) +SMF -> UPF: N4 Session Establishment Request (IMS PDR/FAR/QER) +activate UPF +UPF -> SMF: N4 Session Establishment Response +deactivate UPF + +SMF -> AMF: Nsmf_PDUSession_UpdateSMContext Response +deactivate SMF +deactivate AMF + +note over UE, UPF: IMS PDU Session established for Voice over NR (VoNR) + +== IMS Registration (for Voice Services) == +UE -> UPF: SIP REGISTER (via IMS PDU Session) +activate UPF +UPF -> DN: Forward to IMS (P-CSCF) +activate DN +DN -> DN: IMS Authentication\nand Registration +DN -> UPF: SIP 200 OK (Registration Successful) +deactivate DN +UPF -> UE: SIP 200 OK +deactivate UPF + +note over UE, DN: UE is now registered for IMS Voice Services\nand Data Services are active + +== Data Flow == +UE <-> UPF: User Plane Data Traffic\n(N3 Tunnel via gNB) +activate UPF +UPF <-> DN: N6 Interface (Internet) +activate DN +deactivate DN +deactivate UPF + +@enduml diff --git a/captures/TC_5GNAS_AMF_AUT_REQ_01.pcap b/captures/TC_5GNAS_AMF_AUT_REQ_01.pcap new file mode 100644 index 0000000000000000000000000000000000000000..024f8fbbd9a73a02703b3d4d14d48c66e0d2d952 Binary files /dev/null and b/captures/TC_5GNAS_AMF_AUT_REQ_01.pcap differ diff --git a/captures/TC_5GNAS_AMF_AUT_REQ_02.pcap b/captures/TC_5GNAS_AMF_AUT_REQ_02.pcap new file mode 100644 index 0000000000000000000000000000000000000000..f6e777c656d1ab424f3cfee9cafa76da0ad2fec4 Binary files /dev/null and b/captures/TC_5GNAS_AMF_AUT_REQ_02.pcap differ diff --git a/captures/TC_5GNAS_AMF_AUT_REQ_03.pcap b/captures/TC_5GNAS_AMF_AUT_REQ_03.pcap new file mode 100644 index 0000000000000000000000000000000000000000..08a8a4dbd0afa370de13417509da48073e7bd9b6 Binary files /dev/null and b/captures/TC_5GNAS_AMF_AUT_REQ_03.pcap differ diff --git a/captures/TC_5GNAS_AMF_AUT_REQ_04.pcap b/captures/TC_5GNAS_AMF_AUT_REQ_04.pcap new file mode 100644 index 0000000000000000000000000000000000000000..2e669a1f91b7fc822c2ea3f00cbd142dd38e624b Binary files /dev/null and b/captures/TC_5GNAS_AMF_AUT_REQ_04.pcap differ diff --git a/captures/TC_NGAP_AMF_CMP_01.pcap b/captures/TC_NGAP_AMF_CMP_01.pcap new file mode 100644 index 0000000000000000000000000000000000000000..b7b030854b9399466144f8471c24b84f69eaef3e Binary files /dev/null and b/captures/TC_NGAP_AMF_CMP_01.pcap differ diff --git a/captures/TC_NGAP_AMF_CMP_02.pcap b/captures/TC_NGAP_AMF_CMP_02.pcap new file mode 100644 index 0000000000000000000000000000000000000000..fc6a545f25036eef3bfb70eff5892ecaf40e3ce7 Binary files /dev/null and b/captures/TC_NGAP_AMF_CMP_02.pcap differ diff --git a/captures/TC_NGAP_AMF_CMP_03.pcap b/captures/TC_NGAP_AMF_CMP_03.pcap new file mode 100644 index 0000000000000000000000000000000000000000..f3a65ae9b549c7431a2e0821ef31f5efc31855c0 Binary files /dev/null and b/captures/TC_NGAP_AMF_CMP_03.pcap differ diff --git a/captures/TC_NGAP_AMF_IMP_01.pcap b/captures/TC_NGAP_AMF_IMP_01.pcap new file mode 100644 index 0000000000000000000000000000000000000000..7738bef126fdabeb13d452fb1a2899ab0e501015 Binary files /dev/null and b/captures/TC_NGAP_AMF_IMP_01.pcap differ diff --git a/captures/TC_NGAP_AMF_IMP_01_02.pcap b/captures/TC_NGAP_AMF_IMP_01_02.pcap new file mode 100644 index 0000000000000000000000000000000000000000..d4971adee8862b2522383a1f173fcc08ff7f4b50 Binary files /dev/null and b/captures/TC_NGAP_AMF_IMP_01_02.pcap differ diff --git a/captures/TC_NGAP_AMF_IMP_02.pcap b/captures/TC_NGAP_AMF_IMP_02.pcap new file mode 100644 index 0000000000000000000000000000000000000000..0bbc1fc7a427a79fdb7b2e081b90e1e62dd6da69 Binary files /dev/null and b/captures/TC_NGAP_AMF_IMP_02.pcap differ diff --git a/captures/TC_NGAP_AMF_IMP_04.pcap b/captures/TC_NGAP_AMF_IMP_04.pcap new file mode 100644 index 0000000000000000000000000000000000000000..d7bb93a9bb55db5ed90e3d847565f6e2ec779224 Binary files /dev/null and b/captures/TC_NGAP_AMF_IMP_04.pcap differ diff --git a/captures/TC_NGAP_AMF_IMP_05.pcap b/captures/TC_NGAP_AMF_IMP_05.pcap new file mode 100644 index 0000000000000000000000000000000000000000..525353b6acf915ea637dd874d55575940dadec9f Binary files /dev/null and b/captures/TC_NGAP_AMF_IMP_05.pcap differ diff --git a/captures/TC_NGAP_AMF_IMP_06.pcap b/captures/TC_NGAP_AMF_IMP_06.pcap new file mode 100644 index 0000000000000000000000000000000000000000..8ab74512c6182cdbca50eab433427bb335ae9eda Binary files /dev/null and b/captures/TC_NGAP_AMF_IMP_06.pcap differ diff --git a/captures/TC_NGAP_AMF_IMP_08.pcap b/captures/TC_NGAP_AMF_IMP_08.pcap new file mode 100644 index 0000000000000000000000000000000000000000..f39af748f3d5dd98b1a7cecfa96cdb8464e5e15d Binary files /dev/null and b/captures/TC_NGAP_AMF_IMP_08.pcap differ diff --git a/captures/TC_NGAP_AMF_IMP_08_02.pcap b/captures/TC_NGAP_AMF_IMP_08_02.pcap new file mode 100644 index 0000000000000000000000000000000000000000..a2e774f029f3fe001d74426f58b6c29ff5372921 Binary files /dev/null and b/captures/TC_NGAP_AMF_IMP_08_02.pcap differ diff --git a/captures/TC_NGAP_AMF_NAS_01.pcap b/captures/TC_NGAP_AMF_NAS_01.pcap new file mode 100644 index 0000000000000000000000000000000000000000..ccbde8bc4acf52e375c93d9be1767c0fd3065250 Binary files /dev/null and b/captures/TC_NGAP_AMF_NAS_01.pcap differ diff --git a/captures/TC_NGAP_AMF_PDU_01.pcap b/captures/TC_NGAP_AMF_PDU_01.pcap new file mode 100644 index 0000000000000000000000000000000000000000..c5d873cc5251ef4bf533fb6d5d09bf3b8888bcdd Binary files /dev/null and b/captures/TC_NGAP_AMF_PDU_01.pcap differ diff --git a/captures/TC_NGAP_AMF_PDU_01_02.pcap b/captures/TC_NGAP_AMF_PDU_01_02.pcap new file mode 100644 index 0000000000000000000000000000000000000000..fb82042fad1a22380b6d6f2c3b00643b37865ee4 Binary files /dev/null and b/captures/TC_NGAP_AMF_PDU_01_02.pcap differ diff --git a/captures/TC_NGAP_AMF_PDU_02.pcap b/captures/TC_NGAP_AMF_PDU_02.pcap new file mode 100644 index 0000000000000000000000000000000000000000..47d64281c675e9c85e9e40e1b439848edf91c3fe Binary files /dev/null and b/captures/TC_NGAP_AMF_PDU_02.pcap differ diff --git a/captures/TC_NGAP_AMF_PDU_02_02.pcap b/captures/TC_NGAP_AMF_PDU_02_02.pcap new file mode 100644 index 0000000000000000000000000000000000000000..15ef3cab66ebeb0956d59c274f343a1bce4c601a Binary files /dev/null and b/captures/TC_NGAP_AMF_PDU_02_02.pcap differ diff --git a/captures/TC_NGAP_AMF_PDU_03.pcap b/captures/TC_NGAP_AMF_PDU_03.pcap new file mode 100644 index 0000000000000000000000000000000000000000..649ef26319428b177577dcd1b8839b5915b1f3c7 Binary files /dev/null and b/captures/TC_NGAP_AMF_PDU_03.pcap differ diff --git a/captures/TC_NGAP_GNB_CMP_07.pcap b/captures/TC_NGAP_GNB_CMP_07.pcap new file mode 100644 index 0000000000000000000000000000000000000000..fc6503cf32cb3431028d8aeed986a14a0169bdde Binary files /dev/null and b/captures/TC_NGAP_GNB_CMP_07.pcap differ diff --git a/captures/TC_NGAP_GNB_IMP_01.pcap b/captures/TC_NGAP_GNB_IMP_01.pcap new file mode 100644 index 0000000000000000000000000000000000000000..8f968ffe1b865661bf2cff9d1ed492c7fed4268f Binary files /dev/null and b/captures/TC_NGAP_GNB_IMP_01.pcap differ diff --git a/captures/TC_NGAP_GNB_IMP_05.pcap b/captures/TC_NGAP_GNB_IMP_05.pcap new file mode 100644 index 0000000000000000000000000000000000000000..574878d0726223278ce71e0462c03a26406dbebc Binary files /dev/null and b/captures/TC_NGAP_GNB_IMP_05.pcap differ diff --git a/captures/TC_NGAP_GNB_PDU_01.pcap b/captures/TC_NGAP_GNB_PDU_01.pcap new file mode 100644 index 0000000000000000000000000000000000000000..c9fab3320cd7c251f76a260f79bd95fd2c452aa7 Binary files /dev/null and b/captures/TC_NGAP_GNB_PDU_01.pcap differ diff --git a/ccsrc/EncDec/NG_NAS_EncDec.cc b/ccsrc/EncDec/NG_NAS_EncDec.cc index af95a84a981441b29cdd7991d2aac5e395319b5a..bb4e344c7e7c453cb1559d2bf0203c32c6478db3 100644 --- a/ccsrc/EncDec/NG_NAS_EncDec.cc +++ b/ccsrc/EncDec/NG_NAS_EncDec.cc @@ -22,8 +22,6 @@ namespace NG__NAS__EncdecDeclarations { * @return encoded value ****************************************************/ - BITSTRING fx__enc__NG__NAS__UL__Message__Type(const NG__NAS__MsgContainers::NG__NAS__UL__Message__Type &p){return int2bit(0,0);} - BITSTRING fx__enc__NG__NAS__DL__Message__Type(const NG__NAS__MsgContainers::NG__NAS__DL__Message__Type &p){return int2bit(0,0);} BITSTRING fx__enc__IntraN1TransparentContainer(const NG__NAS__TypeDefs::IntraN1TransparentContainer &p){return int2bit(0,0);} BITSTRING fx__enc__CIoTSmallDataContainer(const NG__NAS__TypeDefs::CIoTSmallDataContainer &p){return int2bit(0,0);} BITSTRING fx__enc__EAP__Message__Type(const EAP__TypeDefs::EAP__Message__Type &p){return int2bit(0,0);} @@ -33,13 +31,10 @@ namespace NG__NAS__EncdecDeclarations { * @param value to encode * @return encoded value ****************************************************/ - INTEGER fx__dec__NG__NAS__UL__Message__Type(BITSTRING &b, NG__NAS__MsgContainers::NG__NAS__UL__Message__Type &p) {return -1;} - INTEGER fx__dec__NG__NAS__DL__Message__Type(BITSTRING &b, NG__NAS__MsgContainers::NG__NAS__DL__Message__Type &p) {return -1;} INTEGER fx__dec__IntraN1TransparentContainer(BITSTRING &b, NG__NAS__TypeDefs::IntraN1TransparentContainer &p) {return -1;} INTEGER fx__dec__CIoTSmallDataContainer(BITSTRING &b, NG__NAS__TypeDefs::CIoTSmallDataContainer &p) {return -1;} INTEGER fx__dec__EAP__Message__Type(BITSTRING &b, EAP__TypeDefs::EAP__Message__Type &p) {return -1;} - } // namespace NG__NAS__EncdecDeclarations diff --git a/ccsrc/Externals/LIB_NG_NAS_Functions_ext.cc b/ccsrc/Externals/Lib_NG_NAS_Functions_ext.cc similarity index 54% rename from ccsrc/Externals/LIB_NG_NAS_Functions_ext.cc rename to ccsrc/Externals/Lib_NG_NAS_Functions_ext.cc index 61e06ec54f29b77fd39fb328a1aa6502537cc229..33605352129175f349adfde3bd3488d3d24983c1 100644 --- a/ccsrc/Externals/LIB_NG_NAS_Functions_ext.cc +++ b/ccsrc/Externals/Lib_NG_NAS_Functions_ext.cc @@ -1,13 +1,18 @@ -#include "LIB_NG_NAS_Functions.hh" +#include "Lib_NG_NAS_Functions.hh" #include "loggers.hh" #include "rijndael.hh" #include "opc.hh" -namespace LIB__NG__NAS__Functions { +/** + * @see https://www.ericsson.com/en/blog/2021/9/authentication-and-key-agreements + */ +namespace Lib__NG__NAS__Security__Functions { static uint8_t OP[16] = {0}; // FIXME FSCOM To be refined. This is a Q&D implementation + static uint8_t OPc[16] = {0}; // FIXME FSCOM To be refined. This is a Q&D implementation + static bool FORCE_OPC = false; void fx__set__op(const OCTETSTRING& p_op) { loggers::get_instance().log_msg(">>> fx__set__op: p_op: ", p_op); @@ -15,17 +20,69 @@ namespace LIB__NG__NAS__Functions { loggers::get_instance().log_to_hexa("<<< fx__set__op: OP: ", static_cast(OP), 16); } + void fx__get__op(OCTETSTRING& p_op) { + p_op = OCTETSTRING(16, static_cast(OP)); + loggers::get_instance().log_msg("<<< fx__get__op: OP: ", p_op); + } + + void fx__force__opc(const OCTETSTRING& p_opc) { + loggers::get_instance().log_msg(">>> fx__force__opc: p_opc: ", p_opc); + std::memcpy(OPc, static_cast(p_opc), 16); + FORCE_OPC = true; + loggers::get_instance().log_to_hexa("<<< fx__force__opc: OPc: ", static_cast(OPc), 16); + } + + INTEGER fx__compute__opc(const OCTETSTRING& p_authK, OCTETSTRING& p_opc) { + loggers::get_instance().log_msg(">>> fx_compute_opc: OP: ", OCTETSTRING(16, static_cast(OP))); + + if (FORCE_OPC) { + loggers::get_instance().log_msg("<<< fx_compute_opc: OPC (forced): ", OCTETSTRING(16, static_cast(OPc))); + p_opc = OCTETSTRING(16, static_cast(OPc)); + return 0; + } + rijndael r; + r.rijndael_key_schedule(p_authK); + opc op(r, OP); + uint8_t op_c[16] = { 0x00 }; + op.compute_opc(op_c); + p_opc = OCTETSTRING(16, static_cast(op_c)); + + loggers::get_instance().log_msg("<<< fx_compute_opc: OPC: ", p_opc); + return 0; + } + + INTEGER fx__rijndael__encrypt(const OCTETSTRING& p_key, const OCTETSTRING& p_plain_text, OCTETSTRING& p_cypherer_text) { + loggers::get_instance().log_msg(">>> fx__rijndael__encrypt: p_key: ", p_key); + loggers::get_instance().log_msg(">>> fx__rijndael__encrypt: p_plain_text: ", p_plain_text); + + rijndael r; + r.rijndael_key_schedule(p_key); + uint8_t cypherer_text[16] = { 0x00 }; + r.rijndael_encrypt(static_cast(p_plain_text), cypherer_text); + p_cypherer_text = OCTETSTRING(16, static_cast(cypherer_text)); + + loggers::get_instance().log_msg("<<< fx__rijndael__encrypt: p_cypherer_text: ", p_cypherer_text); + return 0; + } + INTEGER fx__f1(const BITSTRING& p_authK, const BITSTRING& p_rand, const BITSTRING& p_sqn, const BITSTRING& p_amf, BITSTRING& p_mac_a) { loggers::get_instance().log_msg(">>> fx__f1: p_authK: ", bit2oct(p_authK)); loggers::get_instance().log_msg(">>> fx__f1: p_rand: ", bit2oct(p_rand)); + loggers::get_instance().log_msg(">>> fx__f1: p_sqn: ", bit2oct(p_sqn)); + loggers::get_instance().log_msg(">>> fx__f1: p_amf: ", bit2oct(p_amf)); rijndael r; OCTETSTRING authK = bit2oct(p_authK); r.rijndael_key_schedule(authK); - opc op(r, OP); + OCTETSTRING os; + fx__compute__opc(authK, os); uint8_t op_c[16] = { 0x00 }; - op.compute_opc(op_c); - + std::memcpy(op_c, static_cast(os), 16); + // opc op(r, OP); + // uint8_t op_c[16] = { 0x00 }; + // op.compute_opc(op_c); + loggers::get_instance().log_to_hexa("fx__f1: op_c: ", op_c, 16); + OCTETSTRING rand = bit2oct(p_rand); uint8_t rijndael_input[16] = { 0x00 }; for (int i = 0; i < 16; i++) { @@ -33,6 +90,7 @@ namespace LIB__NG__NAS__Functions { } // End of 'for' statement uint8_t temp[16] = { 0x00 }; r.rijndael_encrypt(rijndael_input, temp); + loggers::get_instance().log_to_hexa("fx__f1: Value after 1st encryption: ", temp, 16); OCTETSTRING sqn = bit2oct(p_sqn); uint8_t in1[16] = { 0x00 }; @@ -58,6 +116,8 @@ namespace LIB__NG__NAS__Functions { uint8_t out1[16] = { 0x00 }; r.rijndael_encrypt(rijndael_input, out1); + loggers::get_instance().log_to_hexa("fx__f1: Value after 2sd encryption: ", out1, 16); + for (int i = 0; i < 16; i++) { out1[i] ^= op_c[i]; } // End of 'for' statement @@ -66,9 +126,9 @@ namespace LIB__NG__NAS__Functions { for (int i = 0; i < 8; i++) { mac_a[i] = out1[i]; } // End of 'for' statement - OCTETSTRING os(8, static_cast(&mac_a[0])); + os = OCTETSTRING(8, static_cast(&mac_a[0])); p_mac_a = oct2bit(os); - loggers::get_instance().log_msg("fx__f1star: p_mac_a: ", os); + loggers::get_instance().log_msg("fx__f1: p_mac_a: ", os); return 0; } @@ -76,13 +136,20 @@ namespace LIB__NG__NAS__Functions { INTEGER fx__f1star(const BITSTRING& p_authK, const BITSTRING& p_rand, const BITSTRING& p_sqn, const BITSTRING& p_amf, BITSTRING& p_mac_s) { loggers::get_instance().log_msg(">>> fx__f1star: p_authK: ", bit2oct(p_authK)); loggers::get_instance().log_msg(">>> fx__f1star: p_rand: ", bit2oct(p_rand)); + loggers::get_instance().log_msg(">>> fx__f1: p_sqn: ", bit2oct(p_sqn)); + loggers::get_instance().log_msg(">>> fx__f1: p_amf: ", bit2oct(p_amf)); rijndael r; OCTETSTRING authK = bit2oct(p_authK); r.rijndael_key_schedule(authK); - opc op(r, OP); + OCTETSTRING os; + fx__compute__opc(authK, os); uint8_t op_c[16] = { 0x00 }; - op.compute_opc(op_c); + std::memcpy(op_c, static_cast(os), 16); + // opc op(r, OP); + // uint8_t op_c[16] = { 0x00 }; + // op.compute_opc(op_c); + loggers::get_instance().log_to_hexa("fx__f1star: op_c: ", op_c, 16); OCTETSTRING rand = bit2oct(p_rand); uint8_t rijndael_input[16] = { 0x00 }; @@ -91,6 +158,7 @@ namespace LIB__NG__NAS__Functions { } // End of 'for' statement uint8_t temp[16] = { 0x00 }; r.rijndael_encrypt(rijndael_input, temp); + loggers::get_instance().log_to_hexa("fx__f1star: Value after 1st encryption: ", temp, 16); OCTETSTRING sqn = bit2oct(p_sqn); uint8_t in1[16] = { 0x00 }; @@ -116,6 +184,8 @@ namespace LIB__NG__NAS__Functions { uint8_t out1[16] = { 0x00 }; r.rijndael_encrypt(rijndael_input, out1); + loggers::get_instance().log_to_hexa("fx__f1: Value after 2sd encryption: ", out1, 16); + for (int i = 0; i < 16; i++) { out1[i] ^= op_c[i]; } // End of 'for' statement @@ -124,7 +194,7 @@ namespace LIB__NG__NAS__Functions { for (int i = 0; i < 8; i++) { mac_s[i] = out1[i + 8]; } // End of 'for' statement - OCTETSTRING os(8, static_cast(&mac_s[0])); + os = OCTETSTRING(8, static_cast(&mac_s[0])); p_mac_s = oct2bit(os); loggers::get_instance().log_msg("fx__f1star: p_mac_s: ", os); @@ -132,15 +202,20 @@ namespace LIB__NG__NAS__Functions { } INTEGER fx__f2345(const BITSTRING& p_authK, const BITSTRING& p_rand, BITSTRING& p_res, BITSTRING& p_ck, BITSTRING& p_ik, BITSTRING& p_ak) { - loggers::get_instance().log_msg(">>> fx_f2345: p_authK: ", p_authK); - loggers::get_instance().log_msg(">>> fx_f2345: p_rand: ", p_rand); + loggers::get_instance().log_msg(">>> fx__f2345: p_authK: ", bit2oct(p_authK)); + loggers::get_instance().log_msg(">>> fx__f2345: p_rand: ", bit2oct(p_rand)); rijndael r; OCTETSTRING authK = bit2oct(p_authK); r.rijndael_key_schedule(authK); - opc op(r, OP); + OCTETSTRING os; + fx__compute__opc(authK, os); uint8_t op_c[16] = { 0x00 }; - op.compute_opc(op_c); + std::memcpy(op_c, static_cast(os), 16); + // opc op(r, OP); + // uint8_t op_c[16] = { 0x00 }; + // op.compute_opc(op_c); + loggers::get_instance().log_to_hexa("fx__f2345: a entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", op_c, 16); OCTETSTRING rand = bit2oct(p_rand); uint8_t rijndael_input[16] = { 0x00 }; @@ -149,15 +224,19 @@ namespace LIB__NG__NAS__Functions { } // End of 'for' statement uint8_t temp[16] = { 0x00 }; r.rijndael_encrypt(rijndael_input, temp); + loggers::get_instance().log_to_hexa("fx__f2345: Value after 1st encryption: ", temp, 16); // To obtain output block OUT2: XOR OPc and TEMP, rotate by r2=0, and XOR on the constant c2 (which is all zeroes except that the last bit is 1) for (int i = 0; i < 16; i++) { rijndael_input[i] = temp[i] ^ op_c[i]; } // End of 'for' statement rijndael_input[15] ^= 1; + loggers::get_instance().log_to_hexa("fx__f2345: b entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", rijndael_input, 16); uint8_t out[16] = { 0x00 }; r.rijndael_encrypt(rijndael_input, out); + loggers::get_instance().log_to_hexa("fx__f2345: f2/d entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", out, 16); + for (int i = 0; i < 16; i++) { out[i] ^= op_c[i]; } // End of 'for' statement @@ -166,19 +245,23 @@ namespace LIB__NG__NAS__Functions { for (int i = 0; i < 8; i++) { res[i] = out[i + 8]; } // End of 'for' statement + loggers::get_instance().log_to_hexa("fx__f2345: f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", res, 8); uint8_t ak[6] = { 0x00 }; for (int i = 0; i < 6; i++) { ak[i] = out[i]; } // End of 'for' statement + loggers::get_instance().log_to_hexa("fx__f2345: f5/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", ak, 6); // To obtain output block OUT3: XOR OPc and TEMP, rotate by r3=32, and XOR on the constant c3 (which is all zeroes except that the next to last bit is 1) for (int i = 0; i < 16; i++) { rijndael_input[(i + 12) % 16] = temp[i] ^ op_c[i]; } // End of 'for' statement rijndael_input[15] ^= 2; - + loggers::get_instance().log_to_hexa("fx__f2345: f3/c entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", out, 16); r.rijndael_encrypt(rijndael_input, out); + loggers::get_instance().log_to_hexa("fx__f2345: f3/d entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", out, 16); + for (int i = 0; i < 16; i++) { out[i] ^= op_c[i]; } // End of 'for' statement @@ -187,14 +270,17 @@ namespace LIB__NG__NAS__Functions { for (int i = 0; i < 16; i++) { ck[i] = out[i]; } // End of 'for' statement + loggers::get_instance().log_to_hexa("fx__f2345: f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.x Test Set table: ", ck, 16); // To obtain output block OUT4: XOR OPc and TEMP, rotate by r4=64, and XOR on the constant c4 (which is all zeroes except that the 2nd from last bit is 1) for (int i = 0; i < 16; i++) { rijndael_input[(i+8) % 16] = temp[i] ^ op_c[i]; } // End of 'for' statement rijndael_input[15] ^= 4; - + loggers::get_instance().log_to_hexa("fx__f2345: f4/c entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", rijndael_input, 16); r.rijndael_encrypt(rijndael_input, out); + loggers::get_instance().log_to_hexa("fx__f2345: f4/d entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", out, 16); + for (int i = 0; i < 16; i++) { out[i] ^= op_c[i]; } // End of 'for' statement @@ -203,33 +289,39 @@ namespace LIB__NG__NAS__Functions { for (int i = 0; i < 16; i++) { ik[i] = out[i]; } // End of 'for' statement + loggers::get_instance().log_to_hexa("fx__f2345: f4/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", ik, 16); - OCTETSTRING os(8, static_cast(&res[0])); + os = OCTETSTRING(8, static_cast(&res[0])); p_res = oct2bit(os); - os = OCTETSTRING(16, static_cast(&ik[0])); - p_ik = oct2bit(os); os = OCTETSTRING(16, static_cast(&ck[0])); p_ck = oct2bit(os); + os = OCTETSTRING(16, static_cast(&ik[0])); + p_ik = oct2bit(os); os = OCTETSTRING(6, static_cast(&ak[0])); p_ak = oct2bit(os); - loggers::get_instance().log_msg("fx_f2345: p_res: ", p_res); - loggers::get_instance().log_msg("fx_f2345: p_ck: ", p_ck); - loggers::get_instance().log_msg("fx_f2345: p_ik: ", p_ik); - loggers::get_instance().log_msg("fx_f2345: p_ak: ", p_ak); + loggers::get_instance().log_msg("fx__f2345: p_res: ", bit2oct(p_res)); + loggers::get_instance().log_msg("fx__f2345: p_ck: ", bit2oct(p_ck)); + loggers::get_instance().log_msg("fx__f2345: p_ik: ", bit2oct(p_ik)); + loggers::get_instance().log_msg("fx__f2345: p_ak: ", bit2oct(p_ak)); return 0; } - INTEGER fx__f5star(const BITSTRING& p_authK, const BITSTRING& p_rand, BITSTRING& p_ak) { + INTEGER fx__f5star(const BITSTRING& p_authK, const BITSTRING& p_rand, BITSTRING& p_ak_s) { loggers::get_instance().log_msg(">>> fx__f5star: p_authK: ", p_authK); loggers::get_instance().log_msg(">>> fx__f5star: p_rand: ", p_rand); rijndael r; OCTETSTRING authK = bit2oct(p_authK); r.rijndael_key_schedule(authK); - opc op(r, OP); + OCTETSTRING os; + fx__compute__opc(authK, os); uint8_t op_c[16] = { 0x00 }; - op.compute_opc(op_c); + std::memcpy(op_c, static_cast(os), 16); + // opc op(r, OP); + // uint8_t op_c[16] = { 0x00 }; + // op.compute_opc(op_c); + loggers::get_instance().log_to_hexa("fx__f5star: a entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", op_c, 16); OCTETSTRING rand = bit2oct(p_rand); uint8_t rijndael_input[16] = { 0x00 }; @@ -244,9 +336,10 @@ namespace LIB__NG__NAS__Functions { rijndael_input[(i + 4) % 16] = temp[i] ^ op_c[i]; } // End of 'for' statement rijndael_input[15] ^= 8; - uint8_t out[16] = { 0x00 }; + loggers::get_instance().log_to_hexa("fx__f5star: f5*/c entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", rijndael_input, 16); r.rijndael_encrypt(rijndael_input, out); + loggers::get_instance().log_to_hexa("fx__f5star: f5*/d entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.x Test Set table: ", out, 16); for (int i = 0; i < 16; i++) { out[i] ^= op_c[i]; } // End of 'for' statement @@ -255,11 +348,12 @@ namespace LIB__NG__NAS__Functions { for (int i = 0; i < 6; i++) { ak[i] = out[i]; } - OCTETSTRING os(6, static_cast(&ak[0])); - p_ak = oct2bit(os); - loggers::get_instance().log_msg("fx__f5star: p_ak: ", os); + os = OCTETSTRING(6, static_cast(&ak[0])); + p_ak_s = oct2bit(os); + loggers::get_instance().log_msg("fx__f5star: p_ak: ", bit2oct(p_ak_s)); return 0; } -} // End of namespace LIB__NG__NAS__Functions +} // End of namespace namespace Lib__NG__NAS__Security__Functions { + diff --git a/ccsrc/Externals/NG_security_ext.cc b/ccsrc/Externals/NG_security_ext.cc index db85ed3c3ee4b783269ce09b83700108c40f8f56..207f2b9732127d0bd6f850abaf549d529d06d404 100644 --- a/ccsrc/Externals/NG_security_ext.cc +++ b/ccsrc/Externals/NG_security_ext.cc @@ -1,45 +1,302 @@ -#include -#include -#include -#include - -//#include "NG_SecurityDefinitionsAndExternalFunctions.hh" -#include "NG_NAS_SecurityFunctions.hh" -//#include "NR_RRC_ASN1_Definitions.hh" -#include "CommonDefs.hh" - -#include "base_time.hh" -//#include "converter.hh" -#include "loggers.hh" -//#include "xml_converters.hh" - - -//namespace NG__SecurityDefinitionsAndExternalFunctions { -namespace NG__NAS__SecurityFunctions { - - /** - * @desc This external function ... - * @return The ... - * @see fx_get...() return ... - */ - -//BITSTRING fx__NR__AsIntegrityAlgorithm(const OCTETSTRING &a, const NR__RRC__ASN1__Definitions::IntegrityProtAlgorithm& b, const BITSTRING &c, const OCTETSTRING &d, const BITSTRING &e, const INTEGER &f){ -//return int2bit(0, 0); -//} - -OCTETSTRING fx__NG__NasIntegrityAlgorithm(const OCTETSTRING& p_EncodedNasPdu, const BITSTRING& p_IntegrityAlgorithm, const BITSTRING& p_KNASint, const OCTETSTRING& p_NasCount, const BITSTRING& p_BearerId, const INTEGER& p_Direction){ -return int2oct(0, 0); -} - -OCTETSTRING fx__NG__NasCiphering(const OCTETSTRING& p_EncodedNasPdu,const BITSTRING& p_CipheringAlgorithm, const BITSTRING& p_KNASenc, const OCTETSTRING& p_NasCount, const BITSTRING& p_BearerId){ -return int2oct(0, 0); -} - -OCTETSTRING fx__NG__NasDeciphering(const OCTETSTRING& p_CipheredNasMsg, const BITSTRING& p_CipheringAlgorithm, const BITSTRING& p_KNASenc, const OCTETSTRING& p_NasCount, const BITSTRING& p_BearerId){ -return int2oct(0, 0); -} - - - -} // namespace NG__NAS__SecurityFunctions - // namespace NG__SecurityDefinitionsAndExternalFunctions +#include +#include +#include +#include + +#include +#include + +//#include "NG_SecurityDefinitionsAndExternalFunctions.hh" +#include "NG_NAS_SecurityFunctions.hh" +//#include "NR_RRC_ASN1_Definitions.hh" +#include "CommonDefs.hh" + +#include "base_time.hh" +#include "converter.hh" +#include "loggers.hh" + +#include "ia1_128.hh" +#include "ia2_128.hh" +#include "ia3_128.hh" + +namespace NG__SecurityDefinitionsAndExternalFunctions { + + /** + * @desc This external function ... + * @return The ... + * @see fx_get...() return ... + */ + +//BITSTRING fx__NR__AsIntegrityAlgorithm(const OCTETSTRING &a, const NR__RRC__ASN1__Definitions::IntegrityProtAlgorithm& b, const BITSTRING &c, const OCTETSTRING &d, const BITSTRING &e, const INTEGER &f){ +//return int2bit(0, 0); +//} +OCTETSTRING fx__NG__NasIntegrityAlgorithm(const OCTETSTRING& p_encoded_nas_pdu, const BITSTRING& p_integrity_algorithm, const BITSTRING& p_knas_int, const OCTETSTRING& p_nas_count, const BITSTRING& p_bearer_id, const INTEGER& p_direction){ + loggers::get_instance().log_msg(">>> fx__NG__NasIntegrityAlgorithm: p_encoded_nas_pdu: ", p_encoded_nas_pdu); + loggers::get_instance().log_msg(">>> fx__NG__NasIntegrityAlgorithm: p_integrity_algorithm: ", bit2oct(p_integrity_algorithm)); + loggers::get_instance().log_msg(">>> fx__NG__NasIntegrityAlgorithm: p_knas_int: ", bit2oct(p_knas_int)); + loggers::get_instance().log_msg(">>> fx__NG__NasIntegrityAlgorithm: p_nas_count: ", p_nas_count); + loggers::get_instance().log_msg(">>> fx__NG__NasIntegrityAlgorithm: p_bearer_id: ", bit2oct(p_bearer_id)); + loggers::get_instance().log_msg(">>> fx__NG__NasIntegrityAlgorithm: p_direction: ", p_direction); + + // Sanity checks + if (p_integrity_algorithm.lengthof() != 4) { + loggers::get_instance().error("fx__NG__NasIntegrityAlgorithm: p_integrity_algorithm: Wrong length"); + return int2oct(0, 0); + } else if (p_knas_int.lengthof() != 128) { + loggers::get_instance().error("fx__NG__NasIntegrityAlgorithm: p_knas_int: Wrong length"); + return int2oct(0, 0); + } else if ((p_nas_count.lengthof() != 4) || (p_bearer_id.lengthof() != 5)) { + loggers::get_instance().error("fx__NG__NasIntegrityAlgorithm: p_nas_count/p_bearer_id: Wrong length"); + return int2oct(0, 0); + } + + unsigned char *mac; + uint32_t mac_length; + uint32_t nas_count = converter::get_instance().bytes_to_int(std::vector(static_cast(p_nas_count), static_cast(p_nas_count) + p_nas_count.lengthof())); + int result = -1; + if (bit2int(p_integrity_algorithm) == 1) { // IA1_128/NEA1_128: Snow 3G based algorithm + loggers::get_instance().log("fx__NG__NasIntegrityAlgorithm: ia1_128 selected"); + ia1_128 enc; + result = enc.mac( + bit2int(p_integrity_algorithm), + static_cast(bit2oct(p_knas_int)), + nas_count, + bit2int(p_bearer_id), + p_direction, + static_cast(p_encoded_nas_pdu), + p_encoded_nas_pdu.lengthof(), + &mac, + &mac_length + ); + } else if (bit2int(p_integrity_algorithm) == 2) { // IA2_128/NEA2_128: AES 128 CTR based algorithm + loggers::get_instance().log("fx__NG__NasIntegrityAlgorithm: ia2_128 selected"); + ia2_128 enc; + result = enc.mac( + bit2int(p_integrity_algorithm), + static_cast(bit2oct(p_knas_int)), + nas_count, + bit2int(p_bearer_id), + p_direction, + static_cast(p_encoded_nas_pdu), + p_encoded_nas_pdu.lengthof(), + &mac, + &mac_length + ); + } else if (bit2int(p_integrity_algorithm) == 3) { // IA3_128/NEA3_128: ZUC based algorithm + loggers::get_instance().log("fx__NG__NasIntegrityAlgorithm: ia3_128 selected"); + ia3_128 enc; + result = enc.mac( + bit2int(p_integrity_algorithm), + static_cast(bit2oct(p_knas_int)), + nas_count, + bit2int(p_bearer_id), + p_direction, + static_cast(p_encoded_nas_pdu), + p_encoded_nas_pdu.lengthof(), + &mac, + &mac_length + ); + } else if (bit2int(p_integrity_algorithm) == 4) { // IA4 + loggers::get_instance().error("fx__NG__NasIntegrityAlgorithm: p_integrity_algorithm: Unsupported algorithm"); + } else if (bit2int(p_integrity_algorithm) == 5) { // IA5 + loggers::get_instance().error("fx__NG__NasIntegrityAlgorithm: p_integrity_algorithm: Unsupported algorithm"); + } else if (bit2int(p_integrity_algorithm) == 6) { // IA6 + loggers::get_instance().error("fx__NG__NasIntegrityAlgorithm: p_integrity_algorithm: Unsupported algorithm"); + } else if (bit2int(p_integrity_algorithm) == 7) { // IA7 + loggers::get_instance().error("fx__NG__NasIntegrityAlgorithm: p_integrity_algorithm: Unsupported algorithm"); + } else { + loggers::get_instance().error("fx__NG__NasIntegrityAlgorithm: p_integrity_algorithm: Unknown algorithm"); + } + if (result != 0) { + loggers::get_instance().error("fx__NG__NasIntegrityAlgorithm: ia2_128.mac() failed"); + return int2oct(0, 0); + } + OCTETSTRING os(mac_length, (const unsigned char*)mac); + std::free(mac); + + loggers::get_instance().log_msg("<<< fx__NG__NasIntegrityAlgorithm: ", os); + return os; +} + +OCTETSTRING fx__NG__NasCiphering(const OCTETSTRING& p_encoded_nas_pdu,const BITSTRING& p_ciphering_algorithm, const BITSTRING& p_knas_enc, const OCTETSTRING& p_nas_count, const BITSTRING& p_bearer_id, const INTEGER& p_direction){ + loggers::get_instance().log_msg(">>> fx__NG__NasCiphering: p_encoded_nas_pdu: ", p_encoded_nas_pdu); + loggers::get_instance().log_msg(">>> fx__NG__NasCiphering: p_ciphering_algorithm: ", bit2oct(p_ciphering_algorithm)); + loggers::get_instance().log_msg(">>> fx__NG__NasCiphering: p_knas_enc: ", bit2oct(p_knas_enc)); + loggers::get_instance().log_msg(">>> fx__NG__NasCiphering: p_nas_count: ", p_nas_count); + loggers::get_instance().log_msg(">>> fx__NG__NasCiphering: p_bearer_id: ", bit2oct(p_bearer_id)); + loggers::get_instance().log_msg(">>> fx__NG__NasCiphering: p_direction: ", p_direction); + + // Sanity checks + if (p_ciphering_algorithm.lengthof() != 4) { + loggers::get_instance().error("fx__NG__NasCiphering: p_ciphering_algorithm: Wrong length"); + return int2oct(0, 0); + } else if (p_knas_enc.lengthof() != 128) { + loggers::get_instance().error("fx__NG__NasCiphering: p_knas_enc: Wrong length"); + return int2oct(0, 0); + } else if ((p_nas_count.lengthof() != 4) || (p_bearer_id.lengthof() != 5)) { + loggers::get_instance().error("fx__NG__NasCiphering: p_nas_count/p_bearer_id: Wrong length"); + return int2oct(0, 0); + } + + unsigned char *cyphered; + uint32_t cyphered_length; + uint32_t nas_count = converter::get_instance().bytes_to_int(std::vector(static_cast(p_nas_count), static_cast(p_nas_count) + p_nas_count.lengthof())); + int result = -1; + if (bit2int(p_ciphering_algorithm) == 0) { // IA0/NEA0: No cyphering + loggers::get_instance().log("fx__NG__NasCiphering: No cyphering"); + return p_encoded_nas_pdu; // no cyphering + } else if (bit2int(p_ciphering_algorithm) == 1) { // IA1_128/NEA1_128: Snow 3G based algorithm + loggers::get_instance().log("fx__NG__NasCiphering: ia1_128 selected"); + ia1_128 enc; + result = enc.encrypt( + bit2int(p_ciphering_algorithm), + static_cast(bit2oct(p_knas_enc)), + nas_count, + bit2int(p_bearer_id), + p_direction, + static_cast(p_encoded_nas_pdu), + p_encoded_nas_pdu.lengthof(), + &cyphered, + &cyphered_length + ); + } else if (bit2int(p_ciphering_algorithm) == 2) { // IA2_128/NEA2_128: AES 128 CTR based algorithm + loggers::get_instance().log("fx__NG__NasCiphering: ia2_128 selected"); + ia2_128 enc; + result = enc.encrypt( + bit2int(p_ciphering_algorithm), + static_cast(bit2oct(p_knas_enc)), + nas_count, + bit2int(p_bearer_id), + p_direction, + static_cast(p_encoded_nas_pdu), + p_encoded_nas_pdu.lengthof(), + &cyphered, + &cyphered_length + ); + } else if (bit2int(p_ciphering_algorithm) == 3) { // IA3_128/NEA3_128: ZUC based algorithm + loggers::get_instance().log("fx__NG__NasCiphering: ia3_128 selected"); + ia3_128 enc; + result = enc.encrypt( + bit2int(p_ciphering_algorithm), + static_cast(bit2oct(p_knas_enc)), + nas_count, + bit2int(p_bearer_id), + p_direction, + static_cast(p_encoded_nas_pdu), + p_encoded_nas_pdu.lengthof(), + &cyphered, + &cyphered_length + ); + } else if (bit2int(p_ciphering_algorithm) == 4) { // IA4 + loggers::get_instance().error("fx__NG__NasCiphering: p_ciphering_algorithm: Unsupported algorithm"); + } else if (bit2int(p_ciphering_algorithm) == 5) { // IA5 + loggers::get_instance().error("fx__NG__NasCiphering: p_ciphering_algorithm: Unsupported algorithm"); + } else if (bit2int(p_ciphering_algorithm) == 6) { // IA6 + loggers::get_instance().error("fx__NG__NasCiphering: p_ciphering_algorithm: Unsupported algorithm"); + } else if (bit2int(p_ciphering_algorithm) == 7) { // IA7 + loggers::get_instance().error("fx__NG__NasCiphering: p_ciphering_algorithm: Unsupported algorithm"); + } else { + loggers::get_instance().error("fx__NG__NasCiphering: p_ciphering_algorithm: Unknown algorithm"); + } + if (result != 0) { + loggers::get_instance().error("fx__NG__NasCiphering: ia2_128.encrypt() failed"); + return int2oct(0, 0); + } + OCTETSTRING os(cyphered_length, (const unsigned char*)cyphered); + free(cyphered); + + loggers::get_instance().log_msg("<<< fx__NG__NasCiphering: ", os); + return os; +} + +OCTETSTRING fx__NG__NasDeciphering(const OCTETSTRING& p_ciphered_nas_message, const BITSTRING& p_ciphering_algorithm, const BITSTRING& p_knas_enc, const OCTETSTRING& p_nas_count, const BITSTRING& p_bearer_id, const INTEGER& p_direction) { + loggers::get_instance().log_msg(">>> fx__NG__NasDeciphering: p_ciphered_nas_message: ", p_ciphered_nas_message); + loggers::get_instance().log_msg(">>> fx__NG__NasDeciphering: p_ciphering_algorithm: ", bit2oct(p_ciphering_algorithm)); + loggers::get_instance().log_msg(">>> fx__NG__NasDeciphering: p_knas_enc: ", bit2oct(p_knas_enc)); + loggers::get_instance().log_msg(">>> fx__NG__NasDeciphering: p_nas_count: ", p_nas_count); + loggers::get_instance().log_msg(">>> fx__NG__NasDeciphering: p_bearer_id: ", bit2oct(p_bearer_id)); + loggers::get_instance().log_msg(">>> fx__NG__NasDeciphering: p_direction: ", p_direction); + + // Sanity checks + if (p_ciphering_algorithm.lengthof() != 4) { + loggers::get_instance().error("fx__NG__NasDeciphering: p_ciphering_algorithm: Wrong length"); + return int2oct(0, 0); + } else if (p_knas_enc.lengthof() != 128) { + loggers::get_instance().error("fx__NG__NasDeciphering: p_knas_enc: Wrong length"); + return int2oct(0, 0); + } else if ((p_nas_count.lengthof() != 4) || (p_bearer_id.lengthof() != 5)) { + loggers::get_instance().error("fx__NG__NasDeciphering: p_nas_count/p_bearer_id: Wrong length"); + return int2oct(0, 0); + } + + unsigned char *payload; + uint32_t payload_length; + uint32_t nas_count = converter::get_instance().bytes_to_int(std::vector(static_cast(p_nas_count), static_cast(p_nas_count) + p_nas_count.lengthof())); + int result = -1; + if (bit2int(p_ciphering_algorithm) == 0) { // IA0/NEA0: No cyphering + loggers::get_instance().log("fx__NG__NasDeciphering: No cyphering"); + return p_ciphered_nas_message; // no cyphering + } else if (bit2int(p_ciphering_algorithm) == 1) { // IA1_128/NEA1_128: Snow 3G based algorithm + loggers::get_instance().log("fx__NG__NasDeciphering: ia1_128 selected"); + ia1_128 enc; + result = enc.decrypt( + bit2int(p_ciphering_algorithm), + static_cast(bit2oct(p_knas_enc)), + nas_count, + bit2int(p_bearer_id), + p_direction, + static_cast(p_ciphered_nas_message), + p_ciphered_nas_message.lengthof(), + &payload, + &payload_length + ); + } else if (bit2int(p_ciphering_algorithm) == 2) { // IA2_128/NEA2_128: AES 128 CTR based algorithm + loggers::get_instance().log("fx__NG__NasDeciphering: ia2_128 selected"); + ia2_128 enc; + result = enc.decrypt( + bit2int(p_ciphering_algorithm), + static_cast(bit2oct(p_knas_enc)), + nas_count, + bit2int(p_bearer_id), + p_direction, + static_cast(p_ciphered_nas_message), + p_ciphered_nas_message.lengthof(), + &payload, + &payload_length + ); + } else if (bit2int(p_ciphering_algorithm) == 3) { // IA3_128/NEA3_128: ZUC based algorithm + ia3_128 enc; + result = enc.decrypt( + bit2int(p_ciphering_algorithm), + static_cast(bit2oct(p_knas_enc)), + nas_count, + bit2int(p_bearer_id), + p_direction, + static_cast(p_ciphered_nas_message), + p_ciphered_nas_message.lengthof(), + &payload, + &payload_length + ); + } else if (bit2int(p_ciphering_algorithm) == 4) { // IA4 + loggers::get_instance().error("fx__NG__NasDeciphering: p_ciphering_algorithm: Unsupported algorithm"); + } else if (bit2int(p_ciphering_algorithm) == 5) { // IA5 + loggers::get_instance().error("fx__NG__NasDeciphering: p_ciphering_algorithm: Unsupported algorithm"); + } else if (bit2int(p_ciphering_algorithm) == 6) { // IA6 + loggers::get_instance().error("fx__NG__NasDeciphering: p_ciphering_algorithm: Unsupported algorithm"); + } else if (bit2int(p_ciphering_algorithm) == 7) { // IA7 + loggers::get_instance().error("fx__NG__NasDeciphering: p_ciphering_algorithm: Unsupported algorithm"); + } else { + loggers::get_instance().error("fx__NG__NasDeciphering: p_ciphering_algorithm: Unknown algorithm"); + } + if (result != 0) { + loggers::get_instance().error("fx__NG__NasDeciphering: decrypt() failed"); + return int2oct(0, 0); + } + OCTETSTRING os(payload_length, (const unsigned char*)payload); + free(payload); + + loggers::get_instance().log_msg("<<< fx__NG__NasDeciphering: ", os); + return os; +} + +} // namespace NG__SecurityDefinitionsAndExternalFunctions diff --git a/ccsrc/Externals/common_ext.cc b/ccsrc/Externals/common_ext.cc index 0addcb8d4b51a95724c12b8ea636e7cad64186a5..33fbbc17e87af9298f4eda6a7bee4479f417517c 100644 --- a/ccsrc/Externals/common_ext.cc +++ b/ccsrc/Externals/common_ext.cc @@ -1,61 +1,119 @@ -#include -#include -#include -#include - -#include "CommonDefs.hh" - -#include "base_time.hh" -//#include "converter.hh" -#include "loggers.hh" - -#include "hmac.hh" - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif -#define earthRadius 6378137.0L -#define rbis = ((double)(earthRadius * M_PI / 180)) - -namespace CommonDefs { - - /** - * @desc This external function gets KEY - * @return The KEY - * @see fx_get...() return UInt64 - */ - //INTEGER fx__KeyDerivationFunction(INTEGER const&, BITSTRING const&, OCTETSTRING const&){ - BITSTRING fx__KeyDerivationFunction(const INTEGER& p__KDF, const BITSTRING& p__Key, const OCTETSTRING& p__String){ - loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__KDF: ", p__KDF); - loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__Key: ", bit2oct(p__Key)); - - hmac h; // hash_algorithms::sha_256: p__KDF == 1 (tsc_KDF_HMAC_SHA_256 see CommonDefs.ttcn) - OCTETSTRING res; - if (h.generate(p__String, bit2oct(p__Key), res) == -1) { - loggers::get_instance().error("fx__KeyDerivationFunction: Key derivation failed"); - return int2bit(0, 0); - } - - loggers::get_instance().log_msg("<<< fx__KeyDerivationFunction: res: ", res); - return oct2bit(res); - } - /** - * @desc This external function gets the current time since 01/01/1970 in UTC format - * @return The current time since 01/01/1970 in UTC format in milliseconds - * @see fx_getSystemTime() return UInt64 - */ -//INTEGER fx__GetSystemTime(CommonDefs::Struct__tm__Type&, INTEGER&){ -void fx__GetSystemTime(CommonDefs::Struct__tm__Type& p__Struct__tm, INTEGER& p__TimezoneInfo){ - const time_t t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - tm* now = std::localtime(&t); - p__Struct__tm = Struct__tm__Type(now->tm_sec, now->tm_min, now->tm_hour, now->tm_mday, now->tm_mon, now->tm_year, now->tm_wday, now->tm_yday, now->tm_isdst); - p__TimezoneInfo = 0; // TODO FSCOM - - return; -} -//void fx__CalculateFCS32(BITSTRING const&) { - BITSTRING fx__CalculateFCS32(const BITSTRING& p__TMSI){ -return int2bit(0, 0); -} - -} // namespace CommonDefs +#include +#include +#include +#include + +#include "CommonDefs.hh" + +#include "base_time.hh" +//#include "converter.hh" +#include "loggers.hh" + +#include "sha256.hh" +#include "hmac.hh" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif +#define earthRadius 6378137.0L +#define rbis = ((double)(earthRadius * M_PI / 180)) + +namespace CommonDefs { + + /** + * @desc This external function gets KEY + * @return The KEY + * @see fx_get...() return UInt64 + * @note ETSI TS 133 220 V18.3.0 (2024-05) Annex B.2 Generic key derivation function + */ + //INTEGER fx__KeyDerivationFunction(INTEGER const&, BITSTRING const&, OCTETSTRING const&){ + BITSTRING fx__KeyDerivationFunction(const INTEGER& p__KDF, const BITSTRING& p__Key, const OCTETSTRING& p__String){ + loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__KDF: ", p__KDF); + loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__Key: ", bit2oct(p__Key)); + loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__String: ", p__String); + + if (p__KDF == 1) { // tsc_KDF_HMAC_SHA_256 see CommonDefs.ttcn + hmac h; + OCTETSTRING res; + if (h.generate(p__String, bit2oct(p__Key), res, false) == -1) { + loggers::get_instance().error("fx__KeyDerivationFunction: Key derivation failed"); + return int2bit(0, 0); + } + + loggers::get_instance().log_msg("<<< fx__KeyDerivationFunction: res: ", res); + return oct2bit(res); + } else { + loggers::get_instance().error("fx__KeyDerivationFunction: Unsupported KDF: %d", p__KDF); + return int2bit(0, 0); + } + } + + /** + * @desc This external function compute the SHA 256 hash of a string + * @param p__String The string to hash + * @return The SHA 256 hash of the specified string + * @see fx_sha256(in octetstring p_String) return B256_Type + */ + BITSTRING fx__sha256(const OCTETSTRING& p__String){ + loggers::get_instance().log_msg(">>> fx__sha256: p__String: ", p__String); + + sha256 sha; + OCTETSTRING res; + if (sha.generate(p__String, res) == -1) { + loggers::get_instance().error("fx__sha256: Key derivation failed"); + return int2bit(0, 0); + } + + loggers::get_instance().log_msg("<<< fx__sha256: res: ", res); + return oct2bit(res); + } + + /** + * @desc This external function gets the current time since 01/01/1970 in UTC format + * @return The current time since 01/01/1970 in UTC format in milliseconds + * @see fx_getSystemTime() return UInt64 + */ + //INTEGER fx__GetSystemTime(CommonDefs::Struct__tm__Type&, INTEGER&){ + void fx__GetSystemTime(CommonDefs::Struct__tm__Type& p__Struct__tm, INTEGER& p__TimezoneInfo){ + const time_t t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + tm* now = std::localtime(&t); + p__Struct__tm = Struct__tm__Type(now->tm_sec, now->tm_min, now->tm_hour, now->tm_mday, now->tm_mon, now->tm_year, now->tm_wday, now->tm_yday, now->tm_isdst); + p__TimezoneInfo = 0; // TODO FSCOM + + return; + } + + //void fx__CalculateFCS32(BITSTRING const&) { + BITSTRING fx__CalculateFCS32(const BITSTRING& p__TMSI){ + loggers::get_instance().log_msg(">>> fx__CalculateFCS32: p__TMSI: ", p__TMSI); + + // Sanity checks + if (p__TMSI.lengthof() == 0) { + loggers::get_instance().error("fx__CalculateFCS32: Empty TMSI"); + return int2bit(0, 0); + } + + OCTETSTRING os = bit2oct(p__TMSI); + const unsigned char *data = static_cast(os); + if (data == NULL) { + loggers::get_instance().error("fx__CalculateFCS32: Failed to get data buffer"); + return int2bit(0, 0); + } + unsigned int crc = 0xffffffff; + for (size_t i = 0; i < os.lengthof(); i++) { + unsigned int val = (crc ^ os[i].get_octet()) & 0xFF; + for(size_t j = 0; j < 8; j++){ + val = val & 0x1 ? (val >> 1) ^ 0xEDB88320 : val >> 1; // 0xEDB88320 is the reverse of 0x04C11DB7 + } // End of 'for' statement + crc = val ^ crc >> 8; + } // End of 'for' statement + crc ^= 0xffffffff; + + crc = ((crc & 0xFF) << 24) | ((crc & 0xFF00) << 8) | ((crc & 0xFF0000) >> 8) | ((crc & 0xFF000000) >> 24); // Reverse the bits of the CRC value + OCTETSTRING crc_os(4, (const unsigned char*)&crc); + loggers::get_instance().log_msg("fx__CalculateFCS32: crc: ", crc_os); + + return oct2bit(crc_os); + } + +} // namespace CommonDefs diff --git a/ccsrc/Externals/ia1_128.cc b/ccsrc/Externals/ia1_128.cc new file mode 100644 index 0000000000000000000000000000000000000000..3dd8592ccba7ead46bc04f297c01628ffa0c32e4 --- /dev/null +++ b/ccsrc/Externals/ia1_128.cc @@ -0,0 +1,312 @@ +/** + * @file ia1_128.cpp + * @brief 3GPP SNOW 3G-based Encryption class implementation + * @author Generated for 3GPP NAS encryption + * @date 2024 + * + * This implementation uses the SNOW 3G algorithm as specified in + * 3GPP TS 33.401. For the actual SNOW 3G cipher implementation, + * this code can be linked with libraries such as libmilenage or + * open5gs crypto library. + */ + +#include "ia1_128.hh" + +//#include "snow3g.hh" + +#include "loggers.hh" + +namespace { + constexpr size_t KEY_SIZE = 16; // 128 bits = 16 bytes + constexpr size_t IV_SIZE = 16; // Initialization vector size +} + +void ia1_128::reset() { + loggers::get_instance().log("ia1_128::reset"); + std::memset(&_ctx, 0, sizeof(_ctx)); +} + +int ia1_128::encrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** cyphered, + uint32_t* cyphered_length) { + loggers::get_instance().log_to_hexa(">>> ia1_128::encrypt: knas_enc", knas_enc, KEY_SIZE); + loggers::get_instance().log_to_hexa(">>> ia1_128::encrypt: payload", payload, payload_length); + loggers::get_instance().log(">>> ia1_128::encrypt: algo_id: %d", algo_id); + loggers::get_instance().log(">>> ia1_128::encrypt: count: %u", count); + loggers::get_instance().log(">>> ia1_128::encrypt: bearer: %d", bearer); + loggers::get_instance().log(">>> ia1_128::encrypt: direction: %d", direction); + + // Input validation + if (!knas_enc || !payload || !cyphered || !cyphered_length) { + loggers::get_instance().error("ia1_128::encrypt: Wrong input parameters"); + return -1; + } + + if (payload_length == 0) { + loggers::get_instance().error("ia1_128::encrypt: Wrong payload length"); + *cyphered = nullptr; + *cyphered_length = 0; + return 0; + } + + // Allocate memory for ciphertext + *cyphered = static_cast(std::malloc(payload_length)); + if (!*cyphered) { + loggers::get_instance().error("ia1_128::encrypt: Failed to allocate memory"); + return -1; + } + snow3g_context_t ctx; + ctx.ciphering = true; + snow3g_initialize(count, bearer, direction, knas_enc, &ctx); + snow3g_generate(payload_length, payload, *cyphered, &ctx); + *cyphered_length = payload_length; + loggers::get_instance().log("ia1_128::encrypt: cyphered_length: %d", *cyphered_length); + loggers::get_instance().log_to_hexa("ia1_128::encrypt: cyphered: ", *cyphered, *cyphered_length); + + loggers::get_instance().log("<<< ia1_128::encrypt: ret: 0"); + return 0; +} + +int ia1_128::decrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* cyphered, + const uint32_t cyphered_length, + unsigned char** payload, + uint32_t* payload_length) { + loggers::get_instance().log(">>> ia1_128::decrypt: Starting decryption"); + loggers::get_instance().log_to_hexa(">>> ia1_128::decrypt: knas_enc", knas_enc, KEY_SIZE); + loggers::get_instance().log_to_hexa(">>> ia1_128::decrypt: cyphered", cyphered, cyphered_length); + loggers::get_instance().log(">>> ia1_128::decrypt: algo_id: %d", algo_id); + loggers::get_instance().log(">>> ia1_128::decrypt: count: %u", count); + loggers::get_instance().log(">>> ia1_128::decrypt: bearer: %d", bearer); + loggers::get_instance().log(">>> ia1_128::decrypt: direction: %d", direction); + + return encrypt(algo_id, knas_enc, count, bearer, direction, + cyphered, cyphered_length, payload, payload_length); +} + +int ia1_128::mac(const uint8_t algo_id, + const unsigned char* knas_int, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** mac, + uint32_t* mac_length) { + loggers::get_instance().log_to_hexa(">>> ia1_128::mac: knas_int", knas_int, KEY_SIZE); + loggers::get_instance().log(">>> ia1_128::mac: payload_length: %d", payload_length); + loggers::get_instance().log_to_hexa(">>> ia1_128::mac: payload", payload, payload_length); + loggers::get_instance().log(">>> ia1_128::mac: algo_id: %d", algo_id); + loggers::get_instance().log(">>> ia1_128::mac: count: %u", count); + loggers::get_instance().log(">>> ia1_128::mac: bearer: %d", bearer); + loggers::get_instance().log(">>> ia1_128::mac: direction: %d", direction); + + // Input validation + if (!knas_int || !payload || !mac || !mac_length) { + loggers::get_instance().error("ia1_128::mac: Wrong input parameters"); + return -1; + } + + if (payload_length == 0) { + loggers::get_instance().error("ia1_128::mac: Wrong payload length"); + *mac = nullptr; + *mac_length = 0; + return 0; + } + + // Allocate memory for ciphertext + *mac = static_cast(std::malloc(4)); + if (!*mac) { + loggers::get_instance().error("ia1_128::mac: Failed to allocate memory"); + return -1; + } + *mac_length = 4; + + snow3g_context_t ctx; + ctx.ciphering = false; + snow3g_initialize(count, bearer, direction, knas_int, &ctx); + + uint32_t z[5] = {0}; + snow3g_generate(5, (uint32_t*)z, &ctx); + loggers::get_instance().log_to_hexa("ia1_128::mac: z: ", (const unsigned char*)z, 5 * sizeof(uint32_t)); + + uint64_t p = (uint64_t)z[0] << 32 | (uint64_t)z[1]; + uint64_t q = (uint64_t)z[2] << 32 | (uint64_t)z[3]; + + uint32_t d; + uint64_t length = payload_length * 8; // Length in bits + loggers::get_instance().log("ia1_128::mac: length: %ld", length); + if ((length % 64) == 0) + d = (length>>6) + 1; + else + d = (length>>6) + 2; + loggers::get_instance().log("ia1_128::mac: d: %u", d); + uint64_t c = 0x1b; + + uint64_t eval = 0; + uint64_t v = 0; + for (uint64_t i = 0; i < d - 2; i++) { + v = eval ^ ((uint64_t)payload[8*i ]<<56 | (uint64_t)payload[8*i+1] << 48 | + (uint64_t)payload[8*i+2]<<40 | (uint64_t)payload[8*i+3] << 32 | + (uint64_t)payload[8*i+4]<<24 | (uint64_t)payload[8*i+5] << 16 | + (uint64_t)payload[8*i+6]<< 8 | (uint64_t)payload[8*i+7] + ); + eval = mul64(v, p, c); + } + loggers::get_instance().log_to_hexa("ia1_128::mac: eval: ", (const unsigned char*)&eval, sizeof(uint64_t)); + + uint64_t rem = length % 64; + if (rem == 0) { + rem = 64; + } + loggers::get_instance().log("ia1_128::mac:rem: %d", rem); + uint64_t m_d_2 = 0; + uint8_t i = 0; + while (rem > 7) { + m_d_2 |= (uint64_t)payload[8*(d-2)+i] << (8*(7-i)); + rem -= 8; + i++; + } + if (rem > 0) { + m_d_2 |= (uint64_t)(payload[8*(d-2)+i] & mask8bit(rem)) << (8*(7-i)); + } + loggers::get_instance().log_to_hexa("ia1_128::mac: m_d_2: ", (const unsigned char*)&m_d_2, sizeof(uint64_t)); + + v = eval ^ m_d_2; + eval = mul64(v, p, c); + loggers::get_instance().log_to_hexa("ia1_128::mac: eval: ", (const unsigned char*)&eval, sizeof(uint64_t)); + + /* for d-1 */ + eval ^= length; + loggers::get_instance().log_to_hexa("ia1_128::mac: eval: ", (const unsigned char*)&eval, sizeof(uint64_t)); + + /* Multiply by q */ + eval = mul64(eval, q, c); + loggers::get_instance().log_to_hexa("ia1_128::mac: eval: ", (const unsigned char*)&eval, sizeof(uint64_t)); + + /* XOR with z_5: this is a modification to the reference C code, + which forgot to XOR z[5] */ + for (i = 0; i < 4; i++) { + (*mac)[i] = ((eval >> (56-(i*8))) ^ (z[4] >> (24-(i*8)))) & 0xff; + } + loggers::get_instance().log_to_hexa("ia1_128::mac: mac: ", *mac, *mac_length); + + loggers::get_instance().log("<<< ia1_128::mac: ret: 0"); + return 0; +} + +int ia1_128::snow3g_initialize(const uint32_t count, const uint8_t bearer, const uint8_t direction, const unsigned char *knas_enc, snow3g_context_t *ctx) { + loggers::get_instance().log_to_hexa(">>> ia1_128::snow3g_initialize: knas_enc", (const unsigned char*)knas_enc, 16); + loggers::get_instance().log(">>> ia1_128::snow3g_initialize: count: %u", count); + loggers::get_instance().log(">>> ia1_128::snow3g_initialize: bearer: %d", bearer); + loggers::get_instance().log(">>> ia1_128::snow3g_initialize: direction: %d", direction); + + // Sanity checks + if (ctx == NULL) { + loggers::get_instance().error("ia1_128::snow3g_initialize: Wrong parameters"); + return -1; + } + + struct snow_key_st snow_key; + memset(&snow_key, 0, sizeof(snow_key)); + snow_key.key[3] = WORD_128(knas_enc, 0); + snow_key.key[2] = WORD_128(knas_enc, 1); + snow_key.key[1] = WORD_128(knas_enc, 2); + snow_key.key[0] = WORD_128(knas_enc, 3); + + snow_key.iv[3] = count; + if (ctx->ciphering) { + snow_key.iv[2] = ((bearer & 0x1F) << 27) | ((direction & 0x01) << 26); + snow_key.iv[1] = snow_key.iv[3]; + snow_key.iv[0] = snow_key.iv[2]; + } else { + snow_key.iv[2] = ((bearer & 0x1F) << 27); + snow_key.iv[1] = count ^ ( direction << 31 ); + snow_key.iv[0] = ((bearer & 0x1F) << 27) ^ (direction << 15); + } + + loggers::get_instance().log_to_hexa("ia1_128::snow3g_initialize: snow_key.key", (const unsigned char*)snow_key.key, 4 * sizeof(uint32_t)); + loggers::get_instance().log_to_hexa("ia1_128::snow3g_initialize: snow_key.iv", (const unsigned char*)snow_key.iv, 4 * sizeof(uint32_t)); + + snow_set_key(snow_key, ctx); + + return 0; +} + +int ia1_128::snow3g_generate(size_t nb_byte, const unsigned char *in, unsigned char *out, snow3g_context_t *ctx) { + loggers::get_instance().log(">>> SNOW: nb_byte: %u", nb_byte); + loggers::get_instance().log_to_hexa(">>> SNOW: in", (const unsigned char*)in, nb_byte); + + // Sanity checks + if (ctx == NULL) { + loggers::get_instance().error("SNOW: Wrong parameters"); + return -1; + } + + size_t i = 0; + size_t nb_word = nb_byte/4; + size_t r = nb_byte % 4; + uint32_t *in_word = (uint32_t*) in; + uint32_t *out_word = (uint32_t*) out; + + /* init */ + clock_fsm(ctx); + lfsr_keystream(ctx); + + for (i = 0; i < nb_word; i++) { + uint32_t f; + f = clock_fsm(ctx) ^ ctx->lfsr[0]; + out_word[i] = in_word[i] ^ be32toh(f); + lfsr_keystream(ctx); + } + + if (r) { + uint32_t f; + uint32_t last_out = 0; + uint32_t last_in = 0; + + f = clock_fsm(ctx) ^ ctx->lfsr[0]; + memcpy(&last_in, in + nb_word*4, r); + last_out = last_in ^ be32toh(f); + memcpy(out + nb_word*4, &last_out, r); + lfsr_keystream(ctx); + } + + loggers::get_instance().log_to_hexa("<<< SNOW: out", (const unsigned char*)out, nb_byte); + return 0; +} + +int ia1_128::snow3g_generate(size_t nb, uint32_t* out, snow3g_context_t* ctx) { + loggers::get_instance().log(">>> snow3g_generate: nb: %u", nb); + + // Sanity checks + if (ctx == NULL) { + loggers::get_instance().error("snow3g_generate: Wrong parameters"); + return -1; + } + + size_t i = 0; + + /* init */ + clock_fsm(ctx); + lfsr_keystream(ctx); + + for (i = 0; i < nb; i++) { + uint32_t f; + out[i] = clock_fsm(ctx) ^ ctx->lfsr[0]; + lfsr_keystream(ctx); + } + + loggers::get_instance().log_to_hexa("<<< snow3g_generate: out", (const unsigned char*)out, nb); + return 0; +} diff --git a/ccsrc/Externals/ia1_128.hh b/ccsrc/Externals/ia1_128.hh new file mode 100644 index 0000000000000000000000000000000000000000..1f32f861f9bc67677bfde2ef1fd4cfefd1fdff4c --- /dev/null +++ b/ccsrc/Externals/ia1_128.hh @@ -0,0 +1,1030 @@ +/** + * @file ia1_128.h + * @brief 3GPP SNOW 3G-based Encryption class header + * @author Generated for 3GPP NAS encryption + * @date 2024 + * + * This class implements the 3GPP SNOW 3G-based encryption algorithm (IA1-128) + * as specified in 3GPP TS 33.401 for NAS encryption/decryption. + */ + +#pragma once + +#include +#include +#include +#include + +namespace { + constexpr uint8_t SNOW_ENCRYPT = 1; + constexpr uint8_t SNOW_DECRYPT = 0; + constexpr size_t SNOW_WORD_SIZE = 4; + constexpr size_t SNOW_KEY_SIZE = 16; + constexpr uint32_t ONE = 0xffffffff; +} + +/** + * @brief reinterpret a char array as big-endian 32 bit unsigned integer array and select the element at index i + */ +#define WORD_128(array, i) be32toh(((uint32_t *)array)[i]); + +/** + * @brief Get the i most significant byte out of a 32 bit word + */ +#define BYTE32(word, i) (uint8_t) ((word >> 8*(3-i)) & 0xff) + +/** + * @class ia1_128 + * @brief Implements 3GPP SNOW 3G-based encryption and decryption (IA1-128) + * + * This class provides encryption and decryption functionality using the + * SNOW 3G stream cipher algorithm as specified in 3GPP TS 33.401. + * The algorithm is used for NAS (Non-Access Stratum) encryption in 3GPP networks. + */ +class ia1_128 { + struct snow_key_st { + uint32_t key[4]; + uint32_t iv[4]; + }; + + struct fsm_st { + uint32_t r1; + uint32_t r2; + uint32_t r3; + }; + + /** + * @brief SNOW 3G context structure + */ + typedef struct snow_ctx_st { + uint32_t lfsr[SNOW_KEY_SIZE]; + struct fsm_st fsm; + bool ciphering; + } snow3g_context_t; + +public: + /** + * @brief Default constructor + */ + ia1_128() = default; + + /** + * @brief Destructor + */ + ~ia1_128() = default; + + /** + * @brief Copy constructor (deleted) + */ + ia1_128(const ia1_128&) = delete; + + /** + * @brief Copy assignment operator (deleted) + */ + ia1_128& operator=(const ia1_128&) = delete; + + /** + * @brief Move constructor (deleted) + */ + ia1_128(ia1_128&&) = delete; + + /** + * @brief Move assignment operator (deleted) + */ + ia1_128& operator=(ia1_128&&) = delete; + + /** + * @brief Encrypts plaintext using SNOW 3G algorithm + * + * This method encrypts the given payload using the SNOW 3G stream cipher. + * The keystream is generated based on the NAS encryption key (knas_enc), + * count, bearer, and direction parameters according to 3GPP TS 33.401. + * + * @param algo_id Algorithm identifier (should be 1 for SNOW 3G) + * @param knas_enc Pointer to the 16-byte NAS encryption key + * @param count 32-bit NAS count value + * @param bearer 5-bit bearer identifier (only lower 5 bits are used) + * @param direction Direction bit (0 = uplink, 1 = downlink) + * @param payload Pointer to the plaintext data to encrypt + * @param payload_length Length of the plaintext data in bytes + * @param cyphered Pointer to pointer that will receive the encrypted data (caller must free) + * @param cyphered_length Pointer to variable that will receive the encrypted data length + * @return 0 on success, negative value on error + * + * @note The caller is responsible for freeing the memory allocated for cyphered + * @note cyphered_length will be equal to payload_length for stream ciphers + */ + int encrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** cyphered, + uint32_t* cyphered_length); + + /** + * @brief Decrypts ciphertext using SNOW 3G algorithm + * + * This method decrypts the given ciphertext using the SNOW 3G stream cipher. + * Decryption is identical to encryption for stream ciphers (XOR operation). + * + * @param algo_id Algorithm identifier (should be 1 for SNOW 3G) + * @param knas_enc Pointer to the 16-byte NAS encryption key + * @param count 32-bit NAS count value + * @param bearer 5-bit bearer identifier (only lower 5 bits are used) + * @param direction Direction bit (0 = uplink, 1 = downlink) + * @param cyphered Pointer to the ciphertext data to decrypt + * @param cyphered_length Length of the ciphertext data in bytes + * @param payload Pointer to pointer that will receive the decrypted data (caller must free) + * @param payload_length Pointer to variable that will receive the decrypted data length + * @return 0 on success, negative value on error + * + * @note The caller is responsible for freeing the memory allocated for payload + * @note payload_length will be equal to cyphered_length for stream ciphers + */ + int decrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* cyphered, + const uint32_t cyphered_length, + unsigned char** payload, + uint32_t* payload_length); + + /** + * @brief Compute NAS integrity protection using SNOW 3G algorithm + * + * This method computes the integrity protection using the SNOW 3G algorithm. + * + * @param algo_id Algorithm identifier (should be 3 for SNOW 3G) + * @param knas_int Pointer to the 16-byte NAS integrity key + * @param count 32-bit NAS count value + * @param bearer 5-bit bearer identifier (only lower 5 bits are used) + * @param direction Direction bit (0 = uplink, 1 = downlink) + * @param payload Pointer to pointer that will receive the decrypted data (caller must free) + * @param payload_length Pointer to variable that will receive the decrypted data length + * @param mac Pointer to the mac to decrypt + * @param mac_length Length of the mac in bytes + * @return 0 on success, negative value on error + * + * @note The caller is responsible for freeing the memory allocated for payload + * @note payload_length will be equal to cyphered_length for stream ciphers + */ + int mac(const uint8_t algo_id, + const unsigned char* knas_int, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** mac, + uint32_t* mac_length); + +private: + const uint32_t S1_T0[256] = { + 0xa56363c6U, 0x847c7cf8U, 0x997777eeU, 0x8d7b7bf6U, + 0x0df2f2ffU, 0xbd6b6bd6U, 0xb16f6fdeU, 0x54c5c591U, + 0x50303060U, 0x03010102U, 0xa96767ceU, 0x7d2b2b56U, + 0x19fefee7U, 0x62d7d7b5U, 0xe6abab4dU, 0x9a7676ecU, + 0x45caca8fU, 0x9d82821fU, 0x40c9c989U, 0x877d7dfaU, + 0x15fafaefU, 0xeb5959b2U, 0xc947478eU, 0x0bf0f0fbU, + 0xecadad41U, 0x67d4d4b3U, 0xfda2a25fU, 0xeaafaf45U, + 0xbf9c9c23U, 0xf7a4a453U, 0x967272e4U, 0x5bc0c09bU, + 0xc2b7b775U, 0x1cfdfde1U, 0xae93933dU, 0x6a26264cU, + 0x5a36366cU, 0x413f3f7eU, 0x02f7f7f5U, 0x4fcccc83U, + 0x5c343468U, 0xf4a5a551U, 0x34e5e5d1U, 0x08f1f1f9U, + 0x937171e2U, 0x73d8d8abU, 0x53313162U, 0x3f15152aU, + 0x0c040408U, 0x52c7c795U, 0x65232346U, 0x5ec3c39dU, + 0x28181830U, 0xa1969637U, 0x0f05050aU, 0xb59a9a2fU, + 0x0907070eU, 0x36121224U, 0x9b80801bU, 0x3de2e2dfU, + 0x26ebebcdU, 0x6927274eU, 0xcdb2b27fU, 0x9f7575eaU, + 0x1b090912U, 0x9e83831dU, 0x742c2c58U, 0x2e1a1a34U, + 0x2d1b1b36U, 0xb26e6edcU, 0xee5a5ab4U, 0xfba0a05bU, + 0xf65252a4U, 0x4d3b3b76U, 0x61d6d6b7U, 0xceb3b37dU, + 0x7b292952U, 0x3ee3e3ddU, 0x712f2f5eU, 0x97848413U, + 0xf55353a6U, 0x68d1d1b9U, 0x00000000U, 0x2cededc1U, + 0x60202040U, 0x1ffcfce3U, 0xc8b1b179U, 0xed5b5bb6U, + 0xbe6a6ad4U, 0x46cbcb8dU, 0xd9bebe67U, 0x4b393972U, + 0xde4a4a94U, 0xd44c4c98U, 0xe85858b0U, 0x4acfcf85U, + 0x6bd0d0bbU, 0x2aefefc5U, 0xe5aaaa4fU, 0x16fbfbedU, + 0xc5434386U, 0xd74d4d9aU, 0x55333366U, 0x94858511U, + 0xcf45458aU, 0x10f9f9e9U, 0x06020204U, 0x817f7ffeU, + 0xf05050a0U, 0x443c3c78U, 0xba9f9f25U, 0xe3a8a84bU, + 0xf35151a2U, 0xfea3a35dU, 0xc0404080U, 0x8a8f8f05U, + 0xad92923fU, 0xbc9d9d21U, 0x48383870U, 0x04f5f5f1U, + 0xdfbcbc63U, 0xc1b6b677U, 0x75dadaafU, 0x63212142U, + 0x30101020U, 0x1affffe5U, 0x0ef3f3fdU, 0x6dd2d2bfU, + 0x4ccdcd81U, 0x140c0c18U, 0x35131326U, 0x2fececc3U, + 0xe15f5fbeU, 0xa2979735U, 0xcc444488U, 0x3917172eU, + 0x57c4c493U, 0xf2a7a755U, 0x827e7efcU, 0x473d3d7aU, + 0xac6464c8U, 0xe75d5dbaU, 0x2b191932U, 0x957373e6U, + 0xa06060c0U, 0x98818119U, 0xd14f4f9eU, 0x7fdcdca3U, + 0x66222244U, 0x7e2a2a54U, 0xab90903bU, 0x8388880bU, + 0xca46468cU, 0x29eeeec7U, 0xd3b8b86bU, 0x3c141428U, + 0x79dedea7U, 0xe25e5ebcU, 0x1d0b0b16U, 0x76dbdbadU, + 0x3be0e0dbU, 0x56323264U, 0x4e3a3a74U, 0x1e0a0a14U, + 0xdb494992U, 0x0a06060cU, 0x6c242448U, 0xe45c5cb8U, + 0x5dc2c29fU, 0x6ed3d3bdU, 0xefacac43U, 0xa66262c4U, + 0xa8919139U, 0xa4959531U, 0x37e4e4d3U, 0x8b7979f2U, + 0x32e7e7d5U, 0x43c8c88bU, 0x5937376eU, 0xb76d6ddaU, + 0x8c8d8d01U, 0x64d5d5b1U, 0xd24e4e9cU, 0xe0a9a949U, + 0xb46c6cd8U, 0xfa5656acU, 0x07f4f4f3U, 0x25eaeacfU, + 0xaf6565caU, 0x8e7a7af4U, 0xe9aeae47U, 0x18080810U, + 0xd5baba6fU, 0x887878f0U, 0x6f25254aU, 0x722e2e5cU, + 0x241c1c38U, 0xf1a6a657U, 0xc7b4b473U, 0x51c6c697U, + 0x23e8e8cbU, 0x7cdddda1U, 0x9c7474e8U, 0x211f1f3eU, + 0xdd4b4b96U, 0xdcbdbd61U, 0x868b8b0dU, 0x858a8a0fU, + 0x907070e0U, 0x423e3e7cU, 0xc4b5b571U, 0xaa6666ccU, + 0xd8484890U, 0x05030306U, 0x01f6f6f7U, 0x120e0e1cU, + 0xa36161c2U, 0x5f35356aU, 0xf95757aeU, 0xd0b9b969U, + 0x91868617U, 0x58c1c199U, 0x271d1d3aU, 0xb99e9e27U, + 0x38e1e1d9U, 0x13f8f8ebU, 0xb398982bU, 0x33111122U, + 0xbb6969d2U, 0x70d9d9a9U, 0x898e8e07U, 0xa7949433U, + 0xb69b9b2dU, 0x221e1e3cU, 0x92878715U, 0x20e9e9c9U, + 0x49cece87U, 0xff5555aaU, 0x78282850U, 0x7adfdfa5U, + 0x8f8c8c03U, 0xf8a1a159U, 0x80898909U, 0x170d0d1aU, + 0xdabfbf65U, 0x31e6e6d7U, 0xc6424284U, 0xb86868d0U, + 0xc3414182U, 0xb0999929U, 0x772d2d5aU, 0x110f0f1eU, + 0xcbb0b07bU, 0xfc5454a8U, 0xd6bbbb6dU, 0x3a16162cU, + }; + + const uint32_t S1_T1[256] = { + 0x6363c6a5U, 0x7c7cf884U, 0x7777ee99U, 0x7b7bf68dU, + 0xf2f2ff0dU, 0x6b6bd6bdU, 0x6f6fdeb1U, 0xc5c59154U, + 0x30306050U, 0x01010203U, 0x6767cea9U, 0x2b2b567dU, + 0xfefee719U, 0xd7d7b562U, 0xabab4de6U, 0x7676ec9aU, + 0xcaca8f45U, 0x82821f9dU, 0xc9c98940U, 0x7d7dfa87U, + 0xfafaef15U, 0x5959b2ebU, 0x47478ec9U, 0xf0f0fb0bU, + 0xadad41ecU, 0xd4d4b367U, 0xa2a25ffdU, 0xafaf45eaU, + 0x9c9c23bfU, 0xa4a453f7U, 0x7272e496U, 0xc0c09b5bU, + 0xb7b775c2U, 0xfdfde11cU, 0x93933daeU, 0x26264c6aU, + 0x36366c5aU, 0x3f3f7e41U, 0xf7f7f502U, 0xcccc834fU, + 0x3434685cU, 0xa5a551f4U, 0xe5e5d134U, 0xf1f1f908U, + 0x7171e293U, 0xd8d8ab73U, 0x31316253U, 0x15152a3fU, + 0x0404080cU, 0xc7c79552U, 0x23234665U, 0xc3c39d5eU, + 0x18183028U, 0x969637a1U, 0x05050a0fU, 0x9a9a2fb5U, + 0x07070e09U, 0x12122436U, 0x80801b9bU, 0xe2e2df3dU, + 0xebebcd26U, 0x27274e69U, 0xb2b27fcdU, 0x7575ea9fU, + 0x0909121bU, 0x83831d9eU, 0x2c2c5874U, 0x1a1a342eU, + 0x1b1b362dU, 0x6e6edcb2U, 0x5a5ab4eeU, 0xa0a05bfbU, + 0x5252a4f6U, 0x3b3b764dU, 0xd6d6b761U, 0xb3b37dceU, + 0x2929527bU, 0xe3e3dd3eU, 0x2f2f5e71U, 0x84841397U, + 0x5353a6f5U, 0xd1d1b968U, 0x00000000U, 0xededc12cU, + 0x20204060U, 0xfcfce31fU, 0xb1b179c8U, 0x5b5bb6edU, + 0x6a6ad4beU, 0xcbcb8d46U, 0xbebe67d9U, 0x3939724bU, + 0x4a4a94deU, 0x4c4c98d4U, 0x5858b0e8U, 0xcfcf854aU, + 0xd0d0bb6bU, 0xefefc52aU, 0xaaaa4fe5U, 0xfbfbed16U, + 0x434386c5U, 0x4d4d9ad7U, 0x33336655U, 0x85851194U, + 0x45458acfU, 0xf9f9e910U, 0x02020406U, 0x7f7ffe81U, + 0x5050a0f0U, 0x3c3c7844U, 0x9f9f25baU, 0xa8a84be3U, + 0x5151a2f3U, 0xa3a35dfeU, 0x404080c0U, 0x8f8f058aU, + 0x92923fadU, 0x9d9d21bcU, 0x38387048U, 0xf5f5f104U, + 0xbcbc63dfU, 0xb6b677c1U, 0xdadaaf75U, 0x21214263U, + 0x10102030U, 0xffffe51aU, 0xf3f3fd0eU, 0xd2d2bf6dU, + 0xcdcd814cU, 0x0c0c1814U, 0x13132635U, 0xececc32fU, + 0x5f5fbee1U, 0x979735a2U, 0x444488ccU, 0x17172e39U, + 0xc4c49357U, 0xa7a755f2U, 0x7e7efc82U, 0x3d3d7a47U, + 0x6464c8acU, 0x5d5dbae7U, 0x1919322bU, 0x7373e695U, + 0x6060c0a0U, 0x81811998U, 0x4f4f9ed1U, 0xdcdca37fU, + 0x22224466U, 0x2a2a547eU, 0x90903babU, 0x88880b83U, + 0x46468ccaU, 0xeeeec729U, 0xb8b86bd3U, 0x1414283cU, + 0xdedea779U, 0x5e5ebce2U, 0x0b0b161dU, 0xdbdbad76U, + 0xe0e0db3bU, 0x32326456U, 0x3a3a744eU, 0x0a0a141eU, + 0x494992dbU, 0x06060c0aU, 0x2424486cU, 0x5c5cb8e4U, + 0xc2c29f5dU, 0xd3d3bd6eU, 0xacac43efU, 0x6262c4a6U, + 0x919139a8U, 0x959531a4U, 0xe4e4d337U, 0x7979f28bU, + 0xe7e7d532U, 0xc8c88b43U, 0x37376e59U, 0x6d6ddab7U, + 0x8d8d018cU, 0xd5d5b164U, 0x4e4e9cd2U, 0xa9a949e0U, + 0x6c6cd8b4U, 0x5656acfaU, 0xf4f4f307U, 0xeaeacf25U, + 0x6565caafU, 0x7a7af48eU, 0xaeae47e9U, 0x08081018U, + 0xbaba6fd5U, 0x7878f088U, 0x25254a6fU, 0x2e2e5c72U, + 0x1c1c3824U, 0xa6a657f1U, 0xb4b473c7U, 0xc6c69751U, + 0xe8e8cb23U, 0xdddda17cU, 0x7474e89cU, 0x1f1f3e21U, + 0x4b4b96ddU, 0xbdbd61dcU, 0x8b8b0d86U, 0x8a8a0f85U, + 0x7070e090U, 0x3e3e7c42U, 0xb5b571c4U, 0x6666ccaaU, + 0x484890d8U, 0x03030605U, 0xf6f6f701U, 0x0e0e1c12U, + 0x6161c2a3U, 0x35356a5fU, 0x5757aef9U, 0xb9b969d0U, + 0x86861791U, 0xc1c19958U, 0x1d1d3a27U, 0x9e9e27b9U, + 0xe1e1d938U, 0xf8f8eb13U, 0x98982bb3U, 0x11112233U, + 0x6969d2bbU, 0xd9d9a970U, 0x8e8e0789U, 0x949433a7U, + 0x9b9b2db6U, 0x1e1e3c22U, 0x87871592U, 0xe9e9c920U, + 0xcece8749U, 0x5555aaffU, 0x28285078U, 0xdfdfa57aU, + 0x8c8c038fU, 0xa1a159f8U, 0x89890980U, 0x0d0d1a17U, + 0xbfbf65daU, 0xe6e6d731U, 0x424284c6U, 0x6868d0b8U, + 0x414182c3U, 0x999929b0U, 0x2d2d5a77U, 0x0f0f1e11U, + 0xb0b07bcbU, 0x5454a8fcU, 0xbbbb6dd6U, 0x16162c3aU, + }; + + const uint32_t S1_T2[256] = { + 0x63c6a563U, 0x7cf8847cU, 0x77ee9977U, 0x7bf68d7bU, + 0xf2ff0df2U, 0x6bd6bd6bU, 0x6fdeb16fU, 0xc59154c5U, + 0x30605030U, 0x01020301U, 0x67cea967U, 0x2b567d2bU, + 0xfee719feU, 0xd7b562d7U, 0xab4de6abU, 0x76ec9a76U, + 0xca8f45caU, 0x821f9d82U, 0xc98940c9U, 0x7dfa877dU, + 0xfaef15faU, 0x59b2eb59U, 0x478ec947U, 0xf0fb0bf0U, + 0xad41ecadU, 0xd4b367d4U, 0xa25ffda2U, 0xaf45eaafU, + 0x9c23bf9cU, 0xa453f7a4U, 0x72e49672U, 0xc09b5bc0U, + 0xb775c2b7U, 0xfde11cfdU, 0x933dae93U, 0x264c6a26U, + 0x366c5a36U, 0x3f7e413fU, 0xf7f502f7U, 0xcc834fccU, + 0x34685c34U, 0xa551f4a5U, 0xe5d134e5U, 0xf1f908f1U, + 0x71e29371U, 0xd8ab73d8U, 0x31625331U, 0x152a3f15U, + 0x04080c04U, 0xc79552c7U, 0x23466523U, 0xc39d5ec3U, + 0x18302818U, 0x9637a196U, 0x050a0f05U, 0x9a2fb59aU, + 0x070e0907U, 0x12243612U, 0x801b9b80U, 0xe2df3de2U, + 0xebcd26ebU, 0x274e6927U, 0xb27fcdb2U, 0x75ea9f75U, + 0x09121b09U, 0x831d9e83U, 0x2c58742cU, 0x1a342e1aU, + 0x1b362d1bU, 0x6edcb26eU, 0x5ab4ee5aU, 0xa05bfba0U, + 0x52a4f652U, 0x3b764d3bU, 0xd6b761d6U, 0xb37dceb3U, + 0x29527b29U, 0xe3dd3ee3U, 0x2f5e712fU, 0x84139784U, + 0x53a6f553U, 0xd1b968d1U, 0x00000000U, 0xedc12cedU, + 0x20406020U, 0xfce31ffcU, 0xb179c8b1U, 0x5bb6ed5bU, + 0x6ad4be6aU, 0xcb8d46cbU, 0xbe67d9beU, 0x39724b39U, + 0x4a94de4aU, 0x4c98d44cU, 0x58b0e858U, 0xcf854acfU, + 0xd0bb6bd0U, 0xefc52aefU, 0xaa4fe5aaU, 0xfbed16fbU, + 0x4386c543U, 0x4d9ad74dU, 0x33665533U, 0x85119485U, + 0x458acf45U, 0xf9e910f9U, 0x02040602U, 0x7ffe817fU, + 0x50a0f050U, 0x3c78443cU, 0x9f25ba9fU, 0xa84be3a8U, + 0x51a2f351U, 0xa35dfea3U, 0x4080c040U, 0x8f058a8fU, + 0x923fad92U, 0x9d21bc9dU, 0x38704838U, 0xf5f104f5U, + 0xbc63dfbcU, 0xb677c1b6U, 0xdaaf75daU, 0x21426321U, + 0x10203010U, 0xffe51affU, 0xf3fd0ef3U, 0xd2bf6dd2U, + 0xcd814ccdU, 0x0c18140cU, 0x13263513U, 0xecc32fecU, + 0x5fbee15fU, 0x9735a297U, 0x4488cc44U, 0x172e3917U, + 0xc49357c4U, 0xa755f2a7U, 0x7efc827eU, 0x3d7a473dU, + 0x64c8ac64U, 0x5dbae75dU, 0x19322b19U, 0x73e69573U, + 0x60c0a060U, 0x81199881U, 0x4f9ed14fU, 0xdca37fdcU, + 0x22446622U, 0x2a547e2aU, 0x903bab90U, 0x880b8388U, + 0x468cca46U, 0xeec729eeU, 0xb86bd3b8U, 0x14283c14U, + 0xdea779deU, 0x5ebce25eU, 0x0b161d0bU, 0xdbad76dbU, + 0xe0db3be0U, 0x32645632U, 0x3a744e3aU, 0x0a141e0aU, + 0x4992db49U, 0x060c0a06U, 0x24486c24U, 0x5cb8e45cU, + 0xc29f5dc2U, 0xd3bd6ed3U, 0xac43efacU, 0x62c4a662U, + 0x9139a891U, 0x9531a495U, 0xe4d337e4U, 0x79f28b79U, + 0xe7d532e7U, 0xc88b43c8U, 0x376e5937U, 0x6ddab76dU, + 0x8d018c8dU, 0xd5b164d5U, 0x4e9cd24eU, 0xa949e0a9U, + 0x6cd8b46cU, 0x56acfa56U, 0xf4f307f4U, 0xeacf25eaU, + 0x65caaf65U, 0x7af48e7aU, 0xae47e9aeU, 0x08101808U, + 0xba6fd5baU, 0x78f08878U, 0x254a6f25U, 0x2e5c722eU, + 0x1c38241cU, 0xa657f1a6U, 0xb473c7b4U, 0xc69751c6U, + 0xe8cb23e8U, 0xdda17cddU, 0x74e89c74U, 0x1f3e211fU, + 0x4b96dd4bU, 0xbd61dcbdU, 0x8b0d868bU, 0x8a0f858aU, + 0x70e09070U, 0x3e7c423eU, 0xb571c4b5U, 0x66ccaa66U, + 0x4890d848U, 0x03060503U, 0xf6f701f6U, 0x0e1c120eU, + 0x61c2a361U, 0x356a5f35U, 0x57aef957U, 0xb969d0b9U, + 0x86179186U, 0xc19958c1U, 0x1d3a271dU, 0x9e27b99eU, + 0xe1d938e1U, 0xf8eb13f8U, 0x982bb398U, 0x11223311U, + 0x69d2bb69U, 0xd9a970d9U, 0x8e07898eU, 0x9433a794U, + 0x9b2db69bU, 0x1e3c221eU, 0x87159287U, 0xe9c920e9U, + 0xce8749ceU, 0x55aaff55U, 0x28507828U, 0xdfa57adfU, + 0x8c038f8cU, 0xa159f8a1U, 0x89098089U, 0x0d1a170dU, + 0xbf65dabfU, 0xe6d731e6U, 0x4284c642U, 0x68d0b868U, + 0x4182c341U, 0x9929b099U, 0x2d5a772dU, 0x0f1e110fU, + 0xb07bcbb0U, 0x54a8fc54U, 0xbb6dd6bbU, 0x162c3a16U, + }; + + const uint32_t S1_T3[256] = { + 0xc6a56363U, 0xf8847c7cU, 0xee997777U, 0xf68d7b7bU, + 0xff0df2f2U, 0xd6bd6b6bU, 0xdeb16f6fU, 0x9154c5c5U, + 0x60503030U, 0x02030101U, 0xcea96767U, 0x567d2b2bU, + 0xe719fefeU, 0xb562d7d7U, 0x4de6ababU, 0xec9a7676U, + 0x8f45cacaU, 0x1f9d8282U, 0x8940c9c9U, 0xfa877d7dU, + 0xef15fafaU, 0xb2eb5959U, 0x8ec94747U, 0xfb0bf0f0U, + 0x41ecadadU, 0xb367d4d4U, 0x5ffda2a2U, 0x45eaafafU, + 0x23bf9c9cU, 0x53f7a4a4U, 0xe4967272U, 0x9b5bc0c0U, + 0x75c2b7b7U, 0xe11cfdfdU, 0x3dae9393U, 0x4c6a2626U, + 0x6c5a3636U, 0x7e413f3fU, 0xf502f7f7U, 0x834fccccU, + 0x685c3434U, 0x51f4a5a5U, 0xd134e5e5U, 0xf908f1f1U, + 0xe2937171U, 0xab73d8d8U, 0x62533131U, 0x2a3f1515U, + 0x080c0404U, 0x9552c7c7U, 0x46652323U, 0x9d5ec3c3U, + 0x30281818U, 0x37a19696U, 0x0a0f0505U, 0x2fb59a9aU, + 0x0e090707U, 0x24361212U, 0x1b9b8080U, 0xdf3de2e2U, + 0xcd26ebebU, 0x4e692727U, 0x7fcdb2b2U, 0xea9f7575U, + 0x121b0909U, 0x1d9e8383U, 0x58742c2cU, 0x342e1a1aU, + 0x362d1b1bU, 0xdcb26e6eU, 0xb4ee5a5aU, 0x5bfba0a0U, + 0xa4f65252U, 0x764d3b3bU, 0xb761d6d6U, 0x7dceb3b3U, + 0x527b2929U, 0xdd3ee3e3U, 0x5e712f2fU, 0x13978484U, + 0xa6f55353U, 0xb968d1d1U, 0x00000000U, 0xc12cededU, + 0x40602020U, 0xe31ffcfcU, 0x79c8b1b1U, 0xb6ed5b5bU, + 0xd4be6a6aU, 0x8d46cbcbU, 0x67d9bebeU, 0x724b3939U, + 0x94de4a4aU, 0x98d44c4cU, 0xb0e85858U, 0x854acfcfU, + 0xbb6bd0d0U, 0xc52aefefU, 0x4fe5aaaaU, 0xed16fbfbU, + 0x86c54343U, 0x9ad74d4dU, 0x66553333U, 0x11948585U, + 0x8acf4545U, 0xe910f9f9U, 0x04060202U, 0xfe817f7fU, + 0xa0f05050U, 0x78443c3cU, 0x25ba9f9fU, 0x4be3a8a8U, + 0xa2f35151U, 0x5dfea3a3U, 0x80c04040U, 0x058a8f8fU, + 0x3fad9292U, 0x21bc9d9dU, 0x70483838U, 0xf104f5f5U, + 0x63dfbcbcU, 0x77c1b6b6U, 0xaf75dadaU, 0x42632121U, + 0x20301010U, 0xe51affffU, 0xfd0ef3f3U, 0xbf6dd2d2U, + 0x814ccdcdU, 0x18140c0cU, 0x26351313U, 0xc32fececU, + 0xbee15f5fU, 0x35a29797U, 0x88cc4444U, 0x2e391717U, + 0x9357c4c4U, 0x55f2a7a7U, 0xfc827e7eU, 0x7a473d3dU, + 0xc8ac6464U, 0xbae75d5dU, 0x322b1919U, 0xe6957373U, + 0xc0a06060U, 0x19988181U, 0x9ed14f4fU, 0xa37fdcdcU, + 0x44662222U, 0x547e2a2aU, 0x3bab9090U, 0x0b838888U, + 0x8cca4646U, 0xc729eeeeU, 0x6bd3b8b8U, 0x283c1414U, + 0xa779dedeU, 0xbce25e5eU, 0x161d0b0bU, 0xad76dbdbU, + 0xdb3be0e0U, 0x64563232U, 0x744e3a3aU, 0x141e0a0aU, + 0x92db4949U, 0x0c0a0606U, 0x486c2424U, 0xb8e45c5cU, + 0x9f5dc2c2U, 0xbd6ed3d3U, 0x43efacacU, 0xc4a66262U, + 0x39a89191U, 0x31a49595U, 0xd337e4e4U, 0xf28b7979U, + 0xd532e7e7U, 0x8b43c8c8U, 0x6e593737U, 0xdab76d6dU, + 0x018c8d8dU, 0xb164d5d5U, 0x9cd24e4eU, 0x49e0a9a9U, + 0xd8b46c6cU, 0xacfa5656U, 0xf307f4f4U, 0xcf25eaeaU, + 0xcaaf6565U, 0xf48e7a7aU, 0x47e9aeaeU, 0x10180808U, + 0x6fd5babaU, 0xf0887878U, 0x4a6f2525U, 0x5c722e2eU, + 0x38241c1cU, 0x57f1a6a6U, 0x73c7b4b4U, 0x9751c6c6U, + 0xcb23e8e8U, 0xa17cddddU, 0xe89c7474U, 0x3e211f1fU, + 0x96dd4b4bU, 0x61dcbdbdU, 0x0d868b8bU, 0x0f858a8aU, + 0xe0907070U, 0x7c423e3eU, 0x71c4b5b5U, 0xccaa6666U, + 0x90d84848U, 0x06050303U, 0xf701f6f6U, 0x1c120e0eU, + 0xc2a36161U, 0x6a5f3535U, 0xaef95757U, 0x69d0b9b9U, + 0x17918686U, 0x9958c1c1U, 0x3a271d1dU, 0x27b99e9eU, + 0xd938e1e1U, 0xeb13f8f8U, 0x2bb39898U, 0x22331111U, + 0xd2bb6969U, 0xa970d9d9U, 0x07898e8eU, 0x33a79494U, + 0x2db69b9bU, 0x3c221e1eU, 0x15928787U, 0xc920e9e9U, + 0x8749ceceU, 0xaaff5555U, 0x50782828U, 0xa57adfdfU, + 0x038f8c8cU, 0x59f8a1a1U, 0x09808989U, 0x1a170d0dU, + 0x65dabfbfU, 0xd731e6e6U, 0x84c64242U, 0xd0b86868U, + 0x82c34141U, 0x29b09999U, 0x5a772d2dU, 0x1e110f0fU, + 0x7bcbb0b0U, 0xa8fc5454U, 0x6dd6bbbbU, 0x2c3a1616U, + }; + + const uint32_t S2_T0[256] = { + 0x6f25254aU, 0x6c242448U, 0x957373e6U, 0xa96767ceU, + 0x10d7d7c7U, 0x9baeae35U, 0xe45c5cb8U, 0x50303060U, + 0x85a4a421U, 0x5beeeeb5U, 0xb26e6edcU, 0x34cbcbffU, + 0x877d7dfaU, 0xb6b5b503U, 0xef82826dU, 0x04dbdbdfU, + 0x45e4e4a1U, 0xfb8e8e75U, 0xd8484890U, 0xdb494992U, + 0xd14f4f9eU, 0xe75d5dbaU, 0xbe6a6ad4U, 0x887878f0U, + 0x907070e0U, 0xf1888879U, 0x51e8e8b9U, 0xe15f5fbeU, + 0xe25e5ebcU, 0xe5848461U, 0xaf6565caU, 0x4fe2e2adU, + 0x01d8d8d9U, 0x52e9e9bbU, 0x3dccccf1U, 0x5eededb3U, + 0xc0404080U, 0x712f2f5eU, 0x33111122U, 0x78282850U, + 0xf95757aeU, 0x1fd2d2cdU, 0x9dacac31U, 0x4ce3e3afU, + 0xde4a4a94U, 0x3f15152aU, 0x2d1b1b36U, 0xa2b9b91bU, + 0xbfb2b20dU, 0xe9808069U, 0xe6858563U, 0x83a6a625U, + 0x722e2e5cU, 0x06020204U, 0xc947478eU, 0x7b292952U, + 0x0907070eU, 0xdd4b4b96U, 0x120e0e1cU, 0x2ac1c1ebU, + 0xf35151a2U, 0x97aaaa3dU, 0xf289897bU, 0x15d4d4c1U, + 0x37cacafdU, 0x03010102U, 0xca46468cU, 0xbcb3b30fU, + 0x58efefb7U, 0x0eddddd3U, 0xcc444488U, 0x8d7b7bf6U, + 0x2fc2c2edU, 0x817f7ffeU, 0xabbebe15U, 0x2cc3c3efU, + 0xc89f9f57U, 0x60202040U, 0xd44c4c98U, 0xac6464c8U, + 0xec83836fU, 0x8fa2a22dU, 0xb86868d0U, 0xc6424284U, + 0x35131326U, 0xb5b4b401U, 0xc3414182U, 0x3ecdcdf3U, + 0xa7baba1dU, 0x23c6c6e5U, 0xa4bbbb1fU, 0xb76d6ddaU, + 0xd74d4d9aU, 0x937171e2U, 0x63212142U, 0x75f4f481U, + 0xfe8d8d73U, 0xb9b0b009U, 0x46e5e5a3U, 0xdc93934fU, + 0x6bfefe95U, 0xf88f8f77U, 0x43e6e6a5U, 0x38cfcff7U, + 0xc5434386U, 0xcf45458aU, 0x53313162U, 0x66222244U, + 0x5937376eU, 0x5a36366cU, 0xd3969645U, 0x67fafa9dU, + 0xadbcbc11U, 0x110f0f1eU, 0x18080810U, 0xf65252a4U, + 0x271d1d3aU, 0xff5555aaU, 0x2e1a1a34U, 0x26c5c5e3U, + 0xd24e4e9cU, 0x65232346U, 0xbb6969d2U, 0x8e7a7af4U, + 0xdf92924dU, 0x68ffff97U, 0xed5b5bb6U, 0xee5a5ab4U, + 0x54ebebbfU, 0xc79a9a5dU, 0x241c1c38U, 0x92a9a93bU, + 0x1ad1d1cbU, 0x827e7efcU, 0x170d0d1aU, 0x6dfcfc91U, + 0xf05050a0U, 0xf78a8a7dU, 0xb3b6b605U, 0xa66262c4U, + 0x76f5f583U, 0x1e0a0a14U, 0x61f8f899U, 0x0ddcdcd1U, + 0x05030306U, 0x443c3c78U, 0x140c0c18U, 0x4b393972U, + 0x7af1f18bU, 0xa1b8b819U, 0x7cf3f38fU, 0x473d3d7aU, + 0x7ff2f28dU, 0x16d5d5c3U, 0xd0979747U, 0xaa6666ccU, + 0xea81816bU, 0x56323264U, 0x89a0a029U, 0x00000000U, + 0x0a06060cU, 0x3bcecef5U, 0x73f6f685U, 0x57eaeabdU, + 0xb0b7b707U, 0x3917172eU, 0x70f7f787U, 0xfd8c8c71U, + 0x8b7979f2U, 0x13d6d6c5U, 0x80a7a727U, 0xa8bfbf17U, + 0xf48b8b7fU, 0x413f3f7eU, 0x211f1f3eU, 0xf55353a6U, + 0xa56363c6U, 0x9f7575eaU, 0x5f35356aU, 0x742c2c58U, + 0xa06060c0U, 0x6efdfd93U, 0x6927274eU, 0x1cd3d3cfU, + 0xd5949441U, 0x86a5a523U, 0x847c7cf8U, 0x8aa1a12bU, + 0x0f05050aU, 0xe85858b0U, 0x772d2d5aU, 0xaebdbd13U, + 0x02d9d9dbU, 0x20c7c7e7U, 0x98afaf37U, 0xbd6b6bd6U, + 0xfc5454a8U, 0x1d0b0b16U, 0x49e0e0a9U, 0x48383870U, + 0x0c040408U, 0x31c8c8f9U, 0xce9d9d53U, 0x40e7e7a7U, + 0x3c141428U, 0xbab1b10bU, 0xe0878767U, 0xcd9c9c51U, + 0x08dfdfd7U, 0xb16f6fdeU, 0x62f9f99bU, 0x07dadaddU, + 0x7e2a2a54U, 0x25c4c4e1U, 0xeb5959b2U, 0x3a16162cU, + 0x9c7474e8U, 0xda91914bU, 0x94abab3fU, 0x6a26264cU, + 0xa36161c2U, 0x9a7676ecU, 0x5c343468U, 0x7d2b2b56U, + 0x9eadad33U, 0xc299995bU, 0x64fbfb9fU, 0x967272e4U, + 0x5dececb1U, 0x55333366U, 0x36121224U, 0x0bdeded5U, + 0xc1989859U, 0x4d3b3b76U, 0x29c0c0e9U, 0xc49b9b5fU, + 0x423e3e7cU, 0x28181830U, 0x30101020U, 0x4e3a3a74U, + 0xfa5656acU, 0x4ae1e1abU, 0x997777eeU, 0x32c9c9fbU, + 0x221e1e3cU, 0xcb9e9e55U, 0xd6959543U, 0x8ca3a32fU, + 0xd9909049U, 0x2b191932U, 0x91a8a839U, 0xb46c6cd8U, + 0x1b090912U, 0x19d0d0c9U, 0x79f0f089U, 0xe3868665U, + }; + + const uint32_t S2_T1[256] = { + 0x25254a6fU, 0x2424486cU, 0x7373e695U, 0x6767cea9U, + 0xd7d7c710U, 0xaeae359bU, 0x5c5cb8e4U, 0x30306050U, + 0xa4a42185U, 0xeeeeb55bU, 0x6e6edcb2U, 0xcbcbff34U, + 0x7d7dfa87U, 0xb5b503b6U, 0x82826defU, 0xdbdbdf04U, + 0xe4e4a145U, 0x8e8e75fbU, 0x484890d8U, 0x494992dbU, + 0x4f4f9ed1U, 0x5d5dbae7U, 0x6a6ad4beU, 0x7878f088U, + 0x7070e090U, 0x888879f1U, 0xe8e8b951U, 0x5f5fbee1U, + 0x5e5ebce2U, 0x848461e5U, 0x6565caafU, 0xe2e2ad4fU, + 0xd8d8d901U, 0xe9e9bb52U, 0xccccf13dU, 0xededb35eU, + 0x404080c0U, 0x2f2f5e71U, 0x11112233U, 0x28285078U, + 0x5757aef9U, 0xd2d2cd1fU, 0xacac319dU, 0xe3e3af4cU, + 0x4a4a94deU, 0x15152a3fU, 0x1b1b362dU, 0xb9b91ba2U, + 0xb2b20dbfU, 0x808069e9U, 0x858563e6U, 0xa6a62583U, + 0x2e2e5c72U, 0x02020406U, 0x47478ec9U, 0x2929527bU, + 0x07070e09U, 0x4b4b96ddU, 0x0e0e1c12U, 0xc1c1eb2aU, + 0x5151a2f3U, 0xaaaa3d97U, 0x89897bf2U, 0xd4d4c115U, + 0xcacafd37U, 0x01010203U, 0x46468ccaU, 0xb3b30fbcU, + 0xefefb758U, 0xddddd30eU, 0x444488ccU, 0x7b7bf68dU, + 0xc2c2ed2fU, 0x7f7ffe81U, 0xbebe15abU, 0xc3c3ef2cU, + 0x9f9f57c8U, 0x20204060U, 0x4c4c98d4U, 0x6464c8acU, + 0x83836fecU, 0xa2a22d8fU, 0x6868d0b8U, 0x424284c6U, + 0x13132635U, 0xb4b401b5U, 0x414182c3U, 0xcdcdf33eU, + 0xbaba1da7U, 0xc6c6e523U, 0xbbbb1fa4U, 0x6d6ddab7U, + 0x4d4d9ad7U, 0x7171e293U, 0x21214263U, 0xf4f48175U, + 0x8d8d73feU, 0xb0b009b9U, 0xe5e5a346U, 0x93934fdcU, + 0xfefe956bU, 0x8f8f77f8U, 0xe6e6a543U, 0xcfcff738U, + 0x434386c5U, 0x45458acfU, 0x31316253U, 0x22224466U, + 0x37376e59U, 0x36366c5aU, 0x969645d3U, 0xfafa9d67U, + 0xbcbc11adU, 0x0f0f1e11U, 0x08081018U, 0x5252a4f6U, + 0x1d1d3a27U, 0x5555aaffU, 0x1a1a342eU, 0xc5c5e326U, + 0x4e4e9cd2U, 0x23234665U, 0x6969d2bbU, 0x7a7af48eU, + 0x92924ddfU, 0xffff9768U, 0x5b5bb6edU, 0x5a5ab4eeU, + 0xebebbf54U, 0x9a9a5dc7U, 0x1c1c3824U, 0xa9a93b92U, + 0xd1d1cb1aU, 0x7e7efc82U, 0x0d0d1a17U, 0xfcfc916dU, + 0x5050a0f0U, 0x8a8a7df7U, 0xb6b605b3U, 0x6262c4a6U, + 0xf5f58376U, 0x0a0a141eU, 0xf8f89961U, 0xdcdcd10dU, + 0x03030605U, 0x3c3c7844U, 0x0c0c1814U, 0x3939724bU, + 0xf1f18b7aU, 0xb8b819a1U, 0xf3f38f7cU, 0x3d3d7a47U, + 0xf2f28d7fU, 0xd5d5c316U, 0x979747d0U, 0x6666ccaaU, + 0x81816beaU, 0x32326456U, 0xa0a02989U, 0x00000000U, + 0x06060c0aU, 0xcecef53bU, 0xf6f68573U, 0xeaeabd57U, + 0xb7b707b0U, 0x17172e39U, 0xf7f78770U, 0x8c8c71fdU, + 0x7979f28bU, 0xd6d6c513U, 0xa7a72780U, 0xbfbf17a8U, + 0x8b8b7ff4U, 0x3f3f7e41U, 0x1f1f3e21U, 0x5353a6f5U, + 0x6363c6a5U, 0x7575ea9fU, 0x35356a5fU, 0x2c2c5874U, + 0x6060c0a0U, 0xfdfd936eU, 0x27274e69U, 0xd3d3cf1cU, + 0x949441d5U, 0xa5a52386U, 0x7c7cf884U, 0xa1a12b8aU, + 0x05050a0fU, 0x5858b0e8U, 0x2d2d5a77U, 0xbdbd13aeU, + 0xd9d9db02U, 0xc7c7e720U, 0xafaf3798U, 0x6b6bd6bdU, + 0x5454a8fcU, 0x0b0b161dU, 0xe0e0a949U, 0x38387048U, + 0x0404080cU, 0xc8c8f931U, 0x9d9d53ceU, 0xe7e7a740U, + 0x1414283cU, 0xb1b10bbaU, 0x878767e0U, 0x9c9c51cdU, + 0xdfdfd708U, 0x6f6fdeb1U, 0xf9f99b62U, 0xdadadd07U, + 0x2a2a547eU, 0xc4c4e125U, 0x5959b2ebU, 0x16162c3aU, + 0x7474e89cU, 0x91914bdaU, 0xabab3f94U, 0x26264c6aU, + 0x6161c2a3U, 0x7676ec9aU, 0x3434685cU, 0x2b2b567dU, + 0xadad339eU, 0x99995bc2U, 0xfbfb9f64U, 0x7272e496U, + 0xececb15dU, 0x33336655U, 0x12122436U, 0xdeded50bU, + 0x989859c1U, 0x3b3b764dU, 0xc0c0e929U, 0x9b9b5fc4U, + 0x3e3e7c42U, 0x18183028U, 0x10102030U, 0x3a3a744eU, + 0x5656acfaU, 0xe1e1ab4aU, 0x7777ee99U, 0xc9c9fb32U, + 0x1e1e3c22U, 0x9e9e55cbU, 0x959543d6U, 0xa3a32f8cU, + 0x909049d9U, 0x1919322bU, 0xa8a83991U, 0x6c6cd8b4U, + 0x0909121bU, 0xd0d0c919U, 0xf0f08979U, 0x868665e3U, + }; + + const uint32_t S2_T2[256] = { + 0x254a6f25U, 0x24486c24U, 0x73e69573U, 0x67cea967U, + 0xd7c710d7U, 0xae359baeU, 0x5cb8e45cU, 0x30605030U, + 0xa42185a4U, 0xeeb55beeU, 0x6edcb26eU, 0xcbff34cbU, + 0x7dfa877dU, 0xb503b6b5U, 0x826def82U, 0xdbdf04dbU, + 0xe4a145e4U, 0x8e75fb8eU, 0x4890d848U, 0x4992db49U, + 0x4f9ed14fU, 0x5dbae75dU, 0x6ad4be6aU, 0x78f08878U, + 0x70e09070U, 0x8879f188U, 0xe8b951e8U, 0x5fbee15fU, + 0x5ebce25eU, 0x8461e584U, 0x65caaf65U, 0xe2ad4fe2U, + 0xd8d901d8U, 0xe9bb52e9U, 0xccf13dccU, 0xedb35eedU, + 0x4080c040U, 0x2f5e712fU, 0x11223311U, 0x28507828U, + 0x57aef957U, 0xd2cd1fd2U, 0xac319dacU, 0xe3af4ce3U, + 0x4a94de4aU, 0x152a3f15U, 0x1b362d1bU, 0xb91ba2b9U, + 0xb20dbfb2U, 0x8069e980U, 0x8563e685U, 0xa62583a6U, + 0x2e5c722eU, 0x02040602U, 0x478ec947U, 0x29527b29U, + 0x070e0907U, 0x4b96dd4bU, 0x0e1c120eU, 0xc1eb2ac1U, + 0x51a2f351U, 0xaa3d97aaU, 0x897bf289U, 0xd4c115d4U, + 0xcafd37caU, 0x01020301U, 0x468cca46U, 0xb30fbcb3U, + 0xefb758efU, 0xddd30eddU, 0x4488cc44U, 0x7bf68d7bU, + 0xc2ed2fc2U, 0x7ffe817fU, 0xbe15abbeU, 0xc3ef2cc3U, + 0x9f57c89fU, 0x20406020U, 0x4c98d44cU, 0x64c8ac64U, + 0x836fec83U, 0xa22d8fa2U, 0x68d0b868U, 0x4284c642U, + 0x13263513U, 0xb401b5b4U, 0x4182c341U, 0xcdf33ecdU, + 0xba1da7baU, 0xc6e523c6U, 0xbb1fa4bbU, 0x6ddab76dU, + 0x4d9ad74dU, 0x71e29371U, 0x21426321U, 0xf48175f4U, + 0x8d73fe8dU, 0xb009b9b0U, 0xe5a346e5U, 0x934fdc93U, + 0xfe956bfeU, 0x8f77f88fU, 0xe6a543e6U, 0xcff738cfU, + 0x4386c543U, 0x458acf45U, 0x31625331U, 0x22446622U, + 0x376e5937U, 0x366c5a36U, 0x9645d396U, 0xfa9d67faU, + 0xbc11adbcU, 0x0f1e110fU, 0x08101808U, 0x52a4f652U, + 0x1d3a271dU, 0x55aaff55U, 0x1a342e1aU, 0xc5e326c5U, + 0x4e9cd24eU, 0x23466523U, 0x69d2bb69U, 0x7af48e7aU, + 0x924ddf92U, 0xff9768ffU, 0x5bb6ed5bU, 0x5ab4ee5aU, + 0xebbf54ebU, 0x9a5dc79aU, 0x1c38241cU, 0xa93b92a9U, + 0xd1cb1ad1U, 0x7efc827eU, 0x0d1a170dU, 0xfc916dfcU, + 0x50a0f050U, 0x8a7df78aU, 0xb605b3b6U, 0x62c4a662U, + 0xf58376f5U, 0x0a141e0aU, 0xf89961f8U, 0xdcd10ddcU, + 0x03060503U, 0x3c78443cU, 0x0c18140cU, 0x39724b39U, + 0xf18b7af1U, 0xb819a1b8U, 0xf38f7cf3U, 0x3d7a473dU, + 0xf28d7ff2U, 0xd5c316d5U, 0x9747d097U, 0x66ccaa66U, + 0x816bea81U, 0x32645632U, 0xa02989a0U, 0x00000000U, + 0x060c0a06U, 0xcef53bceU, 0xf68573f6U, 0xeabd57eaU, + 0xb707b0b7U, 0x172e3917U, 0xf78770f7U, 0x8c71fd8cU, + 0x79f28b79U, 0xd6c513d6U, 0xa72780a7U, 0xbf17a8bfU, + 0x8b7ff48bU, 0x3f7e413fU, 0x1f3e211fU, 0x53a6f553U, + 0x63c6a563U, 0x75ea9f75U, 0x356a5f35U, 0x2c58742cU, + 0x60c0a060U, 0xfd936efdU, 0x274e6927U, 0xd3cf1cd3U, + 0x9441d594U, 0xa52386a5U, 0x7cf8847cU, 0xa12b8aa1U, + 0x050a0f05U, 0x58b0e858U, 0x2d5a772dU, 0xbd13aebdU, + 0xd9db02d9U, 0xc7e720c7U, 0xaf3798afU, 0x6bd6bd6bU, + 0x54a8fc54U, 0x0b161d0bU, 0xe0a949e0U, 0x38704838U, + 0x04080c04U, 0xc8f931c8U, 0x9d53ce9dU, 0xe7a740e7U, + 0x14283c14U, 0xb10bbab1U, 0x8767e087U, 0x9c51cd9cU, + 0xdfd708dfU, 0x6fdeb16fU, 0xf99b62f9U, 0xdadd07daU, + 0x2a547e2aU, 0xc4e125c4U, 0x59b2eb59U, 0x162c3a16U, + 0x74e89c74U, 0x914bda91U, 0xab3f94abU, 0x264c6a26U, + 0x61c2a361U, 0x76ec9a76U, 0x34685c34U, 0x2b567d2bU, + 0xad339eadU, 0x995bc299U, 0xfb9f64fbU, 0x72e49672U, + 0xecb15decU, 0x33665533U, 0x12243612U, 0xded50bdeU, + 0x9859c198U, 0x3b764d3bU, 0xc0e929c0U, 0x9b5fc49bU, + 0x3e7c423eU, 0x18302818U, 0x10203010U, 0x3a744e3aU, + 0x56acfa56U, 0xe1ab4ae1U, 0x77ee9977U, 0xc9fb32c9U, + 0x1e3c221eU, 0x9e55cb9eU, 0x9543d695U, 0xa32f8ca3U, + 0x9049d990U, 0x19322b19U, 0xa83991a8U, 0x6cd8b46cU, + 0x09121b09U, 0xd0c919d0U, 0xf08979f0U, 0x8665e386U, + }; + + const uint32_t S2_T3[256] = { + 0x4a6f2525U, 0x486c2424U, 0xe6957373U, 0xcea96767U, + 0xc710d7d7U, 0x359baeaeU, 0xb8e45c5cU, 0x60503030U, + 0x2185a4a4U, 0xb55beeeeU, 0xdcb26e6eU, 0xff34cbcbU, + 0xfa877d7dU, 0x03b6b5b5U, 0x6def8282U, 0xdf04dbdbU, + 0xa145e4e4U, 0x75fb8e8eU, 0x90d84848U, 0x92db4949U, + 0x9ed14f4fU, 0xbae75d5dU, 0xd4be6a6aU, 0xf0887878U, + 0xe0907070U, 0x79f18888U, 0xb951e8e8U, 0xbee15f5fU, + 0xbce25e5eU, 0x61e58484U, 0xcaaf6565U, 0xad4fe2e2U, + 0xd901d8d8U, 0xbb52e9e9U, 0xf13dccccU, 0xb35eededU, + 0x80c04040U, 0x5e712f2fU, 0x22331111U, 0x50782828U, + 0xaef95757U, 0xcd1fd2d2U, 0x319dacacU, 0xaf4ce3e3U, + 0x94de4a4aU, 0x2a3f1515U, 0x362d1b1bU, 0x1ba2b9b9U, + 0x0dbfb2b2U, 0x69e98080U, 0x63e68585U, 0x2583a6a6U, + 0x5c722e2eU, 0x04060202U, 0x8ec94747U, 0x527b2929U, + 0x0e090707U, 0x96dd4b4bU, 0x1c120e0eU, 0xeb2ac1c1U, + 0xa2f35151U, 0x3d97aaaaU, 0x7bf28989U, 0xc115d4d4U, + 0xfd37cacaU, 0x02030101U, 0x8cca4646U, 0x0fbcb3b3U, + 0xb758efefU, 0xd30eddddU, 0x88cc4444U, 0xf68d7b7bU, + 0xed2fc2c2U, 0xfe817f7fU, 0x15abbebeU, 0xef2cc3c3U, + 0x57c89f9fU, 0x40602020U, 0x98d44c4cU, 0xc8ac6464U, + 0x6fec8383U, 0x2d8fa2a2U, 0xd0b86868U, 0x84c64242U, + 0x26351313U, 0x01b5b4b4U, 0x82c34141U, 0xf33ecdcdU, + 0x1da7babaU, 0xe523c6c6U, 0x1fa4bbbbU, 0xdab76d6dU, + 0x9ad74d4dU, 0xe2937171U, 0x42632121U, 0x8175f4f4U, + 0x73fe8d8dU, 0x09b9b0b0U, 0xa346e5e5U, 0x4fdc9393U, + 0x956bfefeU, 0x77f88f8fU, 0xa543e6e6U, 0xf738cfcfU, + 0x86c54343U, 0x8acf4545U, 0x62533131U, 0x44662222U, + 0x6e593737U, 0x6c5a3636U, 0x45d39696U, 0x9d67fafaU, + 0x11adbcbcU, 0x1e110f0fU, 0x10180808U, 0xa4f65252U, + 0x3a271d1dU, 0xaaff5555U, 0x342e1a1aU, 0xe326c5c5U, + 0x9cd24e4eU, 0x46652323U, 0xd2bb6969U, 0xf48e7a7aU, + 0x4ddf9292U, 0x9768ffffU, 0xb6ed5b5bU, 0xb4ee5a5aU, + 0xbf54ebebU, 0x5dc79a9aU, 0x38241c1cU, 0x3b92a9a9U, + 0xcb1ad1d1U, 0xfc827e7eU, 0x1a170d0dU, 0x916dfcfcU, + 0xa0f05050U, 0x7df78a8aU, 0x05b3b6b6U, 0xc4a66262U, + 0x8376f5f5U, 0x141e0a0aU, 0x9961f8f8U, 0xd10ddcdcU, + 0x06050303U, 0x78443c3cU, 0x18140c0cU, 0x724b3939U, + 0x8b7af1f1U, 0x19a1b8b8U, 0x8f7cf3f3U, 0x7a473d3dU, + 0x8d7ff2f2U, 0xc316d5d5U, 0x47d09797U, 0xccaa6666U, + 0x6bea8181U, 0x64563232U, 0x2989a0a0U, 0x00000000U, + 0x0c0a0606U, 0xf53bceceU, 0x8573f6f6U, 0xbd57eaeaU, + 0x07b0b7b7U, 0x2e391717U, 0x8770f7f7U, 0x71fd8c8cU, + 0xf28b7979U, 0xc513d6d6U, 0x2780a7a7U, 0x17a8bfbfU, + 0x7ff48b8bU, 0x7e413f3fU, 0x3e211f1fU, 0xa6f55353U, + 0xc6a56363U, 0xea9f7575U, 0x6a5f3535U, 0x58742c2cU, + 0xc0a06060U, 0x936efdfdU, 0x4e692727U, 0xcf1cd3d3U, + 0x41d59494U, 0x2386a5a5U, 0xf8847c7cU, 0x2b8aa1a1U, + 0x0a0f0505U, 0xb0e85858U, 0x5a772d2dU, 0x13aebdbdU, + 0xdb02d9d9U, 0xe720c7c7U, 0x3798afafU, 0xd6bd6b6bU, + 0xa8fc5454U, 0x161d0b0bU, 0xa949e0e0U, 0x70483838U, + 0x080c0404U, 0xf931c8c8U, 0x53ce9d9dU, 0xa740e7e7U, + 0x283c1414U, 0x0bbab1b1U, 0x67e08787U, 0x51cd9c9cU, + 0xd708dfdfU, 0xdeb16f6fU, 0x9b62f9f9U, 0xdd07dadaU, + 0x547e2a2aU, 0xe125c4c4U, 0xb2eb5959U, 0x2c3a1616U, + 0xe89c7474U, 0x4bda9191U, 0x3f94ababU, 0x4c6a2626U, + 0xc2a36161U, 0xec9a7676U, 0x685c3434U, 0x567d2b2bU, + 0x339eadadU, 0x5bc29999U, 0x9f64fbfbU, 0xe4967272U, + 0xb15dececU, 0x66553333U, 0x24361212U, 0xd50bdedeU, + 0x59c19898U, 0x764d3b3bU, 0xe929c0c0U, 0x5fc49b9bU, + 0x7c423e3eU, 0x30281818U, 0x20301010U, 0x744e3a3aU, + 0xacfa5656U, 0xab4ae1e1U, 0xee997777U, 0xfb32c9c9U, + 0x3c221e1eU, 0x55cb9e9eU, 0x43d69595U, 0x2f8ca3a3U, + 0x49d99090U, 0x322b1919U, 0x3991a8a8U, 0xd8b46c6cU, + 0x121b0909U, 0xc919d0d0U, 0x8979f0f0U, 0x65e38686U, + }; + + const uint32_t MULalpha[256] = { + 0x00000000U, 0xE19FCF13U, 0x6B973726U, 0x8A08F835U, + 0xD6876E4CU, 0x3718A15FU, 0xBD10596AU, 0x5C8F9679U, + 0x05A7DC98U, 0xE438138BU, 0x6E30EBBEU, 0x8FAF24ADU, + 0xD320B2D4U, 0x32BF7DC7U, 0xB8B785F2U, 0x59284AE1U, + 0x0AE71199U, 0xEB78DE8AU, 0x617026BFU, 0x80EFE9ACU, + 0xDC607FD5U, 0x3DFFB0C6U, 0xB7F748F3U, 0x566887E0U, + 0x0F40CD01U, 0xEEDF0212U, 0x64D7FA27U, 0x85483534U, + 0xD9C7A34DU, 0x38586C5EU, 0xB250946BU, 0x53CF5B78U, + 0x1467229BU, 0xF5F8ED88U, 0x7FF015BDU, 0x9E6FDAAEU, + 0xC2E04CD7U, 0x237F83C4U, 0xA9777BF1U, 0x48E8B4E2U, + 0x11C0FE03U, 0xF05F3110U, 0x7A57C925U, 0x9BC80636U, + 0xC747904FU, 0x26D85F5CU, 0xACD0A769U, 0x4D4F687AU, + 0x1E803302U, 0xFF1FFC11U, 0x75170424U, 0x9488CB37U, + 0xC8075D4EU, 0x2998925DU, 0xA3906A68U, 0x420FA57BU, + 0x1B27EF9AU, 0xFAB82089U, 0x70B0D8BCU, 0x912F17AFU, + 0xCDA081D6U, 0x2C3F4EC5U, 0xA637B6F0U, 0x47A879E3U, + 0x28CE449FU, 0xC9518B8CU, 0x435973B9U, 0xA2C6BCAAU, + 0xFE492AD3U, 0x1FD6E5C0U, 0x95DE1DF5U, 0x7441D2E6U, + 0x2D699807U, 0xCCF65714U, 0x46FEAF21U, 0xA7616032U, + 0xFBEEF64BU, 0x1A713958U, 0x9079C16DU, 0x71E60E7EU, + 0x22295506U, 0xC3B69A15U, 0x49BE6220U, 0xA821AD33U, + 0xF4AE3B4AU, 0x1531F459U, 0x9F390C6CU, 0x7EA6C37FU, + 0x278E899EU, 0xC611468DU, 0x4C19BEB8U, 0xAD8671ABU, + 0xF109E7D2U, 0x109628C1U, 0x9A9ED0F4U, 0x7B011FE7U, + 0x3CA96604U, 0xDD36A917U, 0x573E5122U, 0xB6A19E31U, + 0xEA2E0848U, 0x0BB1C75BU, 0x81B93F6EU, 0x6026F07DU, + 0x390EBA9CU, 0xD891758FU, 0x52998DBAU, 0xB30642A9U, + 0xEF89D4D0U, 0x0E161BC3U, 0x841EE3F6U, 0x65812CE5U, + 0x364E779DU, 0xD7D1B88EU, 0x5DD940BBU, 0xBC468FA8U, + 0xE0C919D1U, 0x0156D6C2U, 0x8B5E2EF7U, 0x6AC1E1E4U, + 0x33E9AB05U, 0xD2766416U, 0x587E9C23U, 0xB9E15330U, + 0xE56EC549U, 0x04F10A5AU, 0x8EF9F26FU, 0x6F663D7CU, + 0x50358897U, 0xB1AA4784U, 0x3BA2BFB1U, 0xDA3D70A2U, + 0x86B2E6DBU, 0x672D29C8U, 0xED25D1FDU, 0x0CBA1EEEU, + 0x5592540FU, 0xB40D9B1CU, 0x3E056329U, 0xDF9AAC3AU, + 0x83153A43U, 0x628AF550U, 0xE8820D65U, 0x091DC276U, + 0x5AD2990EU, 0xBB4D561DU, 0x3145AE28U, 0xD0DA613BU, + 0x8C55F742U, 0x6DCA3851U, 0xE7C2C064U, 0x065D0F77U, + 0x5F754596U, 0xBEEA8A85U, 0x34E272B0U, 0xD57DBDA3U, + 0x89F22BDAU, 0x686DE4C9U, 0xE2651CFCU, 0x03FAD3EFU, + 0x4452AA0CU, 0xA5CD651FU, 0x2FC59D2AU, 0xCE5A5239U, + 0x92D5C440U, 0x734A0B53U, 0xF942F366U, 0x18DD3C75U, + 0x41F57694U, 0xA06AB987U, 0x2A6241B2U, 0xCBFD8EA1U, + 0x977218D8U, 0x76EDD7CBU, 0xFCE52FFEU, 0x1D7AE0EDU, + 0x4EB5BB95U, 0xAF2A7486U, 0x25228CB3U, 0xC4BD43A0U, + 0x9832D5D9U, 0x79AD1ACAU, 0xF3A5E2FFU, 0x123A2DECU, + 0x4B12670DU, 0xAA8DA81EU, 0x2085502BU, 0xC11A9F38U, + 0x9D950941U, 0x7C0AC652U, 0xF6023E67U, 0x179DF174U, + 0x78FBCC08U, 0x9964031BU, 0x136CFB2EU, 0xF2F3343DU, + 0xAE7CA244U, 0x4FE36D57U, 0xC5EB9562U, 0x24745A71U, + 0x7D5C1090U, 0x9CC3DF83U, 0x16CB27B6U, 0xF754E8A5U, + 0xABDB7EDCU, 0x4A44B1CFU, 0xC04C49FAU, 0x21D386E9U, + 0x721CDD91U, 0x93831282U, 0x198BEAB7U, 0xF81425A4U, + 0xA49BB3DDU, 0x45047CCEU, 0xCF0C84FBU, 0x2E934BE8U, + 0x77BB0109U, 0x9624CE1AU, 0x1C2C362FU, 0xFDB3F93CU, + 0xA13C6F45U, 0x40A3A056U, 0xCAAB5863U, 0x2B349770U, + 0x6C9CEE93U, 0x8D032180U, 0x070BD9B5U, 0xE69416A6U, + 0xBA1B80DFU, 0x5B844FCCU, 0xD18CB7F9U, 0x301378EAU, + 0x693B320BU, 0x88A4FD18U, 0x02AC052DU, 0xE333CA3EU, + 0xBFBC5C47U, 0x5E239354U, 0xD42B6B61U, 0x35B4A472U, + 0x667BFF0AU, 0x87E43019U, 0x0DECC82CU, 0xEC73073FU, + 0xB0FC9146U, 0x51635E55U, 0xDB6BA660U, 0x3AF46973U, + 0x63DC2392U, 0x8243EC81U, 0x084B14B4U, 0xE9D4DBA7U, + 0xB55B4DDEU, 0x54C482CDU, 0xDECC7AF8U, 0x3F53B5EBU, + }; + + const uint32_t DIValpha[256] = { + 0x00000000U, 0x180F40CDU, 0x301E8033U, 0x2811C0FEU, + 0x603CA966U, 0x7833E9ABU, 0x50222955U, 0x482D6998U, + 0xC078FBCCU, 0xD877BB01U, 0xF0667BFFU, 0xE8693B32U, + 0xA04452AAU, 0xB84B1267U, 0x905AD299U, 0x88559254U, + 0x29F05F31U, 0x31FF1FFCU, 0x19EEDF02U, 0x01E19FCFU, + 0x49CCF657U, 0x51C3B69AU, 0x79D27664U, 0x61DD36A9U, + 0xE988A4FDU, 0xF187E430U, 0xD99624CEU, 0xC1996403U, + 0x89B40D9BU, 0x91BB4D56U, 0xB9AA8DA8U, 0xA1A5CD65U, + 0x5249BE62U, 0x4A46FEAFU, 0x62573E51U, 0x7A587E9CU, + 0x32751704U, 0x2A7A57C9U, 0x026B9737U, 0x1A64D7FAU, + 0x923145AEU, 0x8A3E0563U, 0xA22FC59DU, 0xBA208550U, + 0xF20DECC8U, 0xEA02AC05U, 0xC2136CFBU, 0xDA1C2C36U, + 0x7BB9E153U, 0x63B6A19EU, 0x4BA76160U, 0x53A821ADU, + 0x1B854835U, 0x038A08F8U, 0x2B9BC806U, 0x339488CBU, + 0xBBC11A9FU, 0xA3CE5A52U, 0x8BDF9AACU, 0x93D0DA61U, + 0xDBFDB3F9U, 0xC3F2F334U, 0xEBE333CAU, 0xF3EC7307U, + 0xA492D5C4U, 0xBC9D9509U, 0x948C55F7U, 0x8C83153AU, + 0xC4AE7CA2U, 0xDCA13C6FU, 0xF4B0FC91U, 0xECBFBC5CU, + 0x64EA2E08U, 0x7CE56EC5U, 0x54F4AE3BU, 0x4CFBEEF6U, + 0x04D6876EU, 0x1CD9C7A3U, 0x34C8075DU, 0x2CC74790U, + 0x8D628AF5U, 0x956DCA38U, 0xBD7C0AC6U, 0xA5734A0BU, + 0xED5E2393U, 0xF551635EU, 0xDD40A3A0U, 0xC54FE36DU, + 0x4D1A7139U, 0x551531F4U, 0x7D04F10AU, 0x650BB1C7U, + 0x2D26D85FU, 0x35299892U, 0x1D38586CU, 0x053718A1U, + 0xF6DB6BA6U, 0xEED42B6BU, 0xC6C5EB95U, 0xDECAAB58U, + 0x96E7C2C0U, 0x8EE8820DU, 0xA6F942F3U, 0xBEF6023EU, + 0x36A3906AU, 0x2EACD0A7U, 0x06BD1059U, 0x1EB25094U, + 0x569F390CU, 0x4E9079C1U, 0x6681B93FU, 0x7E8EF9F2U, + 0xDF2B3497U, 0xC724745AU, 0xEF35B4A4U, 0xF73AF469U, + 0xBF179DF1U, 0xA718DD3CU, 0x8F091DC2U, 0x97065D0FU, + 0x1F53CF5BU, 0x075C8F96U, 0x2F4D4F68U, 0x37420FA5U, + 0x7F6F663DU, 0x676026F0U, 0x4F71E60EU, 0x577EA6C3U, + 0xE18D0321U, 0xF98243ECU, 0xD1938312U, 0xC99CC3DFU, + 0x81B1AA47U, 0x99BEEA8AU, 0xB1AF2A74U, 0xA9A06AB9U, + 0x21F5F8EDU, 0x39FAB820U, 0x11EB78DEU, 0x09E43813U, + 0x41C9518BU, 0x59C61146U, 0x71D7D1B8U, 0x69D89175U, + 0xC87D5C10U, 0xD0721CDDU, 0xF863DC23U, 0xE06C9CEEU, + 0xA841F576U, 0xB04EB5BBU, 0x985F7545U, 0x80503588U, + 0x0805A7DCU, 0x100AE711U, 0x381B27EFU, 0x20146722U, + 0x68390EBAU, 0x70364E77U, 0x58278E89U, 0x4028CE44U, + 0xB3C4BD43U, 0xABCBFD8EU, 0x83DA3D70U, 0x9BD57DBDU, + 0xD3F81425U, 0xCBF754E8U, 0xE3E69416U, 0xFBE9D4DBU, + 0x73BC468FU, 0x6BB30642U, 0x43A2C6BCU, 0x5BAD8671U, + 0x1380EFE9U, 0x0B8FAF24U, 0x239E6FDAU, 0x3B912F17U, + 0x9A34E272U, 0x823BA2BFU, 0xAA2A6241U, 0xB225228CU, + 0xFA084B14U, 0xE2070BD9U, 0xCA16CB27U, 0xD2198BEAU, + 0x5A4C19BEU, 0x42435973U, 0x6A52998DU, 0x725DD940U, + 0x3A70B0D8U, 0x227FF015U, 0x0A6E30EBU, 0x12617026U, + 0x451FD6E5U, 0x5D109628U, 0x750156D6U, 0x6D0E161BU, + 0x25237F83U, 0x3D2C3F4EU, 0x153DFFB0U, 0x0D32BF7DU, + 0x85672D29U, 0x9D686DE4U, 0xB579AD1AU, 0xAD76EDD7U, + 0xE55B844FU, 0xFD54C482U, 0xD545047CU, 0xCD4A44B1U, + 0x6CEF89D4U, 0x74E0C919U, 0x5CF109E7U, 0x44FE492AU, + 0x0CD320B2U, 0x14DC607FU, 0x3CCDA081U, 0x24C2E04CU, + 0xAC977218U, 0xB49832D5U, 0x9C89F22BU, 0x8486B2E6U, + 0xCCABDB7EU, 0xD4A49BB3U, 0xFCB55B4DU, 0xE4BA1B80U, + 0x17566887U, 0x0F59284AU, 0x2748E8B4U, 0x3F47A879U, + 0x776AC1E1U, 0x6F65812CU, 0x477441D2U, 0x5F7B011FU, + 0xD72E934BU, 0xCF21D386U, 0xE7301378U, 0xFF3F53B5U, + 0xB7123A2DU, 0xAF1D7AE0U, 0x870CBA1EU, 0x9F03FAD3U, + 0x3EA637B6U, 0x26A9777BU, 0x0EB8B785U, 0x16B7F748U, + 0x5E9A9ED0U, 0x4695DE1DU, 0x6E841EE3U, 0x768B5E2EU, + 0xFEDECC7AU, 0xE6D18CB7U, 0xCEC04C49U, 0xD6CF0C84U, + 0x9EE2651CU, 0x86ED25D1U, 0xAEFCE52FU, 0xB6F3A5E2U, + }; + + snow3g_context_t _ctx; + + void reset(); + + inline uint32_t snow_s1(const uint32_t in) { return S1_T0[BYTE32(in, 3)] ^ S1_T1[BYTE32(in, 2)] ^ S1_T2[BYTE32(in, 1)] ^ S1_T3[BYTE32(in, 0)]; }; + + inline uint32_t snow_s2(const uint32_t in) { return S2_T0[BYTE32(in, 3)] ^ S2_T1[BYTE32(in, 2)] ^ S2_T2[BYTE32(in, 1)] ^ S2_T3[BYTE32(in, 0)]; }; + + inline uint64_t mul64(uint64_t V, uint64_t P, uint64_t c) { + uint64_t result = 0; + for (int8_t i = 0; i < 64; i++) { + if ((P >> i ) & 0x1) { + result ^= mul64x_pow(V, i, c); + } + } + return result; + }; + + inline uint64_t mul64x_pow(uint64_t V, uint8_t i, uint64_t c) { + if (i == 0) { + return V; + } else { + return mul64x(mul64x_pow(V, i-1, c) , c); + } + }; + + inline uint64_t mul64x(uint64_t V, uint64_t c) { + if (V & 0x8000000000000000) { + return (V << 1) ^ c; + } else { + return V << 1; + } + }; + + inline uint8_t mask8bit(int n) { return 0xFF ^ ((1<<(8-n)) - 1); }; + + /* Clocking operations */ + inline void lfsr_init(uint32_t f, snow3g_context_t *ctx) { + uint32_t v = ( + ((ctx->lfsr[0] << 8) & 0xffffff00) ^ + MULalpha[BYTE32(ctx->lfsr[0], 0)] ^ + ctx->lfsr[2] ^ + ((ctx->lfsr[11] >> 8) & 0x00ffffff) ^ + DIValpha[BYTE32(ctx->lfsr[11], 3)] ^ + f + ); + ctx->lfsr[0] = ctx->lfsr[1]; + ctx->lfsr[1] = ctx->lfsr[2]; + ctx->lfsr[2] = ctx->lfsr[3]; + ctx->lfsr[3] = ctx->lfsr[4]; + ctx->lfsr[4] = ctx->lfsr[5]; + ctx->lfsr[5] = ctx->lfsr[6]; + ctx->lfsr[6] = ctx->lfsr[7]; + ctx->lfsr[7] = ctx->lfsr[8]; + ctx->lfsr[8] = ctx->lfsr[9]; + ctx->lfsr[9] = ctx->lfsr[10]; + ctx->lfsr[10] = ctx->lfsr[11]; + ctx->lfsr[11] = ctx->lfsr[12]; + ctx->lfsr[12] = ctx->lfsr[13]; + ctx->lfsr[13] = ctx->lfsr[14]; + ctx->lfsr[14] = ctx->lfsr[15]; + ctx->lfsr[15] = v; + }; + + inline void lfsr_keystream(snow3g_context_t *ctx) { + uint32_t s0 = ctx->lfsr[0]; + uint32_t s2 = ctx->lfsr[2]; + uint32_t s11 = ctx->lfsr[11]; + uint32_t v = ( + ((s0 << 8) & 0xffffff00) ^ + MULalpha[BYTE32(s0, 0)] ^ + s2 ^ + ((s11 >> 8) & 0x00ffffff) ^ + DIValpha[BYTE32(s11, 3)] + ); + + ctx->lfsr[0] = ctx->lfsr[1]; + ctx->lfsr[1] = ctx->lfsr[2]; + ctx->lfsr[2] = ctx->lfsr[3]; + ctx->lfsr[3] = ctx->lfsr[4]; + ctx->lfsr[4] = ctx->lfsr[5]; + ctx->lfsr[5] = ctx->lfsr[6]; + ctx->lfsr[6] = ctx->lfsr[7]; + ctx->lfsr[7] = ctx->lfsr[8]; + ctx->lfsr[8] = ctx->lfsr[9]; + ctx->lfsr[9] = ctx->lfsr[10]; + ctx->lfsr[10] = ctx->lfsr[11]; + ctx->lfsr[11] = ctx->lfsr[12]; + ctx->lfsr[12] = ctx->lfsr[13]; + ctx->lfsr[13] = ctx->lfsr[14]; + ctx->lfsr[14] = ctx->lfsr[15]; + ctx->lfsr[15] = v; + }; + + inline uint32_t clock_fsm(snow3g_context_t *ctx) { + uint32_t f = (ctx->lfsr[15] + ctx->fsm.r1) ^ ctx->fsm.r2; + uint32_t r = ctx->fsm.r2 + (ctx->fsm.r3 ^ ctx->lfsr[5]); + + ctx->fsm.r3 = snow_s2(ctx->fsm.r2); + ctx->fsm.r2 = snow_s1(ctx->fsm.r1); + ctx->fsm.r1 = r; + + return f; + }; + + inline struct snow_key_st snow_array_to_key(const unsigned char *key, const unsigned char *iv) { + int i; + struct snow_key_st key_iv; + for (i = 0; i < 4; i++) { + key_iv.key[i] = WORD_128(key, i); + key_iv.iv[i] = WORD_128(iv, i); + } + + return key_iv; + }; + + inline void snow_init_lfsr_fsm(struct snow_key_st key, snow3g_context_t *ctx) { + memset(ctx, 0, sizeof(*ctx)); + ctx->lfsr[15] = key.key[3] ^ key.iv[0]; + ctx->lfsr[14] = key.key[2]; + ctx->lfsr[13] = key.key[1]; + ctx->lfsr[12] = key.key[0] ^ key.iv[1]; + ctx->lfsr[11] = key.key[3] ^ ONE; + ctx->lfsr[10] = key.key[2] ^ ONE ^ key.iv[2]; + ctx->lfsr[9] = key.key[1] ^ ONE ^ key.iv[3]; + ctx->lfsr[8] = key.key[0] ^ ONE; + ctx->lfsr[7] = key.key[3]; + ctx->lfsr[6] = key.key[2]; + ctx->lfsr[5] = key.key[1]; + ctx->lfsr[4] = key.key[0]; + ctx->lfsr[3] = key.key[3] ^ ONE; + ctx->lfsr[2] = key.key[2] ^ ONE; + ctx->lfsr[1] = key.key[1] ^ ONE; + ctx->lfsr[0] = key.key[0] ^ ONE; + }; + + inline void snow_set_key(struct snow_key_st key, snow3g_context_t *ctx) { + int i = 0; + + snow_init_lfsr_fsm(key, ctx); + for (i = 0; i < 32; i++) { + lfsr_init(clock_fsm(ctx), ctx); + } + }; + + inline void snow_gen_keystream(uint32_t *stream, size_t nb_word, snow3g_context_t *ctx) { + size_t i = 0; + + for (i = 0; i < nb_word; i++) { + stream[i] = clock_fsm(ctx) ^ ctx->lfsr[0]; + lfsr_keystream(ctx); + } + }; + + /** + * @brief Initialize SNOW 3G with key and IV + * + * @param ctx SNOW 3G context to initialize + * @param key 16-byte encryption key + * @param iv 16-byte initialization vector + */ + int snow3g_initialize(const uint32_t count, const uint8_t bearer, const uint8_t direction, const unsigned char *knas_enc, snow3g_context_t *ctx); + + /** + * @brief Generate keystream using SNOW 3G + * + * @param ctx SNOW 3G context + * @param keystream Output buffer for keystream + * @param length Length of keystream needed in bytes + */ + int snow3g_generate(size_t nb_byte, const unsigned char* in, unsigned char* out, snow3g_context_t *ctx); + + int snow3g_generate(size_t nb_byte, uint32_t* out, snow3g_context_t *ctx); +}; diff --git a/ccsrc/Externals/ia2_128.cc b/ccsrc/Externals/ia2_128.cc new file mode 100644 index 0000000000000000000000000000000000000000..8d3bf3c3ab942bb3b74a96dae9e558f49bdd2fd8 --- /dev/null +++ b/ccsrc/Externals/ia2_128.cc @@ -0,0 +1,390 @@ +/** + * @file ia2_128.cpp + * @brief AES-128 CTR mode Encryption class implementation + * @author Generated for 3GPP NAS encryption + * @date 2024 + */ + +#include "ia2_128.hh" +#include +#include +#include +#include +#include +#include + +#include "loggers.hh" + +namespace { + constexpr size_t KEY_SIZE = 16; // 128 bits = 16 bytes + constexpr size_t BLOCK_SIZE = 16; // AES block size + constexpr size_t COUNTER_SIZE = 16; // Counter block size + constexpr size_t MAC_SIZE = 4; // MAC size in bytes +} + +int ia2_128::encrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** cyphered, + uint32_t* cyphered_length) { + loggers::get_instance().log(">>> ia2_128::encrypt: Starting encryption"); + loggers::get_instance().log_to_hexa(">>> ia2_128::encrypt: knas_enc", knas_enc, 16); + loggers::get_instance().log_to_hexa(">>> ia2_128::encrypt: payload", payload, payload_length); + loggers::get_instance().log(">>> ia2_128::encrypt: algo_id: %d", algo_id); + loggers::get_instance().log(">>> ia2_128::encrypt: count: %u", count); + loggers::get_instance().log(">>> ia2_128::encrypt: bearer: %d", bearer); + loggers::get_instance().log(">>> ia2_128::encrypt: direction: %d", direction); + + // Input validation + if (!knas_enc || !payload || !cyphered || !cyphered_length) { + loggers::get_instance().error("ia2_128::encrypt: Wrong input parameters"); + return -1; + } + + if (payload_length == 0) { + loggers::get_instance().error("ia2_128::encrypt: Wrong payload length"); + *cyphered = nullptr; + *cyphered_length = 0; + return 0; + } + + // Allocate memory for ciphertext + *cyphered = static_cast(std::malloc(payload_length)); + if (!*cyphered) { + loggers::get_instance().error("ia2_128::encrypt: Failed to allocate memory"); + return -1; + } + + // Generate counter block + unsigned char counter_block[COUNTER_SIZE]; + generate_counter_block(count, bearer, direction, counter_block); + loggers::get_instance().log_to_hexa("ia2_128::encrypt: counter_block: ", counter_block, COUNTER_SIZE); + + // Initialize OpenSSL context + EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new(); + if (!ctx) { + loggers::get_instance().error("ia2_128::encrypt: Failed to allocate memory"); + std::free(*cyphered); + *cyphered = nullptr; + return -1; + } + + int result = -1; + int len = 0; + int final_len = 0; + + // Initialize encryption context for AES-128 CTR mode + if (EVP_EncryptInit_ex(ctx, EVP_aes_128_ctr(), nullptr, knas_enc, counter_block) != 1) { + loggers::get_instance().error("ia2_128::encrypt: EVP_EncryptInit_ex failed"); + goto cleanup; + } + + // Encrypt the payload + if (EVP_EncryptUpdate(ctx, *cyphered, &len, payload, static_cast(payload_length)) != 1) { + loggers::get_instance().error("ia2_128::encrypt: EVP_EncryptUpdate failed"); + goto cleanup; + } + loggers::get_instance().log("ia2_128::encrypt: len: %d", len); + + // Finalize encryption + if (EVP_EncryptFinal_ex(ctx, *cyphered + len, &final_len) != 1) { + loggers::get_instance().error("ia2_128::encrypt: EVP_EncryptFinal_ex failed"); + goto cleanup; + } + loggers::get_instance().log("ia2_128::encrypt: final_len: %d", final_len); + + *cyphered_length = static_cast(len + final_len); + loggers::get_instance().log("ia2_128::encrypt: cyphered_length: %d", *cyphered_length); + loggers::get_instance().log_to_hexa("ia2_128::encrypt: cyphered: ", *cyphered, *cyphered_length); + result = 0; + +cleanup: + EVP_CIPHER_CTX_free(ctx); + if (result != 0) { + std::free(*cyphered); + *cyphered = nullptr; + *cyphered_length = 0; + } + + loggers::get_instance().log("<<< ia2_128::encrypt: result: %d", result); + return result; +} + +int ia2_128::decrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* cyphered, + const uint32_t cyphered_length, + unsigned char** payload, + uint32_t* payload_length) { + loggers::get_instance().log(">>> ia2_128::decrypt: Starting decryption"); + loggers::get_instance().log_to_hexa(">>> ia2_128::decrypt: knas_enc", knas_enc, 16); + loggers::get_instance().log_to_hexa(">>> ia2_128::decrypt: cyphered", cyphered, cyphered_length); + loggers::get_instance().log(">>> ia2_128::decrypt: algo_id: %d", algo_id); + loggers::get_instance().log(">>> ia2_128::decrypt: count: %u", count); + loggers::get_instance().log(">>> ia2_128::decrypt: bearer: %d", bearer); + loggers::get_instance().log(">>> ia2_128::decrypt: direction: %d", direction); + + // Input validation + if (!knas_enc || !cyphered || !payload || !payload_length) { + loggers::get_instance().error("ia2_128::decrypt: Wrong input parameters"); + return -1; + } + + if (cyphered_length == 0) { + loggers::get_instance().error("ia2_128::encrypt: Wrong cyphered length"); + *payload = nullptr; + *payload_length = 0; + return 0; + } + + // Allocate memory for plaintext + *payload = static_cast(std::malloc(cyphered_length)); + if (!*payload) { + loggers::get_instance().error("ia2_128::decrypt: Failed to allocate memody"); + return -1; + } + + // Generate counter block (same as encryption) + unsigned char counter_block[COUNTER_SIZE]; + generate_counter_block(count, bearer, direction, counter_block); + loggers::get_instance().log_to_hexa("ia2_128::decrypt: counter_block: ", counter_block, COUNTER_SIZE); + + // Initialize OpenSSL context + EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new(); + if (!ctx) { + loggers::get_instance().error("ia2_128::decrypt: Failed to allocate memory"); + std::free(*payload); + *payload = nullptr; + return -1; + } + + int result = -1; + int len = 0; + int final_len = 0; + + // Initialize decryption context for AES-128 CTR mode + // Note: CTR mode decryption is identical to encryption + if (EVP_DecryptInit_ex(ctx, EVP_aes_128_ctr(), nullptr, knas_enc, counter_block) != 1) { + loggers::get_instance().error("ia2_128::decrypt: EVP_DecryptInit_ex failed"); + goto cleanup; + } + + // Decrypt the ciphertext + if (EVP_DecryptUpdate(ctx, *payload, &len, cyphered, static_cast(cyphered_length)) != 1) { + loggers::get_instance().error("ia2_128::decrypt: EVP_DecryptUpdate failed"); + goto cleanup; + } + loggers::get_instance().log("ia2_128::decrypt: len: %d", len); + + // Finalize decryption + if (EVP_DecryptFinal_ex(ctx, *payload + len, &final_len) != 1) { + loggers::get_instance().error("ia2_128::decrypt: EVP_DecryptFinal_ex failed"); + goto cleanup; + } + + *payload_length = static_cast(len + final_len); + loggers::get_instance().log("ia2_128::decrypt: cyphered_length: %d", *payload_length); + loggers::get_instance().log_to_hexa("ia2_128::decrypt: cyphered: ", *payload, *payload_length); + result = 0; + +cleanup: + EVP_CIPHER_CTX_free(ctx); + if (result != 0) { + std::free(*payload); + *payload = nullptr; + *payload_length = 0; + } + + loggers::get_instance().log("<<< ia2_128::decrypt: result: %d", result); + return result; +} + +int ia2_128::mac(const uint8_t algo_id, + const unsigned char* knas_int, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** mac, + uint32_t* mac_length) { + loggers::get_instance().log_to_hexa(">>> ia2_128::mac: knas_int", knas_int, KEY_SIZE); + loggers::get_instance().log(">>> ia2_128::mac: payload_length: %d", payload_length); + loggers::get_instance().log_to_hexa(">>> ia2_128::mac: payload", payload, payload_length); + loggers::get_instance().log(">>> ia2_128::mac: algo_id: %d", algo_id); + loggers::get_instance().log(">>> ia2_128::mac: count: %u", count); + loggers::get_instance().log(">>> ia2_128::mac: bearer: %d", bearer); + loggers::get_instance().log(">>> ia2_128::mac: direction: %d", direction); + + // Input validation + if (!knas_int || !payload || !mac || !mac_length) { + loggers::get_instance().error("ia2_128::mac: Wrong input parameters"); + return -1; + } + + if (payload_length == 0) { + loggers::get_instance().error("ia2_128::mac: Wrong payload length"); + *mac = nullptr; + *mac_length = 0; + return 0; + } + + // Allocate memory for ciphertext + *mac = static_cast(std::malloc(MAC_SIZE)); + if (!*mac) { + loggers::get_instance().error("ia2_128::mac: Failed to allocate memory"); + return -1; + } + *mac_length = MAC_SIZE; + + // Generate input block for CMAC + unsigned char* input_block = nullptr; + uint32_t input_block_length = 0; + + int result = generate_input_block(count, bearer, direction, payload, payload_length * 8, &input_block, &input_block_length); + if (result != 0) { + loggers::get_instance().error("ia2_128::mac: Failed to generate block for CMAC"); + return -1; + } + + // Compute CMAC using OpenSSL + // Note: CMAC functions are deprecated in OpenSSL 3.0+, but we use them for compatibility + // with older versions. For OpenSSL 3.0+, consider using EVP_MAC API instead. + + // CMAC for AES-128 produces 16 bytes, but we need only 4 bytes (32 bits) for 128-EIA2 + unsigned char cmac_output[16]; + size_t cmac_len = sizeof(cmac_output); + + // Use deprecated CMAC API for compatibility with OpenSSL 1.x + CMAC_CTX* ctx = CMAC_CTX_new(); + if (!ctx) { + loggers::get_instance().error("ia2_128::mac: Failed to intialize CMAC context"); + std::free(input_block); + return -1; + } + + result = -1; + + // Initialize CMAC context with AES-128 + if (CMAC_Init(ctx, knas_int, KEY_SIZE, EVP_aes_128_cbc(), nullptr) != 1) { + loggers::get_instance().error("ia2_128::mac: CMAC_Init failure"); + goto cleanup; + } + + // Update CMAC with input block + if (CMAC_Update(ctx, input_block, input_block_length) != 1) { + loggers::get_instance().error("ia2_128::mac: CMAC_Update failure"); + goto cleanup; + } + + // Finalize CMAC - get the MAC (16 bytes for AES-128) + if (CMAC_Final(ctx, cmac_output, &cmac_len) != 1) { + loggers::get_instance().error("ia2_128::mac: CMAC_Final failure"); + goto cleanup; + } + #pragma GCC diagnostic pop + + // 128-EIA2 produces 32-bit (4-byte) MAC + // Truncate CMAC output to 4 bytes (take the first 4 bytes) + std::memcpy(*mac, cmac_output, MAC_SIZE); + loggers::get_instance().log_to_hexa("ia2_128::mac: mac: ", *mac, *mac_length); + + cleanup: + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + CMAC_CTX_free(ctx); + #pragma GCC diagnostic pop + std::free(input_block); + + loggers::get_instance().log("<<< ia2_128::mac: result: 0"); + return 0; +} + +// ETSI TS 133 401 V18.3.0 (2025-04) Annex B.1.3 128-EEA2 +void ia2_128::generate_counter_block(const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + unsigned char* counter_block) { + std::memset(counter_block, 0, COUNTER_SIZE); + counter_block[0] = static_cast((count >> 24) & 0xFF); + counter_block[1] = static_cast((count >> 16) & 0xFF); + counter_block[2] = static_cast((count >> 8) & 0xFF); + counter_block[3] = static_cast(count & 0xFF); + counter_block[4] = static_cast((bearer & 0x1F) << 3 | ((direction & 0x01) << 2)); + // Remaining bytes are zero +} + +int ia2_128::generate_input_block(const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** input_block, + uint32_t* input_block_length) { + loggers::get_instance().log(">>> ia2_128::generate_input_block: count: %u", count); + loggers::get_instance().log(">>> ia2_128::generate_input_block: bearer: %d", bearer); + loggers::get_instance().log(">>> ia2_128::generate_input_block: direction: %d", direction); + loggers::get_instance().log(">>> ia2_128::generate_input_block: payload_length: %d", payload_length); + loggers::get_instance().log_to_hexa(">>> ia2_128::generate_input_block: payload", payload, payload_length / 8); + + if (!payload || !input_block || !input_block_length) { + loggers::get_instance().error("ia2_128::generate_input_block: Wrong input parameters"); + return -1; + } + + // 3GPP TS 33.401 Section 5.1.4.2: + // Input block = COUNT || (BEARER || DIRECTION || 0^26) || MESSAGE + // COUNT: 4 bytes + // BEARER + DIRECTION + padding: 4 bytes (32 bits total) + // MESSAGE: (payload_length + 7) / 8 bytes (convert bits to bytes, round up) + uint32_t payload_bytes = (payload_length + 7) / 8; + uint32_t total_length = 4 + 4 + payload_bytes; + loggers::get_instance().log("ia2_128::generate_input_block: payload_bytes: %u", payload_bytes); + loggers::get_instance().log("ia2_128::generate_input_block: total_length: %u", total_length); + + // Allocate input block + *input_block = static_cast(std::malloc(total_length)); + if (!*input_block) { + loggers::get_instance().error("ia2_128::mac: Failed to allocate memory"); + return -1; + } + + // Set COUNT (bytes 0-3, big-endian) + unsigned char* ptr = *input_block; + ptr[0] = static_cast((count >> 24) & 0xFF); + ptr[1] = static_cast((count >> 16) & 0xFF); + ptr[2] = static_cast((count >> 8) & 0xFF); + ptr[3] = static_cast(count & 0xFF); + ptr += 4; + // Set BEARER and DIRECTION (byte 4) + // Bits 0-4: BEARER (5 bits), Bit 5: DIRECTION (1 bit), Bits 6-31: padding (26 bits) + ptr[0] = static_cast((bearer << 3) | (direction << 2)); + ptr[1] = 0; + ptr[2] = 0; + ptr[3] = 0; + ptr += 4; + // Copy payload + std::memcpy(ptr, payload, payload_bytes); + loggers::get_instance().log_to_hexa("ia2_128::generate_input_block: ptr", ptr, total_length); + + // Handle partial bytes if payload_length is not a multiple of 8 + if (payload_length % 8 != 0) { + // Clear the unused bits in the last byte + uint32_t unused_bits = 8 - (payload_length % 8); + uint8_t mask = static_cast(0xFF << unused_bits); + ptr[payload_bytes - 1] &= ~mask; + } + + loggers::get_instance().log("ia2_128::generate_input_block: *input_block_length: %d", *input_block_length); + *input_block_length = total_length; + loggers::get_instance().log_to_hexa("<<< ia2_128::generate_input_block: ptr", static_cast(*input_block), *input_block_length * sizeof(uint32_t)); + return 0; +} + diff --git a/ccsrc/Externals/ia2_128.hh b/ccsrc/Externals/ia2_128.hh new file mode 100644 index 0000000000000000000000000000000000000000..e418530285862984e58875da1fbcc2c8a8b1b071 --- /dev/null +++ b/ccsrc/Externals/ia2_128.hh @@ -0,0 +1,184 @@ +/** + * @file ia2_128.h + * @brief AES-128 CTR mode Encryption class header + * @author Generated for 3GPP NAS encryption + * @date 2024 + * + * This class implements the AES-128 in Counter (CTR) mode encryption algorithm (IA2-128) + * as specified in 3GPP TS 33.401 for NAS encryption/decryption. + */ + +#pragma once + +#include +#include + +/** + * @class ia2_128 + * @brief Implements AES-128 CTR mode encryption and decryption (IA2-128) + * + * This class provides encryption and decryption functionality using the + * AES-128 algorithm in Counter (CTR) mode as specified in 3GPP TS 33.401. + * The algorithm is used for NAS (Non-Access Stratum) encryption in 3GPP networks. + * This implementation uses OpenSSL for the AES operations. + */ +class ia2_128 { +public: + /** + * @brief Default constructor + */ + ia2_128() = default; + + /** + * @brief Destructor + */ + ~ia2_128() = default; + + /** + * @brief Copy constructor (deleted) + */ + ia2_128(const ia2_128&) = delete; + + /** + * @brief Copy assignment operator (deleted) + */ + ia2_128& operator=(const ia2_128&) = delete; + + /** + * @brief Move constructor (deleted) + */ + ia2_128(ia2_128&&) = delete; + + /** + * @brief Move assignment operator (deleted) + */ + ia2_128& operator=(ia2_128&&) = delete; + + /** + * @brief Encrypts plaintext using AES-128 CTR mode + * + * This method encrypts the given payload using AES-128 in CTR mode. + * The counter block is generated based on the NAS encryption key (knas_enc), + * count, bearer, and direction parameters according to 3GPP TS 33.401. + * + * @param algo_id Algorithm identifier (should be 2 for AES-128 CTR) + * @param knas_enc Pointer to the 16-byte NAS encryption key + * @param count 32-bit NAS count value + * @param bearer 5-bit bearer identifier (only lower 5 bits are used) + * @param direction Direction bit (0 = uplink, 1 = downlink) + * @param payload Pointer to the plaintext data to encrypt + * @param payload_length Length of the plaintext data in bytes + * @param cyphered Pointer to pointer that will receive the encrypted data (caller must free) + * @param cyphered_length Pointer to variable that will receive the encrypted data length + * @return 0 on success, negative value on error + * + * @note The caller is responsible for freeing the memory allocated for cyphered + * @note cyphered_length will be equal to payload_length for CTR mode + */ + int encrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** cyphered, + uint32_t* cyphered_length); + + /** + * @brief Decrypts ciphertext using AES-128 CTR mode + * + * This method decrypts the given ciphertext using AES-128 in CTR mode. + * Decryption is identical to encryption for CTR mode. + * + * @param algo_id Algorithm identifier (should be 2 for AES-128 CTR) + * @param knas_enc Pointer to the 16-byte NAS encryption key + * @param count 32-bit NAS count value + * @param bearer 5-bit bearer identifier (only lower 5 bits are used) + * @param direction Direction bit (0 = uplink, 1 = downlink) + * @param cyphered Pointer to the ciphertext data to decrypt + * @param cyphered_length Length of the ciphertext data in bytes + * @param payload Pointer to pointer that will receive the decrypted data (caller must free) + * @param payload_length Pointer to variable that will receive the decrypted data length + * @return 0 on success, negative value on error + * + * @note The caller is responsible for freeing the memory allocated for payload + * @note payload_length will be equal to cyphered_length for CTR mode + */ + int decrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* cyphered, + const uint32_t cyphered_length, + unsigned char** payload, + uint32_t* payload_length); + +/** + * @brief Compute NAS integrity protection using AES 128 CRT algorithm + * + * This method computes the integrity protection using the AES 128 CRT algorithm. + * + * @param algo_id Algorithm identifier (should be 3 for AES 128 CRT) + * @param knas_int Pointer to the 16-byte NAS integrity key + * @param count 32-bit NAS count value + * @param bearer 5-bit bearer identifier (only lower 5 bits are used) + * @param direction Direction bit (0 = uplink, 1 = downlink) + * @param payload Pointer to pointer that will receive the decrypted data (caller must free) + * @param payload_length Pointer to variable that will receive the decrypted data length + * @param mac Pointer to the mac to decrypt + * @param mac_length Length of the mac in bytes + * @return 0 on success, negative value on error + * + * @note The caller is responsible for freeing the memory allocated for payload + * @note payload_length will be equal to cyphered_length for stream ciphers + */ +int mac(const uint8_t algo_id, + const unsigned char* knas_int, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** mac, + uint32_t* mac_length); +private: + /** + * @brief Generates the initial counter block for AES-CTR + * + * @param count NAS count + * @param bearer Bearer identifier + * @param direction Direction bit + * @param counter_block Output buffer for 16-byte counter block + */ + void generate_counter_block(const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + unsigned char* counter_block); + + /** + * @brief Generates the input block for CMAC computation + * + * According to 3GPP TS 33.401, the input to CMAC consists of: + * - COUNT (32 bits, big-endian) + * - BEARER (5 bits) + DIRECTION (1 bit) + padding (26 bits) + * - MESSAGE (variable length, in bits) + * + * @param count NAS count + * @param bearer Bearer identifier + * @param direction Direction bit + * @param message Pointer to message data + * @param message_length Length of message in bits + * @param input_block Output buffer for the input block (will be allocated) + * @param input_block_length Output variable for the input block length in bytes + * @return 0 on success, negative on error + */ + int generate_input_block(const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* message, + const uint32_t message_length, + unsigned char** input_block, + uint32_t* input_block_length); +}; diff --git a/ccsrc/Externals/ia3_128.cc b/ccsrc/Externals/ia3_128.cc new file mode 100644 index 0000000000000000000000000000000000000000..3c938001c9b67ca6f1f5e795a3841c834862926d --- /dev/null +++ b/ccsrc/Externals/ia3_128.cc @@ -0,0 +1,255 @@ +/** + * @file ia3_128.cpp + * @brief 3GPP ZUC-based Encryption class implementation + * @author Generated for 3GPP NAS encryption + * @date 2024 + * + * This implementation uses the ZUC algorithm as specified in + * 3GPP TS 33.401. For the actual ZUC cipher implementation, + * this code can be linked with libraries such as libmilenage or + * open5gs crypto library. + */ + +#include "ia3_128.hh" +#include +#include + +#include "loggers.hh" + +namespace { + constexpr size_t KEY_SIZE = 16; // 128 bits = 16 bytes + constexpr size_t IV_SIZE = 16; // Initialization vector size +} + +void ia3_128::reset() { + lfsr_s0 = 0; + lfsr_s1 = 0; + lfsr_s2 = 0; + lfsr_s3 = 0; + lfsr_s4 = 0; + lfsr_s5 = 0; + lfsr_s6 = 0; + lfsr_s7 = 0; + lfsr_s8 = 0; + lfsr_s9 = 0; + lfsr_s10 = 0; + lfsr_s11 = 0; + lfsr_s12 = 0; + lfsr_s13 = 0; + lfsr_s14 = 0; + lfsr_s15 = 0; + f_r1 = 0; + f_r2 = 0; + brc_x0 = 0; + brc_x1 = 0; + brc_x2 = 0; + brc_x3 = 0; +} + +int ia3_128::encrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** cyphered, + uint32_t* cyphered_length) { + loggers::get_instance().log_to_hexa(">>> ia3_128::encrypt: knas_enc", knas_enc, KEY_SIZE); + loggers::get_instance().log_to_hexa(">>> ia3_128::encrypt: payload", payload, payload_length); + loggers::get_instance().log(">>> ia3_128::encrypt: algo_id: %d", algo_id); + loggers::get_instance().log(">>> ia3_128::encrypt: count: %u", count); + loggers::get_instance().log(">>> ia3_128::encrypt: bearer: %d", bearer); + loggers::get_instance().log(">>> ia3_128::encrypt: direction: %d", direction); + + // Input validation + if (!knas_enc || !payload || !cyphered || !cyphered_length) { + loggers::get_instance().error("ia3_128::encrypt: Wrong input parameters"); + return -1; + } + + if (payload_length == 0) { + loggers::get_instance().error("ia3_128::encrypt: Wrong payload length"); + *cyphered = nullptr; + *cyphered_length = 0; + return 0; + } + + reset(); + + // Allocate memory for ciphertext + *cyphered = static_cast(std::malloc(payload_length)); + if (!*cyphered) { + loggers::get_instance().error("ia3_128::encrypt: Failed to allocate memory"); + return -1; + } + + zuc_eea3(knas_enc, count, bearer, direction, payload_length * 8, payload, *cyphered); + *cyphered_length = payload_length; + loggers::get_instance().log("ia3_128::encrypt: cyphered_length: %d", *cyphered_length); + loggers::get_instance().log_to_hexa("ia3_128::encrypt: cyphered: ", *cyphered, *cyphered_length); + + loggers::get_instance().log("<<< ia3_128::encrypt: ret: 0"); + return 0; +} + +int ia3_128::decrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* cyphered, + const uint32_t cyphered_length, + unsigned char** payload, + uint32_t* payload_length) { + // For stream ciphers, decryption is identical to encryption + return encrypt(algo_id, knas_enc, count, bearer, direction, + cyphered, cyphered_length, payload, payload_length); +} + +int ia3_128::mac(const uint8_t algo_id, + const unsigned char* knas_int, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** mac, + uint32_t* mac_length) { + loggers::get_instance().log_to_hexa(">>> ia3_128::mac: knas_int", knas_int, KEY_SIZE); + loggers::get_instance().log(">>> ia3_128::mac: payload_length: %d", payload_length); + loggers::get_instance().log_to_hexa(">>> ia3_128::mac: payload", payload, payload_length); + loggers::get_instance().log(">>> ia3_128::mac: algo_id: %d", algo_id); + loggers::get_instance().log(">>> ia3_128::mac: count: %u", count); + loggers::get_instance().log(">>> ia3_128::mac: bearer: %d", bearer); + loggers::get_instance().log(">>> ia3_128::mac: direction: %d", direction); + + // Input validation + if (!knas_int || !payload || !mac || !mac_length) { + loggers::get_instance().error("ia3_128::mac: Wrong input parameters"); + return -1; + } + + if (payload_length == 0) { + loggers::get_instance().error("ia3_128::mac: Wrong payload length"); + *mac = nullptr; + *mac_length = 0; + return 0; + } + + reset(); + + // Allocate memory for ciphertext + *mac = static_cast(std::malloc(4)); + if (!*mac) { + loggers::get_instance().error("ia3_128::mac: Failed to allocate memory"); + return -1; + } + *mac_length = 4; + uint32_t wmac = 0; + zuc_eia3(knas_int, count, bearer, direction, payload_length * 8, payload, &wmac); + (*mac)[0] = (wmac >> 24) & 0xFF; + (*mac)[1] = (wmac >> 16) & 0xFF; + (*mac)[2] = (wmac >> 8) & 0xFF; + (*mac)[3] = wmac & 0xFF; + loggers::get_instance().log_to_hexa("ia3_128::mac: mac: ", *mac, *mac_length); + + loggers::get_instance().log("<<< ia3_128::mac: ret: 0"); + return 0; +} + +void ia3_128::zuc_eea3(const uint8_t* p_knas_enc, const uint32_t count, const uint32_t bearer, const uint32_t direction, const uint32_t payload_length, const uint8_t* payload, uint8_t* ciphered) { + loggers::get_instance().log_to_hexa(">>> ia3_128::zuc_eea3: knas_enc", p_knas_enc, KEY_SIZE); + loggers::get_instance().log_to_hexa(">>> ia3_128::zuc_eea3: payload", payload, payload_length / 8); + loggers::get_instance().log(">>> ia3_128::zuc_eea3: count: %u", count); + loggers::get_instance().log(">>> ia3_128::zuc_eea3: bearer: %d", bearer); + loggers::get_instance().log(">>> ia3_128::zuc_eea3: direction: %d", direction); + + uint32_t *z, lenght, lenght_in_bytes, i; + uint8_t iv[KEY_SIZE]; + uint32_t lastbits = (8-(payload_length%8))%8; + + lenght = (payload_length+31)/32; + z = static_cast(std::malloc(lenght*sizeof(uint32_t))); + + + lenght_in_bytes = (payload_length+7)/8; + + iv[0] = (count>>24) & 0xFF; + iv[1] = (count>>16) & 0xFF; + iv[2] = (count>>8) & 0xFF; + iv[3] = count & 0xFF; + + iv[4] = ((bearer << 3) | ((direction&1)<<2)) & 0xFC; + iv[5] = 0; + iv[6] = 0; + iv[7] = 0; + + iv[8] = iv[0]; + iv[9] = iv[1]; + iv[10] = iv[2]; + iv[11] = iv[3]; + + iv[12] = iv[4]; + iv[13] = iv[5]; + iv[14] = iv[6]; + iv[15] = iv[7]; + loggers::get_instance().log_to_hexa(">>> ia3_128::zuc_eea3: iv", iv, KEY_SIZE); + + zuc(p_knas_enc, iv, z, lenght); + loggers::get_instance().log_to_hexa(">>> ia3_128::zuc_eea3: z", (uint8_t*)z, lenght*sizeof(uint32_t)); + + for (i=0; i> (3-i%4)*8) & 0xff); + } + + /* zero last bits of data in case its length is not word-aligned (32 bits) + this is an addition to the ciphered reference code, which did not handle it */ + if (lastbits) { + i--; + ciphered[i] &= 0x100 - (1<>24) & 0xFF; + iv[1] = (count>>16) & 0xFF; + iv[2] = (count>>8) & 0xFF; + iv[3] = count & 0xFF; + + iv[4] = (bearer << 3) & 0xF8; + iv[5] = iv[6] = iv[7] = 0; + + iv[8] = ((count>>24) & 0xFF) ^ ((direction&1)<<7); + iv[9] = (count>>16) & 0xFF; + iv[10] = (count>>8) & 0xFF; + iv[11] = count & 0xFF; + + iv[12] = iv[4]; + iv[13] = iv[5]; + iv[14] = iv[6] ^ ((direction&1)<<7); + iv[15] = iv[7]; + + N = payload_length + 64; + lenght = (N + 31) / 32; + z = static_cast(std::malloc(lenght*sizeof(uint32_t))); + + zuc(p_knas_int, iv, z, lenght); + + T = 0; + for (i=0; i +#include + +/** + * @class ia3_128 + * @brief Implements 3GPP ZUC-based encryption and decryption (IA3-128) + * + * This class provides encryption and decryption functionality using the + * ZUC stream cipher algorithm as specified in 3GPP TS 33.401. + * The algorithm is used for NAS (Non-Access Stratum) encryption in 3GPP networks. + */ +class ia3_128 { +public: + /** + * @brief Default constructor + */ + ia3_128() = default; + + /** + * @brief Destructor + */ + ~ia3_128() = default; + + /** + * @brief Copy constructor (deleted) + */ + ia3_128(const ia3_128&) = delete; + + /** + * @brief Copy assignment operator (deleted) + */ + ia3_128& operator=(const ia3_128&) = delete; + + /** + * @brief Move constructor (deleted) + */ + ia3_128(ia3_128&&) = delete; + + /** + * @brief Move assignment operator (deleted) + */ + ia3_128& operator=(ia3_128&&) = delete; + + /** + * @brief Encrypts plaintext using ZUC algorithm + * + * This method encrypts the given payload using the ZUC stream cipher. + * The keystream is generated based on the NAS encryption key (knas_enc), + * count, bearer, and direction parameters according to 3GPP TS 33.401. + * + * @param algo_id Algorithm identifier (should be 3 for ZUC) + * @param knas_enc Pointer to the 16-byte NAS encryption key + * @param count 32-bit NAS count value + * @param bearer 5-bit bearer identifier (only lower 5 bits are used) + * @param direction Direction bit (0 = uplink, 1 = downlink) + * @param payload Pointer to the plaintext data to encrypt + * @param payload_length Length of the plaintext data in bytes + * @param cyphered Pointer to pointer that will receive the encrypted data (caller must free) + * @param cyphered_length Pointer to variable that will receive the encrypted data length + * @return 0 on success, negative value on error + * + * @note The caller is responsible for freeing the memory allocated for cyphered + * @note cyphered_length will be equal to payload_length for stream ciphers + */ + int encrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** cyphered, + uint32_t* cyphered_length); + + /** + * @brief Decrypts ciphertext using ZUC algorithm + * + * This method decrypts the given ciphertext using the ZUC stream cipher. + * Decryption is identical to encryption for stream ciphers (XOR operation). + * + * @param algo_id Algorithm identifier (should be 3 for ZUC) + * @param knas_enc Pointer to the 16-byte NAS encryption key + * @param count 32-bit NAS count value + * @param bearer 5-bit bearer identifier (only lower 5 bits are used) + * @param direction Direction bit (0 = uplink, 1 = downlink) + * @param cyphered Pointer to the ciphertext data to decrypt + * @param cyphered_length Length of the ciphertext data in bytes + * @param payload Pointer to pointer that will receive the decrypted data (caller must free) + * @param payload_length Pointer to variable that will receive the decrypted data length + * @return 0 on success, negative value on error + * + * @note The caller is responsible for freeing the memory allocated for payload + * @note payload_length will be equal to cyphered_length for stream ciphers + */ + int decrypt(const uint8_t algo_id, + const unsigned char* knas_enc, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* cyphered, + const uint32_t cyphered_length, + unsigned char** payload, + uint32_t* payload_length); + + /** + * @brief Compute NAS integrity protection using ZUC algorithm + * + * This method computes the integrity protection using the ZUC stream cipher. + * + * @param algo_id Algorithm identifier (should be 3 for ZUC) + * @param knas_int Pointer to the 16-byte NAS integrity key + * @param count 32-bit NAS count value + * @param bearer 5-bit bearer identifier (only lower 5 bits are used) + * @param direction Direction bit (0 = uplink, 1 = downlink) + * @param payload Pointer to pointer that will receive the decrypted data (caller must free) + * @param payload_length Pointer to variable that will receive the decrypted data length + * @param mac Pointer to the mac to decrypt + * @param mac_length Length of the mac in bytes + * @return 0 on success, negative value on error + * + * @note The caller is responsible for freeing the memory allocated for payload + * @note payload_length will be equal to cyphered_length for stream ciphers + */ + int mac(const uint8_t algo_id, + const unsigned char* knas_int, + const uint32_t count, + const uint8_t bearer, + const uint8_t direction, + const unsigned char* payload, + const uint32_t payload_length, + unsigned char** mac, + uint32_t* mac_length); + +private: + const uint8_t s0[256] = { + 0x3e,0x72,0x5b,0x47,0xca,0xe0,0x00,0x33,0x04,0xd1,0x54,0x98,0x09,0xb9,0x6d,0xcb, + 0x7b,0x1b,0xf9,0x32,0xaf,0x9d,0x6a,0xa5,0xb8,0x2d,0xfc,0x1d,0x08,0x53,0x03,0x90, + 0x4d,0x4e,0x84,0x99,0xe4,0xce,0xd9,0x91,0xdd,0xb6,0x85,0x48,0x8b,0x29,0x6e,0xac, + 0xcd,0xc1,0xf8,0x1e,0x73,0x43,0x69,0xc6,0xb5,0xbd,0xfd,0x39,0x63,0x20,0xd4,0x38, + 0x76,0x7d,0xb2,0xa7,0xcf,0xed,0x57,0xc5,0xf3,0x2c,0xbb,0x14,0x21,0x06,0x55,0x9b, + 0xe3,0xef,0x5e,0x31,0x4f,0x7f,0x5a,0xa4,0x0d,0x82,0x51,0x49,0x5f,0xba,0x58,0x1c, + 0x4a,0x16,0xd5,0x17,0xa8,0x92,0x24,0x1f,0x8c,0xff,0xd8,0xae,0x2e,0x01,0xd3,0xad, + 0x3b,0x4b,0xda,0x46,0xeb,0xc9,0xde,0x9a,0x8f,0x87,0xd7,0x3a,0x80,0x6f,0x2f,0xc8, + 0xb1,0xb4,0x37,0xf7,0x0a,0x22,0x13,0x28,0x7c,0xcc,0x3c,0x89,0xc7,0xc3,0x96,0x56, + 0x07,0xbf,0x7e,0xf0,0x0b,0x2b,0x97,0x52,0x35,0x41,0x79,0x61,0xa6,0x4c,0x10,0xfe, + 0xbc,0x26,0x95,0x88,0x8a,0xb0,0xa3,0xfb,0xc0,0x18,0x94,0xf2,0xe1,0xe5,0xe9,0x5d, + 0xd0,0xdc,0x11,0x66,0x64,0x5c,0xec,0x59,0x42,0x75,0x12,0xf5,0x74,0x9c,0xaa,0x23, + 0x0e,0x86,0xab,0xbe,0x2a,0x02,0xe7,0x67,0xe6,0x44,0xa2,0x6c,0xc2,0x93,0x9f,0xf1, + 0xf6,0xfa,0x36,0xd2,0x50,0x68,0x9e,0x62,0x71,0x15,0x3d,0xd6,0x40,0xc4,0xe2,0x0f, + 0x8e,0x83,0x77,0x6b,0x25,0x05,0x3f,0x0c,0x30,0xea,0x70,0xb7,0xa1,0xe8,0xa9,0x65, + 0x8d,0x27,0x1a,0xdb,0x81,0xb3,0xa0,0xf4,0x45,0x7a,0x19,0xdf,0xee,0x78,0x34,0x60 + }; + + const uint8_t s1[256] = { + 0x55,0xc2,0x63,0x71,0x3b,0xc8,0x47,0x86,0x9f,0x3c,0xda,0x5b,0x29,0xaa,0xfd,0x77, + 0x8c,0xc5,0x94,0x0c,0xa6,0x1a,0x13,0x00,0xe3,0xa8,0x16,0x72,0x40,0xf9,0xf8,0x42, + 0x44,0x26,0x68,0x96,0x81,0xd9,0x45,0x3e,0x10,0x76,0xc6,0xa7,0x8b,0x39,0x43,0xe1, + 0x3a,0xb5,0x56,0x2a,0xc0,0x6d,0xb3,0x05,0x22,0x66,0xbf,0xdc,0x0b,0xfa,0x62,0x48, + 0xdd,0x20,0x11,0x06,0x36,0xc9,0xc1,0xcf,0xf6,0x27,0x52,0xbb,0x69,0xf5,0xd4,0x87, + 0x7f,0x84,0x4c,0xd2,0x9c,0x57,0xa4,0xbc,0x4f,0x9a,0xdf,0xfe,0xd6,0x8d,0x7a,0xeb, + 0x2b,0x53,0xd8,0x5c,0xa1,0x14,0x17,0xfb,0x23,0xd5,0x7d,0x30,0x67,0x73,0x08,0x09, + 0xee,0xb7,0x70,0x3f,0x61,0xb2,0x19,0x8e,0x4e,0xe5,0x4b,0x93,0x8f,0x5d,0xdb,0xa9, + 0xad,0xf1,0xae,0x2e,0xcb,0x0d,0xfc,0xf4,0x2d,0x46,0x6e,0x1d,0x97,0xe8,0xd1,0xe9, + 0x4d,0x37,0xa5,0x75,0x5e,0x83,0x9e,0xab,0x82,0x9d,0xb9,0x1c,0xe0,0xcd,0x49,0x89, + 0x01,0xb6,0xbd,0x58,0x24,0xa2,0x5f,0x38,0x78,0x99,0x15,0x90,0x50,0xb8,0x95,0xe4, + 0xd0,0x91,0xc7,0xce,0xed,0x0f,0xb4,0x6f,0xa0,0xcc,0xf0,0x02,0x4a,0x79,0xc3,0xde, + 0xa3,0xef,0xea,0x51,0xe6,0x6b,0x18,0xec,0x1b,0x2c,0x80,0xf7,0x74,0xe7,0xff,0x21, + 0x5a,0x6a,0x54,0x1e,0x41,0x31,0x92,0x35,0xc4,0x33,0x07,0x0a,0xba,0x7e,0x0e,0x34, + 0x88,0xb1,0x98,0x7c,0xf3,0x3d,0x60,0x6c,0x7b,0xca,0xd3,0x1f,0x32,0x65,0x04,0x28, + 0x64,0xbe,0x85,0x9b,0x2f,0x59,0x8a,0xd7,0xb0,0x25,0xac,0xaf,0x12,0x03,0xe2,0xf2 + }; + + /* the constants D */ + const uint32_t EK_d[16] = { + 0x44D7, 0x26BC, 0x626B, 0x135E, 0x5789, 0x35E2, 0x7135, 0x09AF, + 0x4D78, 0x2F13, 0x6BC4, 0x1AF1, 0x5E26, 0x3C4D, 0x789A, 0x47AC + }; + + /* the state registers of LFSR */ + uint32_t lfsr_s0; + uint32_t lfsr_s1; + uint32_t lfsr_s2; + uint32_t lfsr_s3; + uint32_t lfsr_s4; + uint32_t lfsr_s5; + uint32_t lfsr_s6; + uint32_t lfsr_s7; + uint32_t lfsr_s8; + uint32_t lfsr_s9; + uint32_t lfsr_s10; + uint32_t lfsr_s11; + uint32_t lfsr_s12; + uint32_t lfsr_s13; + uint32_t lfsr_s14; + uint32_t lfsr_s15; + + /* the registers of F */ + uint32_t f_r1; + uint32_t f_r2; + + /* the outputs of bit_reorganization */ + uint32_t brc_x0; + uint32_t brc_x1; + uint32_t brc_x2; + uint32_t brc_x3; + + void reset(); + + /* c = a + b mod (2^31 - 1) */ + inline uint32_t add_m(uint32_t a, uint32_t b) { + uint32_t c = a + b; + return (c & 0x7FFFFFFF) + (c >> 31); + }; + + /* LFSR with initialization mode */ + #define mul_by_pow2(x, k) ((((x) << k) | ((x) >> (31 - k))) & 0x7FFFFFFF) + inline void lfsr_with_initialisation_mode(uint32_t u) { + uint32_t f, v; + f = lfsr_s0; + + v = mul_by_pow2(lfsr_s0, 8); + f = add_m(f, v); + v = mul_by_pow2(lfsr_s4, 20); + f = add_m(f, v); + v = mul_by_pow2(lfsr_s10, 21); + f = add_m(f, v); + v = mul_by_pow2(lfsr_s13, 17); + f = add_m(f, v); + v = mul_by_pow2(lfsr_s15, 15); + f = add_m(f, v); + + f = add_m(f, u); + + /* update the state */ + lfsr_s0 = lfsr_s1; + lfsr_s1 = lfsr_s2; + lfsr_s2 = lfsr_s3; + lfsr_s3 = lfsr_s4; + lfsr_s4 = lfsr_s5; + lfsr_s5 = lfsr_s6; + lfsr_s6 = lfsr_s7; + lfsr_s7 = lfsr_s8; + lfsr_s8 = lfsr_s9; + lfsr_s9 = lfsr_s10; + lfsr_s10 = lfsr_s11; + lfsr_s11 = lfsr_s12; + lfsr_s12 = lfsr_s13; + lfsr_s13 = lfsr_s14; + lfsr_s14 = lfsr_s15; + lfsr_s15 = f; + }; + + /* LFSR with work mode */ + inline void lfsr_with_work_mode(void) { + uint32_t f, v; + f = lfsr_s0; + + v = mul_by_pow2(lfsr_s0, 8); + f = add_m(f, v); + v = mul_by_pow2(lfsr_s4, 20); + f = add_m(f, v); + v = mul_by_pow2(lfsr_s10, 21); + f = add_m(f, v); + v = mul_by_pow2(lfsr_s13, 17); + f = add_m(f, v); + v = mul_by_pow2(lfsr_s15, 15); + f = add_m(f, v); + + /* update the state */ + lfsr_s0 = lfsr_s1; + lfsr_s1 = lfsr_s2; + lfsr_s2 = lfsr_s3; + lfsr_s3 = lfsr_s4; + lfsr_s4 = lfsr_s5; + lfsr_s5 = lfsr_s6; + lfsr_s6 = lfsr_s7; + lfsr_s7 = lfsr_s8; + lfsr_s8 = lfsr_s9; + lfsr_s9 = lfsr_s10; + lfsr_s10 = lfsr_s11; + lfsr_s11 = lfsr_s12; + lfsr_s12 = lfsr_s13; + lfsr_s13 = lfsr_s14; + lfsr_s14 = lfsr_s15; + lfsr_s15 = f; + }; + + /* bit_reorganization */ + inline void bit_reorganization(void) { + brc_x0 = ((lfsr_s15 & 0x7FFF8000) << 1) | (lfsr_s14 & 0xFFFF); + brc_x1 = ((lfsr_s11 & 0xFFFF) << 16) | (lfsr_s9 >> 15); + brc_x2 = ((lfsr_s7 & 0xFFFF) << 16) | (lfsr_s5 >> 15); + brc_x3 = ((lfsr_s2 & 0xFFFF) << 16) | (lfsr_s0 >> 15); + }; + + #define ROT(a, k) (((a) << k) | ((a) >> (32 - k))) + + /* L1 */ + inline uint32_t L1(uint32_t X) { return (X ^ ROT(X, 2) ^ ROT(X, 10) ^ ROT(X, 18) ^ ROT(X, 24)); }; + + /* L2 */ + inline uint32_t L2(uint32_t X) { return (X ^ ROT(X, 8) ^ ROT(X, 14) ^ ROT(X, 22) ^ ROT(X, 30)); }; + + #define MAKEU32(a, b, c, d) (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | ((uint32_t)(d))) + /* F */ + inline uint32_t F(void) { + uint32_t W, W1, W2, u, v; + + W = (brc_x0 ^ f_r1) + f_r2; + W1 = f_r1 + brc_x1; + W2 = f_r2 ^ brc_x2; + + u = L1((W1 << 16) | (W2 >> 16)); + v = L2((W2 << 16) | (W1 >> 16)); + + f_r1 = MAKEU32(s0[u >> 24], s1[(u >> 16) & 0xFF], + s0[(u >> 8) & 0xFF], s1[u & 0xFF]); + f_r2 = MAKEU32(s0[v >> 24], s1[(v >> 16) & 0xFF], + s0[(v >> 8) & 0xFF], s1[v & 0xFF]); + + return W; + }; + +#define MAKEU31(a, b, c) (((uint32_t)(a) << 23) | ((uint32_t)(b) << 8) | (uint32_t)(c)) + + inline void zuc_initialize(const uint8_t* k, const uint8_t* iv) { + uint32_t w, nCount; + + /* expand key */ + lfsr_s0 = MAKEU31(k[0], EK_d[0], iv[0]); + lfsr_s1 = MAKEU31(k[1], EK_d[1], iv[1]); + lfsr_s2 = MAKEU31(k[2], EK_d[2], iv[2]); + lfsr_s3 = MAKEU31(k[3], EK_d[3], iv[3]); + lfsr_s4 = MAKEU31(k[4], EK_d[4], iv[4]); + lfsr_s5 = MAKEU31(k[5], EK_d[5], iv[5]); + lfsr_s6 = MAKEU31(k[6], EK_d[6], iv[6]); + lfsr_s7 = MAKEU31(k[7], EK_d[7], iv[7]); + lfsr_s8 = MAKEU31(k[8], EK_d[8], iv[8]); + lfsr_s9 = MAKEU31(k[9], EK_d[9], iv[9]); + lfsr_s10 = MAKEU31(k[10], EK_d[10], iv[10]); + lfsr_s11 = MAKEU31(k[11], EK_d[11], iv[11]); + lfsr_s12 = MAKEU31(k[12], EK_d[12], iv[12]); + lfsr_s13 = MAKEU31(k[13], EK_d[13], iv[13]); + lfsr_s14 = MAKEU31(k[14], EK_d[14], iv[14]); + lfsr_s15 = MAKEU31(k[15], EK_d[15], iv[15]); + + /* set f_r1 and f_r2 to zero */ + f_r1 = 0; + f_r2 = 0; + nCount = 32; + while (nCount > 0) { + bit_reorganization(); + w = F(); + lfsr_with_initialisation_mode(w >> 1); + nCount --; + } + }; + + inline void zuc_generate_key_stream(uint32_t* pKeystream, uint32_t KeystreamLen) { + int i; + bit_reorganization(); + F(); /* discard the output of F */ + lfsr_with_work_mode(); + + for (i = 0; i < KeystreamLen; i ++) + { + bit_reorganization(); + pKeystream[i] = F() ^ brc_x3; + lfsr_with_work_mode(); + } + }; + + /* The ZUC algorithm, see ref. [3]*/ + inline void zuc(const uint8_t* k, uint8_t* iv, uint32_t* ks, uint32_t len) { + /* The initialization of ZUC, see page 17 of ref. [3]*/ + zuc_initialize(k, iv); + /* The procedure of generating keystream of ZUC, see page 18 of ref. [3]*/ + zuc_generate_key_stream(ks, len); + }; + + inline uint32_t get_word(const uint32_t* p_data, const uint32_t i) { + uint32_t word, ti; + ti = i % 32; + if (ti == 0) + word = p_data[i/32]; + else + word = (p_data[i/32]<>(32-ti)); + return word; + }; + + inline uint8_t get_bit(const uint8_t* p_data, const uint32_t i) { return (p_data[i/8] & (1<<(7-(i%8)))) ? 1 : 0; }; + + /* + * p_knas_enc: ciphering key + * count: frame counter + * bearer: radio bearer + * direction + * payload_length: length of the frame in bits + * payload: original message (input) + * ciphered: processed message (output) + */ + void zuc_eea3(const uint8_t* p_knas_enc, const uint32_t count, const uint32_t bearer, const uint32_t direction, const uint32_t payload_length, const uint8_t* payload, uint8_t* ciphered); + + /* + * p_knas_int: integrity key + * count: frame counter + * bearer: radio bearer + * direction + * payload_length: length of the frame in bits + * payload: original message (input) + * mac: computed integrity protection (output) + */ + void zuc_eia3(const uint8_t* p_knas_int, const uint32_t count, const uint32_t bearer, const uint32_t direction, const uint32_t payload_length, const uint8_t* payload, uint32_t* mac); + +}; diff --git a/ccsrc/Externals/module.mk b/ccsrc/Externals/module.mk index 4701f0069489d370770fdebe90affeafc622c2f6..cc24b328bd58a5166687ee9ce3753ed5271fc769 100644 --- a/ccsrc/Externals/module.mk +++ b/ccsrc/Externals/module.mk @@ -1,7 +1,11 @@ -sources := \ - common_ext.cc \ - NG_security_ext.cc \ - LIB_NG_NAS_Functions_ext.cc +sources := \ + common_ext.cc \ + NG_security_ext.cc \ + Lib_NG_NAS_Functions_ext.cc \ + ia1_128.cc \ + ia2_128.cc \ + ia3_128.cc \ + upper_terster.cc \ includes := . diff --git a/ccsrc/Externals/upper_terster.cc b/ccsrc/Externals/upper_terster.cc new file mode 100644 index 0000000000000000000000000000000000000000..de251ac5860ce978ddd8d28f5819483d86cb3b88 --- /dev/null +++ b/ccsrc/Externals/upper_terster.cc @@ -0,0 +1,122 @@ +#include +#include +#include + +#include "async_process.hh" + +#include "NGAP_Steps.hh" + +#include "loggers.hh" + +static async_process open5gs_proc; +static async_process gnb_proc; +static async_process ue_proc; + +namespace NGAP__Steps { + + INTEGER fx__ut__start__gnb(const CHARSTRING& p__binary__file, const CHARSTRING& p__config__file) { + loggers::get_instance().log_msg(">>> fx__ut__start__gnb: p__binary__file: ", p__binary__file); + loggers::get_instance().log_msg(">>> fx__ut__start__gnb: p__config__file: ", p__config__file); + + async_process::Options opts = {false, "", [](std::string_view chunk, bool isStderr) { + if (isStderr) { + loggers::get_instance().warning("fx__ut__start__gnb: '%s'", std::string(chunk).c_str()); + std::cerr << "GNB STDERR: " << chunk; + } else { + loggers::get_instance().log("fx__ut__start__gnb: '%s'", std::string(chunk).c_str()); + std::cout << "GNB STDOUT: " << chunk; + } + }}; + try { + if (p__config__file.lengthof() == 0) { + loggers::get_instance().log(">>> fx__ut__start__gnb: No config file provided, starting gNB without '-c' argument"); + gnb_proc.start(static_cast(p__binary__file), {}, opts); + } else { + gnb_proc.start(static_cast(p__binary__file), { "-c", static_cast(p__config__file) }, opts); + } + } + catch (const std::exception& e) { + std::cerr << "fx__ut__start__gnb: Failed to start process: " << e.what() << std::endl; + return -1; + } + + return 0; + } + + INTEGER fx__ut__terminate__gnb() { + loggers::get_instance().log(">>> fx__ut__terminate__gnb"); + gnb_proc.terminate(); + return 0; + } + +INTEGER fx__ut__start__ue(const CHARSTRING& p__binary__file, const CHARSTRING& p__config__file) { + loggers::get_instance().log_msg(">>> fx__ut__start__ue: p__binary__file: ", p__binary__file); + loggers::get_instance().log_msg(">>> fx__ut__start__ue: p__config__file: ", p__config__file); + + async_process::Options opts = {false, "", [](std::string_view chunk, bool isStderr) { + if (isStderr) { + loggers::get_instance().warning("fx__ut__start__ue: '%s'", std::string(chunk).c_str()); + std::cerr << "UE STDERR: " << chunk; + } else { + loggers::get_instance().log("fx__ut__start__ue: '%s'", std::string(chunk).c_str()); + std::cout << "UE STDOUT: " << chunk; + } + }}; + try { + if (p__config__file.lengthof() == 0) { + loggers::get_instance().log(">>> fx__ut__start__gnb: No config file provided, starting gNB without '-c' argument"); + ue_proc.start(static_cast(p__binary__file), {}, opts); + } else { + ue_proc.start(static_cast(p__binary__file), { "-c", static_cast(p__config__file) }, opts); + } + } + catch (const std::exception& e) { + std::cerr << "fx__ut__start__gnb: Failed to start process: " << e.what() << std::endl; + return -1; + } + + return 0; +} + + INTEGER fx__ut__terminate__ue() { + loggers::get_instance().log(">>> fx__ut__terminate__ue"); + ue_proc.terminate(); + return 0; + } + + INTEGER fx__ut__start__open5gs(const CHARSTRING& p__binary__file, const CHARSTRING& p__config__file) { + loggers::get_instance().log_msg(">>> fx__ut__start__open5gs: p__binary__file: ", p__binary__file); + loggers::get_instance().log_msg(">>> fx__ut__start__open5gs: p__config__file: ", p__config__file); + + async_process::Options opts = {false, "", [](std::string_view chunk, bool isStderr) { + if (isStderr) { + loggers::get_instance().warning("fx__ut__start__open5gs: '%s'", std::string(chunk).c_str()); + std::cerr << "OPEN5GS STDERR: " << chunk; + } else { + loggers::get_instance().log("fx__ut__start__open5gs: '%s'", std::string(chunk).c_str()); + std::cout << "OPEN5GS STDOUT: " << chunk; + } + }}; + try { + if (p__config__file.lengthof() == 0) { + loggers::get_instance().log(">>> fx__ut__start__gnb: No config file provided, starting gNB without '-c' argument"); + open5gs_proc.start(static_cast(p__binary__file), {}, opts); + } else { + open5gs_proc.start(static_cast(p__binary__file), { "-c", static_cast(p__config__file) }, opts); + } + } + catch (const std::exception& e) { + std::cerr << "fx__ut__start__open5gs: Failed to start process: " << e.what() << std::endl; + return -1; + } + + return 0; + } + + INTEGER fx__ut__terminate__open5gs() { + loggers::get_instance().log(">>> fx__ut__terminate__open5gs"); + open5gs_proc.terminate(); + return 0; + } + +} // End of namespace NGAP__Steps diff --git a/ccsrc/Protocols/FiveG_AKA/opc.cc b/ccsrc/Protocols/FiveG_AKA/opc.cc index 34d39664dfe976e01b51cc50ec89b2e5d1c3b0c1..8f600bcbc06747601b0a2f441dabae6fcdd087d9 100644 --- a/ccsrc/Protocols/FiveG_AKA/opc.cc +++ b/ccsrc/Protocols/FiveG_AKA/opc.cc @@ -1,12 +1,8 @@ #include "opc.hh" void opc::compute_opc(uint8_t p_opc[16]) { - if (!_computed) { - _rijndael.rijndael_encrypt(_op, p_opc); - for (uint8_t i = 0; i < 16; i++) { - p_opc[i] ^= _op[i]; - } // End of 'for' statement - } else { - std::memcpy(p_opc, _op, 16); - } + _rijndael.rijndael_encrypt(_op, p_opc); + for (uint8_t i = 0; i < 16; i++) { + p_opc[i] ^= _op[i]; + } // End of 'for' statement } diff --git a/ccsrc/Protocols/FiveG_AKA/opc.hh b/ccsrc/Protocols/FiveG_AKA/opc.hh index eeaaf80ea06f62e440d1b043ec08748b28f4f17f..861adbe66c1c0073e2b974d81f23715ee4de6e65 100644 --- a/ccsrc/Protocols/FiveG_AKA/opc.hh +++ b/ccsrc/Protocols/FiveG_AKA/opc.hh @@ -9,11 +9,10 @@ class opc { rijndael& _rijndael; uint8_t _op[16]; - bool _computed; public: - opc(rijndael& p_rijndael): _rijndael(p_rijndael), _op(), _computed{false} { std::memcpy(_op, OP, 16); std::memset(_op, 0x00, 16); }; - opc(rijndael& p_rijndael, uint8_t p_op[16]): _rijndael(p_rijndael), _computed{true} { std::memcpy(_op, p_op, 16); }; + opc(rijndael& p_rijndael): _rijndael(p_rijndael), _op() { std::memcpy(_op, OP, 16); std::memset(_op, 0x00, 16); }; + opc(rijndael& p_rijndael, uint8_t p_op[16]): _rijndael(p_rijndael) { std::memcpy(_op, p_op, 16); }; virtual ~opc() {}; void compute_opc(uint8_t p_opc[16]); diff --git a/ccsrc/Protocols/FiveG_AKA/rijndael.cc b/ccsrc/Protocols/FiveG_AKA/rijndael.cc index 701ada5357f1b9ad0d2dfed6a92bc1a907956a6c..f43e8dcefe28e1060f626d900fa1f75954b62ae2 100644 --- a/ccsrc/Protocols/FiveG_AKA/rijndael.cc +++ b/ccsrc/Protocols/FiveG_AKA/rijndael.cc @@ -1,5 +1,7 @@ #include "rijndael.hh" +#include "loggers.hh" + rijndael::rijndael() { } // End of ctor @@ -8,6 +10,8 @@ rijndael::~rijndael() { } // End of dtor int rijndael::rijndael_key_schedule(const uint8_t p_key[16]) { + loggers::get_instance().log_to_hexa(">>> rijndael::rijndael_key_schedule: ", p_key, 16); + uint8_t round_const = 1; // First round p_key equals p_key @@ -29,41 +33,55 @@ int rijndael::rijndael_key_schedule(const uint8_t p_key[16]) { } // End of 'for' statement // Update round constant - round_const = XTIME[round_const]; + round_const = XTIME[round_const]; } // End of 'for' statement + loggers::get_instance().log_to_hexa("rijndael::rijndael_key_schedule: ", static_cast(&_round_keys[0][0][0]), 16); + return 0; } void rijndael::rijndael_encrypt(const uint8_t p_input[16], uint8_t p_output[16]) { + loggers::get_instance().log_to_hexa(">>> rijndael::rijndael_encrypt: ", p_input, 16); // Initialise state array from p_input byte string uint8_t state[4][4]; for (int i = 0; i < 16; i++) { state[i & 0x3][i>>2] = p_input[i]; } // End of 'for' statement + loggers::get_instance().log_rijndael_state("rijndael::rijndael_encrypt: Initial state: ", state); // Add first round_key key_add(state, _round_keys, 0); + loggers::get_instance().log_rijndael_state("rijndael::rijndael_encrypt: First round: key_add:", state); // Do lots of full rounds int r = 1; for ( ; r <= 9; r++) { + loggers::get_instance().log("rijndael::rijndael_encrypt: Round %d:",r); byte_sub(state); + loggers::get_instance().log_rijndael_state("byte_sub: ", state); shift_row(state); + loggers::get_instance().log_rijndael_state("shift_row: ", state); mix_column(state); + loggers::get_instance().log_rijndael_state("mix_column: ", state); key_add(state, _round_keys, r); + loggers::get_instance().log_rijndael_state("key_add: ", state); } // End of 'for' statement // Final round byte_sub(state); + loggers::get_instance().log_rijndael_state("rijndael::rijndael_encrypt: Final round: byte_sub: ", state); shift_row(state); + loggers::get_instance().log_rijndael_state("rijndael::rijndael_encrypt: Final round: shift_row: ", state); key_add(state, _round_keys, r); + loggers::get_instance().log_rijndael_state("rijndael::rijndael_encrypt: Final round: key_add: ", state); /* produce output byte string from state array */ for (int i = 0; i < 16; i++) { p_output[i] = state[i & 0x3][i>>2]; } // End of 'for' statement + loggers::get_instance().log_to_hexa("<<< rijndael::rijndael_encrypt: ", p_output, 16); } void rijndael::key_add(uint8_t p_state[4][4], const uint8_t p_round_keys[11][4][4], const int p_round) { diff --git a/config.mk b/config.mk index 9aeee3f5ae6bf6df196a37ab43f48e1590bb2ee6..01f4dc7d9a1f60a3f8768603dc370c35d2441ef7 100644 --- a/config.mk +++ b/config.mk @@ -1,7 +1,7 @@ # Do not use -X if -H is not used #TTCN3_COMPILER_OPTIONS := -d -e -f -g -j -H -l -L -R -U none -x -X TTCN3_COMPILER_OPTIONS := -b -d -e -f -g -j -l -L -O -P NGAP-PDU-Descriptions.NGAP-PDU -R -U none -x -TTCN3_DIR := $(HOME)/frameworks/titan/titan.core/Install +#TTCN3_DIR := $(HOME)/frameworks/titan-11.0.0/Install #TTCN3_DIR := $(HOME)/tmp/ttcn3-9.0.0 #ASN1C_PATH := $(HOME)/frameworks/asn1c.denis #ASN1C_PATH := /home/ubuntu/bin/asn1c.denis/ diff --git a/etc/AtsNGAP/AtsNGAP_AMF.cfg_ b/etc/AtsNGAP/AtsNGAP_AMF.cfg_ new file mode 100644 index 0000000000000000000000000000000000000000..889ecad415152aa9f3c45f81002dc8ba54e4940c --- /dev/null +++ b/etc/AtsNGAP/AtsNGAP_AMF.cfg_ @@ -0,0 +1,191 @@ +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +NG_NAS_Pics.PICS_NGNAS := true + +NGAP_Pics.PICS_NGAP_AMF_IUT := true +NGAP_Pics.PICS_NGAP_GNB_IUT := false + +LibNGAP_Pics.PICS_OFFLINE_MODE := true + +# 5GRegAuthSec_deReg.pcap +LibNGAP_Pixits.PX_AMF_NAME := "Kontron5G-amf" +LibNGAP_Pixits.PX_RAN_UE_NGAP_ID := 0 +LibNGAP_Pixits.PX_AMF_UE_NGAP_ID := 22 #8934 +LibNGAP_Pixits.PX_NAS_MCC := '999'H +LibNGAP_Pixits.PX_NAS_MNC := '70'H +LibNGAP_Pixits.PX_AMF_REGION_ID := '00000010'B +LibNGAP_Pixits.PX_AMF_SET_ID := '0000000001'B +LibNGAP_Pixits.PX_AMF_POINTER := '011111'B +LibNGAP_Pixits.PX_GNB_ID := '0000000000000001001110'B +LibNGAP_Pixits.PX_RAN_NODE_NAME := "Jenkins-Open5gs-1-0" +LibNGAP_Pixits.PX_TACode := '000001'O +LibNGAP_Pixits.PX_SST := '01'O +LibNGAP_Pixits.PX_SD := '000009'O + +Lib_NG_NAS_Pixits.PX_CHECK_SECURITY := false +Lib_NG_NAS_Pixits.PX_TYPE_OF_ID := '0001'B # SUCI format +Lib_NG_NAS_Pixits.PX_SUPI_DIGITS := '00f110214300014444330302'O +Lib_NG_NAS_Pixits.PX_SUCI_DIGITS := '0000000010'O; + +# OP +Lib_NG_NAS_Pixits.PX_OPERATOR_KEY := '00000000000000000000000000000000'O +# OPc +Lib_NG_NAS_Pixits.PX_OPERATOR_SECRET_KEY := '00000000000000000000000000000000'O +Lib_NG_NAS_Pixits.PX_FORCE_USING_OPERATOR_SECRET_KEY := true + +Lib_NG_NAS_Pixits.PX_SUBSCRIPTION_KEY := '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'B +Lib_NG_NAS_Pixits.PX_BEARER_ID := '00001'B + +Parameters.px_IMSI_Def := '696d73692d3939393730303030303030'H; // imsi-99970000000 +NAS_5GC_Parameters.px_NAS_5GC_XRES_Length := 8 # In ETSI TS 135 206 V16.0.0 (2020-08) Table Table 5. f2 output, RES length is 8 octets (64 bits) + +[LOGGING] +# In this section you can specify the name of the log file and the classes of events +# you want to log into the file or display on console (standard error). + +LogFile := "../logs/AtsNGAP/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +#system.NGAP_gNB_1.params := "NGAP/SCTP(server=192.168.1.21,port=4444,debug=1)" +#system.N2_gNBaMF_P.params := "NGAP/SCTP(server=192.168.1.21,port=4444,debug=1)" + +system.NGAP_gNB_1.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/5GRegAuthSec_deReg.pcap)" +system.N2_gNBaMF_P.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/5GRegAuthSec_deReg.pcap)" + +#system.NGAP_gNB_1.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/open5gs.pcap)" +#system.N2_gNBaMF_P.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/open5gs.pcap)" + +#system.NGAP_gNB_1.params := "NGAP/SCTP_FILE/IP_OFFLINE/LINUX_FRAME/PCAP_FILE(file=../captures/RegTrace4444333000_.pcapng)" +#system.N2_gNBaMF_P.params := "NGAP/SCTP_FILE/IP_OFFLINE/LINUX_FRAME/PCAP_FILE(file=../captures/RegTrace4444333000_.pcapng)" + +[DEFINE] +# In this section you can create macro definitions, +# that can be used in other configuration file sections except [INCLUDE] and [ORDERED_INCLUDE]. + +[INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[ORDERED_INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[EXTERNAL_COMMANDS] +# This section can define external commands (shell scripts) to be executed by the ETS +# whenever a control part or test case is started or terminated. + +#BeginTestCase := "" +#EndTestCase := "" +#BeginControlPart := "" +#EndControlPart := "" + +[EXECUTE] +# In this section you can specify what parts of your test suite you want to execute. +#AtsImsIot_TestControl.control + +# Verify that the IUT can send a PDU SESSION RESOURCE SETUP REQUEST with at least one PDU session resource list to established PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_01 +# Verify that the IUT can send a PDU_SESSION_RESOURCE_RELEASE_COMMAND to release PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_02 +# Verify that the IUT can send a PDU_SESSION_RESOURCE_MODIFY_REQUEST to modify PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_03 +# Verify that the AMF node successfully processes a PDU_SESSION_RESOURCE_MODIFY_INDICATION contains mandatory IEs and answers with PDU_SESSION_RESOURCE_MODIFY_CONFIRM for successfully modified PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_04 +# Verify that the AMF node processes a PDU_SESSION_RESOURCE_MODIFY_INDICATION contains mandatory IEs and answers with PDU_SESSION_RESOURCE_MODIFY_CONFIRM for not successfully modified PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_05 + +# Verify the IUT correctly sets the UE Context after Authentication and Security procedure has been executed +NGAP_TestCases.TC_NGAP_AMF_CMP_01 +# Verify that the IUT can send a UE CONTEXT RELEASE COMMAND that contains both the AMF_UE_NGAP_ID IE and the RAN_UE_NGAP_ID IE or only AMF_UE_NGAP_ID +#NGAP_TestCases.TC_NGAP_AMF_CMP_02 +# Verify that the IUT sends a UE CONTEXT RELEASE COMMAND after UE_CONTEXT_RELEASE_REQUEST to release the UE-associated logic NG-connection due to NG-RAN node generated reasons +#NGAP_TestCases.TC_NGAP_AMF_CMP_03 +# Verify that the IUT can send a UE CONTEXT MODIFICATION REQUEST containing mandatory IEs +NGAP_TestCases.TC_NGAP_AMF_CMP_04 +# Verify that the IUT can send a CONNECTION ESTABLISHMENT INDICATION that contains mandatory IEs +#NGAP_TestCases.TC_NGAP_AMF_CMP_05 +# Verify that the IUT can send an AMF CP RELOCATION INDICATION that contains mandatory IEs +#NGAP_TestCases.TC_NGAP_AMF_CMP_06 +# Verify that the IUT can successfully request UE information from the AMF +#NGAP_TestCases.TC_NGAP_AMF_CMP_07 +# Verify that the AMF node successfully processes a UE CONTEXT SUSPEND REQUEST containing mandatory IEs and answers with UE CONTEXT SUSPEND REQUEST RESPONSE with successfully suspend UE context +#NGAP_TestCases.TC_NGAP_AMF_CMP_08 +# Verify that the AMF node successfully processes a UE CONTEXT SUSPEND REQUEST containing mandatory IEs and answers with UE CONTEXT SUSPEND FAILURE with failed suspension +#NGAP_TestCases.TC_NGAP_AMF_CMP_09 +# Verify that the AMF node successfully processes a UE CONTEXT RESUME REQUEST containing mandatory IEs and answers with UE CONTEXT RESUME RESPONSE with successfully resume UE context +#NGAP_TestCases.TC_NGAP_AMF_CMP_10 +# Verify that the AMF node successfully processes a UE CONTEXT RESUME REQUEST containing mandatory IEs and answers with UE CONTEXT RESUME FAILURE with failing to resume UE context +#NGAP_TestCases.TC_NGAP_AMF_CMP_11 + + + +# Verify that the AMF node successfully processes a HANDOVER REQUIRED message contains mandatory IEs and answers with HANDOVER COMMAND with successfully handover. +#NGAP_TestCases.TC_NGAP_AMF_MMP_01 +# Verify that the AMF node successfully processes a HANDOVER REQUIRED message contains mandatory IEs and answers with HANDOVER PREPARATION FAILURE because the UE is not longer available. +#NGAP_TestCases.TC_NGAP_AMF_MMP_02 +# Verify that the AMF node successfully sends a HANDOVER REQUEST message that contains mandatory IEs to the GNB. +#NGAP_TestCases.TC_NGAP_AMF_MMP_03 +# Verify that the AMF node successfully processes a PATH SWITCH REQUEST message that contains mandatory IEs and answers with PATH SWITCH REQUEST ACKNOWLEDGE to acknowledge the path switch. +#NGAP_TestCases.TC_NGAP_AMF_MMP_04 +# Verify that the AMF node successfully processes a PATH SWITCH REQUEST message that contains mandatory IEs and two PDU Sessions with same ID and answers with PATH SWITCH REQUEST FAILURE. +#NGAP_TestCases.TC_NGAP_AMF_MMP_05 +# Verify that the AMF node successfully processes a HANDOVER CANCEL message that contains mandatory IEs and answers with HANDOVER CANCEL ACKNOWLEDGE to confirm that the ongoing handover was cancelled. +#NGAP_TestCases.TC_NGAP_AMF_MMP_06 +# Verify that the AMF node successfully sends a DOWNLINK RAN STATUS TRANSFER message that contains mandatory IEs. +#NGAP_TestCases.TC_NGAP_AMF_MMP_07 +# Verify that the NG-RAN node successfully sends a Handover Success message to the AMF. +#NGAP_TestCases.TC_NGAP_AMF_MMP_08 +# Verify that the AMF node successfully sends a DOWNLINK RAN EARLY STATUS TRANSFER message that contains mandatory IEs. +#NGAP_TestCases.TC_NGAP_AMF_MMP_09 + +# Verify that the IUT can send an DOWNLINK NAS TRANSPORT message to carry NAS information over the NG interface. +#NGAP_TestCases.TC_NGAP_AMF_NAS_01 + +# Verify that the AMF node successfully processes a NG SETUP REQEST message that contains mandatory IEs and answers with NG SETUP RESPONSE to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_01 +# Verify that the AMF node successfully processes a NG SETUP REQEST message that contains mandatory IEs and answers with NG SETUP RESPONSE to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_02 +# Verify that the AMF node successfully processes a NG SETUP REQEST message with optional field UE Retention Information and answers with NG SETUP RESPONSE to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_03 +# Verify that the AMF node successfully processes a NG SETUP REQEST message with different optional fields and answers with NG SETUP RESPONSE to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_04 +# Verify that the AMF node successfully processes a RAN CONFIGURATION UPDATE message with RAN CONFIGURATION UPDATE ACKNOWLEDGE to acknowledge the update. +#NGAP_TestCases.TC_NGAP_AMF_IMP_05 +# Verify that the AMF node successfully declines a RAN CONFIGURATION UPDATE message with RAN CONFIGURATION UPDATE FAILURE when the AMF is not able to handle the request. +#NGAP_TestCases.TC_NGAP_AMF_IMP_06 +# Verify that the IUT can send a AMF CONFIGURATION UPDATE message to the AMF. +#NGAP_TestCases.TC_NGAP_AMF_IMP_07 +# Verify that the AMF node successfully processes a NG RESET message that contains mandatory IEs and answers with NG RESET ACKNOWLEDGE to acknowledge the reset. +#NGAP_TestCases.TC_NGAP_AMF_IMP_08 +# Verify that the AMF can send a ERROR INDICATION to the GNB when a error occurs. +#NGAP_TestCases.TC_NGAP_AMF_IMP_09 +# Verify that the AMF can send a AMF STATUS INDICATION to the GNB when a error occurs. +#NGAP_TestCases.TC_NGAP_AMF_IMP_10 +# Verify that the AMF can send a OVERLOAD START to the GNB. +#NGAP_TestCases.TC_NGAP_AMF_IMP_11 +# Verify that the AMF can send a OVERLOAD STOP to the GNB. +#NGAP_TestCases.TC_NGAP_AMF_IMP_12 + +[GROUPS] +# In this section you can specify groups of hosts. These groups can be used inside the +# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts. + +[COMPONENTS] +# This section consists of rules restricting the location of created PTCs. + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsNGAP/AtsNGAP_AMF_open5gs.cfg_ b/etc/AtsNGAP/AtsNGAP_AMF_open5gs.cfg_ new file mode 100644 index 0000000000000000000000000000000000000000..d9470d80718b82fe36c9dc02bf3598e97d6ef70b --- /dev/null +++ b/etc/AtsNGAP/AtsNGAP_AMF_open5gs.cfg_ @@ -0,0 +1,215 @@ +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# https://www.binaryhexconverter.com/hex-to-binary-converter + +LibCommon_Time.PX_TDONE := 30.0; +LibCommon_Time.PX_TAC := 30.0; +LibCommon_Time.PX_TNOAC := 10.0; +LibCommon_Time.PX_TWAIT := 30.0; +LibCommon_Sync.PX_TSYNC_TIME_LIMIT := 10.0; +LibCommon_Sync.PX_TSHUT_DOWN_TIME_LIMIT := 10.0; + +NGAP_Pics.PICS_NGAP_AMF_IUT := true +NGAP_Pics.PICS_NGAP_GNB_IUT := false + +LibNGAP_Pics.PICS_OFFLINE_MODE := false # true for offline mode with pcap files, false for online mode with SCTP server +LibNGAP_Pics.PICS_USE_OPEN5GS := false # true to start open5gs, false to not start them + +LibNGAP_Pixits.PX_NAS_MCC := '999'H +LibNGAP_Pixits.PX_NAS_MNC := '70'H +LibNGAP_Pixits.PX_RAN_NODE_NAME := "gnb0012345" +LibNGAP_Pixits.PX_GNB_ID := '00000000000000000000000000000001'B +LibNGAP_Pixits.PX_RAN_NODE_NAME := "UERANSIM-gnb-999-70-1" +LibNGAP_Pixits.PX_TACode := '000001'O +LibNGAP_Pixits.PX_SST := '01'O +LibNGAP_Pixits.PX_SD := '000009'O +LibNGAP_Pixits.PX_PAGING_DRX := v128 +LibNGAP_Pixits.PX_AMF_NAME := "open5gs-amf0" +LibNGAP_Pixits.PX_AMF_REGION_ID := '00000010'B +LibNGAP_Pixits.PX_AMF_SET_ID := '0000000001'B +LibNGAP_Pixits.PX_AMF_POINTER := '000000'B +LibNGAP_Pixits.PX_RAN_UE_NGAP_ID := 1 +LibNGAP_Pixits.PX_AMF_UE_NGAP_ID := 2 + +LibNGAP_Pixits.PX_TIME_ZONE := '80'O # 0x40 for GMT+1, 0x80 for GMT+2 + +LibNGAP_Pixits.PX_PDU_SESSION_ID := 1 + +Lib_NG_NAS_Pixits.PX_CHECK_SECURITY := false +Lib_NG_NAS_Pixits.PX_SUPI_FORMAT := '0000'B # IMSI format +Lib_NG_NAS_Pixits.PX_TYPE_OF_ID := '001'B # SUCI type +Lib_NG_NAS_Pixits.PX_SUPI_DIGITS := '00f110214300014444330302'O +Lib_NG_NAS_Pixits.PX_MSIN := '0000000010'O; +Lib_NG_NAS_Pixits.PX_NETWORK_NAME := "Open5GS" + +# OP +Lib_NG_NAS_Pixits.PX_OPERATOR_KEY := '00000000000000000000000000000000'O +# OPc +Lib_NG_NAS_Pixits.PX_OPERATOR_SECRET_KEY := 'E8ED289DEBA952E4283B54E88E6183CA'O +Lib_NG_NAS_Pixits.PX_FORCE_USING_OPERATOR_SECRET_KEY := true + +Lib_NG_NAS_Pixits.PX_SUBSCRIPTION_KEY := '01000110010110110101110011101000101100011001100110110100100111111010101001011111000010100010111011100010001110001010011010111100'B +Lib_NG_NAS_Pixits.PX_BEARER_ID := '00001'B + +Parameters.px_IMSI_Def := '393939373030303030303030303031'H # 999700000000001 +Parameters.px_IMEISV_Def := '73806121856151f1'H +NAS_5GC_Parameters.px_NAS_5GC_XRES_Length := 8 # In ETSI TS 135 206 V16.0.0 (2020-08) Table Table 5. f2 output, RES length is 8 octets (64 bits) + +# Upper tester parameters for UERANSIM integration +LibNGAP_Pixits.PX_OPEN5GS_BINARY_FILE := "/home/yann/dev/open5gs/build/tests/app/5gc" + +[LOGGING] +# In this section you can specify the name of the log file and the classes of events +# you want to log into the file or display on console (standard error). + +LogFile := "../logs/AtsNGAP/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +#ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. + +# Open5GS AMF IP and port as listener +system.NGAP_AMF.params := "NGAP/SCTP(server=127.0.0.5,port=38412,debug=1)" + +# Open5GS pcap files +# Do not forget to set LibNGAP_Pics.PICS_OFFLINE_MODE to true +#system.NGAP_AMF.params := "NGAP/SCTP_FILE/IP_OFFLINE/PCAP_FILE(file=../captures/ttcn_5g_ngap.pcapng)" # Linux cooked capture v2, no Ethernet layer +#system.NGAP_AMF.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/TC_NGAP_AMF_PDU_01.pcap)" # regular pcap with Ethernet layer + +[DEFINE] +# In this section you can create macro definitions, +# that can be used in other configuration file sections except [INCLUDE] and [ORDERED_INCLUDE]. + +[INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[ORDERED_INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[EXTERNAL_COMMANDS] +# This section can define external commands (shell scripts) to be executed by the ETS +# whenever a control part or test case is started or terminated. + +#BeginTestCase := "" +#EndTestCase := "" +#BeginControlPart := "" +#EndControlPart := "" + +[EXECUTE] +# In this section you can specify what parts of your test suite you want to execute. +#AtsImsIot_TestControl.control + +# Verify that the IUT can send a PDU SESSION RESOURCE SETUP REQUEST with at least one PDU session resource list to established PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_01 +# Verify that the IUT successfully receives and processes the PDU_SESSION_RESOURCE_SETUP_RESPONSE message and completes the PDU Session Resource Setup procedure for a single PDU_Session_Resource. +#NGAP_TestCases.TC_NGAP_AMF_PDU_01_02 +# Verify that the IUT can send a PDU_SESSION_RESOURCE_RELEASE_COMMAND to release PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_02 +# Verify that the IUT successfully receives and processes the PDU_SESSION_RESOURCE_RELEASE_RESPONSE message and completes the PDU Session Resource Release procedure for a single PDU_Session_Resource. +#NGAP_TestCases.TC_NGAP_AMF_PDU_02_02 +# Verify that the IUT can send a PDU_SESSION_RESOURCE_MODIFY_REQUEST to modify PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_03 +# Verify that the AMF node successfully processes a PDU_SESSION_RESOURCE_MODIFY_INDICATION contains mandatory IEs and answers with PDU_SESSION_RESOURCE_MODIFY_CONFIRM for successfully modified PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_04 +# Verify that the AMF node processes a PDU_SESSION_RESOURCE_MODIFY_INDICATION contains mandatory IEs and answers with PDU_SESSION_RESOURCE_MODIFY_CONFIRM for not successfully modified PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_05 + +# Verify the IUT correctly sets the UE Context after Authentication and Security procedure has been executed +#NGAP_TestCases.TC_NGAP_AMF_CMP_01 +# Verify that the IUT can send a UE CONTEXT RELEASE COMMAND that contains both the AMF_UE_NGAP_ID IE and the RAN_UE_NGAP_ID IE or only AMF_UE_NGAP_ID +#NGAP_TestCases.TC_NGAP_AMF_CMP_02 +# Verify that the IUT sends a UE CONTEXT RELEASE COMMAND after UE_CONTEXT_RELEASE_REQUEST to release the UE-associated logic NG-connection due to NG-RAN node generated reasons +#NGAP_TestCases.TC_NGAP_AMF_CMP_03 +# Verify that the IUT can send a UE CONTEXT MODIFICATION REQUEST containing mandatory IEs +##NGAP_TestCases.TC_NGAP_AMF_CMP_04 +## Verify that the IUT can send a CONNECTION ESTABLISHMENT INDICATION that contains mandatory IEs +##NGAP_TestCases.TC_NGAP_AMF_CMP_05 +## Verify that the IUT can send an AMF CP RELOCATION INDICATION that contains mandatory IEs +##NGAP_TestCases.TC_NGAP_AMF_CMP_06 +## Verify that the IUT can successfully request UE information from the AMF +##NGAP_TestCases.TC_NGAP_AMF_CMP_07 +## Verify that the AMF node successfully processes a UE CONTEXT SUSPEND REQUEST containing mandatory IEs and answers with UE CONTEXT SUSPEND REQUEST RESPONSE with successfully suspend UE context +##NGAP_TestCases.TC_NGAP_AMF_CMP_08 +## Verify that the AMF node successfully processes a UE CONTEXT SUSPEND REQUEST containing mandatory IEs and answers with UE CONTEXT SUSPEND FAILURE with failed suspension +##NGAP_TestCases.TC_NGAP_AMF_CMP_09 +## Verify that the AMF node successfully processes a UE CONTEXT RESUME REQUEST containing mandatory IEs and answers with UE CONTEXT RESUME RESPONSE with successfully resume UE context +##NGAP_TestCases.TC_NGAP_AMF_CMP_10 +## Verify that the AMF node successfully processes a UE CONTEXT RESUME REQUEST containing mandatory IEs and answers with UE CONTEXT RESUME FAILURE with failing to resume UE context +##NGAP_TestCases.TC_NGAP_AMF_CMP_11 + +# Verify that the AMF node successfully processes a HANDOVER REQUIRED message contains mandatory IEs and answers with HANDOVER COMMAND with successfully handover. +#NGAP_TestCases.TC_NGAP_AMF_MMP_01 +# Verify that the AMF node successfully processes a HANDOVER REQUIRED message contains mandatory IEs and answers with HANDOVER PREPARATION FAILURE because the UE is not longer available. +#NGAP_TestCases.TC_NGAP_AMF_MMP_02 +# Verify that the AMF node successfully sends a HANDOVER REQUEST message that contains mandatory IEs to the GNB. +#NGAP_TestCases.TC_NGAP_AMF_MMP_03 +# Verify that the AMF node successfully processes a PATH SWITCH REQUEST message that contains mandatory IEs and answers with PATH SWITCH REQUEST ACKNOWLEDGE to acknowledge the path switch. +#NGAP_TestCases.TC_NGAP_AMF_MMP_04 +# Verify that the AMF node successfully processes a PATH SWITCH REQUEST message that contains mandatory IEs and two PDU Sessions with same ID and answers with PATH SWITCH REQUEST FAILURE. +#NGAP_TestCases.TC_NGAP_AMF_MMP_05 +# Verify that the AMF node successfully processes a HANDOVER CANCEL message that contains mandatory IEs and answers with HANDOVER CANCEL ACKNOWLEDGE to confirm that the ongoing handover was cancelled. +#NGAP_TestCases.TC_NGAP_AMF_MMP_06 +# Verify that the AMF node successfully sends a DOWNLINK RAN STATUS TRANSFER message that contains mandatory IEs. +#NGAP_TestCases.TC_NGAP_AMF_MMP_07 +# Verify that the NG-RAN node successfully sends a Handover Success message to the AMF. +#NGAP_TestCases.TC_NGAP_AMF_MMP_08 +# Verify that the AMF node successfully sends a DOWNLINK RAN EARLY STATUS TRANSFER message that contains mandatory IEs. +#NGAP_TestCases.TC_NGAP_AMF_MMP_09 + +# Verify that the IUT can send an DOWNLINK NAS TRANSPORT message to carry NAS information over the NG interface. +#NGAP_TestCases.TC_NGAP_AMF_NAS_01 + +# Verify that the AMF node successfully processes a NG SETUP REQEST message that contains mandatory IEs and answers with NG SETUP RESPONSE to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_01 +# Verify that the AMF node successfully processes an NG_SETUP_REQUEST message containing the PLMN identity, TAC, supported slice IEs and Extended RAN Node Name, and responds with an NG_SETUP_RESPONSE message to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_01_02 +# Verify that the AMF with IAB support successfully processes an NG_SETUP_REQUEST message containing the PLMN identity, TAC and supported slice IEs, and responds with an NG_SETUP_RESPONSE message containing IAB Supported IE to acknowledge the setup." +#NGAP_TestCases.TC_NGAP_AMF_IMP_01_03 +# Verify that the AMF node successfully processes a NG SETUP REQEST message that contains mandatory IEs and answers with NG SETUP RESPONSE to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_02 +# Verify that the AMF node successfully processes a NG SETUP REQEST message with optional field UE Retention Information and answers with NG SETUP RESPONSE to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_03 +# Verify that the AMF node successfully processes a NG SETUP REQEST message with different optional fields and answers with NG SETUP RESPONSE to acknowledge the setup. +NGAP_TestCases.TC_NGAP_AMF_IMP_04 +# Verify that the AMF node successfully processes a RAN_CONFIGURATION_UPDATE message containing new slice with RAN_CONFIGURATION_UPDATE_ACKNOWLEDGE to acknowledge the update with supported slice at AMF. +#NGAP_TestCases.TC_NGAP_AMF_IMP_05 +# Verify that the AMF node successfully declines a RAN CONFIGURATION UPDATE message with RAN CONFIGURATION UPDATE FAILURE when the AMF is not able to handle the request. +#NGAP_TestCases.TC_NGAP_AMF_IMP_06 +# Verify that the IUT can send a AMF CONFIGURATION UPDATE message to the AMF. +#NGAP_TestCases.TC_NGAP_AMF_IMP_07 +# Verify that the AMF node successfully processes a NG RESET message that contains mandatory IEs and answers with NG RESET ACKNOWLEDGE to acknowledge the reset. +#NGAP_TestCases.TC_NGAP_AMF_IMP_08 +# Verify that the AMF node successfully processes a partial NG_RESET message and answers with NG_RESET_ACKNOWLEDGE to acknowledge the partial reset. +#NGAP_TestCases.TC_NGAP_AMF_IMP_08_02 +# Verify that the AMF can send a ERROR INDICATION to the GNB when a error occurs. +#NGAP_TestCases.TC_NGAP_AMF_IMP_09 +# Verify that the AMF can send a AMF STATUS INDICATION to the GNB when a error occurs. +#NGAP_TestCases.TC_NGAP_AMF_IMP_10 +# Verify that the AMF can send a OVERLOAD START to the GNB. +#NGAP_TestCases.TC_NGAP_AMF_IMP_11 +# Verify that the AMF can send a OVERLOAD STOP to the GNB. +#NGAP_TestCases.TC_NGAP_AMF_IMP_12 + +[GROUPS] +# In this section you can specify groups of hosts. These groups can be used inside the +# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts. + +[COMPONENTS] +# This section consists of rules restricting the location of created PTCs. + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsNGAP/AtsNGAP_AMF_sintesio.cfg_ b/etc/AtsNGAP/AtsNGAP_AMF_sintesio.cfg_ new file mode 100644 index 0000000000000000000000000000000000000000..0e0176925defd5ba972b5e61a06a8e213bb2ab50 --- /dev/null +++ b/etc/AtsNGAP/AtsNGAP_AMF_sintesio.cfg_ @@ -0,0 +1,192 @@ +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# https://www.binaryhexconverter.com/hex-to-binary-converter + +NGAP_Pics.PICS_NGAP_AMF_IUT := true +NGAP_Pics.PICS_NGAP_GNB_IUT := false + +LibNGAP_Pics.PICS_OFFLINE_MODE := true # true for offline mode with pcap files, false for online mode with SCTP server + +LibNGAP_Pixits.PX_NAS_MCC := '001'H +LibNGAP_Pixits.PX_NAS_MNC := '01'H +LibNGAP_Pixits.PX_RAN_NODE_NAME := "UERANSIM-gnb-999-70-1" +LibNGAP_Pixits.PX_GNB_ID := '0000000000000000000001'B +LibNGAP_Pixits.PX_RAN_NODE_NAME := "UERANSIM-gnb-999-70-1" +LibNGAP_Pixits.PX_TACode := '000001'O +LibNGAP_Pixits.PX_SST := '01'O +LibNGAP_Pixits.PX_SD := '000009'O +LibNGAP_Pixits.PX_PAGING_DRX := v32 #v128 +LibNGAP_Pixits.PX_AMF_NAME := "Kontron5G-amf" +LibNGAP_Pixits.PX_AMF_REGION_ID := '00000001'B +LibNGAP_Pixits.PX_AMF_SET_ID := '0000000010'B +LibNGAP_Pixits.PX_AMF_POINTER := '011111'B +LibNGAP_Pixits.PX_RAN_UE_NGAP_ID := 1 +LibNGAP_Pixits.PX_AMF_UE_NGAP_ID := 4957 + +LibNGAP_Pixits.PX_PDU_SESSION_ID := 1 + +Lib_NG_NAS_Pixits.PX_CHECK_SECURITY := false +Lib_NG_NAS_Pixits.PX_SUPI_FORMAT := '0000'B # IMSI format +Lib_NG_NAS_Pixits.PX_TYPE_OF_ID := '001'B # SUCI type +Lib_NG_NAS_Pixits.PX_SUPI_DIGITS := '00f110214300014444330302'O +Lib_NG_NAS_Pixits.PX_MSIN := '0000000010'O; + +# OP +Lib_NG_NAS_Pixits.PX_OPERATOR_KEY := '00000000000000000000000000000000'O +# OPc +Lib_NG_NAS_Pixits.PX_OPERATOR_SECRET_KEY := 'E8ED289DEBA952E4283B54E88E6183CA'O +Lib_NG_NAS_Pixits.PX_FORCE_USING_OPERATOR_SECRET_KEY := true + +Lib_NG_NAS_Pixits.PX_SUBSCRIPTION_KEY := '01000110010110110101110011101000101100011001100110110100100111111010101001011111000010100010111011100010001110001010011010111100'B +Lib_NG_NAS_Pixits.PX_BEARER_ID := '00001'B + +Parameters.px_IMSI_Def := '393939373030303030303030303031'H # 999700000000001 +Parameters.px_IMEISV_Def := '73806121856151f1'H +NAS_5GC_Parameters.px_NAS_5GC_XRES_Length := 8 # In ETSI TS 135 206 V16.0.0 (2020-08) Table Table 5. f2 output, RES length is 8 octets (64 bits) + +[LOGGING] +# In this section you can specify the name of the log file and the classes of events +# you want to log into the file or display on console (standard error). + +LogFile := "../logs/AtsNGAP/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +#ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. + +# Open5GS AMF IP and port as listener +#system.NGAP_AMF.params := "NGAP/SCTP(server=127.0.0.5,port=38412,debug=1)" + +# Open5GS pcap files +system.NGAP_AMF.params := "NGAP/SCTP_FILE/IP_OFFLINE/PCAP_FILE(file=../captures/ttcn_5g_ngap.pcapng)" # Linux cooked capture v2, no Ethernet layer +#system.NGAP_AMF.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/open5gs.pcap)" # regular pcap with Ethernet layer + +[DEFINE] +# In this section you can create macro definitions, +# that can be used in other configuration file sections except [INCLUDE] and [ORDERED_INCLUDE]. + +[INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[ORDERED_INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[EXTERNAL_COMMANDS] +# This section can define external commands (shell scripts) to be executed by the ETS +# whenever a control part or test case is started or terminated. + +#BeginTestCase := "" +#EndTestCase := "" +#BeginControlPart := "" +#EndControlPart := "" + +[EXECUTE] +# In this section you can specify what parts of your test suite you want to execute. +#AtsImsIot_TestControl.control + +# Verify that the IUT can send a PDU SESSION RESOURCE SETUP REQUEST with at least one PDU session resource list to established PDU session. +NGAP_TestCases.TC_NGAP_AMF_PDU_01 +# Verify that the IUT can send a PDU_SESSION_RESOURCE_RELEASE_COMMAND to release PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_02 +# Verify that the IUT can send a PDU_SESSION_RESOURCE_MODIFY_REQUEST to modify PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_03 +# Verify that the AMF node successfully processes a PDU_SESSION_RESOURCE_MODIFY_INDICATION contains mandatory IEs and answers with PDU_SESSION_RESOURCE_MODIFY_CONFIRM for successfully modified PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_04 +# Verify that the AMF node processes a PDU_SESSION_RESOURCE_MODIFY_INDICATION contains mandatory IEs and answers with PDU_SESSION_RESOURCE_MODIFY_CONFIRM for not successfully modified PDU session. +#NGAP_TestCases.TC_NGAP_AMF_PDU_05 + +# Verify the IUT correctly sets the UE Context after Authentication and Security procedure has been executed +#NGAP_TestCases.TC_NGAP_AMF_CMP_01 +# Verify that the IUT can send a UE CONTEXT RELEASE COMMAND that contains both the AMF_UE_NGAP_ID IE and the RAN_UE_NGAP_ID IE or only AMF_UE_NGAP_ID +#NGAP_TestCases.TC_NGAP_AMF_CMP_02 +# Verify that the IUT sends a UE CONTEXT RELEASE COMMAND after UE_CONTEXT_RELEASE_REQUEST to release the UE-associated logic NG-connection due to NG-RAN node generated reasons +#NGAP_TestCases.TC_NGAP_AMF_CMP_03 +# Verify that the IUT can send a UE CONTEXT MODIFICATION REQUEST containing mandatory IEs +###########################################NGAP_TestCases.TC_NGAP_AMF_CMP_04 +# Verify that the IUT can send a CONNECTION ESTABLISHMENT INDICATION that contains mandatory IEs +#NGAP_TestCases.TC_NGAP_AMF_CMP_05 +# Verify that the IUT can send an AMF CP RELOCATION INDICATION that contains mandatory IEs +#NGAP_TestCases.TC_NGAP_AMF_CMP_06 +# Verify that the IUT can successfully request UE information from the AMF +#NGAP_TestCases.TC_NGAP_AMF_CMP_07 +# Verify that the AMF node successfully processes a UE CONTEXT SUSPEND REQUEST containing mandatory IEs and answers with UE CONTEXT SUSPEND REQUEST RESPONSE with successfully suspend UE context +#NGAP_TestCases.TC_NGAP_AMF_CMP_08 +# Verify that the AMF node successfully processes a UE CONTEXT SUSPEND REQUEST containing mandatory IEs and answers with UE CONTEXT SUSPEND FAILURE with failed suspension +#NGAP_TestCases.TC_NGAP_AMF_CMP_09 +# Verify that the AMF node successfully processes a UE CONTEXT RESUME REQUEST containing mandatory IEs and answers with UE CONTEXT RESUME RESPONSE with successfully resume UE context +#NGAP_TestCases.TC_NGAP_AMF_CMP_10 +# Verify that the AMF node successfully processes a UE CONTEXT RESUME REQUEST containing mandatory IEs and answers with UE CONTEXT RESUME FAILURE with failing to resume UE context +#NGAP_TestCases.TC_NGAP_AMF_CMP_11 + + + +# Verify that the AMF node successfully processes a HANDOVER REQUIRED message contains mandatory IEs and answers with HANDOVER COMMAND with successfully handover. +#NGAP_TestCases.TC_NGAP_AMF_MMP_01 +# Verify that the AMF node successfully processes a HANDOVER REQUIRED message contains mandatory IEs and answers with HANDOVER PREPARATION FAILURE because the UE is not longer available. +#NGAP_TestCases.TC_NGAP_AMF_MMP_02 +# Verify that the AMF node successfully sends a HANDOVER REQUEST message that contains mandatory IEs to the GNB. +#NGAP_TestCases.TC_NGAP_AMF_MMP_03 +# Verify that the AMF node successfully processes a PATH SWITCH REQUEST message that contains mandatory IEs and answers with PATH SWITCH REQUEST ACKNOWLEDGE to acknowledge the path switch. +#NGAP_TestCases.TC_NGAP_AMF_MMP_04 +# Verify that the AMF node successfully processes a PATH SWITCH REQUEST message that contains mandatory IEs and two PDU Sessions with same ID and answers with PATH SWITCH REQUEST FAILURE. +#NGAP_TestCases.TC_NGAP_AMF_MMP_05 +# Verify that the AMF node successfully processes a HANDOVER CANCEL message that contains mandatory IEs and answers with HANDOVER CANCEL ACKNOWLEDGE to confirm that the ongoing handover was cancelled. +#NGAP_TestCases.TC_NGAP_AMF_MMP_06 +# Verify that the AMF node successfully sends a DOWNLINK RAN STATUS TRANSFER message that contains mandatory IEs. +#NGAP_TestCases.TC_NGAP_AMF_MMP_07 +# Verify that the NG-RAN node successfully sends a Handover Success message to the AMF. +#NGAP_TestCases.TC_NGAP_AMF_MMP_08 +# Verify that the AMF node successfully sends a DOWNLINK RAN EARLY STATUS TRANSFER message that contains mandatory IEs. +#NGAP_TestCases.TC_NGAP_AMF_MMP_09 + +# Verify that the IUT can send an DOWNLINK NAS TRANSPORT message to carry NAS information over the NG interface. +#NGAP_TestCases.TC_NGAP_AMF_NAS_01 + +# Verify that the AMF node successfully processes a NG SETUP REQEST message that contains mandatory IEs and answers with NG SETUP RESPONSE to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_01 +# Verify that the AMF node successfully processes a NG SETUP REQEST message that contains mandatory IEs and answers with NG SETUP RESPONSE to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_02 +# Verify that the AMF node successfully processes a NG SETUP REQEST message with optional field UE Retention Information and answers with NG SETUP RESPONSE to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_03 +# Verify that the AMF node successfully processes a NG SETUP REQEST message with different optional fields and answers with NG SETUP RESPONSE to acknowledge the setup. +#NGAP_TestCases.TC_NGAP_AMF_IMP_04 +# Verify that the AMF node successfully processes a RAN CONFIGURATION UPDATE message with RAN CONFIGURATION UPDATE ACKNOWLEDGE to acknowledge the update. +#NGAP_TestCases.TC_NGAP_AMF_IMP_05 +# Verify that the AMF node successfully declines a RAN CONFIGURATION UPDATE message with RAN CONFIGURATION UPDATE FAILURE when the AMF is not able to handle the request. +#NGAP_TestCases.TC_NGAP_AMF_IMP_06 +# Verify that the IUT can send a AMF CONFIGURATION UPDATE message to the AMF. +#NGAP_TestCases.TC_NGAP_AMF_IMP_07 +# Verify that the AMF node successfully processes a NG RESET message that contains mandatory IEs and answers with NG RESET ACKNOWLEDGE to acknowledge the reset. +#NGAP_TestCases.TC_NGAP_AMF_IMP_08 +# Verify that the AMF can send a ERROR INDICATION to the GNB when a error occurs. +#NGAP_TestCases.TC_NGAP_AMF_IMP_09 +# Verify that the AMF can send a AMF STATUS INDICATION to the GNB when a error occurs. +#NGAP_TestCases.TC_NGAP_AMF_IMP_10 +# Verify that the AMF can send a OVERLOAD START to the GNB. +#NGAP_TestCases.TC_NGAP_AMF_IMP_11 +# Verify that the AMF can send a OVERLOAD STOP to the GNB. +#NGAP_TestCases.TC_NGAP_AMF_IMP_12 + +[GROUPS] +# In this section you can specify groups of hosts. These groups can be used inside the +# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts. + +[COMPONENTS] +# This section consists of rules restricting the location of created PTCs. + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsNGAP/AtsNGAP_GNB.cfg_ b/etc/AtsNGAP/AtsNGAP_GNB.cfg_ new file mode 100644 index 0000000000000000000000000000000000000000..05a2c7870bff9168fbc6a3cc7e2c84d0b0cb9318 --- /dev/null +++ b/etc/AtsNGAP/AtsNGAP_GNB.cfg_ @@ -0,0 +1,186 @@ +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +NGAP_Pics.PICS_NGAP_GNB_IUT := true +NGAP_Pics.PICS_NGAP_AMF_IUT := false + +LibNGAP_Pics.PICS_OFFLINE_MODE := true + +# 5GRegAuthSec_deReg.pcap +LibNGAP_Pixits.PX_AMF_NAME := "open5gs-amf0" +LibNGAP_Pixits.PX_RAN_UE_NGAP_ID := 1 +LibNGAP_Pixits.PX_AMF_UE_NGAP_ID := 1 +# https://www.binaryhexconverter.com/hex-to-binary-converter +LibNGAP_Pixits.PX_NAS_MCC := '999'H +LibNGAP_Pixits.PX_NAS_MNC := '70'H +LibNGAP_Pixits.PX_AMF_REGION_ID := '00000010'B +LibNGAP_Pixits.PX_AMF_SET_ID := '0000000100'B +LibNGAP_Pixits.PX_AMF_POINTER := '000000'B +LibNGAP_Pixits.PX_GNB_ID := '00000000000000000000000000000001'B +LibNGAP_Pixits.PX_RAN_NODE_NAME := "UERANSIM-gnb-999-70-1" +LibNGAP_Pixits.PX_TACode := '000001'O +LibNGAP_Pixits.PX_SST := '01'O +LibNGAP_Pixits.PX_SD := '000009'O +LibNGAP_Pixits.PX_PAGING_DRX := v128 + +Lib_NG_NAS_Pixits.PX_CHECK_SECURITY := false +Lib_NG_NAS_Pixits.PX_TYPE_OF_ID := '0001'B # SUCI format +Lib_NG_NAS_Pixits.PX_SUPI_DIGITS := '00f110214300014444330302'O +Lib_NG_NAS_Pixits.PX_SUCI_DIGITS := '0000000010'O; + +# OP +Lib_NG_NAS_Pixits.PX_OPERATOR_KEY := '00000000000000000000000000000000'O +# OPc +Lib_NG_NAS_Pixits.PX_OPERATOR_SECRET_KEY := 'E8ED289DEBA952E4283B54E88E6183CA'O +Lib_NG_NAS_Pixits.PX_FORCE_USING_OPERATOR_SECRET_KEY := true + +Lib_NG_NAS_Pixits.PX_SUBSCRIPTION_KEY := '01000110010110110101110011101000101100011001100110110100100111111010101001011111000010100010111011100010001110001010011010111100'B +Lib_NG_NAS_Pixits.PX_BEARER_ID := '00001'B + +Parameters.px_IMSI_Def := '393939373030303030303030303031'H; # 999700000000001 +NAS_5GC_Parameters.px_NAS_5GC_XRES_Length := 8 # In ETSI TS 135 206 V16.0.0 (2020-08) Table Table 5. f2 output, RES length is 8 octets (64 bits) + +[LOGGING] +# In this section you can specify the name of the log file and the classes of events +# you want to log into the file or display on console (standard error). + +LogFile := "../logs/AtsNGAP/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. + +# Open5GS AMF IP and port +#system.NGAP_gNB_1.params := "NGAP/SCTP(server=127.0.0.5,port=38412,debug=1)" +#system.N2_gNBaMF_P.params := "NGAP/SCTP(server=127.0.0.5,port=38412,debug=1)" + +system.NGAP_gNB_1.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/open5gs.pcap)" +system.N2_gNBaMF_P.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/open5gs.pcap)" + +[DEFINE] +# In this section you can create macro definitions, +# that can be used in other configuration file sections except [INCLUDE] and [ORDERED_INCLUDE]. + +[INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[ORDERED_INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[EXTERNAL_COMMANDS] +# This section can define external commands (shell scripts) to be executed by the ETS +# whenever a control part or test case is started or terminated. + +#BeginTestCase := "" +#EndTestCase := "" +#BeginControlPart := "" +#EndControlPart := "" + +[EXECUTE] +# In this section you can specify what parts of your test suite you want to execute. +#AtsImsIot_TestControl.control + +# Verify that the NG-RAN node successfully processes a PDU SESSION RESOURCE SETUP REQUEST contains mandatory IEs and answers with PDU SESSION RESOURCE SETUP RESPONSE for successfully established PDU session. +NGAP_TestCases.TC_NGAP_GNB_PDU_01 +# Verify that the NG-RAN node reports the establishment of the corresponding PDU session as failed if a PDU SESSION RESOURCE SETUP REQUEST contains several PDU Session ID IEs set to the same value. +#NGAP_TestCases.TC_NGAP_GNB_PDU_02 +# Verify that the NG-RAN node reports the establishment of the new PDU session as failed if a PDU SESSION RESOURCE SETUP REQUEST contains a PDU Session ID IE set to value that identifies an active PDU Session. NOTE: Run TP_NGAP_GNB_PDU_01 before this TP. +#NGAP_TestCases.TC_NGAP_GNB_PDU_03 +# Verify that the NG-RAN node reports the establishment of the corresponding PDU session as failed if a PDU SESSION RESOURCE SETUP REQUEST contains a QoS Flow Setup Request List IE in the PDU Session Resource Setup Request Transfer IE including at least one Non-GBR QoS flow but the PDU Session Aggregate Maximum Bit Rate IE is not present. +#NGAP_TestCases.TC_NGAP_GNB_PDU_04 +# Verify that the NG-RAN node successfully processes a PDU SESSION RESOURCE RELEASE COMMAND contains mandatory IEs and answers with PDU SESSION RESOURCE RELEASE RESPONSE to release PDU session. +#NGAP_TestCases.TC_NGAP_GNB_PDU_05 +# Verify that the NG-RAN node successfully processes a PDU SESSION RESOURCE RELEASE COMMAND containing multiple PDU Session ID IEs set to the same value and ignore the duplication. +#NGAP_TestCases.TC_NGAP_GNB_PDU_05 +# Verify that the NG-RAN node successfully processes a PDU SESSION RESOURCE MODIFY REQUEST contains mandatory IEs and answers with PDU SESSION RESOURCE MODIFY RESPONSE for successfully modified PDU session. +#NGAP_TestCases.TC_NGAP_GNB_PDU_07 +# Verify that the IUT can send a PDU_SESSION_RESOURCE_NOTIFY that already established QoS flow or PDU session for given UE are release. +#NGAP_TestCases.TC_NGAP_GNB_PDU_08 +# Verify that the IUT can send a PDU_SESSION_RESOURCE_MODIFY_INDICATION to request modification of established PDU session. +#NGAP_TestCases.TC_NGAP_GNB_PDU_09 + +# Verify that the IUT can send a HANDOVER REQUIRED message containing mandatory IEs. +#NGAP_TestCases.TC_NGAP_GNB_MMP_01 +# Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains mandatory IEs and answers with HANDOVER REQUEST ACKNOWLEDGE to acknowledge the handover. +#NGAP_TestCases.TC_NGAP_GNB_MMP_02 +# Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains mandatory IEs and answers with HANDOVER REQUEST FAILURE because the UE is not longer available. +#NGAP_TestCases.TC_NGAP_GNB_MMP_03 +# Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains optional IEs and answers with HANDOVER REQUEST ACKNOWLEDGE to acknowledge the handover. +#NGAP_TestCases.TC_NGAP_GNB_MMP_04 +# Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains optional IEs within the Handover Request Transfer IEs and answers with correct HANDOVER REQUEST ACKNOWLEDGE. +#NGAP_TestCases.TC_NGAP_GNB_MMP_05 +# Verify that the GNB node successfully processes a HANDOVER REQUEST message for an intra-system handover and answers with HANDOVER REQUEST ACKNOWLEDGE to acknowledge the handover. +#NGAP_TestCases.TC_NGAP_GNB_MMP_06 +# Verify that the AMF node successfully sends a HANDOVER NOTIFICATION message that contains mandatory IEs to the AMF. +#NGAP_TestCases.TC_NGAP_GNB_MMP_07 +# Verify that the AMF node successfully sends a PATH SWITCH REQUEST message that contains mandatory IEs to the AMF. +#NGAP_TestCases.TC_NGAP_GNB_MMP_08 +# Verify that the GNB node successfully sends a HANDOVER CANCEL message that contains mandatory IEs to the AMF. +#NGAP_TestCases.TC_NGAP_GNB_MMP_09 +# Verify that the NG-RAN node successfully send a UPLINK RAN STATUS TRANSFER message to the AMF. +#NGAP_TestCases.TC_NGAP_GNB_MMP_10 +# Verify that the NG-RAN node successfully sends a UPLINK RAN EARLY STATUS TRANSFER message to the AMF. +#NGAP_TestCases.TC_NGAP_GNB_MMP_11 + +# Verify that the IUT can send an INITIAL UE MESSAGE to indicate the initiation of a NAS Transport procedure. +#NGAP_TestCases.TC_NGAP_GNB_NAS_01 +# Verify that the IUT can send an UPLINK NAS TRANSPORT message to the AMF. +#NGAP_TestCases.TC_NGAP_GNB_NAS_02 +# Verify that the IUT can send a NAS NON DELIVERY INDICATION message to t.he AMF +#NGAP_TestCases.TC_NGAP_GNB_NAS_03 + +# Verify that the GNB node successfully sends a NG SETUP REQEST message to the AMF. +#NGAP_TestCases.TC_NGAP_GNB_IMP_01 +## Verify that the IUT can send a RAN CONFIGURATION UPDATE message to the AMF. +##NGAP_TestCases.TC_NGAP_GNB_IMP_02 +## Verify that the GNB node successfully processes a AMF CONFIGURATION UPDATE message with AMF CONFIGURATION UPDATE ACKNOWLEDGE to acknowledge the update. +##NGAP_TestCases.TC_NGAP_GNB_IMP_03 +## Verify that the GNB node can send a AMF CONFIGURATION UPDATE FAILURE. +##NGAP_TestCases.TC_NGAP_GNB_IMP_04 +# Verify that the GNB node successfully processes a NG RESET message that contains mandatory IEs and answers with NG RESET ACKNOWLEDGE to acknowledge the reset. +#NGAP_TestCases.TC_NGAP_GNB_IMP_05 +# Verify that the GNB node successfully processes a NG RESET message that contains mandatory IEs and answers with NG RESET ACKNOWLEDGE to acknowledge the reset. +#NGAP_TestCases.TC_NGAP_GNB_IMP_05_02 +## Verify that the GNB can send a ERROR INDICATION to the AMF when a error occurs. +##NGAP_TestCases.TC_NGAP_GNB_IMP_06 + +# Verify that the NG-RAN node successfully processes a WRITE-REPLACE WARNING REQUEST containing mandatory IEs and answers with WRITE-REPLACE WARNING RESPONSE to start broadcasting of warning messages. +#NGAP_TestCases.TC_NGAP_GNB_WTP_01 +# Verify that the NG-RAN node successfully processes a WRITE-REPLACE WARNING REQUEST containing Message Identifier IE and/or Serial Number IE different from those in the warning message being broadcast and if Concurent Warning Message Indicator is not present then IUT node answers with WRITE-REPLACE WARNING RESPONSE and replaces the warning message being broadcast with newly received one for that area. +#NGAP_TestCases.TC_NGAP_GNB_WTP_02 +# Verify that the NG-RAN node successfully processes a PWS CANCEL REQUEST containing mandatory IEs and answers with PWS CANCEL RESPONSE to cancel an already ongoing broadcast warning messages in all of the cells in the NG-RAN. +#NGAP_TestCases.TC_NGAP_GNB_WTP_03 +# Verify that the IUT can send a PWS RESTART INDICATION to inform AMF that PWS information for some or all cells may be reloaded from the CBC if needed. +#NGAP_TestCases.TC_NGAP_GNB_WTP_04 +# Verify that the IUT can send a PWS FAILURE INDICATION to inform AMF that ongoing PWS operation for one or more cells has failed. +#NGAP_TestCases.TC_NGAP_GNB_WTP_05 + +# Verify that the IUT can send a TRACE_FAILURE_INDICATION to inform AMF that Trace Start procedure has failed due to an interaction with handover procedure. +#NGAP_TestCases.TC_NGAP_GNB_TRP_01 +# Verify that the IUT can send a TRACE_FAILURE_INDICATION to inform AMF that a Deactivate Trace procedure has failed due to an interaction with handover procedure. +#NGAP_TestCases.TC_NGAP_GNB_TRP_02 +# Verify that the IUT can send a CELL_TRAFFIC_TRACE to send the allocated Trace Recording Session Reference and Trace Reference to AMF. +#NGAP_TestCases.TC_NGAP_GNB_TRP_03 + +[GROUPS] +# In this section you can specify groups of hosts. These groups can be used inside the +# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts. + +[COMPONENTS] +# This section consists of rules restricting the location of created PTCs. + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsNGAP/AtsNGAP_GNB_ueransim.cfg_ b/etc/AtsNGAP/AtsNGAP_GNB_ueransim.cfg_ new file mode 100644 index 0000000000000000000000000000000000000000..abfe52e1b8632041c2d757a1bbc720ea38b608a5 --- /dev/null +++ b/etc/AtsNGAP/AtsNGAP_GNB_ueransim.cfg_ @@ -0,0 +1,211 @@ +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +LibCommon_Time.PX_TDONE := 30.0; +LibCommon_Time.PX_TAC := 30.0; +LibCommon_Time.PX_TNOAC := 10.0; +LibCommon_Time.PX_TWAIT := 30.0; +LibCommon_Sync.PX_TSYNC_TIME_LIMIT := 10.0; +LibCommon_Sync.PX_TSHUT_DOWN_TIME_LIMIT := 10.0; + +NGAP_Pics.PICS_NGAP_AMF_IUT := false +NGAP_Pics.PICS_NGAP_GNB_IUT := true + +LibNGAP_Pics.PICS_OFFLINE_MODE := false # true for offline mode with pcap files, false for online mode with SCTP server +LibNGAP_Pics.PICS_USE_UERANSIMU := false # true to start UERANSIM gNB and UE simulators, false to not start them + +LibNGAP_Pixits.PX_NAS_MCC := '999'H +LibNGAP_Pixits.PX_NAS_MNC := '70'H +LibNGAP_Pixits.PX_RAN_NODE_NAME := "gnb0012345" +LibNGAP_Pixits.PX_GNB_ID := '00000000000000000000000000000001'B +LibNGAP_Pixits.PX_RAN_NODE_NAME := "UERANSIM-gnb-999-70-1" +LibNGAP_Pixits.PX_TACode := '000001'O +LibNGAP_Pixits.PX_SST := '01'O +LibNGAP_Pixits.PX_SD := '000009'O +LibNGAP_Pixits.PX_PAGING_DRX := v128 +LibNGAP_Pixits.PX_AMF_NAME := "open5gs-amf0" +LibNGAP_Pixits.PX_AMF_REGION_ID := '00000010'B +LibNGAP_Pixits.PX_AMF_SET_ID := '0000000001'B +LibNGAP_Pixits.PX_AMF_POINTER := '000000'B +LibNGAP_Pixits.PX_RAN_UE_NGAP_ID := 1 +LibNGAP_Pixits.PX_AMF_UE_NGAP_ID := 1 + +LibNGAP_Pixits.PX_TIME_ZONE := '80'O # 0x40 for GMT+1, 0x80 for GMT+2 + +LibNGAP_Pixits.PX_PDU_SESSION_ID := 1 + +LibNGAP_Pixits.PX_NR_ENCRYPTION_ALGORITHMS := '1110000000000000'B +LibNGAP_Pixits.PX_NR_INTEGRITY_PROTECTION_ALGORITHMS := '1110000000000000'B +LibNGAP_Pixits.PX_EUTRA_ENCRYPTION_ALGORITHMS := '1110000000000000'B +LibNGAP_Pixits.PX_EUTRA_INTEGRITY_PROTECTION_ALGORITHMS := '1110000000000000'B + +Lib_NG_NAS_Pixits.PX_CHECK_SECURITY := false +Lib_NG_NAS_Pixits.PX_SUPI_FORMAT := '0000'B # IMSI format +Lib_NG_NAS_Pixits.PX_TYPE_OF_ID := '001'B # SUCI type +Lib_NG_NAS_Pixits.PX_SUPI_DIGITS := '00f110214300014444330302'O +Lib_NG_NAS_Pixits.PX_MSIN := '0000000010'O; +Lib_NG_NAS_Pixits.PX_NETWORK_NAME := "Open5GS" + +# OP +Lib_NG_NAS_Pixits.PX_OPERATOR_KEY := '00000000000000000000000000000000'O +# OPc +Lib_NG_NAS_Pixits.PX_OPERATOR_SECRET_KEY := 'E8ED289DEBA952E4283B54E88E6183CA'O +Lib_NG_NAS_Pixits.PX_FORCE_USING_OPERATOR_SECRET_KEY := true +Lib_NG_NAS_Pixits.PX_SUBSCRIPTION_KEY := '01000110010110110101110011101000101100011001100110110100100111111010101001011111000010100010111011100010001110001010011010111100'B # 465B5CE8B199B49FAA5F0A2EE238A6BC +Lib_NG_NAS_Pixits.PX_BEARER_ID := '00001'B +Lib_NG_NAS_Pixits.PX_SQN := '000000000000000000000000000000000000001000000000'B +#Lib_NG_NAS_Pixits.PX_AMF := oct2bit('8000'O) +#Lib_NG_NAS_Pixits.PX_RAND_VALUE := oct2bit('23553cbe9637a89d218ae64dae47bf35'O) + +Parameters.px_IMSI_Def := '393939373030303030303030303031'H # 999700000000001 +Parameters.px_IMEISV_Def := '73806121856151f1'H +NAS_5GC_Parameters.px_NAS_5GC_XRES_Length := 8 # In ETSI TS 135 206 V16.0.0 (2020-08) Table Table 5. f2 output, RES length is 8 octets (64 bits) + +# Upper tester parameters for UERANSIM integration +LibNGAP_Pixits.PX_GNB_BINARY_FILE := "/home/yann/dev/UERANSIM/build/nr-gnb"; +LibNGAP_Pixits.PX_GNB_CONFIG_FILE := "/home/yann/dev/UERANSIM/config/open5gs-gnb.yaml"; +LibNGAP_Pixits.PX_UE_BINARY_FILE := "/home/yann/dev/UERANSIM/build/nr-ue"; +LibNGAP_Pixits.PX_UE_CONFIG_FILE := "/home/yann/dev/UERANSIM/config/open5gs-ue.yaml"; + +[LOGGING] +# In this section you can specify the name of the log file and the classes of events +# you want to log into the file or display on console (standard error). + +LogFile := "../logs/AtsNGAP/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. + +# Act as AMF, listen for incoming connections from gNB +system.NGAP_gNB_1.params := "NGAP/SCTP(local_server=127.0.0.5,server_mode=1,local_port=38412,debug=1)" + +# Open5GS pcap files +# Do not forget to set LibNGAP_Pics.PICS_OFFLINE_MODE to true +#system.NGAP_AMF.params := "NGAP/SCTP_FILE/IP_OFFLINE/PCAP_FILE(file=../captures/ttcn_5g_ngap.pcapng)" # Linux cooked capture v2, no Ethernet layer +#system.NGAP_AMF.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/TC_NGAP_AMF_PDU_01.pcap)" # regular pcap with Ethernet layer + +[DEFINE] +# In this section you can create macro definitions, +# that can be used in other configuration file sections except [INCLUDE] and [ORDERED_INCLUDE]. + +[INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[ORDERED_INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[EXTERNAL_COMMANDS] +# This section can define external commands (shell scripts) to be executed by the ETS +# whenever a control part or test case is started or terminated. + +#BeginTestCase := "" +#EndTestCase := "" +#BeginControlPart := "" +#EndControlPart := "" + +[EXECUTE] +# In this section you can specify what parts of your test suite you want to execute. +#AtsImsIot_TestControl.control + +# Verify that the GNB successfully processes a PDU_SESSION_RESOURCE_SETUP_REQUEST and answers with PDU_SESSION_RESOURCE_SETUP_RESPONSE for successfully established PDU session. +#NGAP_TestCases.TC_NGAP_GNB_PDU_01 +## Verify that the NG-RAN node reports the establishment of the corresponding PDU session as failed if a PDU SESSION RESOURCE SETUP REQUEST contains several PDU Session ID IEs set to the same value. +##NGAP_TestCases.TC_NGAP_GNB_PDU_02 +## Verify that the NG-RAN node reports the establishment of the new PDU session as failed if a PDU SESSION RESOURCE SETUP REQUEST contains a PDU Session ID IE set to value that identifies an active PDU Session. NOTE: Run TP_NGAP_GNB_PDU_01 before this TP. +##NGAP_TestCases.TC_NGAP_GNB_PDU_03 +## Verify that the NG-RAN node reports the establishment of the corresponding PDU session as failed if a PDU SESSION RESOURCE SETUP REQUEST contains a QoS Flow Setup Request List IE in the PDU Session Resource Setup Request Transfer IE including at least one Non-GBR QoS flow but the PDU Session Aggregate Maximum Bit Rate IE is not present. +##NGAP_TestCases.TC_NGAP_GNB_PDU_04 +## Verify that the NG-RAN node successfully processes a PDU SESSION RESOURCE RELEASE COMMAND contains mandatory IEs and answers with PDU SESSION RESOURCE RELEASE RESPONSE to release PDU session. +##NGAP_TestCases.TC_NGAP_GNB_PDU_05 +## Verify that the NG-RAN node successfully processes a PDU SESSION RESOURCE RELEASE COMMAND containing multiple PDU Session ID IEs set to the same value and ignore the duplication. +##NGAP_TestCases.TC_NGAP_GNB_PDU_05 +## Verify that the NG-RAN node successfully processes a PDU SESSION RESOURCE MODIFY REQUEST contains mandatory IEs and answers with PDU SESSION RESOURCE MODIFY RESPONSE for successfully modified PDU session. +##NGAP_TestCases.TC_NGAP_GNB_PDU_07 +## Verify that the IUT can send a PDU_SESSION_RESOURCE_NOTIFY that already established QoS flow or PDU session for given UE are release. +##NGAP_TestCases.TC_NGAP_GNB_PDU_08 +## Verify that the IUT can send a PDU_SESSION_RESOURCE_MODIFY_INDICATION to request modification of established PDU session. +##NGAP_TestCases.TC_NGAP_GNB_PDU_09 + +# Verify that the GNB successfully requests the AMF to release the UE-associated logical NG-connection due to user inactivity. +#NGAP_TestCases.TC_NGAP_GNB_CMP_07 +# Verify that the GNB successfully requests the AMF to release the UE-associated logical NG-connection after rejected registration procedure. +#NGAP_TestCases.TC_NGAP_GNB_CMP_07_02 + +## Verify that the IUT can send a HANDOVER REQUIRED message containing mandatory IEs. +##NGAP_TestCases.TC_NGAP_GNB_MMP_01 +## Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains mandatory IEs and answers with HANDOVER REQUEST ACKNOWLEDGE to acknowledge the handover. +##NGAP_TestCases.TC_NGAP_GNB_MMP_02 +## Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains mandatory IEs and answers with HANDOVER REQUEST FAILURE because the UE is not longer available. +##NGAP_TestCases.TC_NGAP_GNB_MMP_03 +## Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains optional IEs and answers with HANDOVER REQUEST ACKNOWLEDGE to acknowledge the handover. +##NGAP_TestCases.TC_NGAP_GNB_MMP_04 +## Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains optional IEs within the Handover Request Transfer IEs and answers with correct HANDOVER REQUEST ACKNOWLEDGE. +##NGAP_TestCases.TC_NGAP_GNB_MMP_05 +## Verify that the GNB node successfully processes a HANDOVER REQUEST message for an intra-system handover and answers with HANDOVER REQUEST ACKNOWLEDGE to acknowledge the handover. +##NGAP_TestCases.TC_NGAP_GNB_MMP_06 +## Verify that the AMF node successfully sends a HANDOVER NOTIFICATION message that contains mandatory IEs to the AMF. +##NGAP_TestCases.TC_NGAP_GNB_MMP_07 +## Verify that the AMF node successfully sends a PATH SWITCH REQUEST message that contains mandatory IEs to the AMF. +##NGAP_TestCases.TC_NGAP_GNB_MMP_08 +## Verify that the GNB node successfully sends a HANDOVER CANCEL message that contains mandatory IEs to the AMF. +##NGAP_TestCases.TC_NGAP_GNB_MMP_09 +## Verify that the NG-RAN node successfully send a UPLINK RAN STATUS TRANSFER message to the AMF. +##NGAP_TestCases.TC_NGAP_GNB_MMP_10 +## Verify that the NG-RAN node successfully sends a UPLINK RAN EARLY STATUS TRANSFER message to the AMF. +##NGAP_TestCases.TC_NGAP_GNB_MMP_11 + +## Verify that the IUT can send an INITIAL UE MESSAGE to indicate the initiation of a NAS Transport procedure. +##NGAP_TestCases.TC_NGAP_GNB_NAS_01 +## Verify that the IUT can send an UPLINK NAS TRANSPORT message to the AMF. +##NGAP_TestCases.TC_NGAP_GNB_NAS_02 +## Verify that the IUT can send a NAS NON DELIVERY INDICATION message to t.he AMF +##NGAP_TestCases.TC_NGAP_GNB_NAS_03 + +## Verify that the GNB sends an NG_SETUP_REQUEST message to the AMF after TNL establishment. +#NGAP_TestCases.TC_NGAP_GNB_IMP_01 +# Verify that the GNB successfully processes a full NG_RESET message and answers with NG_RESET_ACKNOWLEDGE to acknowledge the reset. +NGAP_TestCases.TC_NGAP_GNB_IMP_05 +# Verify that the GNB successfully processes a partial NG_RESET message and answers with NG_RESET_ACKNOWLEDGE to acknowledge the partial reset. +#NGAP_TestCases.TC_NGAP_GNB_IMP_05_02 + +## Verify that the NG-RAN node successfully processes a WRITE-REPLACE WARNING REQUEST containing mandatory IEs and answers with WRITE-REPLACE WARNING RESPONSE to start broadcasting of warning messages. +##NGAP_TestCases.TC_NGAP_GNB_WTP_01 +## Verify that the NG-RAN node successfully processes a WRITE-REPLACE WARNING REQUEST containing Message Identifier IE and/or Serial Number IE different from those in the warning message being broadcast and if Concurent Warning Message Indicator is not present then IUT node answers with WRITE-REPLACE WARNING RESPONSE and replaces the warning message being broadcast with newly received one for that area. +##NGAP_TestCases.TC_NGAP_GNB_WTP_02 +## Verify that the NG-RAN node successfully processes a PWS CANCEL REQUEST containing mandatory IEs and answers with PWS CANCEL RESPONSE to cancel an already ongoing broadcast warning messages in all of the cells in the NG-RAN. +##NGAP_TestCases.TC_NGAP_GNB_WTP_03 +## Verify that the IUT can send a PWS RESTART INDICATION to inform AMF that PWS information for some or all cells may be reloaded from the CBC if needed. +##NGAP_TestCases.TC_NGAP_GNB_WTP_04 +## Verify that the IUT can send a PWS FAILURE INDICATION to inform AMF that ongoing PWS operation for one or more cells has failed. +##NGAP_TestCases.TC_NGAP_GNB_WTP_05 + +# Verify that the IUT can send a TRACE_FAILURE_INDICATION to inform AMF that Trace Start procedure has failed due to an interaction with handover procedure. +#NGAP_TestCases.TC_NGAP_GNB_TRP_01 +# Verify that the IUT can send a TRACE_FAILURE_INDICATION to inform AMF that a Deactivate Trace procedure has failed due to an interaction with handover procedure. +#NGAP_TestCases.TC_NGAP_GNB_TRP_02 +# Verify that the IUT can send a CELL_TRAFFIC_TRACE to send the allocated Trace Recording Session Reference and Trace Reference to AMF. +#NGAP_TestCases.TC_NGAP_GNB_TRP_03 + +[GROUPS] +# In this section you can specify groups of hosts. These groups can be used inside the +# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts. + +[COMPONENTS] +# This section consists of rules restricting the location of created PTCs. + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/Ats_NG_NAS/AtsNGAP_AMF.cfg_ b/etc/Ats_NG_NAS/AtsNGAP_AMF.cfg_ index 9a5c40c22cc36e7e64ce6dea74fb6e8695e0304d..4f454190cff069f4e09c514a29b4617203966673 100644 --- a/etc/Ats_NG_NAS/AtsNGAP_AMF.cfg_ +++ b/etc/Ats_NG_NAS/AtsNGAP_AMF.cfg_ @@ -1,18 +1,63 @@ [MODULE_PARAMETERS] # This section shall contain the values of all parameters that are defined in your TTCN-3 modules. -#NAS_Pics.PICS_NAS_AMF_IUT := false -#NAS_Pics.PICS_NAS_AMF_IUT := true -NG_NAS_Pics.PICS_NGNAS := true - -# 5GRegAuthSec_deReg.pcap -LibNGAP_Pixits.PX_AMF_NAME := "Kontron5G-amf" -LibNGAP_Pixits.PX_RAN_UE_NGAP_ID := 0 -LibNGAP_Pixits.PX_AMF_UE_NGAP_ID := 22 -LibNGAP_Pixits.PX_PLMN_IDENTITY := '00f110'O - -Lib_NG_NAS_Pixits.PX_SUPI_FORMAT := '0000'B -Lib_NG_NAS_Pixits.PX_SUPI_DIGITS := '00f110214300014444330302'O +LibCommon_Time.PX_TDONE := 30.0; +LibCommon_Time.PX_TAC := 30.0; +LibCommon_Time.PX_TNOAC := 10.0; +LibCommon_Time.PX_TWAIT := 30.0; +LibCommon_Sync.PX_TSYNC_TIME_LIMIT := 10.0; +LibCommon_Sync.PX_TSHUT_DOWN_TIME_LIMIT := 10.0; + +NGAP_Pics.PICS_NGAP_AMF_IUT := true +NGAP_Pics.PICS_NGAP_GNB_IUT := false + +NG_NAS_Pics.PICS_NGNAS := true + +LibNGAP_Pics.PICS_OFFLINE_MODE := false # true to use offline mode with pcap files, false to use online mode with real network functions +LibNGAP_Pics.PICS_USE_OPEN5GS := false # true to start open5gs, false to not start them + +LibNGAP_Pixits.PX_NAS_MCC := '999'H +LibNGAP_Pixits.PX_NAS_MNC := '70'H +LibNGAP_Pixits.PX_RAN_NODE_NAME := "gnb0012345" +LibNGAP_Pixits.PX_GNB_ID := '00000000000000000000000000000001'B +LibNGAP_Pixits.PX_RAN_NODE_NAME := "UERANSIM-gnb-999-70-1" +LibNGAP_Pixits.PX_TACode := '000001'O +LibNGAP_Pixits.PX_SST := '01'O +LibNGAP_Pixits.PX_SD := '000009'O +LibNGAP_Pixits.PX_PAGING_DRX := v128 +LibNGAP_Pixits.PX_AMF_NAME := "open5gs-amf0" +LibNGAP_Pixits.PX_AMF_REGION_ID := '00000010'B +LibNGAP_Pixits.PX_AMF_SET_ID := '0000000001'B +LibNGAP_Pixits.PX_AMF_POINTER := '000000'B +LibNGAP_Pixits.PX_RAN_UE_NGAP_ID := 1 +LibNGAP_Pixits.PX_AMF_UE_NGAP_ID := 2 + +LibNGAP_Pixits.PX_TIME_ZONE := '80'O # 0x40 for GMT+1, 0x80 for GMT+2 + +LibNGAP_Pixits.PX_PDU_SESSION_ID := 1 + +Lib_NG_NAS_Pixits.PX_CHECK_SECURITY := false +Lib_NG_NAS_Pixits.PX_SUPI_FORMAT := '0000'B # IMSI format +Lib_NG_NAS_Pixits.PX_TYPE_OF_ID := '001'B # SUCI type +Lib_NG_NAS_Pixits.PX_SUPI_DIGITS := '00f110214300014444330302'O +Lib_NG_NAS_Pixits.PX_MSIN := '0000000010'O; +Lib_NG_NAS_Pixits.PX_NETWORK_NAME := "Open5GS" + +# OP +Lib_NG_NAS_Pixits.PX_OPERATOR_KEY := '00000000000000000000000000000000'O +# OPc +Lib_NG_NAS_Pixits.PX_OPERATOR_SECRET_KEY := 'E8ED289DEBA952E4283B54E88E6183CA'O +Lib_NG_NAS_Pixits.PX_FORCE_USING_OPERATOR_SECRET_KEY := true + +Lib_NG_NAS_Pixits.PX_SUBSCRIPTION_KEY := '01000110010110110101110011101000101100011001100110110100100111111010101001011111000010100010111011100010001110001010011010111100'B +Lib_NG_NAS_Pixits.PX_BEARER_ID := '00001'B + +Parameters.px_IMSI_Def := '393939373030303030303030303031'H # 999700000000001 +Parameters.px_IMEISV_Def := '73806121856151f1'H +NAS_5GC_Parameters.px_NAS_5GC_XRES_Length := 8 # In ETSI TS 135 206 V16.0.0 (2020-08) Table Table 5. f2 output, RES length is 8 octets (64 bits) + +# Upper tester parameters for UERANSIM integration +LibNGAP_Pixits.PX_OPEN5GS_BINARY_FILE := "/home/yann/dev/open5gs/build/tests/app/5gc" [LOGGING] # In this section you can specify the name of the log file and the classes of events @@ -30,9 +75,14 @@ LogEventTypes:= Yes [TESTPORT_PARAMETERS] # In this section you can specify parameters that are passed to Test Ports. -system.NGAP_gNB_1.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/5GRegAuthSec_deReg.pcap)" -system.N2_gNBaMF_P.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/5GRegAuthSec_deReg.pcap)" -#aMFNASComponent.N2_gNBaMF_P.params := "NAS/SCTP_FILE/IP_FILE/ETH/PCAP_FILE(file=../captures/free5gc.pcap)" + +# Open5GS AMF IP and port as listener +system.NGAP_AMF.params := "NGAP/SCTP(server=127.0.0.5,port=38412,debug=1)" + +# Open5GS pcap files +# Do not forget to set LibNGAP_Pics.PICS_OFFLINE_MODE to true +#system.NGAP_AMF.params := "NGAP/SCTP_FILE/IP_OFFLINE/PCAP_FILE(file=../captures/ttcn_5g_ngap.pcapng)" # Linux cooked capture v2, no Ethernet layer +#system.NGAP_AMF.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0,mac_dst=8c554ac1eee1)/PCAP_FILE(file=../captures/TC_NGAP_AMF_PDU_01.pcap)" # regular pcap with Ethernet layer [DEFINE] # In this section you can create macro definitions, @@ -59,14 +109,23 @@ system.N2_gNBaMF_P.params := "NGAP/SCTP_FILE/IP_OFFLINE/ETH(mac_src=8c554ac1eee0 # In this section you can specify what parts of your test suite you want to execute. #AtsImsIot_TestControl.control +# Verify that the IUT sends an AUTHENTICATION REQUEST message correctly upon receipt of a NAS Registration without an active security context #NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_01 +# Verify that the IUT sends an AUTHENTICATION_REJECT message upon receipt of an AUTHENTICATION_RESPONSE containing an invalid authentication response value, when the UE was identified with SUCI in the initial NAS message #NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_02 +# Verify that the IUT stops re-sending an AUTHENTICATION_REQUEST message if no AUTHENTICATION_RESPONSE message is received on the fifth expire of timer T3560 #NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_03 +# Verify that the IUT sends an IDENTITY_REQUEST message correctly upon receipt of an AUTHENTICATION_FAILURE message indicating a 5GMM cause value #20 - MAC failure #NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_04 -#NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_05 +# Verify that the IUT sends a new AUTHENTICATION_REQUEST message with new ngKSI value to re-initiate the 5G AKA based primary authentication upon receipt of an AUTHENTICATION_FAILURE message indicating a 5GMM cause value #71 - ngKSI already in use +NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_05 +# Verify that the IUT sends an IDENTITY_REQUEST message to obtain the SUCI from the UE upon receipt of an AUTHENTICATION_FAILURE message indicating a 5GMM cause value #26 - non-5G authentication unacceptable #NG_NAS_TestCases.TC_5GNAS_AMF_AUT_ABN_01 -NG_NAS_TestCases.TC_NGNAS_AMF_AUT_SEQ_01 +# Verify that the IUT sends a SECURITY MODE COMMAND message correctly to indicate NAS security mode procedure upon receipt of a NAS AUTHENTICATION RESPONSE +#NG_NAS_TestCases.TC_5GNAS_AMF_SEC_COM_01 +# Verify that the IUT, upon receiving the NAS SECURITY MODE COMPLETE message after completing the NAS Authentication and Security procedure, successfully completes the registration process by accepting the registration #NG_NAS_TestCases.TC_5GNAS_AMF_SEC_ACC_01 +# Verify that the IUT, upon receiving the NAS SECURITY MODE REJECT Message after a failed NAS Authentication and security procedure, successfully aborts the registration process by rejecting the registration #NG_NAS_TestCases.TC_5GNAS_AMF_SEC_REJ_01 #NG_NAS_TestCases.TC_5GNAS_AMF_DLN_ACC_01 #NG_NAS_TestCases.TC_5GNAS_AMF_REG_ACC_01 @@ -82,6 +141,67 @@ NG_NAS_TestCases.TC_NGNAS_AMF_AUT_SEQ_01 #NG_NAS_TestCases.TC_5GNAS_AMF_DRG_REQ_02 #NG_NAS_TestCases.TC_5GNAS_AMF_DRG_REQ_03 +# Security function tests, out of scope of the Ats_NG_NAS test suite, but useful to verify the correctness of the test implementation and the security functions used in the test suite. These tests are based on the 5G AKA test vectors given in 3GPP TS 35.208 V16.0.0 (2020-09) Annex A, and on the security analysis of 5G authentication given in the Eurecom publication "Security Analysis of 5G Authentication" (https://eprint.iacr.org/2022/1623.pdf) +#NG_NAS_TestCases.TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_01_01 +#NG_NAS_TestCases.TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_01_02 +#NG_NAS_TestCases.TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_01_03 +#NG_NAS_TestCases.TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_01_04 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_02_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_02_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_02_03 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_03 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_04_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_04_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_04_03 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_05_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_05_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_05_03 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_06_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_06_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_07_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_07_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_08_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_08_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_09_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_09_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_10_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_10_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_11 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_12_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_12_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_13 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_14_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_14_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_15_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_16_01 +# Eurecom publiction "Security Analysis of 5G Authentication" +# https://eprint.iacr.org/2022/1623.pdf +# Verdict fail +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_03 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_04 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_04 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_18_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_19_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_20_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_21_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_22_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_23_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_24_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_01_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_01_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_02_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_03_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_01_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_01_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_01_03 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_02_02 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_03_01 +#NG_NAS_TestCases.TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_27_01 + + [GROUPS] # In this section you can specify groups of hosts. These groups can be used inside the # [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts. diff --git a/etc/Ats_NG_NAS/AtsNGAP_GNB.cgf_ b/etc/Ats_NG_NAS/AtsNGAP_GNB.cfg_ similarity index 100% rename from etc/Ats_NG_NAS/AtsNGAP_GNB.cgf_ rename to etc/Ats_NG_NAS/AtsNGAP_GNB.cfg_ diff --git a/install.sh b/install.sh index e05d3d56f72b8f973c2a7aefec1eb4bc4ff990b4..09e128d606304211dacb70608debbb3c55071e57 100755 --- a/install.sh +++ b/install.sh @@ -5,9 +5,6 @@ set -vx BASE_PATH=`pwd` -git checkout devel -git submodule update --init --recursive --remote - if [ ! -d ./titan-test-system-framework ] then git clone --recurse-submodules --branch devel https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git @@ -22,11 +19,13 @@ fi cd $BASE_PATH ln -f ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/ -# TODO Add other patch +cd $BASE_PATH cd ./ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module/src -git apply ../../../../patch_abstract_socket/Abstract_Socket.hh.patch -git apply ../../../../patch_abstract_socket/Abstract_Socket.cc.patch +patch -i ../../../../patch_abstract_socket/Abstract_Socket.hh.patch Abstract_Socket.hh +patch -i ../../../../patch_abstract_socket/Abstract_Socket.cc.patch Abstract_Socket.cc cd $BASE_PATH +# TODO Add other patch + exit 0 diff --git a/scripts/run_all.bash b/scripts/run_all.bash index f5fe4490ed33e548810b911615a0299df7d2a264..315ff1594cbe7db4c027f686b645deefb8d310f4 100755 --- a/scripts/run_all.bash +++ b/scripts/run_all.bash @@ -55,6 +55,8 @@ do fi done +stty sane + exit 0 diff --git a/scripts/run_ptcs.bash b/scripts/run_ptcs.bash index 1c097d445d09ed82c6c8e934e7e57c03fe142474..1f319e6a4355c1651772707ef5be5c23f2301616 100755 --- a/scripts/run_ptcs.bash +++ b/scripts/run_ptcs.bash @@ -26,11 +26,8 @@ then rm -f ./core fi -if [ "$ATS" == "AtsRSUsSimulator" ] -then - sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH ../bin/$ATS 127.0.0.1 12001 -else - sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH ../bin/$ATS 127.0.0.1 12000 -fi +LOCAL_ADDRESS=`cat ../etc/$ATS/$ATS.cfg | grep 'LocalAddress := ' | awk '{print $3}'` +PORT=`cat ../etc/$ATS/$ATS.cfg | grep 'TCPPort := ' | awk '{print $3}'` +sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH ../bin/$ATS $LOCAL_ADDRESS $PORT cd ${CURPWD} diff --git a/test_purposes/NGAP_Common.tdltx b/test_purposes/NGAP_Common.tdltx new file mode 100644 index 0000000000000000000000000000000000000000..a6c97f9a7a06e8868a9cc293fcbcc548d13e866e --- /dev/null +++ b/test_purposes/NGAP_Common.tdltx @@ -0,0 +1,326 @@ +Package NGAP_Common { + + Import all from TDL + + // Configurations + + Entity UE + Entity GNB + Entity AMF + Entity IUT + + Type NgapMessage + Message Gate Ngap_Port accepts NgapMessage + + Component node { + gate Ngap_Port g + } + + Configuration CF_AMF_N2 { + node GNB as Tester, + node IUT as SUT, + connect GNB::g to IUT::g + } + + Configuration CF_GNB_N2 { + node AMF as Tester, + node IUT as SUT, + connect AMF::g to IUT::g + } + + // Common events + Event send + Event sends + Event receives + Event accepts + Event aborts + + + //TP_AMF NGAP events + Event hasActiveUeNgapContext //The AMF maintains a valid UE NGAP context identified by the AMF UE NGAP ID and RAN UE NGAP ID and associated with an active UE-associated logical NG-connection towards the NG-RAN node. + Event hasEstablished_NG_C_AssociationToAMF //An NG-C (NGAP) association exists between the gNB and AMF, reached after successful NG Setup procedure. + Event hasEstablishedInitialContext //The UE context is established in the gNB after successful Initial Context Setup procedure triggered by the AMF. + Event hasEstablishedPduSessionResourceForTheConcernedPduSessionId //The AMF maintains an established PDU Session Resource in the UE NGAP context for the concerned PDU Session ID following a successful PDU Session Resource Setup procedure. + Event hasEstablishedTNL_AssociationToAMF //A transport-layer (SCTP) association between gNB and AMF is established before any NGAP procedures. + Event hasNoPduSessionResourceEstablishedForTheConcernedPduSessionId //The AMF does not maintain any established PDU Session Resource in the UE NGAP context for the concerned PDU Session ID, and no NGAP PDU Session Resource Setup procedure is ongoing for that PDU Session ID. + Event hasNotEstablished_NG_C_AssociationToAMF //No NG-C (NGAP) association exists between the gNB and AMF. + Event hasSentPDU_SESSION_RESOURCE_RELEASE_COMMAND //The AMF has transmitted a PDU_SESSION_RESOURCE_RELEASE_COMMAND message to the NG-RAN node for the concerned UE and is awaiting the corresponding PDU_SESSION_RESOURCE_RELEASE_RESPONSE. + Event hasSentPDU_SESSION_RESOURCE_SETUP_REQUEST //The AMF has transmitted a PDU_SESSION_RESOURCE_SETUP_REQUEST message to the NG-RAN node for the concerned UE and is awaiting the corresponding PDU_SESSION_RESOURCE_SETUP_RESPONSE. + Event initiatesPduSessionResourceModificationToAddQoSFlow //AMF initiates PDU_SESSION_RESOURCE_MODIFY_REQUEST to add the QoS flow for already established PDU session. + Event isInCM_CONNECTED //UE is in CM_CONNECTED state + Event isNotRegisteredToAMF //The UE has no active 5G registration with the AMF. + Event isRegisteredToAMF //The UE has completed the 5G Registration procedure and received a Registration Accept from the AMF. + Event processTheUENasDeregistration //UE performs the NAS Deregistration signalling to release its registration and associated contexts from the AMF. + + + //TP_gNB NGAP events + Event hasEstablished_NG_C_AssociationToAMF //An NG-C (NGAP) association exists between the gNB and AMF, reached after successful NG Setup procedure. + Event hasEstablishedPDUsession //The AMF maintains an established PDU Session Resource in the UE NGAP context for the concerned PDU Session ID following a successful PDU Session Resource Setup procedure. + Event hasSuccessfullyEstablishedTNLconnection //A transport network layer (TNL) connection is successfully established after completion of the SCTP association setup between the gNB and the AMF. + Event havingSentPDUSessionEstablishment //The UE has sent a PDU Session Establishment Request and is awaiting the network response. + Event isRegisteredToAMF //The UE has completed the 5G Registration procedure and received a Registration Accept from the AMF. + Event u_Plane_inactivity_timer_expires //The user-plane inactivity timer expires when no uplink or downlink user-plane traffic is detected for a configured duration. + + // NGAP messages + //Table 8.1-1 + NgapMessage AMF_CONFIGURATION_UPDATE + NgapMessage AMF_CONFIGURATION_UPDATE_ACKNOWLEDGE + NgapMessage AMF_CONFIGURATION_UPDATE_FAILURE + NgapMessage RAN_CONFIGURATION_UPDATE + NgapMessage RAN_CONFIGURATION_UPDATE_ACKNOWLEDGE + NgapMessage RAN_CONFIGURATION_UPDATE_FAILURE + NgapMessage HANDOVER_CANCEL + NgapMessage HANDOVER_CANCEL_ACKNOWLEDGE + NgapMessage HANDOVER_REQUIRED + NgapMessage HANDOVER_COMMAND + NgapMessage HANDOVER_PREPARATION_FAILURE + NgapMessage HANDOVER_REQUEST + NgapMessage HANDOVER_REQUEST_ACKNOWLEDGE + NgapMessage HANDOVER_FAILURE + NgapMessage INITIAL_CONTEXT_SETUP_REQUEST + NgapMessage INITIAL_CONTEXT_SETUP_RESPONSE + NgapMessage INITIAL_CONTEXT_SETUP_FAILURE + NgapMessage NG_RESET + NgapMessage NG_RESET_ACKNOWLEDGE + NgapMessage NG_SETUP_REQUEST + NgapMessage NG_SETUP_RESPONSE + NgapMessage NG_SETUP_FAILURE + NgapMessage PATH_SWITCH_REQUEST + NgapMessage PATH_SWITCH_REQUEST_ACKNOWLEDGE + NgapMessage PATH_SWITCH_REQUEST_FAILURE + NgapMessage PDU_SESSION_RESOURCE_MODIFY_REQUEST + NgapMessage PDU_SESSION_RESOURCE_MODIFY_RESPONSE + NgapMessage PDU_SESSION_RESOURCE_MODIFY_INDICATION + NgapMessage PDU_SESSION_RESOURCE_MODIFY_CONFIRM + NgapMessage PDU_SESSION_RESOURCE_RELEASE_COMMAND + NgapMessage PDU_SESSION_RESOURCE_RELEASE_RESPONSE + NgapMessage PDU_SESSION_RESOURCE_SETUP_REQUEST + NgapMessage PDU_SESSION_RESOURCE_SETUP_RESPONSE + NgapMessage UE_CONTEXT_MODIFICATION_REQUEST + NgapMessage UE_CONTEXT_MODIFICATION_RESPONSE + NgapMessage UE_CONTEXT_MODIFICATION_FAILURE + NgapMessage UE_CONTEXT_RELEASE_COMMAND + NgapMessage UE_CONTEXT_RELEASE_COMPLETE + NgapMessage WRITE_REPLACE_WARNING_REQUEST + NgapMessage WRITE_REPLACE_WARNING_RESPONSE + NgapMessage PWS_CANCEL_REQUEST + NgapMessage PWS_CANCEL_RESPONSE + NgapMessage UE_RADIO_CAPABILITY_CHECK_REQUEST + NgapMessage UE_RADIO_CAPABILITY_CHECK_RESPONSE + NgapMessage UE_CONTEXT_SUSPEND_REQUEST + NgapMessage UE_CONTEXT_SUSPEND_RESPONSE + NgapMessage UE_CONTEXT_SUSPEND_FAILURE + NgapMessage UE_CONTEXT_RESUME_REQUEST + NgapMessage UE_CONTEXT_RESUME_RESPONSE + NgapMessage UE_CONTEXT_RESUME_FAILURE + NgapMessage UE_RADIO_CAPABILITY_ID_MAPPING_REQUEST + NgapMessage UE_RADIO_CAPABILITY_ID_MAPPING_RESPONSE + + //Table 8.1-2 + NgapMessage DOWNLINK_RAN_CONFIGURATION_TRANSFER + NgapMessage DOWNLINK_RAN_STATUS_TRANSFER + NgapMessage DOWNLINK_NAS_TRANSPORT + NgapMessage ERROR_INDICATION + NgapMessage UPLINK_RAN_CONFIGURATION_TRANSFER + NgapMessage UPLINK_RAN_STATUS_TRANSFER + NgapMessage HANDOVER_NOTIFY + NgapMessage INITIAL_UE_MESSAGE + NgapMessage NAS_NON_DELIVERY_INDICATION + NgapMessage PAGING + NgapMessage PDU_SESSION_RESOURCE_NOTIFY + NgapMessage REROUTE_NAS_REQUEST + NgapMessage UE_CONTEXT_RELEASE_REQUEST + NgapMessage UPLINK_NAS_TRANSPORT + NgapMessage AMF_STATUS_INDICATION + NgapMessage PWS_RESTART_INDICATION + NgapMessage PWS_FAILURE_INDICATION + NgapMessage DOWNLINK_UE_ASSOCIATED_NRPPA_TRANSPORT + NgapMessage UPLINK_UE_ASSOCIATED_NRPPA_TRANSPORT + NgapMessage DOWNLINK_NON_UE_ASSOCIATED_NRPPA_TRANSPORT + NgapMessage UPLINK_NON_UE_ASSOCIATED_NRPPA_TRANSPORT + NgapMessage TRACE_START + NgapMessage TRACE_FAILURE_INDICATION + NgapMessage DEACTIVATE_TRACE + NgapMessage CELL_TRAFFIC_TRACE + NgapMessage LOCATION_REPORTING_CONTROL + NgapMessage LOCATION_REPORTING_FAILURE_INDICATION + NgapMessage LOCATION_REPORT + NgapMessage UE_TNLA_BINDING_RELEASE_REQUEST + NgapMessage UE_RADIO_CAPABILITY_INFO_INDICATION + NgapMessage RRC_INACTIVE_TRANSITION_REPORT + NgapMessage OVERLOAD_START + NgapMessage OVERLOAD_STOP + NgapMessage SECONDARY_RAT_DATA_USAGE_REPORT + NgapMessage UPLINK_RIM_INFORMATION_TRANSFER + NgapMessage DOWNLINK_RIM_INFORMATION_TRANSFER + NgapMessage RETRIEVE_UE_INFORMATION + NgapMessage UE_INFORMATION_TRANSFER + NgapMessage RAN_CP_RELOCATION_INDICATION + NgapMessage CONNECTION_ESTABLISHMENT_INDICATION + NgapMessage AMF_CP_RELOCATION_INDICATION + NgapMessage HANDOVER_SUCCESS + NgapMessage UPLINK_RAN_EARLY_STATUS_TRANSFER + NgapMessage DOWNLINK_RAN_EARLY_STATUS_TRANSFER + + NgapMessage SECURITY_MODE_COMPLETE + NgapMessage SECURITY_MODE_REJECT + + // PICS + PICS PICS_A2_1 //NG RAN + PICS PICS_A2_1_1 //gNB + PICS PICS_A2_1_2 //ng-eNB + PICS PICS_A2_2 //AMF + PICS PICS_A3_1_1 //gNB - PDU session management procedure - PDU SESSION RESOURCE SETUP REQUEST + PICS PICS_A3_1_2 //gNB - PDU session management procedure - PDU SESSION RESOURCE RELEASE COMMAND + PICS PICS_A3_1_3 //gNB - PDU session management procedure - PDU SESSION RESOURCE MODIFY REQUEST + PICS PICS_A3_1_4 //gNB - PDU session management procedure - PDU SESSION RESOURCE MODIFY NOTIFY + PICS PICS_A3_1_5 //gNB - PDU session management procedure - PDU SESSION RESOURCE MODIFY INDICATION + PICS PICS_A3_2_1 //gnB - UE Context Management Procedures - INITIAL CONTEXT SETUP REQUEST + PICS PICS_A3_2_2 //gnB - UE Context Management Procedures - UE CONTEXT RELEASE REQUEST + PICS PICS_A3_2_3 //gnB - UE Context Management Procedures - UE CONTEXT RELEASE COMMAND + PICS PICS_A3_2_4 //gnB - UE Context Management Procedures - UE CONTEXT MODIFICATION REQUEST + PICS PICS_A3_2_5 //gnB - UE Context Management Procedures - RRC INACTIVE TRANSITION REPORT + PICS PICS_A3_2_8 //gnB - UE Context Management Procedures - RAN CP Relocation Indication + PICS PICS_A3_2_11 //gnB - UE Context Management Procedures - UE CONTEXT SUSPEND REQUEST + PICS PICS_A3_2_12 //gnB - UE Context Management Procedures - UE CONTEXT RESUME REQUEST + PICS PICS_A3_3_1 //gnB - UE Mobility Management Procedures - HANDOVER REQUIRED + PICS PICS_A3_3_2 //gnB - UE Mobility Management Procedures - HANDOVER REQUEST + PICS PICS_A3_3_3 //gnB - UE Mobility Management Procedures - HANDOVER NOTIFY + PICS PICS_A3_3_4 //gnB - UE Mobility Management Procedures - PATH SWITCH REQUEST + PICS PICS_A3_3_5 //gnB - UE Mobility Management Procedures - HANDOVER CANCEL + PICS PICS_A3_3_6 //gnB - UE Mobility Management Procedures - UPLINK RAN STATUS TRANSFER + PICS PICS_A3_3_8 //gnB - UE Mobility Management Procedures - HANDOVER SUCCESS + PICS PICS_A3_3_9 //gnB - UE Mobility Management Procedures - UPLINK RAN EARLY STATUS TRANSFER + PICS PICS_A3_5_1 //gNB - Transport of NAS Messages Procedures - INITIAL UE MESSAGE + PICS PICS_A3_5_3 //gNB - Transport of NAS Messages Procedures - UPLINK NAS TRANSPORT + PICS PICS_A3_5_4 //gNB - Transport of NAS Messages Procedures - NAS NON DELIVERY INDICATION + PICS PICS_A3_6_1 //gNB - Interface Management Procedures - NG SETUP REQUEST + PICS PICS_A3_6_2 //gNB - Interface Management Procedures - RAN CONFIGURATION UPDATE + PICS PICS_A3_6_3 //gNB - Interface Management Procedures - AMF CONFIGURATION UPDATE + PICS PICS_A3_6_4 //gNB - Interface Management Procedures - NG RESET + PICS PICS_A3_6_5 //gNB - Interface Management Procedures - ERROR INDICATION + PICS PICS_A3_7_1 //gNB - Configuration Transfer Procedures - UPLINK RAN CONFIGURATION TRANSFER + PICS PICS_A3_8_1 //gNB - Warning Message Transmission procedure - WRITE-REPLACE WARNING REQUEST + PICS PICS_A3_8_2 //gNB - Warning Message Transmission procedure - PWS CANCEL REQUEST + PICS PICS_A3_8_3 //gNB - Warning Message Transmission procedure - PWS RESTART INDICATION + PICS PICS_A3_8_4 //gNB - Warning Message Transmission procedure - PWS FAILURE INDICATION + PICS PICS_A3_9_1 //gNB - NRPPa Transport procedure - DOWNLINK UE ASSOCIATED NRPPA TRANSPORT messages + PICS PICS_A3_9_2 //gNB - NRPPa Transport procedure - UPLINK UE ASSOCIATED NRPPA TRANSPORT messages + PICS PICS_A3_9_3 //gNB - NRPPa Transport procedure - DOWNLINK NON UE ASSOCIATED NRPPA TRANSPORT messages + PICS PICS_A3_9_4 //gNB - NRPPa Transport procedure - UPLINK NON UE ASSOCIATED NRPPA TRANSPORT messages + PICS PICS_A3_10_1 //gNB - Trace procedure - TRACE START messages + PICS PICS_A3_10_2 //gNB - Trace procedure - TRACE FAILURE INDICATION messages + PICS PICS_A3_10_3 //gNB - Trace procedure - DEACTIVATE TRACE messages + PICS PICS_A3_10_4 //gNB - Trace procedure - CELL TRAFFIC TRACE messages + PICS PICS_A3_11_1 //gNB - Location Reporting Procedures - LOCATION REPORTING CONTROL + PICS PICS_A3_11_2 //gNB - Location Reporting Procedures - LOCATION REPORTING FAILURE INDICATION + PICS PICS_A3_11_3 //gNB - Location Reporting Procedures - LOCATION REPORT + PICS PICS_A3_12_1 //gNB - TNLA procedure - UE TNLA BINDING RELEASE REQUEST messages + PICS PICS_A3_13_1 //gNB - UE Radio Capability Management procedure - UE RADIO CAPABILITY INFO INDICATION messages + PICS PICS_A3_13_2 //gNB - UE Radio Capability Management procedure - UE RADIO CAPABILITY CHECK REQUEST messages + PICS PICS_A3_13_3 //gNB - UE Radio Capability Management procedure - UE RADIO CAPABILITY ID MAPPING REQUEST messages + PICS PICS_A3_14_1 //gNB - Data Usage Reporting Procedures - SECONDARY RAT DATA USAGE REPORT + PICS PICS_A3_15_1 //gNB - RIM information Transfer procedure - UPLINK RIM INFORMATION TRANSFER + PICS PICS_A3_15_2 //gNB - RIM information Transfer procedure - DOWNLINK RIM INFORMATION TRANSFER + PICS PICS_A4_1_1 //AMF - PDU session management procedure - PDU SESSION RESOURCE SETUP REQUEST + PICS PICS_A4_1_2 //AMF - PDU session management procedure - PDU SESSION RESOURCE RELEASE COMMAND + PICS PICS_A4_1_3 //AMF - PDU session management procedure - PDU SESSION RESOURCE MODIFY REQUEST + PICS PICS_A4_1_4 //AMF - PDU session management procedure - PDU SESSION RESOURCE MODIFY NOTIFY + PICS PICS_A4_1_5 //AMF - PDU session management procedure - PDU SESSION RESOURCE MODIFY INDICATION + PICS PICS_A4_2_1 //AMF - UE Context Management Procedures - INITIAL CONTEXT SETUP REQUEST + PICS PICS_A4_2_3 //AMF - UE Context Management Procedures - UE CONTEXT RELEASE COMMAND + PICS PICS_A4_2_4 //AMF - UE Context Management Procedures - UE CONTEXT MODIFICATION REQUEST + PICS PICS_A4_2_6 //AMF - UE Context Management Procedures - CONNECTION ESTABLISHMENT INDICATION + PICS PICS_A4_2_7 //AMF - UE Context Management Procedures - AMF CP RELOCATION INDICATION + PICS PICS_A4_2_9 //AMF - UE Context Management Procedures - RETRIEVE UE INFORMATION + PICS PICS_A4_2_10 //AMF - UE Context Management Procedures - UE INFORMATION TRANSFER + PICS PICS_A4_2_11 //AMF - UE Context Management Procedures - UE CONTEXT SUSPEND REQUEST + PICS PICS_A4_2_12 //AMF - UE Context Management Procedures - UE CONTEXT RESUME REQUEST + PICS PICS_A4_3_1 //AMF - UE Mobility Management Procedures - HANDOVER REQUIRED + PICS PICS_A4_3_2 //AMF - UE Mobility Management Procedures - HANDOVER REQUEST + PICS PICS_A4_3_4 //AMF - UE Mobility Management Procedures - PATH SWITCH REQUESTS + PICS PICS_A4_3_5 //AMF - UE Mobility Management Procedures - HANDOVER CANCEL + PICS PICS_A4_3_6 //AMF - UE Mobility Management Procedures - UPLINK RAN STATUS TRANSFER + PICS PICS_A4_3_9 //AMF - UE Mobility Management Procedures - UPLINK RAN EARLY STATUS TRANSFER + PICS PICS_A4_4_1 //AMF - Paging procedures - Paging + PICS PICS_A4_5_2 //AMF - Transport of NAS Messages Procedures - DOWNLINK NAS TRANSPORT + PICS PICS_A4_5_5 //AMF - Transport of NAS Messages Procedures - REROUTE NAS REQUEST + PICS PICS_A4_6_1 //AMF - Interface Management Procedures - NG SETUP REQUEST + PICS PICS_A4_6_1_1 //AMF - Rejection of an unacceptable NG SETUP REQUEST message with an NG SETUP FAILURE message + PICS PICS_A4_6_1_2 //AMF - IAB + PICS PICS_A4_6_2 //AMF - Interface Management Procedures - RAN CONFIGURATION UPDATE + PICS PICS_A4_6_3 //AMF - Interface Management Procedures - AMF CONFIGURATION UPDATE + PICS PICS_A4_6_4 //AMF - Interface Management Procedures - NG RESET + PICS PICS_A4_6_5 //AMF - Interface Management Procedures - ERROR INDICATION + PICS PICS_A4_6_6 //AMF - Interface Management Procedures - AMF STATUS INDICATION + PICS PICS_A4_6_7 //AMF - Interface Management Procedures - OVERLOAD START + PICS PICS_A4_6_8 //AMF - Interface Management Procedures - OVERLOAD STOP + PICS PICS_A4_7_2 //AMF - Configuration Transfer Procedures - DOWNLINK RAN CONFIGURATION TRANSFER + PICS PICS_A4_8_1 //AMF - Warning Message Transmission procedure - WRITE-REPLACE WARNING REQUEST + PICS PICS_A4_8_2 //AMF - Warning Message Transmission procedure - PWS CANCEL REQUEST + PICS PICS_A4_8_3 //AMF - Warning Message Transmission procedure - PWS RESTART INDICATION + PICS PICS_A4_8_4 //AMF - Warning Message Transmission procedure - PWS FAILURE INDICATION + PICS PICS_A4_9_1 //AMF - NRPPa Transport procedure - DOWNLINK UE ASSOCIATED NRPPA TRANSPORT messages + PICS PICS_A4_9_2 //AMF - NRPPa Transport procedure - UPLINK UE ASSOCIATED NRPPA TRANSPORT messages + PICS PICS_A4_9_3 //AMF - NRPPa Transport procedure - DOWNLINK NON UE ASSOCIATED NRPPA TRANSPORT messages + PICS PICS_A4_9_4 //AMF - NRPPa Transport procedure - UPLINK NON UE ASSOCIATED NRPPA TRANSPORT messages + PICS PICS_A4_10_1 //AMF - Trace procedure - TRACE START messages + PICS PICS_A4_10_2 //AMF - Trace procedure - TRACE FAILURE INDICATION messages + PICS PICS_A4_10_3 //AMF - Trace procedure - DEACTIVATE TRACE messages + PICS PICS_A4_10_4 //AMF - Trace procedure - CELL TRAFFIC TRACE messages + PICS PICS_A4_11_1 //AMF - Location Reporting Procedures - LOCATION REPORTING CONTROL + PICS PICS_A4_11_2 //AMF - Location Reporting Procedures - LOCATION REPORTING FAILURE INDICATION + PICS PICS_A4_11_3 //AMF - Location Reporting Procedures - LOCATION REPORT + PICS PICS_A4_12_1 //AMF - TNLA procedure - UE TNLA BINDING RELEASE REQUEST messages + PICS PICS_A4_13_1 //AMF - UE Radio Capability Management procedure - UE RADIO CAPABILITY INFO INDICATION messages + PICS PICS_A4_13_2 //AMF - UE Radio Capability Management procedure - UE RADIO CAPABILITY CHECK REQUEST messages + PICS PICS_A4_13_3 //AMF - UE Radio Capability Management procedure - UE RADIO CAPABILITY ID MAPPING REQUEST messages + PICS PICS_A4_14_1 //AMF - Data Usage Reporting Procedures - SECONDARY RAT DATA USAGE REPORT + PICS PICS_A4_15_1 //AMF - RIM information Transfer procedure - UPLINK RIM INFORMATION TRANSFER + PICS PICS_A4_15_2 //AMF - RIM information Transfer procedure - DOWNLINK RIM INFORMATION TRANSFER + + + //PIXIT + PIXIT NgapMessage PX_RAN_UE_NGAP_ID + PIXIT NgapMessage PX_PDU_SessionId + PIXIT NgapMessage PX_PLMN_Identity + PIXIT NgapMessage PX_TAC + PIXIT NgapMessage PX_SST + PIXIT NgapMessage PX_SD + PIXIT NgapMessage PX_QFI + PIXIT NgapMessage PX_5QI + PIXIT NgapMessage PX_Cause + PIXIT NgapMessage PX_2nd_5QI + PIXIT NgapMessage PX_N3_GNB_IP_ADDRESS + PIXIT NgapMessage PX_N3_AMF_IP_ADDRESS + PIXIT NgapMessage PX_QFI_Wrong + PIXIT NgapMessage PX_AMF_Region_ID + PIXIT NgapMessage PX_AMF_Set_ID + PIXIT NgapMessage PX_AMF_Pointer_ID + PIXIT NgapMessage PX_SST_Allowed + PIXIT NgapMessage PX_SD_Allowed + PIXIT NgapMessage PX_NR_Encryption_Algorithms + PIXIT NgapMessage PX_NR_Integrity_Protection_Algorithms + PIXIT NgapMessage PX_E_UTRA_Encryption_Algorithms + PIXIT NgapMessage PX_E_UTRA_Integrity_Protection_Algorithms + PIXIT NgapMessage PX_VA_Cause + PIXIT NgapMessage PX_gNB_ID + PIXIT NgapMessage PX_AMF_Name + PIXIT NgapMessage PX_NOTSUPPORTED_PLMN_Identity + PIXIT NgapMessage PX_RAN_NODE_NAME + PIXIT NgapMessage PX_NID + PIXIT NgapMessage PX_SST_EXTENDED + PIXIT NgapMessage PX_SD_EXTENDED + PIXIT NgapMessage PX_RAN_NODE_NAME_VISIBLE + PIXIT NgapMessage PX_RAN_Node_Name + PIXIT NgapMessage PX_Extended_RAN_Node_Name + PIXIT NgapMessage PX_SST_NEW + PIXIT NgapMessage PX_SD_NEW + PIXIT NgapMessage PX_SST_UNSUPPORTED + PIXIT NgapMessage PX_CAUSE + PIXIT NgapMessage PX_AMF_UE_NGAP_ID + PIXIT NgapMessage PX_N3_ENDPOINT_IP_ADDRESS + PIXIT NgapMessage PX_GTP_TEID + PIXIT NgapMessage PX_GNB_DEF_DRX + +} \ No newline at end of file diff --git a/test_purposes/NGNAS_Common.tdltx b/test_purposes/NGNAS_Common.tdltx new file mode 100644 index 0000000000000000000000000000000000000000..dd893f120304386838980f296fd8c5e0d46bce6e --- /dev/null +++ b/test_purposes/NGNAS_Common.tdltx @@ -0,0 +1,189 @@ +Package NGNAS_Common { + + Import all from TDL + Import all from NGAP_Common + + // Configurations + Configuration CF_AMF_N2N1 { + node GNB as Tester, + node IUT as SUT, + connect GNB::g to IUT::g + } + + //TP AMF NGNAS events + Event isInOverloadedState //The AMF is in an overload condition and overload control procedures are active. + Event indicateUEdeactivation //The UE is administratively deactivated in the 5GC. + Event indicateUEderegistration //The UE is administratively de-registered in the 5GC. + + + // This template may be used as default AUTHENTICATION REQUEST message within a DOWNLINK NAS TRANSPORT message. */ + Template AUTHENTICATION_REQUEST { + the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to AUTHENTICATION_REQUEST, + ngKSI containing { + nas_key_set_identifier set to "111"}, + ABBA containing { + ABBA_contents set to " '0000'H "}, + Authentication_parameter_RAND set to RV_Authentication_parameter_RAND, + Authentication_parameter_AUTN set to RV_Authentication_parameter_AUTN + } + } + to the GNB entity + } + + // This template may be used as default SECURITY_MODE_COMMAND message within a DOWNLINK NAS TRANSPORT message. + Template SECURITY_MODE_COMMAND { + the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing { // SECURITY_MODE_COMMAND + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, + message_type set to SECURITY_MODE_COMMAND, + selected_NAS_security_algorithms containing { + type_of_ciphering_algorithm set to PX_SELECTED_NAS_CIPHERING_ALGORITHM, + type_of_integrity_algorithm set to PX_SELECTED_NAS_INTEGRITY_ALGORITHM }, + ngKSI containing { + nas_key_set_identifier set to "111" }, + replayed_UE_security_capabilities set to PX_UE_SECURITY_CAPABILITIES}} // UE security capability 9.11.3.54 + to the GNB entity + } + + + //Table 8.2 + NgapMessage AUTHENTICATION_RESPONSE + + // Table 9.3.1: Security header type + Bitstring PLAIN_5GS_NAS_MESSAGE // 0 0 0 0 , not security protected + Bitstring INTEGRITY_PROTECTED // 0 0 0 1 + Bitstring INTEGRITY_PROTECTED_AND_CIPHERED // 0 0 1 0 + Bitstring INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT // 0 0 1 1 + Bitstring INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_5G_NAS_SECURITY_CONTEXT // 0 1 0 0 + + // PICS + PICS PICS_A2_1 //AMF + PICS PICS_A3_1 //5GMM-DEREGISTERED + PICS PICS_A3_2 //5GMM-COMMON-PROCEDURE-INITIATED + PICS PICS_A3_3 //5GMM-REGISTERED + PICS PICS_A3_4 //5GMM-DEREGISTERED-INITIATED + PICS PICS_A3_5 //5GSM-PDU SESSION INACTIVE + PICS PICS_A3_6 //5GSM-PDU SESSION ACTIVE + PICS PICS_A3_7 //5GSM-PDU SESSION INACTIVE PENDING + PICS PICS_A3_8 //5GSM-PDU SESSION MODIFICATION PENDING + PICS PICS_A3_9 //5GSM-PROCEDURE TRANSACTION INACTIVE + PICS PICS_A3_10 //5GSM-PROCEDURE TRANSACTION PENDING + PICS PICS_A4_1 //5GMM-Primary authentication and key agreement procedures + PICS PICS_A4_1_1 //Initiation and control of the EAP based primary authentication and key agreement procedures + PICS PICS_A4_1_2 //Initiation and control of the 5G AKA based primary authentication and key agreement procedures + PICS PICS_A4_1_2_1_1 //Provision of new authentication parameters to the UE on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #21 "synch failure" + PICS PICS_A4_1_2_1_2 //Termination of the 5G AKA based primary authentication and key agreement procedure with AUTHENTICATION REJECT on receipt of two consecutive AUTHENTICATION FAILURE message containing 5GMM cause #21 "synch failure" + PICS PICS_A4_1_2_2_1 //Initiation of the identification procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #20 "MAC failure" + PICS PICS_A4_1_2_2_2 //Termination of the 5G AKA based primary authentication and key agreement procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #20 "MAC failure" + PICS PICS_A4_1_2_3_1 //Initiation of the identification procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #26 "non-5G authentication unacceptable" + PICS PICS_A4_1_2_3_2 //Termination of the 5G AKA based primary authentication and key agreement procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #26 "non-5G authentication unacceptable" + PICS PICS_A4_1_2_4 //Re-initiation of the 5G AKA based primary authentication and key agreement procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #71 "ngKSI already in use" + PICS PICS_A4_2 //Security mode control procedures + PICS PICS_A4_2_1 //Initiation of the security mode control procedure to take a 5G NAS security context into use, and initialise and start NAS signalling security + PICS PICS_A4_2_2 //Initiation of the security mode control procedure to change the 5G NAS security algorithms for a current 5G NAS security context already in use + PICS PICS_A4_2_3 //Initiation of the security mode control procedure to change the value of uplink NAS COUNT used in the latest SECURITY MODE COMPLETE message + PICS PICS_A4_2_4 //Initiation of the security mode control procedure to provide the Selected EPS NAS security algorithms to the UE + PICS PICS_A4_3 //Identification procedures + PICS PICS_A4_4 //Generic UE configuration update procedures + PICS PICS_A4_4_1 //Sending of CONFIGURATION UPDATE COMMAND messages to the UE? + PICS PICS_A4_5 //NAS transport procedures + PICS PICS_A4_5_1 //UE-initiated NAS transport procedures (receipt of UL NAS TRANSPORT messages) + PICS PICS_A4_5_1_1 //Sending back to the UE 5GSM messages which were not forwarded due to abnormal case on the network side + PICS PICS_A4_5_2 //Network-initiated NAS transport procedures (sending of DL NAS TRANSPORT messages) + PICS PICS_A4_6 //5GMM status procedures + PICS PICS_A4_7 //Network slice-specific authentication and authorization procedures + PICS PICS_A4_8 //Registration procedures + PICS PICS_A4_8_1 //Initial registration procedures + PICS PICS_A4_8_1_1_1 //Initiation of 5GMM common procedures during the initial registration procedure + PICS PICS_A4_8_1_1_2 //Skipping of the authentication procedure during an (initial) emergency registration procedure, if the AMF is configured to support emergency registration for unauthenticated SUCIs + PICS PICS_A4_8_1_2_1 //Inclusion of service area restrictions in the Service area list IE in the REGISTRATION ACCEPT message + PICS PICS_A4_8_1_2_2 //Inclusion of a list of equivalent PLMNs in the REGISTRATION ACCEPT message + PICS PICS_A4_8_1_2_3 //Inclusion of rejected NSSAI (S-NSSAIs which are included in the requested NSSAI in the REGISTRATION REQUEST message but rejected by the network) in the REGISTRATION ACCEPT message + PICS PICS_A4_8_1_2_4 //Inclusion of operator-defined access category definitions in the REGISTRATION ACCEPT message + PICS PICS_A4_8_1_3 //SMS over NAS in initial registration + PICS PICS_A4_8_1_4 //MICO mode in initial registration i.e., inclusion of the MICO indication IE in the REGISTRATION ACCEPT message + PICS PICS_A4_8_2 //Registration procedures for mobility and periodic registration update + PICS PICS_A4_8_2_1_1 //Initiation of 5GMM common procedures during the mobility and periodic registration update procedure + PICS PICS_A4_8_2_1_2 //Skipping of the authentication procedure during the registration procedure for mobility and periodic registration update for a UE that has only an emergency PDU session + PICS PICS_A4_8_2_2_1 //Inclusion of a new TAI list for the UE in the REGISTRATION ACCEPT message + PICS PICS_A4_8_2_2_2 //Inclusion of a list of equivalent PLMNs in the REGISTRATION ACCEPT message + PICS PICS_A4_8_2_2_3 //Inclusion of new service area restrictions in the Service area list IE in the REGISTRATION ACCEPT message + PICS PICS_A4_8_2_2_4 //Inclusion of rejected NSSAI (S-NSSAIs which are included in the requested NSSAI in the REGISTRATION REQUEST message but rejected by the network) in the REGISTRATION ACCEPT message + PICS PICS_A4_8_2_2_5 //Inclusion of the LADN information IE in the REGISTRATION ACCEPT message + PICS PICS_A4_8_2_2_6 //Inclusion of operator-defined access category definitions in the REGISTRATION ACCEPT message + PICS PICS_A4_8_2_3 //SMS over NAS in mobility and periodic registration updates + PICS PICS_A4_8_2_4 //MICO mode in mobility and periodic registration updates i.e., inclusion of the MICO indication IE in the REGISTRATION ACCEPT message + PICS PICS_A4_9 //Deregistration procedures + PICS PICS_A4_9_1 //UE-initiated deregistration procedures + PICS PICS_A4_9_2 //Network-initiated deregistration procedures + PICS PICS_A4_9_2_1 //Inclusion of the 5GMM cause IE to specify the reason for the deregistration in the DEREGISTRATION REQUEST message + PICS PICS_A4_10 //Service request procedures + PICS PICS_A4_10_1 //Initiation of common procedures during the service request procedure (receipt of SERVICE REQUEST or CONTROL PLANE SERVICE REQUEST message) + PICS PICS_A4_11 //Paging procedures + PICS PICS_A4_11_1 //Re-initiation of network paging on expiry of timer T3513 + PICS PICS_A4_12 //Notification procedures + PICS PICS_A5_1 //PDU session authentication and authorization procedures + PICS PICS_A5_2 //Network-requested PDU session modification procedures + PICS PICS_A5_3 //Network-requested PDU session release procedures + PICS PICS_A5_6 //UE-requested PDU session establishment procedures + PICS PICS_A5_6_1 //Inclusion of the Back-off timer value IE in the PDU SESSION ESTABLISHMENT REJECT message, if a PDU session establishment procedure is not accepted by the network + PICS PICS_A5_7 //UE-requested PDU session modification procedures + PICS PICS_A5_7_1 //Inclusion of the Back-off timer value IE in the PDU SESSION MODIFICATION REJECT message, if a PDU session modification procedure is not accepted by the network + PICS PICS_A5_8 //UE-requested PDU session release procedures + PICS PICS_A5_9 //5GMM status procedures + PICS PICS_A5_10 //Exchange of extended protocol configuration options + PICS PICS_A6_1 //Procedures for handling of unknown, unforeseen, and erroneous protocol data? + PICS PICS_A6_1_1 //Handling (i.e., ignoring) of messages that are too short to contain a complete message type information element + PICS PICS_A6_1_2_1 //Handling of an unknown, erroneous, or unforeseen PTI received in a 5GSM message + PICS PICS_A6_1_2_2 //Handling of an unknown, erroneous, or unforeseen PDU session identity received in the header of a 5GSM message + PICS PICS_A6_1_3 //Sending of a 5GMM STATUS or 5GSM STATUS message (depending on the EPD) with cause #97 "message type non-existent or not implemented" on receipt of a message with message type not defined for the EPD or not implemented by the receiver + PICS PICS_A6_1_4_1 //Treating messages (see note) received with non-semantical mandatory information element errors + PICS PICS_A6_1_4_2 //Ignoring messages (see note) received with non-semantical mandatory information element errors + PICS PICS_A6_1_4_3 //Rejection of PDU SESSION ESTABLISHMENT REQUEST, PDU SESSION MODIFICATION REQUEST, and PDU SESSION RELEASE REQUEST messages with cause #96 "invalid mandatory information" when an error is encountered with a mandatory information element in the 5GSM message + PICS PICS_A6_1_5 //Handling of messages containing unknown or unforeseen (out of sequence, repeated) IEs in the non-imperative message part + PICS PICS_A6_1_6_1 //Treating messages received missing a conditional IE or containing an unexpected or a syntactically incorrect conditional IE + PICS PICS_A6_1_6_2 //Ignoring messages received missing a conditional IE or containing an unexpected or a syntactically incorrect conditional IE + PICS PICS_A6_1_6_2_1 //Returning a status message (5GMM STATUS or 5GSM STATUS depending on the EPD) with cause #100 "conditional IE error" when ignoring a message received missing a conditional IE or containing an unexpected or a syntactically incorrect conditional IE + PICS PICS_A6_1_7 //Responding to messages (where a reaction is foreseen) with semantically incorrect contents with status messages (5GMM STATUS or 5GSM STATUS depending on the EPD) with cause #95 "semantically incorrect message + + + // PIXIT + PIXIT NgapMessage PX_MCC + PIXIT NgapMessage PX_MNC + PIXIT NgapMessage PX_ROUTING_INDICATOR + PIXIT NgapMessage PX_PROTECTION_SCHEME_ID + PIXIT NgapMessage PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER + PIXIT NgapMessage PX_MSIN + PIXIT NgapMessage PX_INVALID_RES_VALUE + PIXIT NgapMessage PX_WRONG_MAC_CODE + PIXIT NgapMessage PX_NON_DEFAULT_NGKSI + PIXIT NgapMessage PX_Authentication_parameter_AUTN_NON_5G_UNACCEPTABLE + PIXIT NgapMessage PX_SELECTED_NAS_CIPHERING_ALGORITHM + PIXIT NgapMessage PX_SELECTED_NAS_INTEGRITY_ALGORITHM + PIXIT NgapMessage PX_UE_SECURITY_CAPABILITIES + PIXIT NgapMessage PX_AMF_REGION_ID + PIXIT NgapMessage PX_AMF_SET_ID + PIXIT NgapMessage PX_AMF_POINTER + PIXIT NgapMessage PX_TAC + PIXIT NgapMessage PX_SEC_ABORT_TWAIT + PIXIT NgapMessage PX_UNASSIGNED_5G_TMSI + PIXIT NgapMessage PX_CUC_TWAIT + PIXIT NgapMessage PX_PDU_session_identity + PIXIT NgapMessage PX_SST + PIXIT NgapMessage PX_SD + PIXIT NgapMessage PX_DNN + PIXIT NgapMessage PX_SST_1 + PIXIT NgapMessage PX_SD_1 + PIXIT NgapMessage PX_SST_2 + PIXIT NgapMessage PX_SD_2 + PIXIT NgapMessage PX_SST_Rejected + PIXIT NgapMessage PX_SD_Rejected + PIXIT NgapMessage PX_DRG_TWAIT + PIXIT NgapMessage PX_T3522 + +} \ No newline at end of file diff --git a/test_purposes/Ngnas_Common.tplan2 b/test_purposes/Ngnas_Common.tplan2 deleted file mode 100644 index 419fbca969162194d41952320567454ce5126ba1..0000000000000000000000000000000000000000 --- a/test_purposes/Ngnas_Common.tplan2 +++ /dev/null @@ -1,403 +0,0 @@ -/* ETSI Software License -* As long as the here under conditions are respected, non-exclusive permission is hereby granted, -* free of charge, to use, reproduce and modify this software source code, under the following conditions: -* This source code is provided AS IS with no warranties, express or implied, including but not limited to, -* the warranties of merchant ability, fitness for a particular purpose and warranties for non-infringement -* of intellectual property rights. -* ETSI shall not be held liable in any event for any direct or indirect damages whatsoever (including, without -* limitation, damages for loss of profits, business interruption, loss of information, or any other pecuniary -* loss) arising out of or related to the use of or inability to use the source code. -* This permission is granted to facilitate the implementation of the related ETSI standard, provided that -* ETSI is given the right to use, reproduce and amend the modified source code under the same conditions -* as the present permission. -* This permission does not apply to any documentation associated with this source code for which ETSI keeps -* all rights reserved. -* The present ETSI Source Code license shall be included in all copies of whole or part of this source code -* and shall not imply any sub-license right. -* (c) ETSI 2023-2024 -*/ - - -Package Ngnas_Common { - Domain { - pics: - - NONE - //5G NAS PICS - - PICS_A2/1 //AMF - - PICS_A3/1 //5GMM-DEREGISTERED - - PICS_A3/2 //5GMM-COMMON-PROCEDURE-INITIATED - - PICS_A3/3 //5GMM-REGISTERED - - PICS_A3/4 //5GMM-DEREGISTERED-INITIATED - - PICS_A3/5 //5GSM-PDU SESSION INACTIVE - - PICS_A3/6 //5GSM-PDU SESSION ACTIVE - - PICS_A3/7 //5GSM-PDU SESSION INACTIVE PENDING - - PICS_A3/8 //5GSM-PDU SESSION MODIFICATION PENDING - - PICS_A3/9 //5GSM-PROCEDURE TRANSACTION INACTIVE - - PICS_A3/10 //5GSM-PROCEDURE TRANSACTION PENDING - - PICS_A4/1 //5GMM-Primary authentication and key agreement procedures - - PICS_A4/1_1 //Initiation and control of the EAP based primary authentication and key agreement procedures - - PICS_A4/1_2 //Initiation and control of the 5G AKA based primary authentication and key agreement procedures - - PICS_A4/1_2_1_1 //Provision of new authentication parameters to the UE on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #21 "synch failure" - - PICS_A4/1_2_1_2 //Termination of the 5G AKA based primary authentication and key agreement procedure with AUTHENTICATION REJECT on receipt of two consecutive AUTHENTICATION FAILURE message containing 5GMM cause #21 "synch failure" - - PICS_A4/1_2_2_1 //Initiation of the identification procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #20 "MAC failure" - - PICS_A4/1_2_2_2 //Termination of the 5G AKA based primary authentication and key agreement procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #20 "MAC failure" - - PICS_A4/1_2_3_1 //Initiation of the identification procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #26 "non-5G authentication unacceptable" - - PICS_A4/1_2_3_2 //Termination of the 5G AKA based primary authentication and key agreement procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #26 "non-5G authentication unacceptable" - - PICS_A4/1_2_4 //Re-initiation of the 5G AKA based primary authentication and key agreement procedure on receipt of an AUTHENTICATION FAILURE message containing 5GMM cause #71 "ngKSI already in use" - - PICS_A4/2 //Security mode control procedures - - PICS_A4/2_1 //Initiation of the security mode control procedure to take a 5G NAS security context into use, and initialise and start NAS signalling security - - PICS_A4/2_2 //Initiation of the security mode control procedure to change the 5G NAS security algorithms for a current 5G NAS security context already in use - - PICS_A4/2_3 //Initiation of the security mode control procedure to change the value of uplink NAS COUNT used in the latest SECURITY MODE COMPLETE message - - PICS_A4/2_4 //Initiation of the security mode control procedure to provide the Selected EPS NAS security algorithms to the UE - - PICS_A4/3 //Identification procedures - - PICS_A4/4 //Generic UE configuration update procedures - - PICS_A4/4_1 //Sending of CONFIGURATION UPDATE COMMAND messages to the UE? - - PICS_A4/5 //NAS transport procedures - - PICS_A4/5_1 //UE-initiated NAS transport procedures (receipt of UL NAS TRANSPORT messages) - - PICS_A4/5_1_1 //Sending back to the UE 5GSM messages which were not forwarded due to abnormal case on the network side - - PICS_A4/5_2 //Network-initiated NAS transport procedures (sending of DL NAS TRANSPORT messages) - - PICS_A4/6 //5GMM status procedures - - PICS_A4/7 //Network slice-specific authentication and authorization procedures - - PICS_A4/8 //Registration procedures - - PICS_A4/8_1 //Initial registration procedures - - PICS_A4/8_1_1_1 //Initiation of 5GMM common procedures during the initial registration procedure - - PICS_A4/8_1_1_2 //Skipping of the authentication procedure during an (initial) emergency registration procedure, if the AMF is configured to support emergency registration for unauthenticated SUCIs - - PICS_A4/8_1_2_1 //Inclusion of service area restrictions in the Service area list IE in the REGISTRATION ACCEPT message - - PICS_A4/8_1_2_2 //Inclusion of a list of equivalent PLMNs in the REGISTRATION ACCEPT message - - PICS_A4/8_1_2_3 //Inclusion of rejected NSSAI (S-NSSAIs which are included in the requested NSSAI in the REGISTRATION REQUEST message but rejected by the network) in the REGISTRATION ACCEPT message - - PICS_A4/8_1_2_4 //Inclusion of operator-defined access category definitions in the REGISTRATION ACCEPT message - - PICS_A4/8_1_3 //SMS over NAS in initial registration - - PICS_A4/8_1_4 //MICO mode in initial registration i.e., inclusion of the MICO indication IE in the REGISTRATION ACCEPT message - - PICS_A4/8_2 //Registration procedures for mobility and periodic registration update - - PICS_A4/8_2_1_1 //Initiation of 5GMM common procedures during the mobility and periodic registration update procedure - - PICS_A4/8_2_1_2 //Skipping of the authentication procedure during the registration procedure for mobility and periodic registration update for a UE that has only an emergency PDU session - - PICS_A4/8_2_2_1 //Inclusion of a new TAI list for the UE in the REGISTRATION ACCEPT message - - PICS_A4/8_2_2_2 //Inclusion of a list of equivalent PLMNs in the REGISTRATION ACCEPT message - - PICS_A4/8_2_2_3 //Inclusion of new service area restrictions in the Service area list IE in the REGISTRATION ACCEPT message - - PICS_A4/8_2_2_4 //Inclusion of rejected NSSAI (S-NSSAIs which are included in the requested NSSAI in the REGISTRATION REQUEST message but rejected by the network) in the REGISTRATION ACCEPT message - - PICS_A4/8_2_2_5 //Inclusion of the LADN information IE in the REGISTRATION ACCEPT message - - PICS_A4/8_2_2_6 //Inclusion of operator-defined access category definitions in the REGISTRATION ACCEPT message - - PICS_A4/8_2_3 //SMS over NAS in mobility and periodic registration updates - - PICS_A4/8_2_4 //MICO mode in mobility and periodic registration updates i.e., inclusion of the MICO indication IE in the REGISTRATION ACCEPT message - - PICS_A4/9 //Deregistration procedures - - PICS_A4/9_1 //UE-initiated deregistration procedures - - PICS_A4/9_2 //Network-initiated deregistration procedures - - PICS_A4/9_2_1 //Inclusion of the 5GMM cause IE to specify the reason for the deregistration in the DEREGISTRATION REQUEST message - - PICS_A4/10 //Service request procedures - - PICS_A4/10_1 //Initiation of common procedures during the service request procedure (receipt of SERVICE REQUEST or CONTROL PLANE SERVICE REQUEST message) - - PICS_A4/11 //Paging procedures - - PICS_A4/11_1 //Re-initiation of network paging on expiry of timer T3513 - - PICS_A4/12 //Notification procedures - - PICS_A5/1 //PDU session authentication and authorization procedures - - PICS_A5/2 //Network-requested PDU session modification procedures - - PICS_A5/3 //Network-requested PDU session release procedures - - PICS_A5/6 //UE-requested PDU session establishment procedures - - PICS_A5/6_1 //Inclusion of the Back-off timer value IE in the PDU SESSION ESTABLISHMENT REJECT message, if a PDU session establishment procedure is not accepted by the network - - PICS_A5/7 //UE-requested PDU session modification procedures - - PICS_A5/7_1 //Inclusion of the Back-off timer value IE in the PDU SESSION MODIFICATION REJECT message, if a PDU session modification procedure is not accepted by the network - - PICS_A5/8 //UE-requested PDU session release procedures - - PICS_A5/9 //5GMM status procedures - - PICS_A5/10 //Exchange of extended protocol configuration options - - PICS_A6/1 //Procedures for handling of unknown, unforeseen, and erroneous protocol data? - - PICS_A6/1_1 //Handling (i.e., ignoring) of messages that are too short to contain a complete message type information element - - PICS_A6/1_2_1 //Handling of an unknown, erroneous, or unforeseen PTI received in a 5GSM message - - PICS_A6/1_2_2 //Handling of an unknown, erroneous, or unforeseen PDU session identity received in the header of a 5GSM message - - PICS_A6/1_3 //Sending of a 5GMM STATUS or 5GSM STATUS message (depending on the EPD) with cause #97 "message type non-existent or not implemented" on receipt of a message with message type not defined for the EPD or not implemented by the receiver - - PICS_A6/1_4_1 //Treating messages (see note) received with non-semantical mandatory information element errors - - PICS_A6/1_4_2 //Ignoring messages (see note) received with non-semantical mandatory information element errors - - PICS_A6/1_4_3 //Rejection of PDU SESSION ESTABLISHMENT REQUEST, PDU SESSION MODIFICATION REQUEST, and PDU SESSION RELEASE REQUEST messages with cause #96 "invalid mandatory information" when an error is encountered with a mandatory information element in the 5GSM message - - PICS_A6/1_5 //Handling of messages containing unknown or unforeseen (out of sequence, repeated) IEs in the non-imperative message part - - PICS_A6/1_6_1 //Treating messages received missing a conditional IE or containing an unexpected or a syntactically incorrect conditional IE - - PICS_A6/1_6_2 //Ignoring messages received missing a conditional IE or containing an unexpected or a syntactically incorrect conditional IE - - PICS_A6/1_6_2_1 //Returning a status message (5GMM STATUS or 5GSM STATUS depending on the EPD) with cause #100 "conditional IE error" when ignoring a message received missing a conditional IE or containing an unexpected or a syntactically incorrect conditional IE - - PICS_A6/1_7 //Responding to messages (where a reaction is foreseen) with semantically incorrect contents with status messages (5GMM STATUS or 5GSM STATUS depending on the EPD) with cause #95 "semantically incorrect message - - ; - entities: - - UE - - GNB - - AMF - - IUT - ; - events: - - receives - - sends - - forwards - - isRequestedToPlaceACall - - aborts - // Initial conditions - - isNotRegisteredTo - - hasAchievedFirstRegistration - - isRegisteredTo - - isNotAttachedTo - - isAttachedTo - - isNotConfiguredForTopologyHiding - - isConfiguredForTopologyHiding - - isExistingIn - - isNotAppropriateToServe - - establishedSecurityRelation - - registeredIdentityTelURI - - registeredIdentitySipURI - - hasInitiatedDialogWith - - hasInitiatedPS2CSinEarlydialog - - hasInitiatedPS2CSinAlertingState - - hasEstablishedDialog - - hasEstablishedPS2CSDialog - - hasEstablishedInitialContext - - hasEstablishedRRCConnection - - hasEstablishedContextInproperly - - hasEstablishedPDUsessionWithSameId - - hasEstablishedPDUsession - - isConfiguredWithENUMentryForTelURI_E164NumberOf - - hasReceivedInitialRequestForDialog - - hasReceived200OkOnInitialRequestForDialogWith - - hasReceived180OnInitialRequest - - hasReceived200OkCancel - - hasReceivedTerminatedRequest - - hasReceivedNASMessage - - hasReceivedPAGINGMessage - - hasReceivedOVERLOADSTARTtMessage - - hasSuspendedContext - - hasPendingDataTransmission - - registeredPublicIdsWithTelUriAndSipUri - - hasReceivedSubsequentOrTargetRefreshRequestInDialog - - previouslyEstablishedCallWith - - isRequestedToSend - - isRequestedToDeregisterUser - - isBusy - - isNoLongerAvailable - - isTriggeredToDetachUser - - isRequestedToDetachfromNetwork - - isTransitioningTo - - hasAchievedFirstREGISTER - - hasResponded486INVITE - - hasAchievedInitialINVITE - - hasAchievedINVITE - - hasAchievedUPDATEuponINVITE - - timerOperatorSpecificTimeout //NOTE: 8 seconds is an appropriate value for the operator policy. - - isAttachingToNetwork - - hasDoneSubscription - - indicate - - trigger - - isCMIDLE - - isCMCONNECTED - - alreadyPreparedHandover - - completedHandover - - isInOverloadedState - ; - event templates: - /* This template can be used as default AUTHENTICATION REQUEST message within a DOWNLINK NAS TRANSFER message. */ - - AUTHENTICATION_REQUEST { - the IUT entity sends an DOWNLINK_NAS_TRANSFER containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to NOT_SECURITY_PROTECTED, - spare_half_octet, - authentication_request_message_identity set to AUTHENTICATION_REQUEST, - ngKSI containing - nas_key_set_identifier set to "111" - ;, - spare_half_octet, - ABBA, - Authentication_parameter_RAND, - Authentication_parameter_AUTN - ; - ; - to the UE entity - } - ; - } // End of Domain section - - Data { - - type NgapMessage; - type Cause; - type Bitstring; - type PIXIT; - - PIXIT PX_WRONG_ARP_IEI; //0x20 - PIXIT PX_WRONG_ARP_IEI; //0x20 - - //Table 8.1-1 - NgapMessage AMF_CONFIGURATION_UPDATE; - NgapMessage AMF_CONFIGURATION_UPDATE_ACKNOWLEDGE; - NgapMessage AMF_CONFIGURATION_UPDATE_FAILURE; - NgapMessage RAN_CONFIGURATION_UPDATE; - NgapMessage RAN_CONFIGURATION_UPDATE_ACKNOWLEDGE; - NgapMessage RAN_CONFIGURATION_UPDATE_FAILURE; - NgapMessage HANDOVER_CANCEL; - NgapMessage HANDOVER_CANCEL_ACKNOWLEDGE; - NgapMessage HANDOVER_REQUIRED; - NgapMessage HANDOVER_COMMAND; - NgapMessage HANDOVER_PREPARATION_FAILURE; - NgapMessage HANDOVER_REQUEST ; - NgapMessage HANDOVER_REQUEST_ACKNOWLEDGE; - NgapMessage HANDOVER_FAILURE; - NgapMessage INITIAL_CONTEXT_SETUP_REQUEST; - NgapMessage INITIAL_CONTEXT_SETUP_RESPONSE; - NgapMessage INITIAL_CONTEXT_SETUP_FAILURE; - NgapMessage NG_RESET; - NgapMessage NG_RESET_ACKNOWLEDGE; - NgapMessage NG_SETUP_REQUEST; - NgapMessage NG_SETUP_RESPONSE; - NgapMessage NG_SETUP_FAILURE; - NgapMessage PATH_SWITCH_REQUEST; - NgapMessage PATH_SWITCH_REQUEST_ACKNOWLEDGE; - NgapMessage PATH_SWITCH_REQUEST_FAILURE; - NgapMessage PDU_SESSION_RESOURCE_MODIFY_REQUEST; - NgapMessage PDU_SESSION_RESOURCE_MODIFY_RESPONSE; - NgapMessage PDU_SESSION_RESOURCE_MODIFY_INDICATION; - NgapMessage PDU_SESSION_RESOURCE_MODIFY_CONFIRM; - NgapMessage PDU_SESSION_RESOURCE_RELEASE_COMMAND; - NgapMessage PDU_SESSION_RESOURCE_RELEASE_RESPONSE; - NgapMessage PDU_SESSION_RESOURCE_SETUP_REQUEST; - NgapMessage PDU_SESSION_RESOURCE_SETUP_RESPONSE; - NgapMessage UE_CONTEXT_MODIFICATION_REQUEST; - NgapMessage UE_CONTEXT_MODIFICATION_RESPONSE; - NgapMessage UE_CONTEXT_MODIFICATION_FAILURE; - NgapMessage UE_CONTEXT_RELEASE_COMMAND; - NgapMessage UE_CONTEXT_RELEASE_COMPLETE; - NgapMessage WRITE_REPLACE_WARNING_REQUEST; - NgapMessage WRITE_REPLACE_WARNING_RESPONSE; - NgapMessage PWS_CANCEL_REQUEST; - NgapMessage PWS_CANCEL_RESPONSE; - NgapMessage UE_RADIO_CAPABILITY_CHECK_REQUEST; - NgapMessage UE_RADIO_CAPABILITY_CHECK_RESPONSE; - NgapMessage UE_CONTEXT_SUSPEND_REQUEST; - NgapMessage UE_CONTEXT_SUSPEND_RESPONSE; - NgapMessage UE_CONTEXT_SUSPEND_FAILURE; - NgapMessage UE_CONTEXT_RESUME_REQUEST; - NgapMessage UE_CONTEXT_RESUME_RESPONSE; - NgapMessage UE_CONTEXT_RESUME_FAILURE; - NgapMessage UE_RADIO_CAPABILITY_ID_MAPPING_REQUEST; - NgapMessage UE_RADIO_CAPABILITY_ID_MAPPING_RESPONSE; - - //Table 8.1-2 - NgapMessage DOWNLINK_RAN_CONFIGURATION_TRANSFER; - NgapMessage DOWNLINK_RAN_STATUS_TRANSFER; - NgapMessage DOWNLINK_NAS_TRANSPORT; - NgapMessage ERROR_INDICATION; - NgapMessage UPLINK_RAN_CONFIGURATION_TRANSFER; - NgapMessage UPLINK_RAN_STATUS_TRANSFER; - NgapMessage HANDOVER_NOTIFY; - NgapMessage INITIAL_UE_MESSAGE; - NgapMessage NAS_NON_DELIVERY_INDICATION; - NgapMessage PAGING; - NgapMessage PDU_SESSION_RESOURCE_NOTIFY; - NgapMessage REROUTE_NAS_REQUEST; - NgapMessage UE_CONTEXT_RELEASE_REQUEST; - NgapMessage UPLINK_NAS_TRANSPORT; - NgapMessage AMF_STATUS_INDICATION; - NgapMessage PWS_RESTART_INDICATION; - NgapMessage PWS_FAILURE_INDICATION; - NgapMessage DOWNLINK_UE_ASSOCIATED_NRPPA_TRANSPORT; - NgapMessage UPLINK_UE_ASSOCIATED_NRPPA_TRANSPORT; - NgapMessage DOWNLINK_NON_UE_ASSOCIATED_NRPPA_TRANSPORT; - NgapMessage UPLINK_NON_UE_ASSOCIATED_NRPPA_TRANSPORT; - NgapMessage TRACE_START; - NgapMessage TRACE_FAILURE_INDICATION; - NgapMessage DEACTIVATE_TRACE; - NgapMessage CELL_TRAFFIC_TRACE; - NgapMessage LOCATION_REPORTING_CONTROL; - NgapMessage LOCATION_REPORTING_FAILURE_INDICATION; - NgapMessage LOCATION_REPORT; - NgapMessage UE_TNLA_BINDING_RELEASE_REQUEST; - NgapMessage UE_RADIO_CAPABILITY_INFO_INDICATION; - NgapMessage RRC_INACTIVE_TRANSITION_REPORT; - NgapMessage OVERLOAD_START; - NgapMessage OVERLOAD_STOP; - NgapMessage SECONDARY_RAT_DATA_USAGE_REPORT; - NgapMessage UPLINK_RIM_INFORMATION_TRANSFER; - NgapMessage DOWNLINK_RIM_INFORMATION_TRANSFER; - NgapMessage RETRIEVE_UE_INFORMATION; - NgapMessage UE_INFORMATION_TRANSFER; - NgapMessage RAN_CP_RELOCATION_INDICATION; - NgapMessage CONNECTION_ESTABLISHMENT_INDICATION; - NgapMessage AMF_CP_RELOCATION_INDICATION; - NgapMessage HANDOVER_SUCCESS; - NgapMessage UPLINK_RAN_EARLY_STATUS_TRANSFER; - NgapMessage DOWNLINK_RAN_EARLY_STATUS_TRANSFER; - - NgapMessage SECURITY_MODE_COMPLETE; - NgapMessage SECURITY_MODE_REJECT; - - //Table 8.2 - NgapMessage AUTHENTICATION_REQUEST; - NgapMessage AUTHENTICATION_RESPONSE; - - // Table 9.3.1: Security header type - Bitstring PLAIN_5GS_NAS_MESSAGE; // 0 0 0 0 , not security protected - Bitstring INTEGRITY_PROTECTED; // 0 0 0 1 - Bitstring INTEGRITY_PROTECTED_AND_CIPHERED; // 0 0 1 0 - Bitstring INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT; // 0 0 1 1 - Bitstring INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_5G_NAS_SECURITY_CONTEXT; // 0 1 0 0 - - //Section 9.11.3.2 - Cause MAC_failure; - - - - } // End of Data section - - Configuration { - Interface Type defaultGT accepts NgapMessage; - Component Type NgapComponent with gate g of type defaultGT; - Component Type NgapComponent with gate g2 of type defaultGT; - - - Test Configuration CF_GNB_N2N1 - containing - Tester component AMF of type NgapComponent - SUT component IUT of type NgapComponent - connection between AMF.g and IUT.g; - - Test Configuration CF_AMF_N2N1 - containing - Tester component GNB of type NgapComponent - SUT component IUT of type NgapComponent - connection between GNB.g and IUT.g; - - - Test Configuration CF_GNB_2N2 - containing - Tester component AMF of type NgapComponent - SUT component IUT of type NgapComponent - connection between AMF.g and IUT.g; - - Test Configuration CF_AMF_2N2 - containing - Tester component GNB of type NgapComponent - SUT component IUT of type NgapComponent - connection between GNB.g and IUT.g; - - - Test Configuration CF_GNB_N2N1 - containing - Tester component AMF of type NgapComponent - SUT component IUT of type NgapComponent - connection between AMF.g and IUT.g; - - Test Configuration CF_AMF_N2N1 - containing - Tester component GNB of type NgapComponent - SUT component IUT of type NgapComponent - connection between GNB.g and IUT.g; - - - Test Configuration CF_GNB_2N2N1 - containing - Tester component AMF of type NgapComponent - SUT component IUT of type NgapComponent - connection between AMF.g and IUT.g; - - Test Configuration CF_AMF_2N2N1 - containing - Tester component GNB of type NgapComponent - SUT component IUT of type NgapComponent - connection between GNB.g and IUT.g; - - } - - -} // End of Package Ngnas_Common - diff --git a/test_purposes/References.txt b/test_purposes/References.txt index 2161f8f52e31ba6b4b220129f90e0055608ae523..c82d569d4f51f50fd123059891d1b859e0891443 100644 --- a/test_purposes/References.txt +++ b/test_purposes/References.txt @@ -1 +1,6 @@ -[1] ETSI TS 124 501: "5G;Non-Access-Stratum (NAS) protocol for 5G System (5GS);Stage 3 (3GPP TS 24.501 version 16.14.1 Release 16)". +Followig references are related to NGAP Test Specification TS 103 920-2 +[1] ETSI TS 138 413: "5G;NG-RAN; NG Application Protocol (NGAP) (3GPP TS 38.413 Release 16)". +[3] ETSI TS 123 502: "5G; Procedures for the 5G System (5GS) (3GPP TS 23.502 Release 16)". + +Followig references are related to 5G NAS Test Specification TS 103 921-2 +[1] ETSI TS 124 501: "5G; Non-Access-Stratum (NAS) protocol for 5G System (5GS); Stage 3 (3GPP TS 24.501 Release 16)". \ No newline at end of file diff --git a/test_purposes/TDL.tdltx b/test_purposes/TDL.tdltx new file mode 100644 index 0000000000000000000000000000000000000000..0b2a2bb45f53cae72085cead439822e4a03639e2 --- /dev/null +++ b/test_purposes/TDL.tdltx @@ -0,0 +1,62 @@ +@Version: "1.8.1" +Package TDL { + + Constraint length + Constraint minLength + Constraint maxLength + Constraint range + Constraint format + Constraint union + Constraint uniontype + + Type Boolean + Type Integer + Type String + Type Verdict + Type Bitstring + + Boolean ^true + Boolean ^false + Boolean True + Boolean False + + Verdict pass + Verdict fail + Verdict inconclusive + + Time second + + Annotation Master + Annotation MappingName + Annotation Version + Annotation check + Annotation where + Annotation PICS + Annotation PIXIT + + //standard annotations for STO + Annotation Initial conditions + Annotation Expected behaviour + Annotation Final conditions + Annotation Test Purpose Description + Annotation when + Annotation then + + Predefined == returns Boolean + Predefined != returns Boolean + Predefined and returns Boolean + Predefined or returns Boolean + Predefined xor returns Boolean + Predefined not returns Boolean + Predefined < returns Boolean + Predefined > returns Boolean + Predefined <= returns Boolean + Predefined >= returns Boolean + Predefined + + Predefined - + Predefined * + Predefined / + Predefined mod + Predefined size returns Integer + +} diff --git a/test_purposes/TP_AMF_NGAP.tdltx b/test_purposes/TP_AMF_NGAP.tdltx new file mode 100644 index 0000000000000000000000000000000000000000..0ac7306a7649d64b14a27df4787dc9525b53c077 --- /dev/null +++ b/test_purposes/TP_AMF_NGAP.tdltx @@ -0,0 +1,1252 @@ +/* +Copyright (c) ETSI 2026. + +This software is subject to copyrights owned by ETSI. Non-exclusive permission +is hereby granted, free of charge, to copy, reproduce and amend this file +under the following conditions: It is provided "as is", without warranty of any +kind, expressed or implied. + +ETSI shall never be liable for any claim, damages, or other liability arising +from its use or inability of use.This permission does not apply to any documentation +associated with this file for which ETSI keeps all rights reserved. The present +copyright notice shall be included in all copies of whole or part of this +file and shall not imply any sub-license right. +*/ + +/* interface at AMF */ +Package TP_AMF_NGAP { + + + + Package Clause_8_2_PDU_Session_Management_Procedures { + Import all from TDL + Import all from NGAP_Common + + + Test Purpose TP_NGAP_AMF_PDU_01 { + + Objective: "Verify that the IUT successfully processes a PDU Session Establishment Request and initiates the PDU Session Resource Setup procedure for a single PDU_Session_Resource." + + Reference: "ETSI TS 138 413 [1], Clauses 8.2.1.2 and 9.2.1.1" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_1_1 + + Initial conditions + with { + the UE entity isInCM_CONNECTED and + the IUT entity hasActiveUeNgapContext and + the IUT entity hasNoPduSessionResourceEstablishedForTheConcernedPduSessionId + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an UPLINK_NAS_TRANSPORT containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + NAS_PDU containing { + ul_nas_transport_message_identity set to UL_NAS_TRANSPORT, + payload_container containing { + PDU_session_identity set to PX_PDU_SessionId, + Message_type set to PDU_SESSION_ESTABLISHMENT_REQUEST}}, + User_Location_Information containing { + nr_cgi containing { + PLMN_Identity set to PX_PLMN_Identity}, + tai containing { + PLMN_Identity set to PX_PLMN_Identity, + TAC set to PX_TAC} + } + } + from the UE entity + } + then { + the IUT entity sends a PDU_SESSION_RESOURCE_SETUP_REQUEST containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + PDU_Session_Resource_Setup_Request_List containing { + PDU_Session_Resource_Setup_Request_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_NAS_PDU containing { + uL_NAS_TRANSPORT_message_identity set to UL_NAS_TRANSPORT, + payload_container containing { + PDU_session_identity set to PX_PDU_SessionId, + Message_type set to PDU_SESSION_ESTABLISHMENT_ACCEPT, + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}}}, + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}, + PDU_Session_Resource_Setup_Request_Transfer containing { + PDU_Session_Type set to IPv4, + QoS_Flow_Setup_Request_List containing { + QoS_Flow_Setup_Request_Item containing { + QoSFlowIdentifier set to PX_QFI, + QoSFlowLevelQosParameters containing { + QoSCharacteristics containing { + Non_Dynamic_5QI set to PX_5QI}, + AllocationAndRetentionPriority}}}}}}} + to the GNB entity + } + + } + + } // end TP_NGAP_AMF_PDU_01 + + Test Purpose TP_NGAP_AMF_PDU_01_2 { + + Objective: "Verify that the IUT successfully receives and processes the PDU_SESSION_RESOURCE_SETUP_RESPONSE message and completes the PDU Session Resource Setup procedure for a single PDU_Session_Resource." + + Reference: "ETSI TS 138 413 [1], Clauses 8.2.1.2 and 9.2.1.1" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_1_1 + + Initial conditions + with { + the UE entity isInCM_CONNECTED and + the IUT entity hasActiveUeNgapContext and + the IUT entity hasSentPDU_SESSION_RESOURCE_SETUP_REQUEST + } + + Expected behaviour + ensure that { + when { + the IUT entity sends a PDU_SESSION_RESOURCE_SETUP_REQUEST containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + PDU_Session_Resource_Setup_Request_List containing { + PDU_Session_Resource_Setup_Request_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_NAS_PDU containing { + uL_NAS_TRANSPORT_message_identity set to UL_NAS_TRANSPORT, + payload_container containing { + Message_type set to PDU_SESSION_ESTABLISHMENT_ACCEPT}}, + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}, + PDU_Session_Resource_Setup_Request_Transfer containing { + PDU_Session_Type set to IPv4, + QoS_Flow_Setup_Request_List containing { + QoS_Flow_Setup_Request_Item containing { + QoSFlowIdentifier set to RV_QFI, + QoSFlowLevelQosParameters containing { + QoSCharacteristics containing { + Non_Dynamic_5QI set to PX_5QI}, + AllocationAndRetentionPriority}}}}}}} + to the GNB entity + } + then { + the IUT entity accepts a PDU_SESSION_RESOURCE_SETUP_RESPONSE containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + PDU_Session_Resource_Setup_Response_List containing { + PDU_Session_Resource_Setup_Response_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_Resource_Setup_Response_Transfer containing { + DL_QoS_Flow_per_TNL_Information containing { + AssociatedQoSFlowList containing { + AssociatedQoSFlowItem containing { + QoSFlowIdentifier set to RV_QFI}}}}}}} + from the GNB entity + } + + } + + } // end TP_NGAP_AMF_PDU_01_2 + + Test Purpose TP_NGAP_AMF_PDU_02 { + + Objective: "Verify that the IUT successfully processes a PDU Session Release request and initiates the PDU Session Resource Release procedure for a single PDU_Session_Resource." + + Reference: "ETSI TS 138 413 [1], Clauses 8.2.2.2 and 9.2.1.3" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_1_2 + + Initial conditions + with { + the UE entity isInCM_CONNECTED and + the IUT entity hasActiveUeNgapContext and + the IUT entity hasEstablishedPduSessionResourceForTheConcernedPduSessionId + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an UPLINK_NAS_TRANSPORT containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + NAS_PDU containing { + ul_nas_transport_message_identity set to UL_NAS_TRANSPORT, + payload_container containing { + PDU_SessionId set to PX_PDU_SessionId, + Message_type set to PDU_SESSION_RELEASE_REQUEST}}, + User_Location_Information containing { + nr_cgi containing { + PLMN_Identity set to PX_PLMN_Identity}, + tai containing { + PLMN_Identity set to PX_PLMN_Identity, + TAC set to PX_TAC} + } + } + from the GNB entity + } + then { + the IUT entity sends a PDU_SESSION_RESOURCE_RELEASE_COMMAND containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + NAS_PDU containing { + ul_nas_transport_message_identity set to DL_NAS_TRANSPORT, + payload_container containing { + Message_type set to PDU_SESSION_RELEASE_COMMAND}, + PDU_SessionId set to PX_PDU_SessionId}, + PDU_Session_Resource_To_Release_List containing { + PDU_Session_Resource_To_Release_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_Resource_Release_Command_Transfer containing { + Cause set to PX_Cause}}}} //normal_release + to the GNB entity + } + } + } // end TP Id TP_NGAP_AMF_PDU_02 + + Test Purpose TP_NGAP_AMF_PDU_02_2 { + + Objective: "Verify that the IUT successfully receives and processes the PDU_SESSION_RESOURCE_RELEASE_RESPONSE message and completes the PDU Session Resource Release procedure for a single PDU_Session_Resource." + + Reference: "ETSI TS 138 413 [1], Clauses 8.2.2.2 and 9.2.1.3" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_1_2 + + Initial conditions + with { + the UE entity isInCM_CONNECTED and + the IUT entity hasActiveUeNgapContext and + the IUT entity hasSentPDU_SESSION_RESOURCE_RELEASE_COMMAND + } + + Expected behaviour + ensure that { + when { + the IUT entity sends a PDU_SESSION_RESOURCE_RELEASE_COMMAND containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + NAS_PDU containing { + ul_nas_transport_message_identity set to DL_NAS_TRANSPORT, + payload_container containing { + Message_type set to PDU_SESSION_RELEASE_COMMAND}, + PDU_SessionId set to PX_PDU_SessionId}, + PDU_Session_Resource_To_Release_List containing { + PDU_Session_Resource_To_Release_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_Resource_Release_Command_Transfer containing { + Cause set to PX_Cause}}}} //normal_release + to the GNB entity + } + then { + the IUT entity accepts a PDU_SESSION_RESOURCE_RELEASE_RESPONSE containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + PDU_Session_Resource_To_Release_List containing { + PDU_Session_Resource_To_Release_Item containing { + PDU_SessionId set to PX_PDU_SessionId}}} + from the GNB entity + } + } + } // end TP Id TP_NGAP_AMF_PDU_02_2 + + Test Purpose TP_NGAP_AMF_PDU_03 { + + Objective: "Verify that the IUT initiates the PDU Session Resource Modify procedure to request the setup of an additional QoS flow for an already established PDU session. NOTE: The UE shall be configured in the IUT to require an additional QoS flow for the concerned PDU session." + + Reference: "ETSI TS 138 413 [1], Clauses 8.2.3.2 and 9.2.1.5" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_1_3 + + + Initial conditions + with { + the UE entity isInCM_CONNECTED and + the IUT entity hasActiveUeNgapContext and + the IUT entity hasEstablishedPduSessionResourceForTheConcernedPduSessionId + } + + Expected behaviour + ensure that { + when { + the IUT entity initiatesPduSessionResourceModificationToAddQoSFlow + } + then { + the IUT entity sends a PDU_SESSION_RESOURCE_MODIFY_REQUEST containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + PDU_Session_Resource_Modify_Request_List containing { + PDU_Session_Resource_Modify_Request_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_Resource_Modify_Request_Transfer containing { + QoSFlowAddOrModifyRequestList containing { + QoSFlowAddOrModifyRequestItem containing { + QoSFlowIdentifier set to RV_2nd_QFI, + QoSFlowLevelQosParameters containing { + QoSCharacteristics containing { + Non_Dynamic_5QI set to PX_2nd_5QI, + AllocationAndRetentionPriority}}}}}}}} + to the GNB entity + and the IUT entity accepts a PDU_SESSION_RESOURCE_MODIFY_RESPONSE containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + PDU_Session_Resource_Modify_Response_List containing { + PDU_Session_Resource_Modify_Response_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_Resource_Modify_Response_Transfer containing { + QoSFlowAddOrModifyResponseList containing { + QoSFlowAddOrModifyResponseItem containing { + QoSFlowIdentifier set to RV_2nd_QFI}}}}}} + from the GNB entity + } + } + } // end TP_NGAP_AMF_PDU_03 + + Test Purpose TP_NGAP_AMF_PDU_04 { + + Objective: "Verify that the AMF node successfully processes a PDU_SESSION_RESOURCE_MODIFY_INDICATION and answers with PDU_SESSION_RESOURCE_MODIFY_CONFIRM for successfully modified PDU session." + + Reference: "ETSI TS 138 413 [1], Clauses 8.2.5.2 and 9.2.1.8" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_1_5 + + Initial conditions + with { + the UE entity isInCM_CONNECTED and + the IUT entity hasActiveUeNgapContext and + the IUT entity hasEstablishedPduSessionResourceForTheConcernedPduSessionId + } + + Expected behaviour + ensure that { + when { + the IUT entity receives a PDU_SESSION_RESOURCE_MODIFY_INDICATION containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + PDU_Session_Resource_Modify_Indication_List containing { + PDU_Session_Resource_Modify_Indication_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_Resource_Modify_Indication_Transfer containing { + DLQoSFlowperTNLInformation containing { + UPTransportLayerInformation containing { + EndpointIPAddress set to PX_N3_GNB_IP_ADDRESS, + GTP_TEID set to RV_GTP_TEID}, + AssociatedQoSFlowList containing { + AssociatedQoSFlowItem containing { + QoSFlowIdentifier set to RV_QFI}}}}}}} + from the GNB entity + } + then { + the IUT entity sends a PDU_SESSION_RESOURCE_MODIFY_CONFIRM containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + PDU_Session_Resource_Modify_Confirm_List containing { + PDU_Session_Resource_Modify_Confirm_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_Resource_Modify_Confirm_Transfer containing { + QoSFlowModifyConfirmList containing { + QoSFlowModifyConfirmItem containing { + QoSFlowIdentifier set to RV_QFI}}, + UL_NG_U_UP_TNLInformation containing { + UP_Transport_Layer_Information containing { + EndpointIPAddress set to PX_N3_AMF_IP_ADDRESS, + GTP_TEID set to RV_GTP_TEID}}}}}} + to the GNB entity + } + } + } // end TP_NGAP_AMF_PDU_04 + + Test Purpose TP_NGAP_AMF_PDU_05 { + + Objective: "Verify that the AMF node processes a PDU_SESSION_RESOURCE_MODIFY_INDICATION and answers with PDU_SESSION_RESOURCE_MODIFY_CONFIRM for not successfully modified PDU session." + + Reference: "ETSI TS 138 413 [1], Clauses 8.2.5.2 and 9.2.1.8" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_1_5 + + Initial conditions + with { + the UE entity isInCM_CONNECTED and + the IUT entity hasActiveUeNgapContext and + the IUT entity hasEstablishedPduSessionResourceForTheConcernedPduSessionId + } + + Expected behaviour + ensure that { + when { + the IUT entity receives a PDU_SESSION_RESOURCE_MODIFY_INDICATION containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + PDU_Session_Resource_Modify_Indication_List containing { + PDU_Session_Resource_Modify_Indication_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_Resource_Modify_Indication_Transfer containing { + DLQoSFlowperTNLInformation containing { + UPTransportLayerInformation containing { + EndpointIPAddress set to PX_N3_GNB_IP_ADDRESS, + GTP_TEID set to RV_GTP_TEID}, + AssociatedQoSFlowList containing { + AssociatedQoSFlowItem containing { + QoSFlowIdentifier set to PX_QFI_Wrong}}}}}}} + from the GNB entity + } + then { + the IUT entity sends a PDU_SESSION_RESOURCE_MODIFY_CONFIRM containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + PDU_Session_Resource_Failed_To_Modify_List containing { + PDU_Session_Resource_Failed_To_Modify_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_Resource_Modify_Indication_Unsuccessful_Transfer containing { + Cause set to "Unknown QoS Flow ID"}}}} + to the GNB entity + } + } + } // end TP_NGAP_AMF_PDU_05 + + + + } //end Package Clause_8_2_PDU_Session_Management_Procedures + + Package Clause_8_3_UE_Context_Management_Procedures { + + Package Initial_Context_Setup { + Import all from TDL + Import all from NGAP_Common + + Test Purpose TP_NGAP_AMF_CMP_01 { + + Objective: "Verify the IUT correctly sets the UE Context after Authentication and Security procedure has been executed." + + Reference: "ETSI TS 138 413 [1], Clauses 8.3.1.2" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_2_1 + + Initial conditions + with { + the GNB entity hasEstablished_NG_C_AssociationToAMF and + the IUT entity hasActiveUeNgapContext and + the UE entity isNotRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an UplinkNASTransport containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + NAS_PDU containing { + Message_identity set to SECURITY_MODE_COMPLETE}, + User_Location_Information containing { + nr_cgi containing { + PLMN_Identity set to PX_PLMN_Identity}, + tai containing { + PLMN_Identity set to PX_PLMN_Identity, + TAC set to PX_TAC}}} + from the GNB entity + } + then { + the IUT entity sends an INITIAL_CONTEXT_SETUP_REQUEST containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + GUAMI containing { + PLMN_Identity set to PX_PLMN_Identity, + AMF_Region_ID set to PX_AMF_Region_ID, + AMF_Set_ID set to PX_AMF_Set_ID, + AMF_Pointer set to PX_AMF_Pointer_ID}, + Allowed_NSSAI containing { + Allowed_NSSAI_List containing { + Allowed_NSSAI_Item containing { + S_NSSAI containing { + SST set to PX_SST_Allowed, + SD set to PX_SD_Allowed}}}}, + UE_Security_Capabilities containing { + NR_Encryption_Algorithms set to PX_NR_Encryption_Algorithms, + NR_Integrity_Protection_Algorithms set to PX_NR_Integrity_Protection_Algorithms, + E_UTRA_Encryption_Algorithms set to PX_E_UTRA_Encryption_Algorithms, + E_UTRA_Integrity_Protection_Algorithms set to PX_E_UTRA_Integrity_Protection_Algorithms}, + Security_Key set to RV_Security_Key, + NAS_PDU containing { + Message_identity set to REGISTRATION_ACCEPT}} + to the GNB entity + and the IUT entity accepts a INITIAL_CONTEXT_SETUP_RESPONSE containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID} + from the GNB entity + } + } + } // end TP_NGAP_AMF_CMP_01 + + } //end Package Initial_Context_Setup + + Package UE_Context_Release_AMF_initiated { + Import all from TDL + Import all from NGAP_Common + + Test Purpose TP_NGAP_AMF_CMP_02 { + + Objective: "Verify that the IUT can send a UE_CONTEXT_RELEASE_COMMAND that contains both the AMF_UE_NGAP_ID IE and the RAN_UE_NGAP_ID IE or only AMF_UE_NGAP_ID ." + + Reference: "ETSI TS 138 413 [1], Clauses 8.3.3 and 9.2.2.5" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_2_3 + + Initial conditions + with { + the UE entity isRegisteredToAMF and + the IUT entity hasActiveUeNgapContext and + the UE entity hasEstablishedInitialContext + } + + Expected behaviour + ensure that { + when { + // implicit trigger: AMF releases UE Context + the IUT entity processTheUENasDeregistration + } + then { + the IUT entity sends a UE_CONTEXT_RELEASE_COMMAND containing { + CHOICE_UE_NGAP_IDs containing { + UE_NGAP_ID_pair containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID + } + }, + Cause set to "nas.normal_release" + } + to the GNB entity + } + } + } // end TP_NGAP_AMF_CMP_02 + + Test Purpose TP_NGAP_AMF_CMP_03 { + + Objective: "Verify that the IUT executes a UE_CONTEXT_RELEASE procedure when it has received UE_CONTEXT_RELEASE_REQUEST due to GNB generated reasons." + + Reference: "ETSI TS 138 413 [1], Clauses 8.3.2, 8.3.3 and 9.2.2.5" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_2_3 + + Initial conditions + with { + the UE entity isRegisteredToAMF and + the UE entity hasEstablishedInitialContext + } + + Expected behaviour + ensure that { + when { + the IUT entity receives a UE_CONTEXT_RELEASE_REQUEST containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + PDU_Session_Resource_List containing { + PDU_Session_Resource_Item containing { + PDU_SessionId set to PX_PDU_SessionId}}, + Cause set to PX_VA_Cause} + from the GNB entity + } + then { + the IUT entity sends a UE_CONTEXT_RELEASE_COMMAND containing { + CHOICE_UE_NGAP_IDs containing { + UE_NGAP_ID_pair containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID}} + , + Cause set to PX_VA_Cause} + to the GNB entity + and the IUT entity accepts a UE_CONTEXT_RELEASE_COMPLETE containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID} + } + } + Variant TP_NGAP_AMF_CMP_03_ID_01 { + Bindings { + value PX_VA_Cause set to "RadioNetwork.user-inactivity" + } + } + Variant TP_NGAP_AMF_CMP_03_ID_02 { + Bindings { + value PX_VA_Cause set to "RadioNetwork.unspecified" + } + } + Variant TP_NGAP_AMF_CMP_03_ID_03 { + Bindings { + value PX_VA_Cause set to "RadioNetwork.release due to NG-RAN generated reason" + } + } + Variant TP_NGAP_AMF_CMP_03_ID_04 { + Bindings { + value PX_VA_Cause set to "RadioNetwork.cell not available" + } + } + Variant TP_NGAP_AMF_CMP_03_ID_05 { + Bindings { + value PX_VA_Cause set to "RadioNetwork.radio resource not available" + } + } + Variant TP_NGAP_AMF_CMP_03_ID_06 { + Bindings { + value PX_VA_Cause set to "RadioNetwork.radio connection with UE lost" + } + } + } // end TP_NGAP_AMF_CMP_03 + + } //end Package UE_Context_Release_AMF_initiated + + Package UE_Context_Modification { + + Import all from TDL + Import all from NGAP_Common + + + } //end Package UE_Context_Modification + + Package Connection_Establishment_Indication { + //Currently skipped test since CONNECTION_ESTABLISHMENT_INDICATION is sent only if NG-RAN node is an ng-eNB + + } //end Package Connection_Establishment_Indication + + Package AMF_CP_Relocation_Indication { + + Import all from TDL + Import all from NGAP_Common + + } //end Package AMF_CP_Relocation_Indication + + Package Retrieve_UE_information { + + Import all from TDL + Import all from NGAP_Common + + + } //end Package Retrieve_UE_information + + Package UE_Context_Suspend { + Import all from TDL + Import all from NGAP_Common + + + } //end Package UE_Context_Suspend + + Package UE_Context_Resume { + Import all from TDL + Import all from NGAP_Common + + + } //end Package UE_Context_Resume + + } //end Package Clause_8_3_UE_Context_Management_Procedures + + Package Clause_8_4_UE_Mobility_Management_Procedures { + + Package Handover_Preparation { + Import all from TDL + Import all from NGAP_Common + + + } //end Package Handover_Preparation + + Package Handover_Resource_Allocation { + Import all from TDL + Import all from NGAP_Common + + + } //end Package Handover_Resource_Allocation + + Package Path_Switch_Request { + Import all from TDL + Import all from NGAP_Common + + + } //end Package Path_Switch_Request + + Package Handover_Cancellation { + Import all from TDL + Import all from NGAP_Common + + + } //end Package Handover_Cancellation + + Package Downlink_RAN_Status_Transfer { + Import all from TDL + Import all from NGAP_Common + + + } //end Package Downlink_RAN_Status_Transfer + + Package Handover_Success { + Import all from TDL + Import all from NGAP_Common + + } //end Package Handover_Success + + Package Downlink_RAN_Early_Status_Transfer { + Import all from TDL + Import all from NGAP_Common + } //end Package Downlink_RAN_Early_Status_Transfer + + } //end Package Clause_8_4_UE_Mobility_Management_Procedures + + Package Clause_8_5_Paging_Procedures { + Package Paging { + Import all from TDL + Import all from NGAP_Common + + } // end "Paging" + + } // end "8.5 Paging Procedures" + + Package Clause_8_6_Transport_of_NAS_Messages_Procedures { + Package Downlink_NAS_Transport { + Import all from TDL + Import all from NGAP_Common + + Test Purpose TP_NGAP_AMF_NAS_01 { + + Objective: "Verify that the IUT can send a DOWNLINK_NAS_TRANSPORT message to carry NAS information over the NG interface after INITIAL_UE_MESSAGE to start with UE registration procedure." + + Reference: "ETSI TS 138 413 [1], Clauses 8.6.2.2, 9.2.5.1 and 9.2.5.2", + "ETSI TS 123 502 [3], Clause 4.24.1" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_5_2 + + Initial conditions + with { + the GNB entity hasEstablished_NG_C_AssociationToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an INITIAL_UE_MESSAGE containing { + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + NAS_PDU containing { + Message_identity set to REGISTRATION_REQUEST}, + User_Location_Information containing { + nr_cgi containing { + PLMN_Identity set to PX_PLMN_Identity}, + tai containing { + PLMN_Identity set to PX_PLMN_Identity, + TAC set to PX_TAC}}, + RRC_Establishmnet_Cause set to "mo-Signalling"} + from the GNB entity + } + then { + the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID, + NAS_PDU containing { + Message_identity set to AUTHENTICATION_REQUEST}} + to the GNB entity + } + } + } // end TP_NGAP_AMF_NAS_01 + + } // end "Downlink NAS Transport" + + Package Reroute_NAS_Request { + Import all from TDL + Import all from NGAP_Common + + } // end "Reroute NAS Request" + + } //end Package Reroute_NAS_Request + + Package Clause_8_7_Interface_Management_Procedures { + Package NG_Setup { + Import all from TDL + Import all from NGAP_Common + + Test Purpose TP_NGAP_AMF_IMP_01 { + + Objective: "Verify that the AMF node successfully processes an NG_SETUP_REQUEST message containing the PLMN identity, TAC, and supported slice IEs, and responds with an NG_SETUP_RESPONSE message to acknowledge the setup." + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.1.2, 9.2.6.1 and 9.2.6.2" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_6_1 + + Initial conditions + with { + the GNB entity hasNotEstablished_NG_C_AssociationToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an NG_SETUP_REQUEST containing { + Global_RAN_Node_ID containing { + Global_gNB_ID containing { + PLMN_Identity set to PX_PLMN_Identity, + gNB_ID set to PX_gNB_ID}}, + Supported_TA_List containing { + Supported_TA_Item containing { + TAC set to PX_TAC, + Broadcast_PLMN_List containing { + Broadcast_PLMN_Item containing { + PLMN_Identity set to PX_PLMN_Identity, + TAI_Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}}}}} + }} + from the GNB entity + } + then { + the IUT entity sends an NG_SETUP_RESPONSE containing { + AMF_Name set to PX_AMF_Name, + Served_GUAMI_List containing { + Served_GUAMI_Item containing { + GUAMI containing { + PLMN_Identity set to PX_PLMN_Identity, + AMF_Region_ID set to PX_AMF_Region_ID, + AMF_Set_ID set to PX_AMF_Set_ID, + AMF_Pointer set to PX_AMF_Pointer_ID}}}, + PLMN_Support_List containing { + PLMN_Support_Item containing { + PLMN_Identity set to PX_PLMN_Identity, + Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}}}}} + to the GNB entity + } + } + } // end TP TP_NGAP_AMF_IMP_01 + + Test Purpose TP_NGAP_AMF_IMP_02 { + + Objective: "Verify that the AMF node successfully decline an NG_SETUP_REQUEST message containing only PLMNs/SNPNs that does not recognize or support, rejects the NG Setup procedure by responding with NG_SETUP_FAILURE message including the appropriate cause value." + //Possible test for not supported slice at AMF and cause would be "slice-not-supported"; + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.1.3, 9.2.6.1 and 9.2.6.3" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_6_1 + + Initial conditions + with { + the GNB entity hasEstablishedTNL_AssociationToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an NG_SETUP_REQUEST containing { + Supported_TA_List containing { + Supported_TA_Item containing { + TAC set to PX_TAC, + Broadcast_PLMN_List containing { + Broadcast_PLMN_Item containing { + PLMN_Identity set to PX_NOTSUPPORTED_PLMN_Identity, + TAI_Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}}}}} + //!Default_Paging_DRX + }} + from the GNB entity + } + then { + the IUT entity sends an NG_SETUP_FAILURE containing { + Cause set to "unknown-PLMN-or-SNPN"} + to the GNB entity + } + } + } // end TP TP_NGAP_AMF_IMP_02 + + Test Purpose TP_NGAP_AMF_IMP_04 { + + Objective: "Verify that the AMF node successfully processes an NG_SETUP_REQUEST message including the appropriate data and answers with NG_SETUP_RESPONSE to acknowledge the setup." + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.1.2, 9.2.6.1 and 9.2.6.2" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_6_1 + + Initial conditions + with { + the GNB entity hasEstablishedTNL_AssociationToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an NG_SETUP_REQUEST containing { + Global_RAN_Node_ID containing { + Global_gNB_ID containing { + PLMN_Identity set to PX_PLMN_Identity, + gNB_ID set to PX_gNB_ID}}, + RAN_Node_Name set to PX_RAN_NODE_NAME, + Supported_TA_List containing { + Supported_TA_Item containing { + TAC set to PX_TAC, + Broadcast_PLMN_List containing { + Broadcast_PLMN_Item containing { + PLMN_Identity set to PX_PLMN_Identity, + TAI_Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}}, + NPN_Support containing { + SNPN containing { + NID set to PX_NID}}, + Extended_TAI_Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST_EXTENDED, + SD set to PX_SD_EXTENDED}}}}, + RAT_Information set to "unlicensed"}, + Extended_RAN_Node_Name containing { + RAN_Node_Name_Visible set to PX_RAN_NODE_NAME_VISIBLE}}} + from the GNB entity + } + then { + the IUT entity sends an NG_SETUP_RESPONSE containing { + AMF_Name set to PX_AMF_Name, + Served_GUAMI_List containing { + Served_GUAMI_Item containing { + GUAMI containing { + PLMN_Identity set to PX_PLMN_Identity, + AMF_Region_ID set to PX_AMF_Region_ID, + AMF_Set_ID set to PX_AMF_Set_ID, + AMF_Pointer set to PX_AMF_Pointer_ID}}}, + Relative_AMF_Capacity, + PLMN_Support_List containing { + PLMN_Support_Item containing { + PLMN_Identity set to PX_PLMN_Identity, + Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}}, + NPN_Support containing { + SNPN containing { + NID set to PX_NID}}, + Extended_Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST_EXTENDED, + SD set to PX_SD_EXTENDED}}}}, + Extended_RAN_Node_Name containing { + RAN_Node_Name_Visible set to PX_RAN_NODE_NAME_VISIBLE}} + to the GNB entity + } + } + } // end TP TP_NGAP_AMF_IMP_04 + + Test Purpose TP_NGAP_AMF_IMP_01_2 { + + Objective: "Verify that the AMF node successfully processes an NG_SETUP_REQUEST message containing the PLMN identity, TAC, supported slice IEs and Extended RAN Node Name, and responds with an NG_SETUP_RESPONSE message to acknowledge the setup." + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.1.2, 9.2.6.1 and 9.2.6.2" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_6_1 + + Initial conditions + with { + the GNB entity hasNotEstablished_NG_C_AssociationToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an NG_SETUP_REQUEST containing { + Global_RAN_Node_ID containing { + Global_gNB_ID containing { + PLMN_Identity set to PX_PLMN_Identity, + gNB_ID set to PX_gNB_ID}}, + RAN_Node_Name set to PX_RAN_Node_Name, + Supported_TA_List containing { + Supported_TA_Item containing { + TAC set to PX_TAC, + Broadcast_PLMN_List containing { + Broadcast_PLMN_Item containing { + PLMN_Identity set to PX_PLMN_Identity, + TAI_Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}}}}}, + Extended_RAN_Node_Name set to PX_Extended_RAN_Node_Name + }} + from the GNB entity + } + then { + the IUT entity sends an NG_SETUP_RESPONSE containing { + AMF_Name set to PX_AMF_Name, + Served_GUAMI_List containing { + Served_GUAMI_Item containing { + GUAMI containing { + PLMN_Identity set to PX_PLMN_Identity, + AMF_Region_ID set to PX_AMF_Region_ID, + AMF_Set_ID set to PX_AMF_Set_ID, + AMF_Pointer set to PX_AMF_Pointer_ID}}}, + PLMN_Support_List containing { + PLMN_Support_Item containing { + PLMN_Identity set to PX_PLMN_Identity, + Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}}}}} + to the GNB entity + } + } + } // end TP TP_NGAP_AMF_IMP_01_2 + + Test Purpose TP_NGAP_AMF_IMP_01_3 { + + Objective: "Verify that the AMF with IAB support successfully processes an NG_SETUP_REQUEST message containing the PLMN identity, TAC and supported slice IEs, and responds with an NG_SETUP_RESPONSE message containing IAB Supported IE to acknowledge the setup." + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.1.2, 9.2.6.1 and 9.2.6.2" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_6_1 and PICS_A4_6_1_2 + + Initial conditions + with { + the GNB entity hasNotEstablished_NG_C_AssociationToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an NG_SETUP_REQUEST containing { + Global_RAN_Node_ID containing { + Global_gNB_ID containing { + PLMN_Identity set to PX_PLMN_Identity, + gNB_ID set to PX_gNB_ID}}, + RAN_Node_Name set to PX_RAN_Node_Name, + Supported_TA_List containing { + Supported_TA_Item containing { + TAC set to PX_TAC, + Broadcast_PLMN_List containing { + Broadcast_PLMN_Item containing { + PLMN_Identity set to PX_PLMN_Identity, + TAI_Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}}}}} + }} + from the GNB entity + } + then { + the IUT entity sends an NG_SETUP_RESPONSE containing { + AMF_Name set to PX_AMF_Name, + Served_GUAMI_List containing { + Served_GUAMI_Item containing { + GUAMI containing { + PLMN_Identity set to PX_PLMN_Identity, + AMF_Region_ID set to PX_AMF_Region_ID, + AMF_Set_ID set to PX_AMF_Set_ID, + AMF_Pointer set to PX_AMF_Pointer_ID}}}, + PLMN_Support_List containing { + PLMN_Support_Item containing { + PLMN_Identity set to PX_PLMN_Identity, + Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}}}}, + IAB_Supported set to "true"} + to the GNB entity + } + } + } // end TP TP_NGAP_AMF_IMP_01_3 + + } //end Package NG_Setup + + Package RAN_Configuration_Update { + Import all from TDL + Import all from NGAP_Common + + Test Purpose TP_NGAP_AMF_IMP_05 { + + Objective: "Verify that the AMF node successfully processes a RAN_CONFIGURATION_UPDATE message containing new slice with RAN_CONFIGURATION_UPDATE_ACKNOWLEDGE to acknowledge the update with supported slice at AMF." + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.2.2, 9.2.6.4 and 9.2.6.5" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_6_2 + + Initial conditions + with { + the GNB entity hasEstablished_NG_C_AssociationToAMF + + } + + Expected behaviour + ensure that { + when { + the IUT entity receives a RAN_CONFIGURATION_UPDATE containing { + Supported_TA_List containing { + Supported_TA_Item containing { + TAC set to PX_TAC, + Broadcast_PLMN_List containing { + Broadcast_PLMN_Item containing { + PLMN_Identity set to PX_PLMN_Identity, + TAI_Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST_NEW, + SD set to PX_SD_NEW}}}}}}} + from the GNB entity + } + then { + the IUT entity sends a RAN_CONFIGURATION_UPDATE_ACKNOWLEDGE + to the GNB entity + } + } + } // end TP TP_NGAP_AMF_IMP_05 + + Test Purpose TP_NGAP_AMF_IMP_06 { + + Objective: "Verify that the AMF node successfully declines a RAN_CONFIGURATION_UPDATE message with RAN_CONFIGURATION_UPDATE_FAILURE and appropriate cause value (i.e. slice not supported) when the AMF is not able to handle new slice type as requested." + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.2.3 and 9.2.6.4 and 9.2.6.6" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_6_2 + + Initial conditions + with { + the GNB entity hasEstablished_NG_C_AssociationToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives a RAN_CONFIGURATION_UPDATE containing { + Supported_TA_List containing { + Supported_TA_Item containing { // Implementation note: RAN has been reconfigured via O&M interface to support different SST + TAC set to PX_TAC, + Broadcast_PLMN_List containing { + Broadcast_PLMN_Item containing { + PLMN_Identity set to PX_PLMN_Identity, + TAI_Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST_UNSUPPORTED, // Implementation note: The new SST indicated is not supported by Core side. + SD set to PX_SD_NEW}}}}}}} + from the GNB entity + } + then { + the IUT entity sends a RAN_CONFIGURATION_UPDATE_FAILURE containing { + Cause set to "RadioNetwork_slice-not-supported"} + to the GNB entity + } + } + } // end TP TP_NGAP_AMF_IMP_06 + + } //end Package RAN_Configuration_Update + + Package AMF_Configuration_Update { + Import all from TDL + Import all from NGAP_Common + + } //end Package AMF_Configuration_Update + + Package NG_Reset { + Import all from TDL + Import all from NGAP_Common + + Test Purpose TP_NGAP_AMF_IMP_08 { + + Objective: "Verify that the AMF node successfully processes a full NG_RESET message and answers with NG_RESET_ACKNOWLEDGE to acknowledge the reset." + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.4.2.2, 9.2.6.11 and 9.2.6.12" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_6_4 + + Initial conditions + with { + the GNB entity hasEstablished_NG_C_AssociationToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an NG_RESET containing { + Cause set to PX_CAUSE, + CHOICE_Reset_Type containing { + NG_interface containing { + Reset_All set to "Reset all"}}} + from the GNB entity + } + then { + the IUT entity sends an NG_RESET_ACKNOWLEDGE containing { + not UE_associated_Logical_NGconnection_List} + to the GNB entity + } + } + } // end TP TP_NGAP_AMF_IMP_08 + + Test Purpose TP_NGAP_AMF_IMP_08_2 { + + Objective: "Verify that the AMF node successfully processes a partial NG_RESET message and answers with NG_RESET_ACKNOWLEDGE to acknowledge the partial reset." + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.4.2.2, 9.2.6.11 and 9.2.6.12" + + Configuration: CF_AMF_N2 + + PICS: PICS_A2_2 and PICS_A4_6_4 + + Initial conditions + with { + the UE entity isRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an NG_RESET containing { + Cause set to PX_CAUSE, + CHOICE_Reset_Type containing { + Part_of_NG_interface containing { + UE_associated_Logical_NGconnection_List containing { + UE_associated_Logical_NGconnection_Item containing { + AMF_UE_NGAP_ID set to RV_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to PX_RAN_UE_NGAP_ID}}}}} + from the GNB entity + } + then { + the IUT entity sends an NG_RESET_ACKNOWLEDGE containing { + not UE_associated_Logical_NGconnection_List} + to the GNB entity + } + } + } // end TP TP_NGAP_AMF_IMP_08_2 + + } //end Package NG_Reset + } //end Package Clause_8_7_Interface_Management_Procedures +} //end Package TP_AMF_NGAP + diff --git a/test_purposes/TP_AMF_NGNAS.tdltx b/test_purposes/TP_AMF_NGNAS.tdltx new file mode 100644 index 0000000000000000000000000000000000000000..16a97820c3c0214a71a451a9d44b44e6832676ed --- /dev/null +++ b/test_purposes/TP_AMF_NGNAS.tdltx @@ -0,0 +1,1275 @@ +/* +Copyright (c) ETSI 2026. + +This software is subject to copyrights owned by ETSI. Non-exclusive permission +is hereby granted, free of charge, to copy, reproduce and amend this file +under the following conditions: It is provided "as is", without warranty of any +kind, expressed or implied. + +ETSI shall never be liable for any claim, damages, or other liability arising +from its use or inability of use.This permission does not apply to any documentation +associated with this file for which ETSI keeps all rights reserved. The present +copyright notice shall be included in all copies of whole or part of this +file and shall not imply any sub-license right. +*/ + +/* interface at AMF */ +Package TP_AMF_NGNAS { + + + Package Clause_5_4_5_GMM_Common_Procedures { + Package Clause_5_4_1_Primary_authentication_and_key_agreement_procedure { + Import all from TDL + Import all from NGAP_Common + Import all from NGNAS_Common + + Test Purpose TP_5GNAS_AMF_AUT_REQ_01 { + + Objective: "Verify that the IUT sends an AUTHENTICATION_REQUEST message upon receipt of an initial REGISTRATION_REQUEST containing a SUCI, when no active 5G NAS security context exists." + + Reference: "ETSI TS 124 501 [1], Clauses 5.4.1.3.2 and 8.2.1" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_1_2 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an INITIAL_UE_MESSAGE containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to REGISTRATION_REQUEST, + 5GS_registration_type containing { + 5GS_registration_type_value set to INITIAL_REGISTRATION}, + 5GS_mobile_identity containing { + SUPI_format set to IMSI, + Type_of_identity set to SUCI, + MCC set to PX_MCC, + MNC set to PX_MNC, + Routing_indicator set to PX_ROUTING_INDICATOR, + Protection_scheme_id set to PX_PROTECTION_SCHEME_ID, + Home_network_public_key_identifier set to PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, + MSIN set to PX_MSIN}}} + } + then { + the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to AUTHENTICATION_REQUEST, + ngKSI containing { + nas_key_set_identifier set to "111"}, + ABBA containing { + ABBA_contents set to " '0000'H "}, + Authentication_parameter_RAND set to RV_Authentication_parameter_RAND, + Authentication_parameter_AUTN set to RV_Authentication_parameter_AUTN}} + to the GNB entity + } + } + } // end TP_5GNAS_AMF_AUT_REQ_01 + + Test Purpose TP_5GNAS_AMF_AUT_REQ_02 { + + Objective: "Verify that the IUT sends an AUTHENTICATION_REJECT message upon receipt of an AUTHENTICATION_RESPONSE containing an invalid authentication response value, when the UE was identified with SUCI in the initial NAS message." + + Reference: "ETSI TS 124 501 [1], Clauses 5.4.1.3.5 and 8.2.5" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_1_2 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF and + the IUT entity receives an INITIAL_UE_MESSAGE containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to REGISTRATION_REQUEST, + 5GS_registration_type containing { + 5GS_registration_type_value set to INITIAL_REGISTRATION}, + 5GS_mobile_identity containing { + Type_of_identity set to SUCI}}} and + event AUTHENTICATION_REQUEST occurs + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an UPLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to AUTHENTICATION_RESPONSE, + authentication_response_parameter containing { + RES set to PX_INVALID_RES_VALUE}}} + from the GNB entity + } + then { + the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to AUTHENTICATION_REJECT}} + to the GNB entity + } + } + } // end TP_5GNAS_AMF_AUT_REQ_02 + + Test Purpose TP_5GNAS_AMF_AUT_REQ_03 { + + Objective: "Verify that the IUT stops re-sending an AUTHENTICATION_REQUEST message if no AUTHENTICATION_RESPONSE message is received on the fifth expire of timer T3560." + + Reference: "ETSI TS 124 501 [1], Clauses 5.4.1.3.7 b) and Table 10.3.1" + + Configuration: CF_AMF_N2N1 + + + Initial conditions + with { + the UE entity isNotRegisteredToAMF + and (.) at time point start_initial_T3560 : event AUTHENTICATION_REQUEST occurs + and (!) 6s after @start_initial_T3560 : event AUTHENTICATION_REQUEST occurs + and (!) 12s after @start_initial_T3560 : event AUTHENTICATION_REQUEST occurs + and (!) 18s after @start_initial_T3560 : event AUTHENTICATION_REQUEST occurs + } + Expected behaviour + ensure that { + when { + (.) at time point start_trigger_T3560 : event AUTHENTICATION_REQUEST occurs + } + then { + (!) 6s after @start_trigger_T3560 : the IUT entity aborts an AUTHENTICATION_REQUEST procedure + //(Note 1: "It is not expected to receive another AUTHENTICATION message on the N2N1 interface.") + } + } + } // end TP_5GNAS_AMF_AUT_REQ_03 + + Test Purpose TP_5GNAS_AMF_AUT_REQ_04 { + + Objective: "Verify that the IUT sends an IDENTITY_REQUEST message correctly upon receipt of an AUTHENTICATION_FAILURE message indicating a 5GMM cause value #20 - MAC failure." + + Reference: "ETSI TS 124 501 [1], Clauses 5.4.1.3.7 c), 5.4.3 and 8.2.4" + + Configuration: CF_AMF_N2N1 + + + Initial conditions + with { + the UE entity isNotRegisteredToAMF and + event AUTHENTICATION_REQUEST occurs + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an UPLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to INTEGRITY_PROTECTED, + message_type set to AUTHENTICATION_FAILURE, + 5GMM_cause set to MAC_failure}} + from the GNB entity + } + then { + the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to INTEGRITY_PROTECTED, + message_type set to IDENTITY_REQUEST, + identity_type set to SUCI}} + to the GNB entity + } + } + } // end TP_5GNAS_AMF_AUT_REQ_04 + + Test Purpose TP_5GNAS_AMF_AUT_REQ_05 { + + Objective: "Verify that the IUT sends a new AUTHENTICATION_REQUEST message with new ngKSI value to re-initiate the 5G AKA based primary authentication upon receipt of an AUTHENTICATION_FAILURE message indicating a 5GMM cause value #71 - ngKSI already in use." + + Reference: "ETSI TS 124 501 [1], Clauses 5.4.1.3.7 e) and 8.2.4" + + Configuration: CF_AMF_N2N1 + + + Initial conditions + with { + the UE entity isNotRegisteredToAMF and + the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to AUTHENTICATION_REQUEST, + ngKSI containing { + nas_key_set_identifier set to "111"}, //!value for nas_key_set_identifier was already used before + ABBA containing { + ABBA_contents set to " '0000'H "}, + Authentication_parameter_RAND set to RV_Authentication_parameter_RAND, + Authentication_parameter_AUTN set to RV_Authentication_parameter_AUTN}} + to the GNB entity + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an UPLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to INTEGRITY_PROTECTED, + message_type set to AUTHENTICATION_FAILURE, + 5GMM_cause set to ngKSI_already_in_use}} + from the GNB entity + } + then { + the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to AUTHENTICATION_REQUEST, + ngKSI containing { + nas_key_set_identifier set to PX_NON_DEFAULT_NGKSI}, + ABBA containing { + ABBA_contents set to " '0000'H "}, + Authentication_parameter_RAND set to RV_Authentication_parameter_RAND, + Authentication_parameter_AUTN set to RV_Authentication_parameter_AUTN}} + to the GNB entity + } + } + } // end TP_5GNAS_AMF_AUT_REQ_05 + + + + Test Purpose TP_5GNAS_AMF_AUT_ABN_01 { + + Objective: "Verify that the IUT sends an IDENTITY_REQUEST message to obtain the SUCI from the UE upon receipt of an AUTHENTICATION_FAILURE message indicating a 5GMM cause value #26 - non-5G authentication unacceptable." + + Reference: "ETSI TS 124 501 [1], Clauses 5.4.1.3.7, 8.2.4, 5.4.3.2 and 8.2.21.1" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_1_2_3_1 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF and + the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to AUTHENTICATION_REQUEST, + ngKSI containing { + nas_key_set_identifier set to "111"}, + ABBA containing { + ABBA_contents set to " '0000'H "}, + Authentication_parameter_RAND set to RV_Authentication_parameter_RAND, + Authentication_parameter_AUTN set to PX_Authentication_parameter_AUTN_NON_5G_UNACCEPTABLE}} //!the "separation bit" in the AMF field of AUTN is set to 0 + to the GNB entity + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an UPLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to INTEGRITY_PROTECTED, + message_type set to AUTHENTICATION_FAILURE, + 5GMM_cause set to "Non-5G authentication unacceptable (26)"}} + from the GNB entity + } + then { + the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to IDENTITY_REQUEST, + identity_type set to SUCI}} + to the GNB entity + } + } + + } // end TP_5GNAS_AMF_AUT_ABN_01 + + } //end Package Clause_5_4_1_Primary_authentication_and_key_agreement_procedure + + Package Clause_5_4_2_Security_mode_control_procedure { + + Import all from TDL + Import all from NGAP_Common + Import all from NGNAS_Common + + Test Purpose TP_5GNAS_AMF_SEC_COM_01 { //!Renamed TP Id from AUT_SEQ -> SEC_COM due to naming conventions + + Objective: "Verify that the IUT sends a SECURITY_MODE_COMMAND message to initiate the NAS security mode control procedure upon receipt of an AUTHENTICATION_RESPONSE message in a 5G AKA based primary authentication procedure." + + Reference: "ETSI TS 124 501 [1], Clauses 5.4.2.2, 5.4.2.3 and 8.2.25" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_2_1 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF and + event AUTHENTICATION_REQUEST occurs with { + argument replaced by the AUTHENTICATION_REQUEST containing { + security_header_type set to NOT_SECURITY_PROTECTED} + } + } + + Expected behaviour + ensure that { + when { + the IUT entity receives a UPLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to AUTHENTICATION_RESPONSE}} //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + from the GNB entity + } + then { + the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, //!reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values + security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, + message_type set to SECURITY_MODE_COMMAND, + selected_NAS_security_algorithms containing { + type_of_ciphering_algorithm set to PX_SELECTED_NAS_CIPHERING_ALGORITHM, + type_of_integrity_algorithm set to PX_SELECTED_NAS_INTEGRITY_ALGORITHM}, + ngKSI containing { + nas_key_set_identifier set to "111"}, + replayed_UE_security_capabilities set to PX_UE_SECURITY_CAPABILITIES}} //! UE security capability 9.11.3.54 + to the GNB entity + } + } + } // end TP_5GNAS_AMF_SEC_COM_01 + + Test Purpose TP_5GNAS_AMF_SEC_ACC_01 { + + Objective: "Verify that the IUT, upon receiving the NAS SECURITY_MODE_COMPLETE message after completing the NAS Authentication and Security procedure, successfully completes the registration process by accepting the registration." + + Reference: "ETSI TS 124 501 [1], Clauses 5.4.2.4, 5.5.1.2.4, 8.2.7 and 8.2.26" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_2 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF + } + + + Expected behaviour + ensure that { + when { + the IUT entity receives a UPLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, + message_type set to SECURITY_MODE_COMPLETE}} + from the GNB entity + } + then { + the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to REGISTRATION_ACCEPT, + 5GS_registration_result containing { + 5GS_registration_result_value set to 3GPP_ACCESS}, + 5G_GUTI containing { + Type_of_identity set to 5G_GUTI, + MCC set to PX_MCC, + MNC set to PX_MNC, + AMF_Region_ID set to PX_AMF_REGION_ID, + AMF_Set_ID set to PX_AMF_SET_ID, + AMF_Pointer set to PX_AMF_POINTER, + 5G_TMSI set to RV_5G_TMSI}, + TAI_list containing { + Partial_tracking_area_list_1 containing { + MCC set to PX_MCC, + MNC set to PX_MNC, + TAC set to PX_TAC}}, + T3512_value containing { + Timer_value set to nonZeroValue}}} + to the GNB entity + } + + } + + } // end TP_5GNAS_AMF_SEC_ACC_01 + + Test Purpose TP_5GNAS_AMF_SEC_REJ_01 { + + Objective: "Verify that the IUT aborts the ongoing procedure that triggered the NAS security mode control procedure upon receipt of a SECURITY_MODE_REJECT message containing 5GMM cause #23 'UE security capabilities mismatch'." + + Reference: "ETSI TS 124 501 [1], Clauses 5.4.2.5 and 8.2.27" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_2 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF and + (.) at time point start_SMC_event : event SECURITY_MODE_COMMAND occurs + } + + Expected behaviour + ensure that { + when { + (.) at time point start_SMC_event : event SECURITY_MODE_COMMAND occurs and + the IUT entity receives a UPLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, + message_type set to SECURITY_MODE_REJECT, + 5GMM_cause set to "UE security capabilities mismatch (23)"}} + from the GNB entity + } + then { + // PX_SEC_ABORT_TWAIT: observation timer to verify that no further registration progression occurs + (!) PX_SEC_ABORT_TWAIT after @start_SMC_event : the IUT entity does not send a INITIAL_CONTEXT_SETUP_REQUEST containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + message_type set to REGISTRATION_ACCEPT}} + to the GNB entity + //(Note 1: "The IUT is expected to abort the ongoing procedure and shall not proceed with registration completion.") + } + + } + + } // end TP_5GNAS_AMF_SEC_REJ_01 + + + + } //end Package Clause_5_4_2_Security_mode_control_procedure + + Package Clause_5_4_3_Identification_procedure { + Import all from TDL + Import all from NGAP_Common + Import all from NGNAS_Common + + Test Purpose TP_5GNAS_AMF_IDN_REQ_01 { + + Objective: "Verify that the IUT initiates the identification procedure by sending an IDENTITY_REQUEST message with identity type set to SUCI when the IUT receives a REGISTRATION_REQUEST message containing a 5G-GUTI that is not known by the IUT." + + Reference: "ETSI TS 123 502 [2], Clause 4.2.2.2.2 + ETSI TS 124 501 [1], Clauses 5.4.3.2 and 8.2.21" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_3 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an INITIAL_UE_MESSAGE containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to REGISTRATION_REQUEST, + 5GS_mobile_identity containing { + Type_of_identity set to 5G_GUTI, + MCC set to PX_MCC, + MNC set to PX_MNC, + AMF_Region_ID set to PX_AMF_REGION_ID, + AMF_Set_ID set to PX_AMF_SET_ID, + AMF_Pointer set to PX_AMF_POINTER, + 5G_TMSI set to PX_UNASSIGNED_5G_TMSI}}} + from the GNB entity + } + then { + the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + message_type set to IDENTITY_REQUEST, + identity_type set to SUCI}} + to the GNB entity + } + } + + } // end TP_5GNAS_AMF_IDN_REQ_01 + + } //end Package Clause_5_4_3_Identification_procedure + + Package Clause_5_4_4_Generic_UE_configuration_update_procedure { + Import all from TDL + Import all from NGAP_Common + Import all from NGNAS_Common + + Test Purpose TP_5GNAS_AMF_CNF_COM_01 { + + Objective: "Verify that the IUT does not retransmit a CONFIGURATION_UPDATE_COMMAND containing only NITZ-related information elements when the Configuration update indication IE is absent or indicates that acknowledgement is not requested." + // Example trigger observed in implementation: CONFIGURATION_UPDATE_COMMAND sent after PDU_SESSION_ESTABLISHMENT_REQUEST; + // note that the base specification does not explicitly define when the CONFIGURATION_UPDATE_COMMAND shall be sent. + + Reference: "ETSI TS 124 501 [1], Clauses 5.4.4.2 and 8.2.19" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_4_1 + + Initial conditions + with { + the UE entity isRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + (.) at time point start_CUC_event :the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to CONFIGURATION_UPDATE_COMMAND, + Full_name_for_network, + Short_name_for_network, + Local_time_zone, + Universal_time_and_local_time_zone, + Daylight_saving_time, + not Configuration_update_indication OR + Configuration_update_indication containing { + Acknowledgement_requested set to 0 + }}} + to the GNB entity + } + then { + // PX_CUC_TWAIT value for timer awaiting no response after CUC message + (!) PX_CUC_TWAIT after @start_CUC_event : the IUT entity does not send a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to CONFIGURATION_UPDATE_COMMAND}} + to the GNB entity + //(Note 1: "It is not expected to receive a retransmission of the same NITZ-only CONFIGURATION_UPDATE_COMMAND on the N2N1 interface.") + } + } + } // end TP_5GNAS_AMF_CNF_COM_01 + + } //end Package Clause_5_4_4_Generic_UE_configuration_update_procedure + + Package Clause_5_4_5_NAS_transport_procedure { + Import all from TDL + Import all from NGAP_Common + Import all from NGNAS_Common + + Test Purpose TP_5GNAS_AMF_DLN_ACC_01 { + + Objective: "Verify that the IUT, upon receipt of a UL NAS TRANSPORT message containing a PDU SESSION ESTABLISHMENT REQUEST, sends a PDU_SESSION_RESOURCE_SETUP_REQUEST carrying a DL NAS TRANSPORT message with a PDU SESSION ESTABLISHMENT ACCEPT." + + Reference: "ETSI TS 124 501 [1], Clauses 5.4.5, 6.4.1, 8.2.10 and 8.2.11" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A5_6 + + Initial conditions + with { + the UE entity isRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an UPLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to UL_NAS_TRANSPORT, + payload_container_type set to "N1 SM information", + payload_container containing { + 5GSM_PDU containing { + extended_protocol_discriminator set to 5GS_SESSION_MANAGEMENT_MESSAGES, + message_type set to PDU_SESSION_ESTABLISHMENT_REQUEST, + PDU_session_type set to "IPv4", + SSC_mode set to "SSC mode 1"}}, + pDU_session_identity set to PX_PDU_session_identity, + request_type set to "Initial request", + s_NSSAI containing { + sst set to PX_SST, + sd set to PX_SD}, + dNN set to PX_DNN}} + from the GNB entity + } + then { + the IUT entity sends a PDU_SESSION_RESOURCE_SETUP_REQUEST containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to DL_NAS_TRANSPORT, + payload_container_type set to "N1 SM information", + payload_container containing { + 5GSM_PDU containing { + extended_protocol_discriminator set to 5GS_SESSION_MANAGEMENT_MESSAGES, + message_type set to PDU_SESSION_ESTABLISHMENT_ACCEPT}}, + pDU_session_identity set to PX_PDU_session_identity}} + to the GNB entity + } + + } + }// end TP_5GNAS_AMF_DLN_ACC_01 + + } //end Package Clause_5_4_5_NAS_transport_procedure + + } //end Package Clause_5_4_5_GMM_Common_Procedures + + Package Clause_5_5_1_2_Registration_Procedure_for_initial_registration { + Import all from TDL + Import all from NGAP_Common + Import all from NGNAS_Common + + Test Purpose TP_5GNAS_AMF_REG_ACC_01 { + + Objective: "Verify that, after successful completion of the initial registration procedure over 3GPP access, the IUT sends a REGISTRATION_ACCEPT message containing the 5GS registration result, TAI list, 5G-GUTI and T3512 value." + + Reference: "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_8_1 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an INITIAL_UE_MESSAGE containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to REGISTRATION_REQUEST, + 5GS_registration_type containing { + 5GS_registration_type_value set to INITIAL_REGISTRATION}, + 5GS_mobile_identity containing { + SUPI_format set to IMSI, + Type_of_identity set to SUCI, + MCC set to PX_MCC, + MNC set to PX_MNC, + Routing_indicator set to PX_ROUTING_INDICATOR, + Protection_scheme_id set to PX_PROTECTION_SCHEME_ID, + Home_network_public_key_identifier set to PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, + MSIN set to PX_MSIN}}} + from the GNB entity + } + then { + the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to REGISTRATION_ACCEPT, + 5GS_registration_result containing { + 5GS_registration_result_value set to 3GPP_ACCESS}, + 5G_GUTI containing { + Type_of_identity set to 5G_GUTI, + MCC set to PX_MCC, + MNC set to PX_MNC, + AMF_Region_ID set to PX_AMF_REGION_ID, + AMF_Set_ID set to PX_AMF_SET_ID, + AMF_Pointer set to PX_AMF_POINTER, + 5G_TMSI set to RV_5G_TMSI}, + TAI_list containing { + Partial_tracking_area_list_1 containing { + MCC set to PX_MCC, + MNC set to PX_MNC, + TAC set to PX_TAC}}, + T3512_value containing { + Timer_value set to nonZeroValue}}} + to the GNB entity + } + } + }// end TP_5GNAS_AMF_REG_ACC_01 + + + Test Purpose TP_5GNAS_AMF_REG_ACC_02 { + + Objective: "Verify that, when the UE requests SMS over NAS transport during initial registration and the IUT supports SMS over NAS in initial registration, the IUT sends a REGISTRATION_ACCEPT message with the SMS allowed bit in the 5GS registration result IE set to 'SMS over NAS allowed'." + + Reference: "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_8_1_3 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an INITIAL_UE_MESSAGE containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to REGISTRATION_REQUEST, + 5GS_registration_type containing { + 5GS_registration_type_value set to INITIAL_REGISTRATION}, + 5GS_mobile_identity containing { + SUPI_format set to IMSI, + Type_of_identity set to SUCI, + MCC set to PX_MCC, + MNC set to PX_MNC, + Routing_indicator set to PX_ROUTING_INDICATOR, + Protection_scheme_id set to PX_PROTECTION_SCHEME_ID, + Home_network_public_key_identifier set to PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, + MSIN set to PX_MSIN}, + 5GS_update_type containing { + SMS_over_NAS_transport_requested set to 1}}} //!SMS over NAS supported + from the GNB entity + } + then { + the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to REGISTRATION_ACCEPT, + 5GS_registration_result containing { + 5GS_registration_result_value set to 3GPP_ACCESS, + SMS_over_NAS_transport_allowed set to 1}}} //!SMS over NAS allowed + to the GNB entity + } + } + }// end TP_5GNAS_AMF_REG_ACC_02 + + + Test Purpose TP_5GNAS_AMF_REG_ACC_03 { + + Objective: "Verify that the IUT sends a REGISTRATION_ACCEPT message with the SMS over NAS transport allowed bit set to 'not allowed' when the UE requests SMS over NAS during initial registration and the IUT does not support SMS over NAS in initial registration." + + Reference: "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" + + Configuration: CF_AMF_N2N1 + + PICS: not PICS_A4_8_1_3 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an INITIAL_UE_MESSAGE containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to REGISTRATION_REQUEST, + 5GS_registration_type containing { + 5GS_registration_type_value set to INITIAL_REGISTRATION}, + 5GS_mobile_identity containing { + SUPI_format set to IMSI, + Type_of_identity set to SUCI, + MCC set to PX_MCC, + MNC set to PX_MNC, + Routing_indicator set to PX_ROUTING_INDICATOR, + Protection_scheme_id set to PX_PROTECTION_SCHEME_ID, + Home_network_public_key_identifier set to PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, + MSIN set to PX_MSIN}, + 5GS_update_type containing { + SMS_over_NAS_transport_requested set to 1}}} //!SMS over NAS supported + from the GNB entity + } + then { + the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to REGISTRATION_ACCEPT, + 5GS_registration_result containing { + 5GS_registration_result_value set to 3GPP_ACCESS, + SMS_over_NAS_transport_allowed set to 0}}} //!SMS over NAS not allowed + to the GNB entity + } + } + }// end TP_5GNAS_AMF_REG_ACC_03 + + Test Purpose TP_5GNAS_AMF_REG_ACC_04 { + + Objective: "Verify that the IUT, during the initial registration procedure, sends a REGISTRATION_ACCEPT message including the Allowed NSSAI IE when the UE includes a Requested NSSAI IE in the REGISTRATION_REQUEST message and the IUT allows one or more S-NSSAIs from the requested NSSAI." + + Reference: "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_8_1 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an INITIAL_UE_MESSAGE containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to REGISTRATION_REQUEST, + 5GS_registration_type containing { + 5GS_registration_type_value set to INITIAL_REGISTRATION}, + 5GS_mobile_identity containing { + SUPI_format set to IMSI, + Type_of_identity set to SUCI, + MCC set to PX_MCC, + MNC set to PX_MNC, + Routing_indicator set to PX_ROUTING_INDICATOR, + Protection_scheme_id set to PX_PROTECTION_SCHEME_ID, + Home_network_public_key_identifier set to PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, + MSIN set to PX_MSIN}, + Requested_NSSAI containing { + S_NSSAI_1 containing { + SST set to PX_SST_1, + SD set to PX_SD_1}, + S_NSSAI_2 containing { + SST set to PX_SST_2, + SD set to PX_SD_2}}}} + from the GNB entity + } + then { + the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to REGISTRATION_ACCEPT, + 5G_GUTI containing { + Type_of_identity set to 5G_GUTI, + MCC set to PX_MCC, + MNC set to PX_MNC, + AMF_Region_ID set to PX_AMF_REGION_ID, + AMF_Set_ID set to PX_AMF_SET_ID, + AMF_Pointer set to PX_AMF_POINTER, + 5G_TMSI set to RV_5G_TMSI}, + Allowed_NSSAI containing { + S_NSSAI_1 containing { + SST set to PX_SST_1, + SD set to PX_SD_1}}}} + to the GNB entity + } + } + }// end TP_5GNAS_AMF_REG_ACC_04 + + Test Purpose TP_5GNAS_AMF_REG_ACC_05 { + + Objective: "Verify that, during the initial registration procedure, the IUT includes the Rejected NSSAI IE in the REGISTRATION_ACCEPT message when the UE includes a Requested NSSAI IE in the REGISTRATION_REQUEST message and the IUT rejects one or more S-NSSAIs from the requested NSSAI." + + Reference: "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_8_1_2_3 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an INITIAL_UE_MESSAGE containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to REGISTRATION_REQUEST, + 5GS_registration_type containing { + 5GS_registration_type_value set to INITIAL_REGISTRATION}, + 5GS_mobile_identity containing { + SUPI_format set to IMSI, + Type_of_identity set to SUCI, + MCC set to PX_MCC, + MNC set to PX_MNC, + Routing_indicator set to PX_ROUTING_INDICATOR, + Protection_scheme_id set to PX_PROTECTION_SCHEME_ID, + Home_network_public_key_identifier set to PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, + MSIN set to PX_MSIN}, + Requested_NSSAI containing { + S_NSSAI_1 containing { + SST set to PX_SST_1, + SD set to PX_SD_1}, + S_NSSAI_2 containing { + SST set to PX_SST_Rejected, + SD set to PX_SD_Rejected}}}} + from the GNB entity + } + then { + the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to REGISTRATION_ACCEPT, + 5G_GUTI containing { + Type_of_identity set to 5G_GUTI, + MCC set to PX_MCC, + MNC set to PX_MNC, + AMF_Region_ID set to PX_AMF_REGION_ID, + AMF_Set_ID set to PX_AMF_SET_ID, + AMF_Pointer set to PX_AMF_POINTER, + 5G_TMSI set to RV_5G_TMSI}, + Rejected_NSSAI containing { + S_NSSAI_1 containing { + SST set to PX_SST_Rejected, + SD set to PX_SD_Rejected}}}} + to the GNB entity + } + } + }// end TP_5GNAS_AMF_REG_ACC_05 + + Test Purpose TP_5GNAS_AMF_REG_REJ_01 { + + Objective: "Verify that the IUT sends a REGISTRATION_REJECT message with 5GMM cause value #22 'congestion' and includes the T3346 value IE when the initial registration request is rejected due to general NAS level mobility management congestion control." + + Reference: "ETSI TS 124 501 [1], Clauses 5.5.1.2.5 and 8.2.9" + + Configuration: CF_AMF_N2N1 + + + Initial conditions + with { + the UE entity isNotRegisteredToAMF and + the AMF entity isInOverloadedState + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an INITIAL_UE_MESSAGE containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to NOT_SECURITY_PROTECTED, + message_type set to REGISTRATION_REQUEST, + 5GS_registration_type containing { + 5GS_registration_type_value set to INITIAL_REGISTRATION}, + 5GS_mobile_identity containing { + SUPI_format set to IMSI, + Type_of_identity set to SUCI, + MCC set to PX_MCC, + MNC set to PX_MNC, + Routing_indicator set to PX_ROUTING_INDICATOR, + Protection_scheme_id set to PX_PROTECTION_SCHEME_ID, + Home_network_public_key_identifier set to PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, + MSIN set to PX_MSIN}}} + from the GNB entity + } + then { + the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + message_type set to REGISTRATION_REJECT, + 5GMM_cause set to "Congestion (22)", + T3346_value containing { + Timer_value set to nonZeroValue}}} + to the GNB entity + } + } + }// end TP_5GNAS_AMF_REG_REJ_01 + + Test Purpose TP_5GNAS_AMF_REG_REJ_02 { + + Objective: "Verify that, during the initial registration procedure, the IUT sends a REGISTRATION_REJECT message with 5GMM cause value #9 'UE identity cannot be derived by the network' when the UE responds to an IDENTITY_REQUEST for SUCI with an IDENTITY_RESPONSE indicating that no identity is available." + + Reference: "ETSI TS 123 502 [2], Clause 4.2.2.2.2 + ETSI TS 124 501 [1], Clauses 5.4.3.2, 5.4.3.3, 5.5.1.2.5 and 8.2.9" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_3 + + Initial conditions + with { + the UE entity isNotRegisteredToAMF and + the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + message_type set to IDENTITY_REQUEST, + identity_type set to SUCI}} + to the GNB entity + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an UPLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + message_type set to IDENTITY_RESPONSE, + 5GS_mobile_identity containing { + Type_of_identity set to NO_IDENTITY}}} + from the GNB entity + } + then { + the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + message_type set to REGISTRATION_REJECT, + 5GMM_cause set to "UE identity cannot be derived by the network (9)"}} + to the GNB entity + } + } + }// end TP_5GNAS_AMF_REG_REJ_02 + + } //end Package Clause_5_5_1_2_Registration_Procedure_for_initial_registration + + Package Clause_5_5_2_2_3_UE_initiated_de_registration_procedure_completion { + Import all from TDL + Import all from NGAP_Common + Import all from NGNAS_Common + + + Test Purpose TP_5GNAS_AMF_DRG_ACC_01 { + + Objective: "Verify that the IUT sends a DEREGISTRATION_ACCEPT message upon receipt of a UE-originated DEREGISTRATION_REQUEST message indicating normal de-registration." + + Reference: "ETSI TS 124 501 [1], Clauses 5.5.2.2.3, 8.2.12 and 8.2.13" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_9_1 + + Initial conditions + with { + the UE entity isRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an UPLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to DEREGISTRATION_REQUEST, + Deregistration_type containing { + Switch_off set to NORMAL_DEREGISTRATION, + Reregistration_required set to REREGISTRATION_NOT_REQUIRED, + Access_type set to 3GPP_ACCESS}, + 5GS_mobile_identity containing { + Type_of_identity set to 5G_GUTI, + MCC set to PX_MCC, + MNC set to PX_MNC, + AMF_Region_ID set to PX_AMF_REGION_ID, + AMF_Set_ID set to PX_AMF_SET_ID, + AMF_Pointer set to PX_AMF_POINTER, + 5G_TMSI set to RV_5G_TMSI}}} + from the GNB entity + } + then { + the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to DEREGISTRATION_ACCEPT}} + to the GNB entity + } + } + }// end TP_5GNAS_AMF_DRG_ACC_01 + + Test Purpose TP_5GNAS_AMF_DRG_ACC_02 { + + Objective: "Verify that the IUT does not send a DEREGISTRATION_ACCEPT message upon receipt of a UE-originated DEREGISTRATION_REQUEST message indicating switch off." + + Reference: "ETSI TS 124 501 [1], Clauses 5.5.2.2.3, 8.2.12 and 8.2.13" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_9_1 + + Initial conditions + with { + the UE entity isRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + (.) at time point start_DRG_event : the IUT entity receives an UPLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to DEREGISTRATION_REQUEST, + Deregistration_type containing { + Switch_off set to SWITCH_OFF, + Reregistration_required set to REREGISTRATION_NOT_REQUIRED, + Access_type set to 3GPP_ACCESS}, + 5GS_mobile_identity containing { + Type_of_identity set to 5G_GUTI, + MCC set to PX_MCC, + MNC set to PX_MNC, + AMF_Region_ID set to PX_AMF_REGION_ID, + AMF_Set_ID set to PX_AMF_SET_ID, + AMF_Pointer set to PX_AMF_POINTER, + 5G_TMSI set to RV_5G_TMSI}}} + from the GNB entity + } + then { + // PX_DRG_TWAIT: Test system observation timer used to verify that no DEREGISTRATION_ACCEPT message is sent after receipt of a switch-off DEREGISTRATION_REQUEST (no corresponding NAS timer defined in the specification) + (!) PX_DRG_TWAIT after @start_DRG_event : the IUT entity does not send a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to DEREGISTRATION_ACCEPT}} + to the GNB entity + } + } + }// end TP_5GNAS_AMF_DRG_ACC_02 + + } //end Package Clause_5_5_2_2_3_UE_initiated_de_registration_procedure_completion + + Package Clause_5_5_2_3_1_Network_initiated_de_registration_procedure_initiation { + Import all from TDL + Import all from NGAP_Common + Import all from NGNAS_Common + + + Test Purpose TP_5GNAS_AMF_DRG_REQ_01 { + + Objective: "Verify that the IUT initiates network de-registration by sending a DEREGISTRATION_REQUEST message containing the De-registration type IE with re-registration not required for 3GPP access. **NOTE:** explicit network deregistration triggered by O&M - deactivation of UE" + + Reference: "ETSI TS 124 501 [1], Clauses 5.5.2.3.1 and 8.2.14" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_9_2 + + Initial conditions + with { + the UE entity isRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity indicateUEdeactivation + } + then { + the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to DEREGISTRATION_REQUEST, + Deregistration_type containing { + Switch_off set to NORMAL_DEREGISTRATION, + Reregistration_required set to REREGISTRATION_NOT_REQUIRED, + Access_type set to 3GPP_ACCESS}, + 5GS_mobile_identity containing { + Type_of_identity set to 5G_GUTI, + MCC set to PX_MCC, + MNC set to PX_MNC, + AMF_Region_ID set to PX_AMF_REGION_ID, + AMF_Set_ID set to PX_AMF_SET_ID, + AMF_Pointer set to PX_AMF_POINTER, + 5G_TMSI set to RV_5G_TMSI}}} + to the GNB entity + } + } + }// end TP_5GNAS_AMF_DRG_REQ_01 + + Test Purpose TP_5GNAS_AMF_DRG_REQ_02 { + + Objective: "Verify that the IUT retransmits the DEREGISTRATION_REQUEST message if no DEREGISTRATION_ACCEPT is received from the UE. **NOTE:** explicit network deregistration triggered by O&M - UE deregistration." + + Reference: "ETSI TS 124 501 [1], Clauses 5.5.2.3.1 and 8.2.14" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_9_2 + + Initial conditions + with { + the UE entity isRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity indicateUEdeactivation and + (.) at time point start_DRG_event : the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to DEREGISTRATION_REQUEST}} + to the GNB entity + } + then { + (!) PX_T3522 after @start_DRG_event : the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to DEREGISTRATION_REQUEST}} + to the GNB entity + } + } + }// end TP_5GNAS_AMF_DRG_REQ_02 + + Test Purpose TP_5GNAS_AMF_DRG_REQ_03 { + + Objective: "Verify that the IUT initiates network de-registration by sending a DEREGISTRATION_REQUEST message containing the De-registration type IE with re-registration required for 3GPP access." + // NOTE: After receipt of this message, the UE is expected to respond with DEREGISTRATION_ACCEPT and to initiate a new registration procedure. These subsequent steps are not part of the verification objective of this TP, but need to be handled by the TTCN-3 test implementation and postamble. + // **NOTE 1:** UE sends DEREGISTRATION_ACCEPT and starts with re-registration procedure.(also used ref 5.5.2.3.2 1st paragraph) **NOTE 2:** explicit network deregistration triggered by O&M - UE deregistration" + + Reference: "ETSI TS 124 501 [1], Clauses 5.5.2.3.1, 5.5.2.3.2 and 8.2.14" + + Configuration: CF_AMF_N2N1 + + PICS: PICS_A4_9_2 + + Initial conditions + with { + the UE entity isRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity indicateUEderegistration + } + then { + the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGES, + security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, + message_type set to DEREGISTRATION_REQUEST, + Deregistration_type containing { + Switch_off set to NORMAL_DEREGISTRATION, + Reregistration_required set to REREGISTRATION_REQUIRED, + Access_type set to 3GPP_ACCESS}, + 5GS_mobile_identity containing { + Type_of_identity set to 5G_GUTI, + MCC set to PX_MCC, + MNC set to PX_MNC, + AMF_Region_ID set to PX_AMF_REGION_ID, + AMF_Set_ID set to PX_AMF_SET_ID, + AMF_Pointer set to PX_AMF_POINTER, + 5G_TMSI set to RV_5G_TMSI}}} + to the GNB entity + } + } + }// end TP_5GNAS_AMF_DRG_REQ_03 + + + } //end Package Clause_5_5_2_3_1_Network_initiated_de_registration_procedure_initiation + + + + +} //end Package TP_AMF_NGNAS + diff --git a/test_purposes/TP_GNB_NGAP.tdltx b/test_purposes/TP_GNB_NGAP.tdltx new file mode 100644 index 0000000000000000000000000000000000000000..0f373f1eb7b4d2e662375f57e424cc269d922c25 --- /dev/null +++ b/test_purposes/TP_GNB_NGAP.tdltx @@ -0,0 +1,524 @@ +/* +Copyright (c) ETSI 2025. + +This software is subject to copyrights owned by ETSI. Non-exclusive permission +is hereby granted, free of charge, to copy, reproduce and amend this file +under the following conditions: It is provided "as is", without warranty of any +kind, expressed or implied. + +ETSI shall never be liable for any claim, damages, or other liability arising +from its use or inability of use.This permission does not apply to any documentation +associated with this file for which ETSI keeps all rights reserved. The present +copyright notice shall be included in all copies of whole or part of this +file and shall not imply any sub-license right. +*/ + +/* interface at GNB */ +Package TP_GNB_NGAP { + + Package Clause_8_2_PDU_Session_Management_Procedures { + Import all from TDL + Import all from NGAP_Common + + Test Purpose TP_NGAP_GNB_PDU_01 { + + Objective: "Verify that the GNB successfully processes a PDU_SESSION_RESOURCE_SETUP_REQUEST and answers with PDU_SESSION_RESOURCE_SETUP_RESPONSE for successfully established PDU session." + + Reference: "ETSI TS 138 413 [1], Clauses 8.2.1.2, 9.2.1.1 and 9.2.1.2" + + Configuration: CF_GNB_N2 + + PICS: PICS_A2_1 and PICS_A3_1_1 + + Initial conditions + with { + the UE entity isRegisteredToAMF and + the UE entity havingSentPDUSessionEstablishment + } + + Expected behaviour + ensure that { + when { + the IUT entity receives a PDU_SESSION_RESOURCE_SETUP_REQUEST containing { + AMF_UE_NGAP_ID set to PX_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to RV_RAN_UE_NGAP_ID, + PDU_Session_Resource_Setup_Request_List containing { + PDU_Session_Resource_Setup_Request_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_NAS_PDU containing { + uL_NAS_TRANSPORT_message_identity set to UL_NAS_TRANSPORT, + payload_container containing { + Message_type set to PDU_SESSION_ESTABLISHMENT_ACCEPT}}, + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD}, + PDU_Session_Resource_Setup_Request_Transfer containing { + UL_NG_U_UP_TNL_Information containing { + EndpointIPAddress set to PX_N3_ENDPOINT_IP_ADDRESS, + GTP_TEID set to PX_GTP_TEID}, + PDU_Session_Type set to "IPv4", + QoS_Flow_Setup_Request_List containing { + QoS_Flow_Setup_Request_Item containing { + QoSFlowIdentifier set to PX_QFI, + QoSFlowLevelQosParameters containing { + QoSCharactersistics containing { + Non_Dynamic_5QI set to PX_5QI}, + Allocation_and_Retention_Priority}}}}}}} + from the AMF entity + } + then { + the IUT entity sends a PDU_SESSION_RESOURCE_SETUP_RESPONSE containing { + AMF_UE_NGAP_ID set to PX_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to RV_RAN_UE_NGAP_ID, + PDU_Session_Resource_Setup_Response_List containing { + PDU_Session_Resource_Setup_Response_Item containing { + PDU_SessionId set to PX_PDU_SessionId, + PDU_Session_Resource_Setup_Response_Transfer containing { + DL_QoS_Flow_per_TNL_Information containing { + UP_Transport_Layer_Information containing { + EndpointIPAddress set to RV_N3_GNB_ADDRESS, + GTP_TEID set to RV_GTP_TEID}, + Associated_QoS_Flow_List containing { + Associated_QoS_Flow_Item containing { + QoS_Flow_Identifier set to PX_QFI}}}}}}} + to the AMF entity + } + } + + } // end TP_NGAP_GNB_PDU_01 + + } //end Package Clause_8_2_PDU_Session_Management_Procedures + + Package Clause_8_3_UE_Context_Management_Procedures { + Import all from TDL + Import all from NGAP_Common + + Package Initial_Context_Setup { + Import all from TDL + Import all from NGAP_Common + } //end Package Initial_Context_Setup + + Package UE_Context_Release_NG_RAN_node_initiated { + + Import all from TDL + Import all from NGAP_Common + + Test Purpose TP_NGAP_GNB_CMP_07 { + + Objective: "Verify that the GNB successfully requests the AMF to release the UE-associated logical NG-connection due to user inactivity." + //from CM_CONNECTED to CM_IDLE state + Reference: "ETSI TS 138 413 [1], Clauses 8.3.2.2 and 9.2.2.4" + + Configuration: CF_GNB_N2 + + PICS: PICS_A2_1 and PICS_A3_2_2 + + Initial conditions + with { + the UE entity isRegisteredToAMF and + the UE entity hasEstablishedPDUsession + } + + Expected behaviour + ensure that { + when { + the IUT entity u_Plane_inactivity_timer_expires + } + then { + the IUT entity sends a UE_CONTEXT_RELEASE_REQUEST containing { + AMF_UE_NGAP_ID set to PX_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to RV_RAN_UE_NGAP_ID, + PDU_Session_Resource_List containing { + PDU_Session_Resource_Item containing { + PDU_SessionId set to PX_PDU_SessionId}}, + Cause set to "RadioNetwork.user-inactivity"} + to the AMF entity + } + + } + + } // End TP TP_NGAP_GNB_CMP_07 + + Test Purpose TP_NGAP_GNB_CMP_07_2 { + + Objective: "Verify that the GNB successfully requests the AMF to release the UE-associated logical NG-connection after rejected registration procedure." + //from CM_CONNECTED to CM_IDLE state + Reference: "ETSI TS 138 413 [1], Clauses 8.3.2.2 and 9.2.2.4 + ETSI TS 123 502 [3], Clause 4.2.6" + + Configuration: CF_GNB_N2 + + PICS: PICS_A2_1 and PICS_A3_2_2 + + Initial conditions + with { + the GNB entity hasEstablished_NG_C_AssociationToAMF + } + + Expected behaviour + ensure that { + when { + the AMF entity sends a DOWNLINK_NAS_TRANSPORT containing { + NAS_PDU containing { + Message_identity set to REGISTRATION_REJECT}} + } + then { + the IUT entity sends a UE_CONTEXT_RELEASE_REQUEST containing { + AMF_UE_NGAP_ID set to PX_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to RV_RAN_UE_NGAP_ID, + PDU_Session_Resource_List containing { + PDU_Session_Resource_Item containing { + PDU_SessionId set to PX_PDU_SessionId}}, + Cause set to "RadioNetwork.unspecified"} + to the AMF entity + } + + } + + } // End TP TP_NGAP_GNB_CMP_07_2 + + } //end Package UE_Context_Release_NG_RAN_node_initiated + + Package UE_Context_Release_AMF_initiated { + Import all from TDL + Import all from NGAP_Common + + } //end Package UE_Context_Release_AMF_initiated + + Package UE_Context_Modification { + Import all from TDL + Import all from NGAP_Common + + } //end Package UE_Context_Modification + + Package RRC_Inactive_Transition_Report { + Import all from TDL + Import all from NGAP_Common + + } //end Package RRC_Inactive_Transition_Report + + Package RAN_CP_Relocation_Indication { + + Import all from TDL + Import all from NGAP_Common + + } //end Package RAN_CP_Relocation_Indication + + Package UE_Context_Suspend { + Import all from TDL + Import all from NGAP_Common + + } //end Package UE_Context_Suspend + + Package UE_Context_Resume { + Import all from TDL + Import all from NGAP_Common + + } //end Package UE_Context_Resume + + } //end Package Clause_8_3_UE_Context_Management_Procedures + + Package Clause_8_4_UE_Mobility_Management_Procedures { + + Package Handover_Preparation { + Import all from TDL + Import all from NGAP_Common + + } //end Package Handover_Preparation + + Package Handover_Resource_Allocation { + Import all from TDL + Import all from NGAP_Common + + } //end Package Handover_Resource_Allocation + + Package Handover_Notification { + Import all from TDL + Import all from NGAP_Common + + } //end Package Handover_Notification + + Package Path_Switch_Request { + Import all from TDL + Import all from NGAP_Common + + } //end Package Path_Switch_Request + + Package Handover_Cancellation { + Import all from TDL + Import all from NGAP_Common + } //end Package Handover_Cancellation + + Package Uplink_RAN_Status_Transfer { + Import all from TDL + Import all from NGAP_Common + } //end Package Uplink_RAN_Status_Transfer + + + Package Uplink_RAN_Early_Status_Transfer { + Import all from TDL + Import all from NGAP_Common + + } //end Package Uplink_RAN_Early_Status_Transfer + + } //end Package Clause_8_4_UE_Mobility_Management_Procedures + + Package Clause_8_6_Transport_of_NAS_Messages_Procedures { + Package Initial_UE_Message { + Import all from TDL + Import all from NGAP_Common + } // end "Initial UE Message" + + Package Uplink_NAS_Transport { + Import all from TDL + Import all from NGAP_Common + + } // end "Uplink NAS Transport" + + Package NAS_Non_Delivery_Indication { + Import all from TDL + Import all from NGAP_Common + + } // end "NAS Non Delivery Indication" + + } //end Package NAS_Non_Delivery_Indication + + Package Clause_8_7_Interface_Management_Procedures { + Package NG_Setup { + Import all from TDL + Import all from NGAP_Common + + Test Purpose TP_NGAP_GNB_IMP_01 { + + Objective: "Verify that the GNB sends an NG_SETUP_REQUEST message to the AMF after TNL establishment." + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.1.2 and 9.2.6.1" + + Configuration: CF_GNB_N2 + + PICS: PICS_A2_1 and PICS_A3_6_1 + + Expected behaviour + ensure that { + when { + the IUT entity hasSuccessfullyEstablishedTNLconnection + } + then { + the IUT entity sends an NG_SETUP_REQUEST containing { + Global_RAN_Node_ID containing { + Global_gNB_ID containing { + PLMN_Identity set to PX_PLMN_Identity, + gNB_ID set to PX_gNB_ID}}, + Supported_TA_List containing { + Supported_TA_Item containing { + TAC set to PX_TAC, + Broadcast_PLMN_List containing { + Broadcast_PLMN_Item containing { + PLMN_Identity set to PX_PLMN_Identity, + TAI_Slice_Support_List containing { + S_NSSAI containing { + SST set to PX_SST, + SD set to PX_SD + OR NOT SD}}}}}}, + Default_Paging_DRX set to PX_GNB_DEF_DRX} + to the AMF entity + } + } + } // end TP TP_NGAP_GNB_IMP_01 + } //end Package NG_Setup + + Package RAN_Configuration_Update { + Import all from TDL + Import all from NGAP_Common + } //end Package RAN_Configuration_Update + + Package AMF_Configuration_Update { + Import all from TDL + Import all from NGAP_Common + + } //end Package AMF_Configuration_Update + + Package NG_Reset { + Import all from TDL + Import all from NGAP_Common + + Test Purpose TP_NGAP_GNB_IMP_05 { + + Objective: "Verify that the GNB successfully processes a full NG_RESET message and answers with NG_RESET_ACKNOWLEDGE to acknowledge the reset." + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.4.2.1, 9.2.6.11 and 9.2.6.12" + + Configuration: CF_GNB_N2 + + PICS: PICS_A2_1 and PICS_A3_6_4 + + Initial conditions + with { + the GNB entity hasEstablished_NG_C_AssociationToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an NG_RESET containing { + Cause set to PX_CAUSE, + CHOICE_Reset_Type containing { + NG_interface containing { + Reset_All set to "Reset all"}}} + from the AMF entity + } + then { + the IUT entity sends an NG_RESET_ACKNOWLEDGE containing { + not UE_associated_Logical_NGconnection_List} + to the AMF entity + } + } + } // end TP TP_NGAP_GNB_IMP_05 + + Test Purpose TP_NGAP_GNB_IMP_05_2 { + + Objective: "Verify that the GNB successfully processes a partial NG_RESET message and answers with NG_RESET_ACKNOWLEDGE to acknowledge the partial reset." + + Reference: "ETSI TS 138 413 [1], Clauses 8.7.4.2.1, 9.2.6.11 and 9.2.6.12" + + Configuration: CF_GNB_N2 + + PICS: PICS_A2_1 and PICS_A3_6_4 + + Initial conditions + with { + the UE entity isRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + the IUT entity receives an NG_RESET containing { + Cause set to PX_CAUSE, + CHOICE_Reset_Type containing { + Part_of_NG_interface containing { + UE_associated_Logical_NGconnection_List containing { + UE_associated_Logical_NGconnection_Item containing { + AMF_UE_NGAP_ID set to PX_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to RV_RAN_UE_NGAP_ID}}}}} + from the AMF entity + } + then { + the IUT entity sends an NG_RESET_ACKNOWLEDGE containing { + not UE_associated_Logical_NGconnection_List} + to the AMF entity + } + } + } // end TP TP_NGAP_GNB_IMP_05_2 + + } //end Package NG_Reset + + Package Error_Indication { + Import all from TDL + Import all from NGAP_Common + } //end Package Error_Indication + } //end Package Clause_8_7_Interface_Management_Procedures + + Package Clause_8_8_Configuration_Transfer_Procedure { + Package Uplink_RAN_Configuration_Transfer { + Import all from TDL + Import all from NGAP_Common + } // end "Uplink RAN Configuration Transfer" + } //end Package Uplink_RAN_Configuration_Transfer + + Package Clause_8_9_Warning_Message_Transmission_Procedures { + Import all from TDL + Import all from NGAP_Common + } // end "8.9 Warning Message Transmission Procedures" + + Package Clause_8_10_NRPPa_Transport_Procedures { + Import all from TDL + Import all from NGAP_Common + + } // end "8.10 NRPPa Transport Procedures" + + Package Clause_8_11_Trace_Procedures { + Import all from TDL + Import all from NGAP_Common + + } // end "8.11 Trace Procedures" + + Package Clause_8_12_Location_Reporting_Procedures { + Package Location_Reporting_Failure_Indication { + Import all from TDL + Import all from NGAP_Common + + } // end "Location Reporting Failure Indication" + + Package Location_Report { + Import all from TDL + Import all from NGAP_Common + + } // end "Location Report" + + } // end "8.12 Location Reporting Procedures" + + Package Clause_8_13_UE_TNLA_Binding_Procedures { + + } //end Package Clause_8_13_UE_TNLA_Binding_Procedures + + Package Clause_8_14_UE_Radio_Capability_Management_Procedures { + Import all from TDL + Import all from NGAP_Common + + Test Purpose TP_NGAP_GNB_URP_01 { + + Objective: "Verify that the IUT sends correct UE_RADIO_CAPABILITY_INFO_INDICATION." + + Reference: "ETSI TS 138 413 [1], Clauses 8.14.1.2 and 9.2.13.1" + + Configuration: CF_GNB_N2 + + PICS: PICS_A2_1 and PICS_A3_13_1 + + Initial conditions + with { + the UE entity isRegisteredToAMF + } + + Expected behaviour + ensure that { + when { + + the IUT entity receives a INITIAL_CONTEXT_SETUP_REQUEST containing { + not UE_Radio_Capability} + } + then { + the IUT entity sends a UE_RADIO_CAPABILITY_INFO_INDICATION containing { + AMF_UE_NGAP_ID set to PX_AMF_UE_NGAP_ID, + RAN_UE_NGAP_ID set to RV_RAN_UE_NGAP_ID, + UE_Radio_Capability containing { + UERadioAccessCapabilityInformation containing { + criticalExtensions containing { + c1 containing { + ueRadioAccessCapabilityInformation containing { + UE_CapabilityRAT_ContainerList containing { + UE_CapabilityRAT_Container containing { + rat_Type set to "nr", + UE_NR_Capability containing { + accessStratumRelease set to "rel16"}}}}}}}}} + to the AMF entity + } + } + } // end TP_NGAP_GNB_URP_01 + + } //end Package Clause_8_14_UE_Radio_Capability_Management_Procedures + + Package Clause_8_15_Data_Usage_Reporting_Procedures { + Import all from TDL + Import all from NGAP_Common + + } //end Package Clause_8_15_Data_Usage_Reporting_Procedures + + Package Clause_8_16_RIM_Information_Transfer_Procedures { + Import all from TDL + Import all from NGAP_Common + + } //end Package Clause_8_16_RIM_Information_Transfer_Procedures + +} //end Package TP_GNB_NGAP diff --git a/test_purposes/ngnas/TP_AMF_NGAP.tplan2 b/test_purposes/ngnas/TP_AMF_NGAP.tplan2 deleted file mode 100644 index 0180cfbc9cd175dcbfe1905bac2c751e1d3f8466..0000000000000000000000000000000000000000 --- a/test_purposes/ngnas/TP_AMF_NGAP.tplan2 +++ /dev/null @@ -1,280 +0,0 @@ -/* -Copyright (c) ETSI 2025. - -This software is subject to copyrights owned by ETSI. Non-exclusive permission -is hereby granted, free of charge, to copy, reproduce and amend this file -under the following conditions: It is provided "as is", without warranty of any -kind, expressed or implied. - -ETSI shall never be liable for any claim, damages, or other liability arising -from its use or inability of use.This permission does not apply to any documentation -associated with this file for which ETSI keeps all rights reserved. The present -copyright notice shall be included in all copies of whole or part of this -file and shall not imply any sub-license right. -*/ - -/* interface at AMF */ -Package TP_AMF_NGAP { - - import all from Ngnas_Common; - - Test Purpose { - - TP Id TP_5GAP_ICS_01 - - Test objective "The IUT is able to receive an INITIAL_UE_MESSAGE to indicate a NAS transport procedure and reply with INITIAL_CONTEXT_SETUP_REQUEST." - - Reference - "ETSI TS 138 413 [1], Clauses 8.3.1.2, 8.6.1.2, 9.2.5.1 and 9.2.2.1" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - RAN_UE_NGAP_ID indicating value PX_RAN_UE_NGAP_ID, - NAS_PDU, //(see note) - User_Location_Information containing - nR_CGI containing - pLMNIdentity containing - MCC indicating value PX_MCC, - MNC indicating value PX_MNC;, - nRCellIdentity indicating value PX_NR_CELL_IDENTITY;, - tAI containing - pLMNIdentity containing - MCC indicating value PX_MCC, - MNC indicating value PX_MNC;, - tAC indicating value PX_TAC;;, - RRC_Establishmnet_Cause indicating value "mo-signalling", - UE_Context_Request containing - UEContextRequest indicating value '0';; //requested - from the GNB entity - } - then { - the IUT entity sends an INITIAL_CONTEXT_SETUP_REQUEST containing - AMF_UE_NGAP_ID indicating value RV_AMF_UE_NGAP_ID, - RAN_UE_NGAP_ID indicating value PX_RAN_UE_NGAP_ID, - GUAMI containing - pLMNIdentity containing - MCC indicating value PX_MCC, - MNC indicating value PX_MNC;, - aMFRegionID indicating value RV_AMFRegionID, - aMFSetID indicating value RV_AMFSetID, - aMFPointerID indicating value RV_AMFPointerID;, - NAS_PDU, //(see note) - Allowed_NSSAI containing - Allowed_NSSAI_List containing - Allowed_NSSAI_Item containing - S_NSSAI containing - SST;;;;, - UE_Security_Capabilities containing - NR_Encryption_Algorithms, - NR_Integrity_Protection_Algorithms, - E_UTRA_Encryption_Algorithms, - E_UTRA_Integrity_Protection_Algorithms;, - Security_Key; - to the GNB entity - } - } - }// end TP_5GAP_ICS_01 - - Test Purpose { - - TP Id TP_5GAP_ICS_02 - - Test objective "The IUT is able to receive an UPLINK_NAS_TRANSPORT to indicate a NAS transport procedure and reply with INITIAL_CONTEXT_SETUP_REQUEST." - - Reference - "ETSI TS 138 413 [1], Clauses 8.3.1.2, 8.6.3.2, 9.2.2.1 and 9.2.5.3" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - AMF_UE_NGAP_ID indicating value RV_AMF_UE_NGAP_ID, - RAN_UE_NGAP_ID indicating value PX_RAN_UE_NGAP_ID, - NAS_PDU, //(see note) - User_Location_Information; - from the GNB entity - } - then { - the IUT entity sends an INITIAL_CONTEXT_SETUP_REQUEST containing - AMF_UE_NGAP_ID indicating value RV_AMF_UE_NGAP_ID, - RAN_UE_NGAP_ID indicating value PX_RAN_UE_NGAP_ID, - GUAMI containing - pLMNIdentity containing - MCC indicating value PX_MCC, - MNC indicating value PX_MNC;, - aMFRegionID indicating value RV_AMFRegionID, - aMFSetID indicating value RV_AMFSetID, - aMFPointerID indicating value RV_AMFPointerID;, - NAS_PDU, //(see note) - Allowed_NSSAI containing - Allowed_NSSAI_List containing - Allowed_NSSAI_Item containing - S_NSSAI containing - SST indicating value PX_SST;;;;, - UE_Security_Capabilities containing - NR_Encryption_Algorithms, - NR_Integrity_Protection_Algorithms, - E_UTRA_Encryption_Algorithms, - E_UTRA_Integrity_Protection_Algorithms;, - Security_Key; - to the GNB entity - } - } - }// end TP_5GAP_ICS_02 - - Test Purpose { - - TP Id TP_5GAP_DNA_01 - - Test objective "The IUT is able to receive an INITIAL_UE_MESSAGE to indicate a NAS transport procedure and reply with DOWNLINK_NAS_TRANSPORT." - - Reference - "ETSI TS 138 413 [1], Clauses 8.6.1.2, 8.6.2.2, 9.2.5.1 and 9.2.5.2" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - RAN_UE_NGAP_ID indicating value PX_RAN_UE_NGAP_ID, - NAS_PDU, //(see note) - User_Location_Information containing - nR_CGI containing - pLMNIdentity containing - MCC indicating value PX_MCC, - MNC indicating value PX_MNC;, - nRCellIdentity indicating value PX_NR_CELL_IDENTITY;, - tAI containing - pLMNIdentity containing - MCC indicating value PX_MCC, - MNC indicating value PX_MNC;, - tAC indicating value PX_TAC;;, - RRC_Establishmnet_Cause indicating value "mo-signalling", - UE_Context_Request containing - UEContextRequest indicating value '0';; //requested - from the GNB entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - AMF_UE_NGAP_ID indicating value RV_AMF_UE_NGAP_ID, - RAN_UE_NGAP_ID indicating value PX_RAN_UE_NGAP_ID, - NAS_PDU; //(see note) - to the GNB entity - } - } - }// end TP_5GAP_DNA_01 - - Test Purpose { - - TP Id TP_5GAP_DNA_02 - - Test objective "The IUT is able to receive an UPLINK_NAS_TRANSPORT to indicate a NAS transport procedure and reply with DOWNLINK_NAS_TRANSPORT." - - Reference - "ETSI TS 138 413 [1], Clauses 8.6.2.2, 8.6.3.2, 9.2.5.2 and 9.2.5.3" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - AMF_UE_NGAP_ID indicating value RV_AMF_UE_NGAP_ID, - RAN_UE_NGAP_ID indicating value PX_RAN_UE_NGAP_ID, - NAS_PDU, //(see note) - User_Location_Information; - from the GNB entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - AMF_UE_NGAP_ID indicating value RV_AMF_UE_NGAP_ID, - RAN_UE_NGAP_ID indicating value PX_RAN_UE_NGAP_ID, - NAS_PDU; //(see note) - to the GNB entity - } - } - }// end TP_5GAP_DNA_02 - - Test Purpose { - - TP Id TP_5GAP_PDU_01 - - Test objective "The IUT is able to receive an UPLINK_NAS_TRANSPORT to indicate a NAS transport procedure and reply with DOWNLINK_NAS_TRANSPORT." - - Reference - "ETSI TS 138 413 [1], Clauses 8.2.1.2, 8.6.3.2, 9.2.1.1 and 9.2.5.3" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - AMF_UE_NGAP_ID indicating value RV_AMF_UE_NGAP_ID, - RAN_UE_NGAP_ID indicating value PX_RAN_UE_NGAP_ID, - NAS_PDU, //(see note) - User_Location_Information; - from the GNB entity - } - then { - the IUT entity sends a PDU_SESSION_RESOURCE_SETUP_REQUEST containing - AMF_UE_NGAP_ID indicating value RV_AMF_UE_NGAP_ID, - RAN_UE_NGAP_ID indicating value PX_RAN_UE_NGAP_ID, - PDU_Session_Resource_Setup_Request_List containing - PDU_SessionId, - PDU_Session_NAS_PDU, //(see note) - S_NSSAI containing - SST indicating value PX_SST;, - PDU_Session_Resource_Setup_Request_Transfer containing - UL_NGU_UP_TNL_information containing - gTP_tunnel containing - Endpoint_IP_Address, - GTP_TEID;;, - PDU_Session_Type, - QoS_Flow_Setup_Request_List containing - QoS_Flow_Identifier, - QoS_Flow_Level_QoS_Parameters;;;; - to the GNB entity - } - } - }// end TP_5GAP_PDU_01 - -} // End of Package TP_AMF_NGAP - diff --git a/test_purposes/ngnas/TP_AMF_NGNAS.tplan2 b/test_purposes/ngnas/TP_AMF_NGNAS.tplan2 deleted file mode 100644 index 3253fa1c12a22fe513c0c08116f20f0f49dd4491..0000000000000000000000000000000000000000 --- a/test_purposes/ngnas/TP_AMF_NGNAS.tplan2 +++ /dev/null @@ -1,1276 +0,0 @@ -/* -Copyright (c) ETSI 2024. - -This software is subject to copyrights owned by ETSI. Non-exclusive permission -is hereby granted, free of charge, to copy, reproduce and amend this file -under the following conditions: It is provided "as is", without warranty of any -kind, expressed or implied. - -ETSI shall never be liable for any claim, damages, or other liability arising -from its use or inability of use.This permission does not apply to any documentation -associated with this file for which ETSI keeps all rights reserved. The present -copyright notice shall be included in all copies of whole or part of this -file and shall not imply any sub-license right. -*/ - -/* interface at AMF */ -Package TP_AMF { - - - Group "5.4 5GMM Common Procedures" - { - Group "5.4.1 Primary authentication and key agreement procedure" - { - import all from Ngnas_Common; - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_REQ_01 - - Test objective "Verify that the IUT sends an AUTHENTICATION REQUEST message correctly upon receipt of a NAS Registration without an active security context." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.2 and 8.2.1" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to NOT_SECURITY_PROTECTED, - registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type, - 5GS_mobile_identity - ; - ; - } - then { - the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to NOT_SECURITY_PROTECTED, - authentication_request_message_identity set to AUTHENTICATION_REQUEST, - ngKSI containing - nas_key_set_identifier set to "111" - ;, - Authentication_parameter_RAND, - Authentication_parameter_AUTN - ; - ; - to the UE entity - } - } - } // end TP_5GNAS_AMF_AUT_REQ_01 - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_REQ_02 - - Test objective "Verify that the IUT sends an AUTHENTICATION REJECT message correctly upon receipt of an AUTHENTICATION RESPONSE message indicating a wrong ARP IEI." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.5 and 8.2.5" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - event AUTHENTICATION_REQUEST occurs - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to NOT_SECURITY_PROTECTED, - authentication_response_message_identity set to AUTHENTICATION_RESPONSE, - authentication_response_parameter containing - Authentication_response_parameter_IEI indicating value PX_WRONG_ARP_IEI - ; - ; - ; - from the UE entity - } - then { - the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to NOT_SECURITY_PROTECTED, - authentication_reject_message_identity set to AUTHENTICATION_REJECT - ; - ; - to the UE entity - } - } - } // end TP_5GNAS_AMF_AUT_REQ_02 - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_REQ_03 - - Test objective "Verify that the IUT stops re-sending an AUTHENTICATION REQUEST message if no AUTHENTICATION RESPONSE message is received on the fifth expiry of timer T3560." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.7 b) and Table 10.3.1" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - and (.) at time point start_initial_T3560 : event AUTHENTICATION_REQUEST occurs - and (!) 6s after start_initial_T3560 : event AUTHENTICATION_REQUEST occurs - and (!) 12s after start_initial_T3560 : event AUTHENTICATION_REQUEST occurs - and (!) 18s after start_initial_T3560 : event AUTHENTICATION_REQUEST occurs - } - Expected behaviour - ensure that { - when { - (.) at time point start_trigger_T3560 : event AUTHENTICATION_REQUEST occurs - } - then { - (!) 6s after start_trigger_T3560 : the IUT entity aborts AUTHENTICATION_REQUEST procedure - (Note 1: "It is not expected to receive another AUTHENTICATION message on the N2N1 interface.") - } - } - } // end TP_5GNAS_AMF_AUT_REQ_03 - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_REQ_04 - - Test objective "Verify that the IUT sends an IDENTITY REQUEST message correctly upon receipt of an AUTHENTICATION FAILURE message indicating a 5GMM cause value #20 - MAC failure." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.7 c) and 8.2.4" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - security_header_type set to INTEGRITY_PROTECTED, - authentication_parameter_AUTN containing - AUTN indicating value PX_WRONG_MAC_CODE - ; - ; - ; - to the UE entity - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED, - authentication_failure_message_identity set to AUTHENTICATION_FAILURE, - 5GMM_cause set to MAC_failure - - ; - ; - from the UE entity - } - then { - the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED, - identity_request_message_identity set to IDENTITY_REQUEST, - identity_type set to SUCI - ; - ; - to the UE entity - } - } - } // end TP_5GNAS_AMF_AUT_REQ_04 - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_REQ_05 - - Test objective "Verify that the IUT sends a new AUTHENTICATION REQUEST message with new ngKSI value to re-initiate the 5G AKA based primary authentication upon receipt of an AUTHENTICATION FAILURE message indicating a 5GMM cause value #71 - ngKSI already in use." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.7 e) and 8.2.4" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - the IUT entity sends an DOWNLINK_NAS_TRANSFER containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, - security_header_type set to NOT_SECURITY_PROTECTED, - spare_half_octet, - authentication_request_message_identity set to AUTHENTICATION_REQUEST, - ngKSI containing - nas_key_set_identifier set to "111" //value for nas_key_set_identifier was already used before - ;, - spare_half_octet, - ABBA, - Authentication_parameter_RAND, - Authentication_parameter_AUTN - ; - ; - to the UE entity - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED, - authentication_failure_message_identity set to AUTHENTICATION_FAILURE, - 5GMM_cause set to ngKSI_already_in_use - - ; - ; - from the UE entity - } - then { - event AUTHENTICATION_REQUEST occurs with { - argument replaced by the AUTHENTICATION_REQUEST containing - ngKSI containing - nas_key_set_identifier indicating value PX_NON_DEFAULT_NGKSI - ; - ; - } - to the UE entity - } - } - } // end TP_5GNAS_AMF_AUT_REQ_05 - - - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_ABN_01 - - Test objective "Verify that the IUT sends a new IDENTITY REQUEST message to obtain the SUCI from the UE upon receipt of an AUTHENTICATION FAILURE message indicating a 5GMM cause value #26 - non-5G authentication unacceptable." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.7 and 8.2.4" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - the IUT entity sends an DOWNLINK_NAS_TRANSFER containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, - security_header_type set to NOT_SECURITY_PROTECTED, - spare_half_octet, - authentication_request_message_identity set to AUTHENTICATION_REQUEST, - ngKSI containing - nas_key_set_identifier set to "111" - ;, - spare_half_octet, - ABBA, - Authentication_parameter_RAND, - Authentication_parameter_AUTN //the "separation bit" in the AMF field of AUTN is set to 0 - ; - ; - to the UE entity - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED, - authentication_failure_message_identity set to AUTHENTICATION_FAILURE, - 5GMM_cause set to "Non-5G authentication unacceptable (26)" - - ; - ; - from the UE entity - } - then { - event IDENTITY_REQUEST occurs with { - argument replaced by the AUTHENTICATION_REQUEST containing - 5GS_identity_type_IEI set to "SUCI" - ; - ; - } - to the UE entity - } - } - - } // end TP_5GNAS_AMF_AUT_ABN_01 - - } // end Group Primary authentication and key agreement procedure - - Group "5.4.2 Security mode control procedure" - { - - import all from Ngnas_Common; - - Test Purpose { - - TP Id TP_NGNAS_AMF_AUT_SEQ_01 - - Test objective "Verify that the IUT sends a SECURITY MODE CONTROL message correctly to indicate NAS security mode procedure upon receipt of a NAS AUTHENTICATION RESPONSE." - - Reference - "ETSI TS 124 501 [1], Clause 5.4.1.2" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - event AUTHENTICATION_REQUEST occurs with { - argument replaced by the AUTHENTICATION_REQUEST containing - security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT - ; - } - } - - Expected behaviour - ensure that { - when { - the IUT entity receives a UPLINK_NAS_TRANSPORT containing // AUTHENTICATION_RESPONSE - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, - authentication_response_message_identity set to AUTHENTICATION_RESPONSE //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - ; - ; - from the UE entity - } - then { - the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing // Security mode command - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, - security_mode_command_message_identity set to SECURITY_MODE_COMMAND, - selected_NAS_security_algorithms, - ngKSI containing - nas_key_set_identifier set to "111" - ; - replayed_UE_security_capabilities // UE security capability 9.11.3.54 - ; - ; - to the UE entity - } - } - } // end TP_NGNAS_AMF_AUT_SEQ_01 - - Test Purpose { - - TP Id TP_NGNAS_AMF_AUT_SEQ_02 - - Test objective "Verify that the IUT, upon receiving the NAS Security Mode Complete Message after completing the NAS Authentication and Security procedure, successfully completes the registration process by accepting the registration." - - Reference - "ETSI TS 124 501 [1], Clause 5.4.2.2, Clause 8.2.26" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - // TODO - - } // end TP_NGNAS_AMF_AUT_SEQ_02 - - Test Purpose { - - TP Id TP_NGNAS_AMF_AUT_SEQ_03 - - Test objective "Verify that the IUT, upon receiving the NAS Security Mode Reject Message after a failed NAS Authentication and security procedure, successfully aborts the registration process by rejecting the registration." - - Reference - "ETSI TS 124 501 [1], Clause 5.4.2.5, Clause 8.2.27" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - // TODO - - } // end TP_NGNAS_AMF_AUT_SEQ_03 - - Test Purpose { - - TP Id TP_5GNAS_AMF_SEC_ACC_01 - - Test objective "Verify that the IUT, upon receiving the NAS Security Mode Complete Message after completing the NAS Authentication and Security procedure, successfully completes the registration process by accepting the registration." - - Reference - "ETSI TS 124 501 [1], Clause 5.4.2 and 8.2.25" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/2 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - - Expected behaviour - ensure that { - when { - the IUT entity receives a UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, / - security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, - security_mode_complete_message_identity set to SECURITY_MODE_COMPLETE - ; - ; - from the UE entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5GS_registration_result containing - 55GS_registration_result_value set to 3GPP_ACCESS;, - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - TAI_list containing - Partial_tracking_area_list_1 containing - Type_of_list, - Number_of_elements, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - TAC indicating value PX_TAC - ; - - ;, - T3512_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - } - - } - - } // end TP_5GNAS_AMF_SEC_ACC_01 - - Test Purpose { - - TP Id TP_5GNAS_AMF_SEC_REJ_01 - - Test objective "Verify that the IUT, upon receiving the NAS Security Mode Reject Message after a failed NAS Authentication and security procedure, successfully aborts the registration process by rejecting the registration." - - Reference - "ETSI TS 124 501 [1], Clause 5.4.2 and 8.2.25" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/2 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives a UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, - security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, - security_mode_reject_message_identity set to SECURITY_MODE_REJECT, - 5GMM_cause set to "UE security capabilities mismatch (23)" - ; - ; - from the UE entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_reject_message_identity set to REGISTRATION_REJECT, - 5GMM_cause set to "UE security capabilities mismatch (23)", - T3346_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - - } - - } - - } // end TP_5GNAS_AMF_SEC_REJ_01 - - - - } // end Group Security mode control procedure - - Group "5.4.5 NAS transport procedure" - { - Test Purpose { - - TP Id TP_5GNAS_AMF_DLN_ACC_01 - - Test objective "Verify that the IUT correctly handles a UL NAS transport message containing a PDU SESSION ESTABLISHMENT REQUEST from the UE and responds with a DL NAS transport message containing a PDU SESSION ESTABLISHMENT ACCEPT." - - Reference - "ETSI TS 124 501 [1], Clause 5.4.5 and 8.2.10, 8.2.11" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A5/6 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives a UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - uL_NAS_TRANSPORT_message_identity, - payload_container containing - payload_container_type set to "N1 SM information", - number_of_optional_IEs set to 1, - optional_IE_1 set to "PDU SESSION ESTABLISHMENT REQUEST" - ;, - old_PDU_session_ID - ; - ; - from the UE entity - } - then { - the IUT entity sends an PDU_SESSION_RESOURCE_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - dL_NAS_TRANSPORT_message_identity, - payload_container containing - payload_container_type set to "N1 SM information" - number_of_optional_IEs set to 1, - optional_IE_1 set to "PDU SESSION ESTABLISHMENT ACCEPT" - ;, - pDU_session_ID - ; - ; - to the UE entity - } - - } - }// end TP_5GNAS_AMF_DLN_ACC_01 - - } // end Group 5.4.5 NAS transport procedure - - } // end Group 5.4 5GMM Common Procedures - - Group "5.5.1.2 Registration Procedure for initial registration" - { - import all from Ngnas_Common; - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_ACC_01 - - Test objective "Verify that the IUT sends a REGISTRATION ACCEPT message containing the 5GS registration result, TAI list, 5G-GUTI and T3512 when initial registration is accepted by the network." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/8_1 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;;; - from the GNB entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5GS_registration_result containing - 55GS_registration_result_value set to 3GPP_ACCESS;, - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - TAI_list containing - Partial_tracking_area_list_1 containing - Type_of_list, - Number_of_elements, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - TAC indicating value PX_TAC;; - T3512_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_ACC_01 - - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_ACC_02 - - Test objective "Verify that the IUT sends a REGISTRATION ACCEPT message indicating SMS over NAS allowed when initial registration with SMS over NAS is requested and network allows SMS service." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/8_1_3 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;, - 5GS_update_type containing - SMS_over_NAS_transport_requested set to 1;;; //SMS over NAS supported - from the GNB entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5GS_registration_result containing - 5GS_registration_result_value set to 3GPP_ACCESS, - SMS_over_NAS_transport_allowed set to 1;, //SMS over NAS allowed - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - TAI_list containing - Partial_tracking_area_list_1 containing - Type_of_list, - Number_of_elements, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - TAC indicating value PX_TAC;;, - T3512_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_ACC_02 - - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_ACC_03 - - Test objective "Verify that the IUT sends a REGISTRATION ACCEPT message indicating SMS over NAS not allowed when initial registration with SMS over NAS is requested and network does not support SMS service." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" - - Config Id CF_AMF_N2N1 - - PICS Selection NOT PICS_A4/8_1_3 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;, - 5GS_update_type containing - SMS_over_NAS_transport_requested set to 1;;; //SMS over NAS supported - from the GNB entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5GS_registration_result containing - 5GS_registration_result_value set to 3GPP_ACCESS, - SMS_over_NAS_transport_allowed set to 0;, //SMS over NAS not allowed - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - TAI_list containing - Partial_tracking_area_list_1 containing - Type_of_list, - Number_of_elements, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - TAC indicating value PX_TAC;;, - T3512_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_ACC_03 - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_ACC_04 - - Test objective "Verify that the IUT includes the allowed NSSAI in the REGISTRATION ACCEPT message when the UE includes a requested NSSAI in the REGISTRATION REQUEST message and the network allows one or more S-NSSAIs from the requested NSSAI." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/8_1 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;;; - from the GNB entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - Allowed_NSSAI containing - S_NSSAI_1 containing - SST set to PX_SST_1, - SD set to PX_SD_1, - Mapped_HPLMN_SST set to PX_MAPPED_HPLMN_SST_1, - Mapped_HPLMN_SD set to PX_MAPPED_HPLMN_SD_1;;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_ACC_04 - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_ACC_05 - - Test objective "Verify that the IUT optionally includes rejected NSSAI in the REGISTRATION ACCEPT message when the network rejects one or more S-NSSAIs from the requested NSSAI." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/8_1_2_3 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;;; - from the GNB entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - Rejected_NSSAI containing - Rejected_S_NSSAI_1 containing - Cause_value, - SST set to PX_SST_Rejected, - SD set to PX_SD_Rejected;;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_ACC_05 - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_REJ_01 - - Test objective "Verify that the IUT rejects initial registration request due to general NAS level mobility management congestion control with 5GMM cause value #22 - congestion and assign a value for back-off timer T3346." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.5 and 8.2.9" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - the AMF entity isInOverloadedState - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;;; - from the GNB entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_reject_message_identity set to REGISTRATION_REJECT, - 5GMM_cause set to "Congestion (22)", - T3346_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_REJ_01 - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_REJ_02 - - Test objective "Verify that the IUT rejects initial registration request because all the S-NSSAI(s) included in the requested NSSAI are either rejected for current PLMN, rejected for the current registration area or rejected due to failed or revoked NSSAIs." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.5 and 8.2.9" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - Requested_NSSAI indicating value PX_NSSAI_REVOKED - ; - ; - from the GNB entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - Registration_reject_message_identity set to REGISTRATION_REJECT, - 5GMM_cause set to "No network slice available (62)";; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_REJ_02 - - } //end Group "5.5.1.2 Registration Procedure for initial registration" - - Group "5.5.2.2.3 UE-initiated de-registration procedure completion" - { - import all from Ngnas_Common; - - - Test Purpose { - - TP Id TP_5GNAS_AMF_DRG_ACC_01 - - Test objective "Verify that the IUT, upon receiving a DEREGISTRATION REQUEST message containing the De-registration type IE with Normal de-registration from the UE, sends a DEREGISTRATION ACCEPT message." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.2.2.3, 8.2.12 and 8.2.13" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/9_1 - - Initial conditions with { - the UE entity isRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST, - Deregistration_type containing - Switch_off_value set to NORMAL_DEREGISTRATION, - Reregistration_required_value set to REREGISTRATION_NOT_REQUIRED, - Access_type set to 3GPP_ACCESS;, - 5GS_mobile_identity containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;;; - from the GNB entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Deregistration_accept_message_identity set to DEREGISTRATION_ACCEPT;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_DRG_ACC_01 - - Test Purpose { - - TP Id TP_5GNAS_AMF_DRG_ACC_02 - - Test objective "Verify that the IUT, upon receiving a DEREGISTRATION REQUEST message containing the De-registration type IE with Switch-off from the UE, does not send a DEREGISTRATION ACCEPT message and IUT completes de-registration procedure." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.2.2.3, 8.2.12 and 8.2.13" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/9_1 - - Initial conditions with { - the UE entity isRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST, - Deregistration_type containing - Switch_off_value set to SWITCH_OFF, - Reregistration_required_value set to REREGISTRATION_NOT_REQUIRED, - Access_type set to 3GPP_ACCESS;, - 5GS_mobile_identity containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;;; - from the GNB entity - } - then { - the IUT entity not sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Deregistration_accept_message_identity set to DEREGISTRATION_ACCEPT;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_DRG_ACC_02 - - } //end Group "5.5.2.2.3 UE-initiated de-registration procedure completion" - - Group "5.5.2.3.1 Network-initiated de-registration procedure initiation" - { - import all from Ngnas_Common; - - - Test Purpose { - - TP Id TP_5GNAS_AMF_DRG_REQ_01 - - Test objective "Verify that the IUT initiates network de-registration by sending a DEREGISTRATION REQUEST message containing De-registration type IE with re-registration not required and the access type based on the UE’s registration status (3GPP access only). **NOTE:** explicit network deregistration triggered by O&M - deactivation of UE" - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.2.3.1 and 8.2.14" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/9_2 - - Initial conditions with { - the UE entity isRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity indicate a UE deactivation - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST, - Deregistration_type containing - Switch_off_value set to NORMAL_DEREGISTRATION, - Reregistration_required_value set to REREGISTRATION_NOT_REQUIRED, - Access_type set to 3GPP_ACCESS;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_DRG_REQ_01 - - Test Purpose { - - TP Id TP_5GNAS_AMF_DRG_REQ_02 - - Test objective "Verify that the IUT initiates network de-registration by sending a DEREGISTRATION REQUEST message and if UE does not send DEREGISTRATION ACCEPT then IUT retransmits DEREGISTRATION REQUEST message after timer T3522 expiration. **NOTE:** explicit network deregistration triggered by O&M - UE deregistration." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.2.3.1 and 8.2.14" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/9_2 - - Initial conditions with { - the UE entity isRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity indicate a UE deregistration and - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST;; - to the GNB entity and - the IUT entity does not receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - Deregistration_accept_message_identity set to DEREGISTRATION_ACCEPT;; - from the GNB entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST, - Deregistration_type containing - Switch_off_value set to NORMAL_DEREGISTRATION, - Reregistration_required_value set to REREGISTRATION_NOT_REQUIRED, - Access_type set to 3GPP_ACCESS;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_DRG_REQ_02 - - Test Purpose { - - TP Id TP_5GNAS_AMF_DRG_REQ_03 - - Test objective "Verify that the IUT initiates network de-registration by sending DEREGISTRATION REQUEST message containing De-registration type IE with re-registration required and the access type based on the UE’s registration status (3GPP access only). **NOTE 1:** UE sends DEREGISTRATION ACCEPT and starts with re-registration procedure.(also used ref 5.5.2.3.2 1st paragraph) **NOTE 2:** explicit network deregistration triggered by O&M - UE deregistration" - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.2.3.1, 5.5.2.3.2 and 8.2.14" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/9_2 - - Initial conditions with { - the UE entity isRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity indicate a UE deregistration - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST, - Deregistration_type containing - Switch_off_value set to NORMAL_DEREGISTRATION, - Reregistration_required_value set to REREGISTRATION_REQUIRED, - Access_type set to 3GPP_ACCESS;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_DRG_REQ_03 - - } //end Group "5.5.2.3.1 Network-initiated de-registration procedure initiation" - - } -} // End of Package TP_AMF - diff --git a/test_purposes/ngnas/TP_AMF_NGNAS2_clean.tplan2 b/test_purposes/ngnas/TP_AMF_NGNAS2_clean.tplan2 deleted file mode 100644 index b55480771cae132ae83cce603c21b3d4c9219fcd..0000000000000000000000000000000000000000 --- a/test_purposes/ngnas/TP_AMF_NGNAS2_clean.tplan2 +++ /dev/null @@ -1,1198 +0,0 @@ -/* -Copyright (c) ETSI 2025. - -This software is subject to copyrights owned by ETSI. Non-exclusive permission -is hereby granted, free of charge, to copy, reproduce and amend this file -under the following conditions: It is provided "as is", without warranty of any -kind, expressed or implied. - -ETSI shall never be liable for any claim, damages, or other liability arising -from its use or inability of use.This permission does not apply to any documentation -associated with this file for which ETSI keeps all rights reserved. The present -copyright notice shall be included in all copies of whole or part of this -file and shall not imply any sub-license right. -*/ - -/* interface at AMF */ -Package TP_AMF { - - - Group "5.4 5GMM Common Procedures" - { - Group "5.4.1 Primary authentication and key agreement procedure" - { - import all from Ngnas_Common; - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_REQ_01 - - Test objective "Verify that the IUT sends an AUTHENTICATION REQUEST message correctly upon receipt of a NAS Registration without an active security context." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.2 and 8.2.1" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to NOT_SECURITY_PROTECTED, - registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type, - 5GS_mobile_identity;; - } - then { - the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to NOT_SECURITY_PROTECTED, - authentication_request_message_identity set to AUTHENTICATION_REQUEST, - ngKSI containing - nas_key_set_identifier set to "111";, - Authentication_parameter_RAND, - Authentication_parameter_AUTN;; - to the UE entity - } - } - } // end TP_5GNAS_AMF_AUT_REQ_01 - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_REQ_02 - - Test objective "Verify that the IUT sends an AUTHENTICATION REJECT message correctly upon receipt of an AUTHENTICATION RESPONSE message indicating a wrong ARP IEI." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.5 and 8.2.5" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - event AUTHENTICATION_REQUEST occurs - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to NOT_SECURITY_PROTECTED, - authentication_response_message_identity set to AUTHENTICATION_RESPONSE, - authentication_response_parameter containing - Authentication_response_parameter_IEI indicating value PX_WRONG_ARP_IEI;;; - from the UE entity - } - then { - the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to NOT_SECURITY_PROTECTED, - authentication_reject_message_identity set to AUTHENTICATION_REJECT;; - to the UE entity - } - } - } // end TP_5GNAS_AMF_AUT_REQ_02 - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_REQ_03 - - Test objective "Verify that the IUT stops re-sending an AUTHENTICATION REQUEST message if no AUTHENTICATION RESPONSE message is received on the fifth expiry of timer T3560." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.7 b) and Table 10.3.1" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - and (.) at time point start_initial_T3560 : event AUTHENTICATION_REQUEST occurs - and (!) 6s after start_initial_T3560 : event AUTHENTICATION_REQUEST occurs - and (!) 12s after start_initial_T3560 : event AUTHENTICATION_REQUEST occurs - and (!) 18s after start_initial_T3560 : event AUTHENTICATION_REQUEST occurs - } - Expected behaviour - ensure that { - when { - (.) at time point start_trigger_T3560 : event AUTHENTICATION_REQUEST occurs - } - then { - (!) 6s after start_trigger_T3560 : the IUT entity aborts AUTHENTICATION_REQUEST procedure - (Note 1: "It is not expected to receive another AUTHENTICATION message on the N2N1 interface.") - } - } - } // end TP_5GNAS_AMF_AUT_REQ_03 - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_REQ_04 - - Test objective "Verify that the IUT sends an IDENTITY REQUEST message correctly upon receipt of an AUTHENTICATION FAILURE message indicating a 5GMM cause value #20 - MAC failure." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.7 c) and 8.2.4" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - security_header_type set to INTEGRITY_PROTECTED, - authentication_parameter_AUTN containing - AUTN indicating value PX_WRONG_MAC_CODE;;; - to the UE entity - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED, - authentication_failure_message_identity set to AUTHENTICATION_FAILURE, - 5GMM_cause set to MAC_failure;; - from the UE entity - } - then { - the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED, - identity_request_message_identity set to IDENTITY_REQUEST, - identity_type set to SUCI;; - to the UE entity - } - } - } // end TP_5GNAS_AMF_AUT_REQ_04 - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_REQ_05 - - Test objective "Verify that the IUT sends a new AUTHENTICATION REQUEST message with new ngKSI value to re-initiate the 5G AKA based primary authentication upon receipt of an AUTHENTICATION FAILURE message indicating a 5GMM cause value #71 - ngKSI already in use." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.7 e) and 8.2.4" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - the IUT entity sends an DOWNLINK_NAS_TRANSFER containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, - security_header_type set to NOT_SECURITY_PROTECTED, - spare_half_octet, - authentication_request_message_identity set to AUTHENTICATION_REQUEST, - ngKSI containing - nas_key_set_identifier set to "111";, //value for nas_key_set_identifier was already used before - spare_half_octet, - ABBA, - Authentication_parameter_RAND, - Authentication_parameter_AUTN;; - to the UE entity - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED, - authentication_failure_message_identity set to AUTHENTICATION_FAILURE, - 5GMM_cause set to ngKSI_already_in_use;; - from the UE entity - } - then { - the IUT entity sends an DOWNLINK_NAS_TRANSFER containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, - security_header_type set to NOT_SECURITY_PROTECTED, - spare_half_octet, - authentication_request_message_identity set to AUTHENTICATION_REQUEST, - ngKSI containing - nas_key_set_identifier indicating value PX_NON_DEFAULT_NGKSI;, - spare_half_octet, - ABBA, - Authentication_parameter_RAND, - Authentication_parameter_AUTN;; - to the UE entity - } - } - } // end TP_5GNAS_AMF_AUT_REQ_05 - - - - Test Purpose { - - TP Id TP_5GNAS_AMF_AUT_ABN_01 - - Test objective "Verify that the IUT sends a new IDENTITY REQUEST message to obtain the SUCI from the UE upon receipt of an AUTHENTICATION FAILURE message indicating a 5GMM cause value #26 - non-5G authentication unacceptable." - - Reference - "ETSI TS 124 501 [1], Clauses 5.4.1.3.7, 8.2.4, 5.4.3.2 and 8.2.21.1" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - the IUT entity sends an DOWNLINK_NAS_TRANSFER containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, - security_header_type set to NOT_SECURITY_PROTECTED, - spare_half_octet, - authentication_request_message_identity set to AUTHENTICATION_REQUEST, - ngKSI containing - nas_key_set_identifier set to "111";, - spare_half_octet, - ABBA, - Authentication_parameter_RAND, - Authentication_parameter_AUTN;; //the "separation bit" in the AMF field of AUTN is set to 0 - to the UE entity - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED, - authentication_failure_message_identity set to AUTHENTICATION_FAILURE, - 5GMM_cause set to "Non-5G authentication unacceptable (26)";; - from the UE entity - } - then { - the IUT entity sends an DOWNLINK_NAS_TRANSFER containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, - security_header_type set to NOT_SECURITY_PROTECTED, - spare_half_octet, - identity_request_message_identity set to IDENTITY_REQUEST, - 5GS_identity_type_IEI set to "SUCI";; - to the UE entity - } - } - - } // end TP_5GNAS_AMF_AUT_ABN_01 - - } // end Group Primary authentication and key agreement procedure - - Group "5.4.2 Security mode control procedure" - { - - import all from Ngnas_Common; - - Test Purpose { - - TP Id TP_NGNAS_AMF_AUT_SEQ_01 - - Test objective "Verify that the IUT sends a SECURITY MODE COMMAND message correctly to indicate NAS security mode procedure upon receipt of a NAS AUTHENTICATION RESPONSE." - - Reference - "ETSI TS 124 501 [1], Clause 5.4.1.2" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - event AUTHENTICATION_REQUEST occurs with { - argument replaced by the AUTHENTICATION_REQUEST containing - security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT; - } - } - - Expected behaviour - ensure that { - when { - the IUT entity receives a UPLINK_NAS_TRANSPORT containing // AUTHENTICATION_RESPONSE - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, - authentication_response_message_identity set to AUTHENTICATION_RESPONSE;; //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - from the UE entity - } - then { - the IUT entity sends an DOWNLINK_NAS_TRANSPORT containing // Security mode command - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, //reference ts_124007v180200p: Table 11.2.3.1.1A.1: EPD values - security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, - security_mode_command_message_identity set to SECURITY_MODE_COMMAND, - selected_NAS_security_algorithms, - ngKSI containing - nas_key_set_identifier set to "111";, - replayed_UE_security_capabilities;; // UE security capability 9.11.3.54 - to the UE entity - } - } - } // end TP_NGNAS_AMF_AUT_SEQ_01 - - Test Purpose { - - TP Id TP_5GNAS_AMF_SEC_ACC_01 - - Test objective "Verify that the IUT, upon receiving the NAS SECURITY MODE COMPLETE message after completing the NAS Authentication and Security procedure, successfully completes the registration process by accepting the registration." - - Reference - "ETSI TS 124 501 [1], Clause 5.4.2 and 8.2.25" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/2 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - - Expected behaviour - ensure that { - when { - the IUT entity receives a UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, - security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, - security_mode_complete_message_identity set to SECURITY_MODE_COMPLETE;; - from the UE entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5GS_registration_result containing - 55GS_registration_result_value set to 3GPP_ACCESS;, - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - TAI_list containing - Partial_tracking_area_list_1 containing - Type_of_list, - Number_of_elements, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - TAC indicating value PX_TAC;;, - T3512_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - } - - } - - } // end TP_5GNAS_AMF_SEC_ACC_01 - - Test Purpose { - - TP Id TP_5GNAS_AMF_SEC_REJ_01 - - Test objective "Verify that the IUT, upon receiving the NAS SECURITY MODE REJECT message after a failed NAS Authentication and security procedure, successfully aborts the registration process by rejecting the registration." - - Reference - "ETSI TS 124 501 [1], Clause 5.4.2 and 8.2.25" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/2 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives a UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5GS_MOBILITY_MANAGEMENT_MESSAGE, - security_header_type set to INTEGRITY_PROTECTED_WITH_NEW_5G_NAS_SECURITY_CONTEXT, - security_mode_reject_message_identity set to SECURITY_MODE_REJECT, - 5GMM_cause set to "UE security capabilities mismatch (23)";; - from the UE entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_reject_message_identity set to REGISTRATION_REJECT, - 5GMM_cause set to "UE security capabilities mismatch (23)", - T3346_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - } - - } - - } // end TP_5GNAS_AMF_SEC_REJ_01 - - - - } // end Group Security mode control procedure - - Group "5.4.5 NAS transport procedure" - { - import all from Ngnas_Common; - - Test Purpose { - - TP Id TP_5GNAS_AMF_DLN_ACC_01 - - Test objective "Verify that the IUT correctly handles a UL NAS transport message containing a PDU SESSION ESTABLISHMENT REQUEST from the UE and responds with a DL NAS transport message containing a PDU SESSION ESTABLISHMENT ACCEPT." - - Reference - "ETSI TS 124 501 [1], Clause 5.4.5 and 8.2.10, 8.2.11" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A5/6 - - Initial conditions with { - the UE entity isRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives a UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - uL_NAS_TRANSPORT_message_identity set to UL_NAS_TRANSPORT, - payload_container containing - payload_container_type set to "N1 SM information", - number_of_optional_IEs set to 1, - optional_IE_1 set to "PDU SESSION ESTABLISHMENT REQUEST";, - old_PDU_session_ID;; - from the UE entity - } - then { - the IUT entity sends an PDU_SESSION_RESOURCE_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - dL_NAS_TRANSPORT_message_identity set to DL_NAS_TRANSPORT, - payload_container containing - payload_container_type set to "N1 SM information", - number_of_optional_IEs set to 1, - optional_IE_1 set to "PDU SESSION ESTABLISHMENT ACCEPT";, - pDU_session_ID;; - to the UE entity - } - - } - }// end TP_5GNAS_AMF_DLN_ACC_01 - - } // end Group 5.4.5 NAS transport procedure - - } // end Group 5.4 5GMM Common Procedures - - Group "5.5.1.2 Registration Procedure for initial registration" - { - import all from Ngnas_Common; - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_ACC_01 - - Test objective "Verify that the IUT sends a REGISTRATION ACCEPT message containing the 5GS registration result, TAI list, 5G-GUTI and T3512 when initial registration is accepted by the network." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/8_1 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;;; - from the GNB entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5GS_registration_result containing - 55GS_registration_result_value set to 3GPP_ACCESS;, - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - TAI_list containing - Partial_tracking_area_list_1 containing - Type_of_list, - Number_of_elements, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - TAC indicating value PX_TAC;;, - T3512_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_ACC_01 - - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_ACC_02 - - Test objective "Verify that the IUT sends a REGISTRATION ACCEPT message indicating SMS over NAS allowed when initial registration with SMS over NAS is requested and network allows SMS service." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/8_1_3 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;, - 5GS_update_type containing - SMS_over_NAS_transport_requested set to 1;;; //SMS over NAS supported - from the GNB entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5GS_registration_result containing - 5GS_registration_result_value set to 3GPP_ACCESS, - SMS_over_NAS_transport_allowed set to 1;, //SMS over NAS allowed - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - TAI_list containing - Partial_tracking_area_list_1 containing - Type_of_list, - Number_of_elements, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - TAC indicating value PX_TAC;;, - T3512_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_ACC_02 - - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_ACC_03 - - Test objective "Verify that the IUT sends a REGISTRATION ACCEPT message indicating SMS over NAS not allowed when initial registration with SMS over NAS is requested and network does not support SMS service." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" - - Config Id CF_AMF_N2N1 - - PICS Selection not PICS_A4/8_1_3 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;, - 5GS_update_type containing - SMS_over_NAS_transport_requested set to 1;;; //SMS over NAS supported - from the GNB entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5GS_registration_result containing - 5GS_registration_result_value set to 3GPP_ACCESS, - SMS_over_NAS_transport_allowed set to 0;, //SMS over NAS not allowed - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - TAI_list containing - Partial_tracking_area_list_1 containing - Type_of_list, - Number_of_elements, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - TAC indicating value PX_TAC;;, - T3512_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_ACC_03 - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_ACC_04 - - Test objective "Verify that the IUT includes the allowed NSSAI in the REGISTRATION ACCEPT message when the UE includes a requested NSSAI in the REGISTRATION REQUEST message and the network allows one or more S-NSSAIs from the requested NSSAI." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/8_1 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;;; - from the GNB entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - Allowed_NSSAI containing - S_NSSAI_1 containing - SST set to PX_SST_1, - SD set to PX_SD_1, - Mapped_HPLMN_SST set to PX_MAPPED_HPLMN_SST_1, - Mapped_HPLMN_SD set to PX_MAPPED_HPLMN_SD_1;;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_ACC_04 - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_ACC_05 - - Test objective "Verify that the IUT optionally includes rejected NSSAI in the REGISTRATION ACCEPT message when the network rejects one or more S-NSSAIs from the requested NSSAI." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/8_1_2_3 - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;;; - from the GNB entity - } - then { - the IUT entity sends a INITIAL_CONTEXT_SETUP_REQUEST containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_accept_message_identity set to REGISTRATION_ACCEPT, - 5G_GUTI containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;, - Rejected_NSSAI containing - Rejected_S_NSSAI_1 containing - Cause_value, - SST set to PX_SST_Rejected, - SD set to PX_SD_Rejected;;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_ACC_05 - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_REJ_01 - - Test objective "Verify that the IUT rejects initial registration request due to general NAS level mobility management congestion control with 5GMM cause value #22 - congestion and assign a value for back-off timer T3346." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.5 and 8.2.9" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF and - the AMF entity isInOverloadedState - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - 5GS_mobile_identity containing - SUPI_format indicating value IMSI, - Type_of_idenity indicating value SUCI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - Routing_indicator indicating value PX_ROUTING_INDICATOR, - Protection_scheme_id indicating value PX_PROTECTION_SCHEME_ID, - Home_network_public_key_identifier indicating value PX_HOME_NETWORK_PUBLIC_KEY_IDENTIFIER, - MSIN indicating value PX_MSIN;;; - from the GNB entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Registration_reject_message_identity set to REGISTRATION_REJECT, - 5GMM_cause set to "Congestion (22)", - T3346_value containing - Timer_value indicating value nonZeroValue;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_REJ_01 - - Test Purpose { - - TP Id TP_5GNAS_AMF_REG_REJ_02 - - Test objective "Verify that the IUT rejects initial registration request because all the S-NSSAI(s) included in the requested NSSAI are either rejected for current PLMN, rejected for the current registration area or rejected due to failed or revoked NSSAIs." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.1.2.5 and 8.2.9" - - Config Id CF_AMF_N2N1 - - PICS Selection NONE - - Initial conditions with { - the UE entity isNotRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an INITIAL_UE_MESSAGE containing - NAS_PDU containing - Registration_request_message_identity set to REGISTRATION_REQUEST, - 5GS_registration_type containing - 5GS_registration_type_value set to INITIAL_REGISTRATION, - FOR indicating value 1;, //Follow-on request pending - Requested_NSSAI indicating value PX_NSSAI_REVOKED;; - from the GNB entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - Registration_reject_message_identity set to REGISTRATION_REJECT, - 5GMM_cause set to "No network slice available (62)";; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_REG_REJ_02 - - } //end Group "5.5.1.2 Registration Procedure for initial registration" - - Group "5.5.2.2.3 UE-initiated de-registration procedure completion" - { - import all from Ngnas_Common; - - - Test Purpose { - - TP Id TP_5GNAS_AMF_DRG_ACC_01 - - Test objective "Verify that the IUT, upon receiving a DEREGISTRATION REQUEST message containing the De-registration type IE with Normal de-registration from the UE, sends a DEREGISTRATION ACCEPT message." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.2.2.3, 8.2.12 and 8.2.13" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/9_1 - - Initial conditions with { - the UE entity isRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST, - Deregistration_type containing - Switch_off_value set to NORMAL_DEREGISTRATION, - Reregistration_required_value set to REREGISTRATION_NOT_REQUIRED, - Access_type set to 3GPP_ACCESS;, - 5GS_mobile_identity containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;;; - from the GNB entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Deregistration_accept_message_identity set to DEREGISTRATION_ACCEPT;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_DRG_ACC_01 - - Test Purpose { - - TP Id TP_5GNAS_AMF_DRG_ACC_02 - - Test objective "Verify that the IUT, upon receiving a DEREGISTRATION REQUEST message containing the De-registration type IE with Switch-off from the UE, does not send a DEREGISTRATION ACCEPT message and IUT completes de-registration procedure." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.2.2.3, 8.2.12 and 8.2.13" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/9_1 - - Initial conditions with { - the UE entity isRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST, - Deregistration_type containing - Switch_off_value set to SWITCH_OFF, - Reregistration_required_value set to REREGISTRATION_NOT_REQUIRED, - Access_type set to 3GPP_ACCESS;, - 5GS_mobile_identity containing - Type_of_identity set to 5G_GUTI, - MCC indicating value PX_MCC, - MNC indicating value PX_MNC, - AMF_Region_ID indicating value PX_AMF_REGION_ID, - AMF_Set_ID indicating value PX_AMF_SET_ID, - AMF_Pointer indicating value PX_AMF_POINTER, - 5G_TMSI indicating value RV_5G_TMSI;;; - from the GNB entity - } - then { - the IUT entity not sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to INTEGRITY_PROTECTED_AND_CIPHERED, - Deregistration_accept_message_identity set to DEREGISTRATION_ACCEPT;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_DRG_ACC_02 - - } //end Group "5.5.2.2.3 UE-initiated de-registration procedure completion" - - Group "5.5.2.3.1 Network-initiated de-registration procedure initiation" - { - import all from Ngnas_Common; - - - Test Purpose { - - TP Id TP_5GNAS_AMF_DRG_REQ_01 - - Test objective "Verify that the IUT initiates network de-registration by sending a DEREGISTRATION REQUEST message containing De-registration type IE with re-registration not required and the access type based on the UE’s registration status (3GPP access only). **NOTE:** explicit network deregistration triggered by O&M - deactivation of UE" - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.2.3.1 and 8.2.14" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/9_2 - - Initial conditions with { - the UE entity isRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity indicate a UE deactivation - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST, - Deregistration_type containing - Switch_off_value set to NORMAL_DEREGISTRATION, - Reregistration_required_value set to REREGISTRATION_NOT_REQUIRED, - Access_type set to 3GPP_ACCESS;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_DRG_REQ_01 - - Test Purpose { - - TP Id TP_5GNAS_AMF_DRG_REQ_02 - - Test objective "Verify that the IUT initiates network de-registration by sending a DEREGISTRATION REQUEST message and if UE does not send DEREGISTRATION ACCEPT then IUT retransmits DEREGISTRATION REQUEST message after timer T3522 expiration. **NOTE:** explicit network deregistration triggered by O&M - UE deregistration." - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.2.3.1 and 8.2.14" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/9_2 - - Initial conditions with { - the UE entity isRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity indicate a UE deregistration and - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST;; - to the GNB entity and - the IUT entity does not receives an UPLINK_NAS_TRANSPORT containing - NAS_PDU containing - Deregistration_accept_message_identity set to DEREGISTRATION_ACCEPT;; - from the GNB entity - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST, - Deregistration_type containing - Switch_off_value set to NORMAL_DEREGISTRATION, - Reregistration_required_value set to REREGISTRATION_NOT_REQUIRED, - Access_type set to 3GPP_ACCESS;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_DRG_REQ_02 - - Test Purpose { - - TP Id TP_5GNAS_AMF_DRG_REQ_03 - - Test objective "Verify that the IUT initiates network de-registration by sending DEREGISTRATION REQUEST message containing De-registration type IE with re-registration required and the access type based on the UE’s registration status (3GPP access only). **NOTE 1:** UE sends DEREGISTRATION ACCEPT and starts with re-registration procedure.(also used ref 5.5.2.3.2 1st paragraph) **NOTE 2:** explicit network deregistration triggered by O&M - UE deregistration" - - Reference - "ETSI TS 124 501 [1], Clauses 5.5.2.3.1, 5.5.2.3.2 and 8.2.14" - - Config Id CF_AMF_N2N1 - - PICS Selection PICS_A4/9_2 - - Initial conditions with { - the UE entity isRegisteredTo the AMF - } - - Expected behaviour - ensure that { - when { - the IUT entity indicate a UE deregistration - } - then { - the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing - NAS_PDU containing - extended_protocol_discriminator set to 5G_MOBILITY_MANAGEMENT_MESSAGES, - security_header_type set to NOT_SECURITY_PROTECTED, - Deregistration_request_message_identity set to DEREGISTRATION_REQUEST, - Deregistration_type containing - Switch_off_value set to NORMAL_DEREGISTRATION, - Reregistration_required_value set to REREGISTRATION_REQUIRED, - Access_type set to 3GPP_ACCESS;;; - to the GNB entity - } - } - }// end TP_5GNAS_AMF_DRG_REQ_03 - - } //end Group "5.5.2.3.1 Network-initiated de-registration procedure initiation" - - -} // End of Package TP_AMF - diff --git a/titan-test-system-framework b/titan-test-system-framework index 9ed59ebd3c0a769688262f2370f6d3c3507b2a5f..17ff081971dc4044c8c03f669816c3d81e7c8bd2 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 9ed59ebd3c0a769688262f2370f6d3c3507b2a5f +Subproject commit 17ff081971dc4044c8c03f669816c3d81e7c8bd2 diff --git a/ttcn/AtsNGAP/NGAP_Pics.ttcn b/ttcn/AtsNGAP/NGAP_Pics.ttcn index 4706723e9e60ae03b4b7589d9a5111deb51fa591..a3b70d669c19ed3b2d5e47634e40d2db6ba29258 100644 --- a/ttcn/AtsNGAP/NGAP_Pics.ttcn +++ b/ttcn/AtsNGAP/NGAP_Pics.ttcn @@ -1,5 +1,5 @@ /** -* @author ETSI / TTF033 +* @author ETSI / TTF T033, T048 * @version $URL$ * $Id$ * @desc This module provides PICS for NGAP tests. @@ -108,6 +108,8 @@ module NGAP_Pics { modulepar boolean PICS_A4_5_2 := false; //AMF - Transport of NAS Messages Procedures - DOWNLINK NAS TRANSPORT modulepar boolean PICS_A4_5_5 := false; //AMF - Transport of NAS Messages Procedures - REROUTE NAS REQUEST modulepar boolean PICS_A4_6_1 := false; //AMF - Interface Management Procedures - NG SETUP REQUEST + modulepar boolean PICS_A4_6_1_1 := false; //AMF - Rejection of an unacceptable NG SETUP REQUEST message with an NG SETUP FAILURE message + modulepar boolean PICS_A4_6_1_2 := false; //AMF - IAB modulepar boolean PICS_A4_6_2 := false; //AMF - Interface Management Procedures - RAN CONFIGURATION UPDATE modulepar boolean PICS_A4_6_3 := false; //AMF - Interface Management Procedures - AMF CONFIGURATION UPDATE modulepar boolean PICS_A4_6_4 := false; //AMF - Interface Management Procedures - NG RESET diff --git a/ttcn/AtsNGAP/NGAP_Pixits.ttcn b/ttcn/AtsNGAP/NGAP_Pixits.ttcn index 621abdcbe8c5e1e9bfe620117280da0b3308cc65..fb1bea4b11cea9fb011824164a78b4745c4e3e94 100644 --- a/ttcn/AtsNGAP/NGAP_Pixits.ttcn +++ b/ttcn/AtsNGAP/NGAP_Pixits.ttcn @@ -1,5 +1,5 @@ /** -* @author ETSI / TTF033 +* @author ETSI / TTF T033, T048 * @version $URL$ * $Id$ * @desc This module provides PIXITs for NGAP tests. diff --git a/ttcn/AtsNGAP/NGAP_Steps.ttcn b/ttcn/AtsNGAP/NGAP_Steps.ttcn index a850a23e5ccff945e068332a7850512b49cbe688..1ac87825d2d0343001370859fe27bc26970ab1a7 100644 --- a/ttcn/AtsNGAP/NGAP_Steps.ttcn +++ b/ttcn/AtsNGAP/NGAP_Steps.ttcn @@ -1,5 +1,5 @@ /** -* @author ETSI / TTF033 +* @author ETSI / TTF T033, T048 * @version $URL$ * $Id$ * @desc This module provides ATS specific steps used by the test cases for NGAP tests. @@ -9,17 +9,27 @@ * All rights reserved. * @see ETSI TS */ -module NGAP_Steps { +module NGAP_Steps { // TODO FSCOM f_xxx_UE_SecurityMode to be mmoved into NAG_NGAP_Steps.ttcn module + + // Lib3GPP + import from NG_NAS_TypeDefs all; // LibNGAP + import from NGAP_CommonDataTypes language "ASN.1:1997" all; + import from NGAP_PDU_Descriptions language "ASN.1:1997" all; + import from NGAP_IEs language "ASN.1:1997" all; + import from LibNGAP_Steps all; - import from LibNGAP_Interface all; - import from LibNGAP_Pixits all; import from LibNGAP_Templates all; + import from LibNGAP_Functions all; + import from LibNGAP_Pixits all; + import from LibNGAP_Pics all; + import from LibNGAP_Interface all; - // NGAP_Ats + // AtsNGAP + import from NGAP_TestSystem all; import from NGAP_Pixits all; - + import from NGAP_Pics all; group GlobalSteps { @@ -28,7 +38,7 @@ module NGAP_Steps { * This procedure will be use when the Test System acts as AMF (SUT is gNB) */ function f_NGAP_amf_init() - runs on NGAPComponent { + runs on aMFNGAPComponent { // Defaults vc_default_ngap := activate (a_defaultNGAP()); @@ -48,7 +58,7 @@ module NGAP_Steps { * This procedure will be use when the Test System acts as gNB (SUT is AMF) */ function f_NGAP_gnb_init() - runs on NGAPComponent { + runs on gNBNGAPComponent { // Defaults vc_default_ngap := activate (a_defaultNGAP()); @@ -61,90 +71,17 @@ module NGAP_Steps { vc_SUT_address := PX_NGAP_SUT_IPADDR; vc_SUT_port := PX_NGAP_SUT_PORT; - f_send_NGAP_PDU( - m_ngap_initMsg( - m_n2_NGSetupRequest( - m_globalRANNodeID_globalGNB_ID( - m_ie_globalGnbId( - PX_PLMN_IDENTITY, - PX_GNB_ID,//'0000000000000000000000'B,//in template (value) bitstring p_gnbId, - -//in template (omit) GlobalGNB_ID.iE_Extensions p_iE_Extensions := omit - )), - { - m_supportedTAItem( - PX_TACode, - { - m_ie_broadcastPLMNItem( - PX_PLMN_IDENTITY,//m_ie_pLMNIdentity('00f110'O), - { - m_sliceSupportItem( - m_s_NSSAI( - PX_SST, - PX_SD,// in template (omit) SD p_sD := omit, - -// in template (omit) S_NSSAI.iE_Extensions p_iE_Extensions := omit - ), - -//in template (omit) SliceSupportItem.iE_Extensions p_iE_Extensions := omit - ) - } - ) - },//in template (value) BroadcastPLMNList p_broadcastPLMNList, - -//in template (omit) SupportedTAItem.iE_Extensions p_iE_Extensions := omit - ) - }, - PX_PAGING_DRX - ) - ) - ); - - f_recv_NGAP_PDU( - mw_ngap_succMsg( - mw_n2_NGSetupResponse(-,-,-,-) - ) - ); - // f_recv_NGAP_PDU( - // mw_ngap_succMsg( - // mw_n2_NGSetupResponse( - // ?, - // { - // mw_servedGUAMIItem( - // mw_gUAMI( - // ?,//template (present) PLMNIdentity p_pLMNIdentity := ?, - // ?,//template (present) AMFRegionID p_aMFRegionID := ?, - // ?,//template (present) AMFSetID p_aMFSetID := ?, - // ?,//template (present) AMFPointer p_aMFPointer := ?, - // *//template GUAMI.iE_Extensions p_iE_Extensions := * - // ),//template (present) GUAMI p_gUAMI := ?, - // *,//template AMFName p_backupAMFName := *, - // *//template ServedGUAMIItem.iE_Extensions p_iE_Extensions := * - // ) - // },//template (present) ServedGUAMIList p_servedGUAMIList := ?, - // ?,//template (present) RelativeAMFCapacity p_relativeAmfCap:= ?, - // { - // mw_pLMNSupportItem( - // ?,//template (present) PLMNIdentity p_pLMNIdentity := ?, - // { - // mw_sliceSupportItem( - // mw_s_NSSAI( - // ?,//template (present) SST p_sST := ?, - // *,//template SD p_sD := *, - // *//template S_NSSAI.iE_Extensions p_iE_Extensions := * - // ),//template (present) S_NSSAI p_s_NSSAI := ?, - // ?//template SliceSupportItem.iE_Extensions p_iE_Extensions := * - // ) - // },//template (present) SliceSupportList p_sliceSupportList := ?, - // *//template PLMNSupportItem.iE_Extensions p_iE_Extensions := * - // ) - // }//template (present) PLMNSupportList p_plmnSuppList := ? - // ) - // ) - // ); + if (PICS_USE_UERANSIMU) { + fx_ut_start_gnb(PX_GNB_BINARY_FILE, PX_GNB_CONFIG_FILE); + } + } // End of function f_NGAP_gnb_init /** * @desc This is a test step that init global variables */ function f_NGAP_gnb_init2() - runs on NGAPComponent { + runs on gNBNGAPComponent { // Defaults vc_default_ngap := activate (a_defaultNGAP()); @@ -166,7 +103,7 @@ module NGAP_Steps { /** * @desc */ - function f_preamble_NGAP_AMF() runs on NGAPComponent { + function f_preamble_NGAP_AMF() runs on aMFNGAPComponent { var default v_def_ngap_; f_NGAP_amf_init(); @@ -176,7 +113,7 @@ module NGAP_Steps { /** * @desc */ - function f_preamble_NGAP_gNB() runs on NGAPComponent { + function f_preamble_NGAP_gNB() runs on gNBNGAPComponent { var default v_def_ngap_; f_NGAP_gnb_init(); @@ -186,7 +123,7 @@ module NGAP_Steps { /** * @desc */ - function f_preamble_NGAP_gNB2() runs on NGAPComponent { + function f_preamble_NGAP_gNB2() runs on gNBNGAPComponent { var default v_def_ngap_; f_NGAP_gnb_init2(); @@ -200,8 +137,11 @@ module NGAP_Steps { /** * @desc */ - function f_postamble_NGAP_AMF() runs on NGAPComponent { - f_postambleNGAP_AMF(); + function f_postamble_NGAP_AMF( + in template (value) Cause p_Cause := m_cause_nas(authentication_failure) + ) runs on aMFNGAPComponent { + + f_postambleNGAP_AMF(p_Cause); // Deactivate defaults deactivate; @@ -210,8 +150,17 @@ module NGAP_Steps { /** * @desc */ - function f_postamble_NGAP_gNB() runs on NGAPComponent { - f_postambleNGAP_gNB(); + function f_postamble_NGAP_gNB( + in template (value) Cause p_Cause := m_cause_nas(authentication_failure) + ) runs on gNBNGAPComponent { + if (not(PICS_OFFLINE_MODE)) { + f_postambleNGAP_gNB(p_Cause); + } + + if (PICS_USE_UERANSIMU) { + fx_ut_terminate_ue(); + fx_ut_terminate_gnb(); + } //Deactivate defaults deactivate; @@ -220,8 +169,12 @@ module NGAP_Steps { /** * @desc */ - function f_postamble_NGAP_gNB2() runs on NGAPComponent { - f_postambleNGAP_gNB(); + function f_postamble_NGAP_gNB2( + in template (value) Cause p_Cause := m_cause_nas(authentication_failure) + ) runs on gNBNGAPComponent { + if (not(PICS_OFFLINE_MODE)) { + f_postambleNGAP_gNB(p_Cause); + } // Deactivate defaults deactivate; @@ -238,164 +191,643 @@ module NGAP_Steps { }//end group DefaultTestStep group BehaviorFunctions{ + + /** + * @desc + */ + function f_NGAP_amf_GNB_Setup() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_GNB_Setup"); + if (PICS_OFFLINE_MODE) { + f_await_NGSetupRequest_await_NGSetupResponse(); + } else { + f_send_NGSetupRequest_await_NGSetupResponse(); + } + log("<<< f_NGAP_amf_GNB_Setup"); + } // End of function f_NGAP_amf_UE_Register /** * @desc */ - function f_NGAP_amf_UE_Register() runs on NGAPComponent { - //FIXME: Implementation of UE registration + function f_NGAP_amf_UE_Register() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_Register"); + if (PICS_OFFLINE_MODE) { + f_await_NGSetupRequest_await_NGSetupResponse(); + } else { + f_send_NGSetupRequest_await_NGSetupResponse(); + } + log("f_NGAP_amf_UE_Register: f_send_registration_request done"); + if (PICS_OFFLINE_MODE) { + f_await_registration_request(); + } else { + f_send_registration_request(); + } + log("<<< f_NGAP_amf_UE_Register"); } // End of function f_NGAP_amf_UE_Register /** * @desc */ - function f_NGAP_amf_UE_PDU_ResourceSetup() runs on NGAPComponent { - //FIXME: Implementation of PDU session resource setup + function f_NGAP_amf_UE_NAS_Initiate() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_NAS_Initiate"); + if (PICS_OFFLINE_MODE) { + f_await_registration_request(); + } else { + f_send_registration_request(); + } + log("<<< f_NGAP_amf_UE_NAS_Initiate"); + } // End of function f_NGAP_amf_UE_NAS_Initiate + + /** + * @desc + */ + function f_NGAP_amf_UE_Authentication() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_Authentication"); + if (PICS_OFFLINE_MODE) { + f_await_authentication_request_await_authentication_response(); + } else { + f_await_authentication_request_send_authentication_response(); + } + } // End of function f_NGAP_amf_UE_Authentication + + /** + * @desc + */ + function f_NGAP_amf_UE_Authentication_Failure() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_Authentication"); + if (PICS_OFFLINE_MODE) { + f_await_authentication_request_await_authentication_response_failure(); + } else { + f_await_authentication_request_send_authentication_response_failure(); + } + } // End of function f_NGAP_amf_UE_Authentication + + /** + * @desc + */ + function f_NGAP_amf_UE_ErrorIndication( + in template (value) Cause p_cause := m_cause_misc(unknown_PLMN_or_SNPN) + ) runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_ErrorIndication"); + if (PICS_OFFLINE_MODE) { + f_await_error_indication(p_cause); + } else { + f_send_error_indication(p_cause); + } + } // End of function f_NGAP_amf_UE_ErrorIndication + + function f_NGAP_amf_UE_SecurityMode() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_SecurityMode"); + if (PICS_OFFLINE_MODE) { + f_await_security_mode_command_await_security_mode_complete(); + if (not isbound(vc_inner_message) or (lengthof(vc_inner_message) == 0)) { + log("f_NGAP_gnb_UE_SecurityMode: vc_inner_message is not bound or empty"); + setverdict(fail, "Security Mode Command message content is not available for verification"); + } else { + // TODO FSCOM To be enhanced with more detailed verification of the Security Mode Command message content + var NG_REGISTRATION_REQUEST v_inner_message; + var bitstring v_bs := oct2bit(vc_inner_message); + var integer v_result := decvalue(v_bs, v_inner_message); + if (v_result != 0) { + log("f_NGAP_gnb_UE_SecurityMode: Failed to decode Security Mode Command message content"); + setverdict(fail, "Failed to decode Security Mode Command message content"); + } else { + log("f_NGAP_gnb_UE_SecurityMode: v_inner_message: ", v_inner_message); + // FIXME FSCOM To be enhanced with verification of the inner message + } + } + } else { // Await security mode and send response + f_await_security_mode_command_send_security_mode_complete(); + } + + log("<<< f_NGAP_amf_UE_SecurityMode"); + } // End of function f_NGAP_amf_UE_SecurityMode + + /** + * @desc + */ + function f_NGAP_amf_UE_InitialContextSetup() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_InitialContextSetup"); + if (PICS_OFFLINE_MODE) { + f_await_initial_context_setup_request_await_initial_context_setup_resonse(); + } else { + f_await_initial_context_setup_request_send_initial_context_setup_resonse(); + } + } // End of function f_NGAP_amf_UE_InitialContextSetup + + function f_NGAP_amf_RegistrationComplete() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_RegistrationComplete"); + if (PICS_OFFLINE_MODE) { + f_await_registration_complete(); + } else { + f_send_registration_complete(); + } + } // End of function f_NGAP_amf_RegistrationComplete + + /** + * @desc + */ + function f_NGAP_amf_UE_Has_EstablishedContextInproperly() runs on aMFNGAPComponent return boolean { + if (not(isbound(vc_initialContextSetupRequest))) { + log("f_NGAP_amf_UE_Has_EstablishedContextInproperly: vc_initialContextSetupRequest is not bound"); + return false; + } else { + // TODO FSCOM To be enhanced + } + return true; + } // End of function f_NGAP_amf_UE_Has_EstablishedContextInproperly + + /** + * @desc + */ + function f_NGAP_amf_UE_PDU_SessionEstablishmentRequest() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_PDU_SessionEstablishmentRequest"); + if (PICS_OFFLINE_MODE) { + f_await_pdu_session_establishment_request(); + } else { + f_send_pdu_session_establishment_request(); + } + } // End of function f_NGAP_amf_UE_PDU_SessionEstablishmentRequest + + /** + * @desc + */ + function f_NGAP_amf_UE_PDU_SessionEstablishmentAccept() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_PDU_SessionEstablishmentAccept"); + f_await_session_establishment_accept(); + } // End of function f_NGAP_amf_UE_PDU_SessionEstablishmentAccept + + /** + * @desc + */ + function f_NGAP_amf_ConfigurationUpdateCommand() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_ConfigurationUpdateCommand"); + f_await_configuration_update_command(); + } // End of function f_NGAP_amf_ConfigurationUpdateCommand + + /** + * @desc + */ + function f_NGAP_amf_UE_PDU_SessionResourceSetup() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_PDU_SessionResourceSetup"); + f_await_pdu_session_resource_setup_request(); + } // End of function f_NGAP_amf_UE_PDU_SessionResourceSetup + + function f_NGAP_amf_UE_PDU_SessionResourceSetupResponse() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_PDU_SessionResourceSetupResponse"); + if (PICS_OFFLINE_MODE) { + f_await_pdu_session_resource_setup_response(); + } else { + f_send_pdu_session_resource_setup_response(); + } + } + + function f_NGAP_amf_UE_PDU_SessionResourceReleaseRequest() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_PDU_SessionResourceReleaseRequest"); + if (PICS_OFFLINE_MODE) { + f_await_pdu_session_resource_release_request(); + } else { + f_send_pdu_session_resource_release_request(); + } + } + + function f_NGAP_amf_UE_PDU_SessionResourceReleaseRequest_SessionResourceReleaseCommand() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_PDU_SessionResourceReleaseRequest"); + if (PICS_OFFLINE_MODE) { + f_await_pdu_session_resource_release_request_await_pdu_session_resource_release_command(); + } else { + f_send_pdu_session_resource_release_request_await_pdu_session_resource_release_command(); + } + } + + /** + * @desc + */ + function f_NGAP_amf_UE_PDU_InitialContextSetupFailure() runs on aMFNGAPComponent { + if (PICS_OFFLINE_MODE) { + f_await_initial_context_setup_failure(); + } else { + f_send_initial_context_setup_failure(); + } + } // End of function f_NGAP_amf_UE_PDU_InitialContextSetupFailure + + function f_NGAP_amf_UE_DeregistrationRequest() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_DeregistrationRequest"); + if (PICS_OFFLINE_MODE) { + f_await_deregistration_request(); + } else { + f_send_deregistration_request(); + } + } + + function f_NGAP_amf_UE_DeregistrationRequest_DeregistrationComplete() runs on aMFNGAPComponent { + log(">>> f_NGAP_amf_UE_DeregistrationRequest"); + if (PICS_OFFLINE_MODE) { + f_await_deregistration_request_await_deregistration_accept(); + } else { + f_send_deregistration_request_await_deregistration_accept(); + } + } + + /** + * @desc + */ + function f_NGAP_amf_UE_ContextRealease_ContextRealeaseComplete() runs on aMFNGAPComponent { + if (PICS_OFFLINE_MODE) { + f_await_ue_context_release_command_await_ue_context_release_complete(); + } else { + f_await_ue_context_release_command_send_ue_context_release_complete(); + } + } // End of function f_await_ue_context_release_command_send_ue_context_release_complete + + /** + * @desc + */ + function f_NGAP_amf_UE_ContextRealeaseRequest() runs on aMFNGAPComponent { + if (PICS_OFFLINE_MODE) { + f_await_ue_context_release_request(); + } else { + f_send_ue_context_release_request(); + } + } // End of function f_NGAP_amf_UE_ContextRealeaseRequest + + /** + * @desc + */ + function f_NGAP_amf_UE_ContextRealeaseComplete() runs on aMFNGAPComponent { + if (PICS_OFFLINE_MODE) { + f_await_ue_context_release_complete(); + } else { + f_send_ue_context_release_complete(); + } + } // End of function f_NGAP_amf_UE_ContextRealeaseComplete + + /** + * @desc + */ + function f_NGAP_amf_UE_PDU_ResourceSetup() runs on aMFNGAPComponent { + //FIXME } // End of function f_NGAP_amf_UE_PDU_ResourceSetup /** * @desc */ - function f_NGAP_amf_UE_NoLongerAvailable() runs on NGAPComponent { - //FIXME: Implementation of PDU not longer available + function f_NGAP_amf_UE_NoLongerAvailable() runs on aMFNGAPComponent { + //FIXME: Implementation of PDU not longer available } // End of function f_NGAP_amf_UE_NoLongerAvailable /** * @desc The IUT entity indicate the initiation "of a Handover Required procedure" */ - function f_NGAP_amf_UE_MMP_Initiate_Handover() runs on NGAPComponent { + function f_NGAP_amf_UE_MMP_Initiate_Handover() runs on aMFNGAPComponent { //FIXME: Implementation of Handover init } // End of function f_NGAP_amf_UE_MMP_Initiate_Handover /** * @desc */ - function f_NGAP_amf_UE_MMP_Initiate_Handover_Completed() runs on NGAPComponent { + function f_NGAP_amf_UE_MMP_Initiate_Handover_Completed() runs on aMFNGAPComponent { //FIXME: Implementation of Handover init completed } // End of function f_NGAP_amf_UE_MMP_Initiate_Handover_Completed /** * @desc */ - function f_NGAP_amf_UE_MMP_Handover_Completed() runs on NGAPComponent { + function f_NGAP_amf_UE_MMP_Handover_Completed() runs on aMFNGAPComponent { //FIXME: Implementation of Handover completed } // End of function f_NGAP_amf_UE_MMP_Handover_Completed /** * @desc */ - function f_NGAP_amf_UE_MMP_Cancel_Initiated_Handover() runs on NGAPComponent { + function f_NGAP_amf_UE_MMP_Cancel_Initiated_Handover() runs on aMFNGAPComponent { //FIXME: Implementation of Handover init cancelled } // End of function f_NGAP_amf_UE_MMP_Cancel_Initiated_Handover /** * @desc */ - function f_NGAP_amf_UE_MMP_Initiate_UE_Uplink_RAN_Status_Transfer() runs on NGAPComponent { + function f_NGAP_amf_UE_MMP_Initiate_UE_Uplink_RAN_Status_Transfer() runs on aMFNGAPComponent { //FIXME: Implementation of initiate uplink RAN xfer } // End of function f_NGAP_amf_UE_MMP_Initiate_UE_Uplink_RAN_Status_Transfer /** * @desc */ - function f_NGAP_amf_UE_MMP_Initiate_UE_Uplink_RAN_Early_Status_Transfer() runs on NGAPComponent { + function f_NGAP_amf_UE_MMP_Initiate_UE_Uplink_RAN_Early_Status_Transfer() runs on aMFNGAPComponent { //FIXME: Implementation of initiate an early uplink RAN xfer } // End of function f_NGAP_amf_UE_MMP_Initiate_UE_Uplink_RAN_Early_Status_Transfer /** * @desc */ - function f_NGAP_amf_UE_NAS_Initiate() runs on NGAPComponent { - //FIXME: Implementation of a NAS procedure - } // End of function f_NGAP_amf_UE_NAS_Initiate - - /** - * @desc - */ - function f_NGAP_amf_UE_RRC_UL_Message() runs on NGAPComponent { + function f_NGAP_amf_UE_RRC_UL_Message() runs on aMFNGAPComponent { //FIXME: Implementation of an RRC UL message delivery } // End of function f_NGAP_amf_UE_RRC_UL_Message /** * @desc */ - function f_NGAP_amf_UE_RRC_UL_Message_Failure() runs on NGAPComponent { + function f_NGAP_amf_UE_RRC_UL_Message_Failure() runs on aMFNGAPComponent { //FIXME: Implementation of an RRC UL message delivery failure } // End of function f_NGAP_amf_UE_RRC_UL_Message_Failure /** * @desc */ - function f_NGAP_amf_isTransitioningTo_RRC_INACTIVE() runs on NGAPComponent { + function f_NGAP_amf_isTransitioningTo_RRC_INACTIVE() runs on aMFNGAPComponent { //FIXME: Implementation of an UE transitioning into the RRC_INACTIVE state } // End of function f_NGAP_amf_isTransitioningTo_RRC_INACTIVE + /** + * @desc + */ + function f_NGAP_amf_UE_Not_Available() runs on aMFNGAPComponent { + //FIXME: + } // End of function f_NGAP_amf_UE_Not_Available + + function f_NGAP_amf_UE_HasPendingDataTransmission() runs on aMFNGAPComponent return boolean { + //FIXME: + return false; + } // End of function f_NGAP_amf_UE_HasPendingDataTransmission + + function f_NGAP_amf_UE_Has_Suspended_Context() runs on aMFNGAPComponent return boolean { + //FIXME: + return false; + } // End of function f_NGAP_amf_UE_Has_Suspended_Context + /******************************************************************/ /** * @desc */ - function f_NGAP_gnb_UE_Register() runs on NGAPComponent { - //FIXME: Implementation of UE registration + function f_NGAP_gnb_UE_Register() runs on gNBNGAPComponent { + log(">>> f_NGAP_gnb_UE_Register"); + if (PICS_OFFLINE_MODE) { + f_await_NGSetupRequest_await_NGSetupResponse(); + } else { + f_await_NGSetupRequest_send_NGSetupRespone(); + } + + if (PICS_USE_UERANSIMU) { + fx_ut_start_ue(PX_UE_BINARY_FILE, PX_UE_CONFIG_FILE); + } + + log("f_NGAP_gnb_UE_Register: f_send_NGSetupRequest_await_NGSetupResponse done"); + f_await_registration_request(); + log("<<< f_NGAP_gnb_UE_Register"); } // End of function f_NGAP_gnb_UE_Register /** * @desc */ - function f_NGAP_gnb_UE_Not_Available() runs on NGAPComponent { - //FIXME: Implementation of UE not available - } // End of function f_NGAP_gnb_UE_Not_Available + function f_NGAP_gnb_UE_ErrorIndication( + in template (value) Cause p_cause := m_cause_misc(unknown_PLMN_or_SNPN) + ) runs on gNBNGAPComponent { + log(">>> f_NGAP_gnb_UE_ErrorIndication"); + if (PICS_OFFLINE_MODE) { + f_await_error_indication(p_cause); + } else { + f_send_error_indication(p_cause); + } + } // End of function f_NGAP_amf_UE_ErrorIndication /** * @desc */ - function f_NGAP_gnb_UE_Handover_Required() runs on NGAPComponent { - //FIXME: Implementation of UE handover required - } // End of function f_NGAP_gnb_UE_Handover_Required + function f_NGAP_gnb_UE_NAS_Initiate() runs on gNBNGAPComponent { + // FIXME + } // End of function f_NGAP_gnb_UE_NAS_Initiate /** * @desc */ - function f_NGAP_gnb_UE_EstablishedInitialContext() runs on NGAPComponent { - //FIXME: Implementation of UE handover required - } // End of function f_NGAP_gnb_UE_EstablishedInitialContext + function f_NGAP_gnb_UE_Authentication() runs on gNBNGAPComponent { + log(">>> f_NGAP_gnb_UE_Authentication"); + if (PICS_OFFLINE_MODE) { + f_await_authentication_request_await_authentication_response(); + } else { + f_send_authentication_request_await_authentication_response(); + } + log("<<< f_NGAP_gnb_UE_Authentication"); + } // End of function f_NGAP_gnb_UE_Authentication + + /** + * @desc + */ + function f_NGAP_gnb_UE_SecurityMode() runs on gNBNGAPComponent { + log(">>> f_NGAP_gnb_UE_SecurityMode"); + if (PICS_OFFLINE_MODE) { + f_await_security_mode_command_await_security_mode_complete(); + } else { // Await security mode and send response + f_send_security_mode_command_await_security_mode_complete(); + } + + if (not isbound(vc_inner_message) or (lengthof(vc_inner_message) == 0)) { + log("f_NGAP_gnb_UE_SecurityMode: vc_inner_message is not bound or empty"); + setverdict(fail, "Security Mode Command message content is not available for verification"); + } else { + // TODO FSCOM To be enhanced with more detailed verification of the Security Mode Command message content + var NG_REGISTRATION_REQUEST v_inner_message; + var bitstring v_bs := oct2bit(vc_inner_message); + var integer v_result := decvalue(v_bs, v_inner_message); + if (v_result != 0) { + log("f_NGAP_gnb_UE_SecurityMode: Failed to decode Security Mode Command message content"); + setverdict(fail, "Failed to decode Security Mode Command message content"); + } else { + log("f_NGAP_gnb_UE_SecurityMode: v_inner_message: ", v_inner_message); + // FIXME FSCOM To be enhanced with verification of the inner message + } + } + log("<<< f_NGAP_gnb_UE_SecurityMode"); + } // End of function f_NGAP_gnb_UE_SecurityMode + + /** + * @desc + */ + function f_NGAP_gnb_UE_InitialContextSetup() runs on gNBNGAPComponent { + log(">>> f_NGAP_gnb_UE_InitialContextSetup"); + if (PICS_OFFLINE_MODE) { + f_await_initial_context_setup_request_await_initial_context_setup_resonse(); + } else { + f_send_initial_context_setup_request_await_initial_context_setup_resonse(); + } + } // End of function f_NGAP_gnb_UE_InitialContextSetup + function f_NGAP_gnb_RegistrationComplete() runs on gNBNGAPComponent { + log(">>> f_NGAP_gnb_RegistrationComplete"); + f_await_registration_complete(); + } // End of function f_NGAP_gnb_RegistrationComplete + /** * @desc */ - function f_NGAP_gnb_UE_Has_EstablishedContextInproperly() runs on NGAPComponent { - //FIXME: Implementation of UE handover required + function f_NGAP_gnb_UE_Has_EstablishedContextInproperly() runs on gNBNGAPComponent return boolean { + if (not(isbound(vc_initialContextSetupRequest))) { + log("f_NGAP_gnb_UE_Has_EstablishedContextInproperly: vc_initialContextSetupRequest is not bound"); + return false; + } else { + // TODO FSCOM To be enhanced + } + return true; } // End of function f_NGAP_gnb_UE_Has_EstablishedContextInproperly /** * @desc */ - function f_NGAP_gnb_UE_HasPendingDataTransmission() runs on NGAPComponent { - //FIXME: Implementation of UE has pending data transmission leading to failed context suspension + function f_NGAP_gnb_UE_PDU_SessionEstablishmentRequest() runs on gNBNGAPComponent { + log(">>> f_NGAP_gnb_UE_PDU_SessionEstablishmentRequest"); + f_await_pdu_session_establishment_request(); + } // End of function f_NGAP_gnb_UE_PDU_SessionEstablishmentRequest + + /** + * @desc + */ + function f_NGAP_gnb_UE_PDU_SessionEstablishmentAccept() runs on gNBNGAPComponent { + log(">>> f_NGAP_gnb_UE_PDU_SessionEstablishmentAccept"); + if (PICS_OFFLINE_MODE) { + f_await_session_establishment_accept(); + } else { + f_send_session_establishment_accept(); + } + } // End of function f_NGAP_gnb_UE_PDU_SessionEstablishmentRequest + + function f_NGAP_gnb_UE_PDU_SessionResourceSetup() runs on gNBNGAPComponent { + log(">>> f_NGAP_gnb_UE_PDU_SessionResourceSetup"); + if (PICS_OFFLINE_MODE) { + f_await_pdu_session_resource_setup_request(); + } else { + f_send_pdu_session_resource_setup_request(); + } + } + + function f_NGAP_gnb_UE_PDU_SessionResourceResponse() runs on gNBNGAPComponent { + log(">>> f_NGAP_gnb_UE_PDU_SessionResourceResponse"); + f_await_pdu_session_resource_setup_response(); + } + + /** + * @desc + */ + function f_NGAP_gnb_UE_Not_Available() runs on gNBNGAPComponent { + //FIXME: Implementation of UE not available + } // End of function f_NGAP_gnb_UE_Not_Available + + /** + * @desc + */ + function f_NGAP_gnb_UE_Handover_Required() runs on gNBNGAPComponent { + //FIXME: Implementation of UE handover required + } // End of function f_NGAP_gnb_UE_Handover_Required + + /** + * @desc + */ + function f_NGAP_gnb_UE_MMP_Initiate_Handover_Completed() runs on gNBNGAPComponent { + //FIXME: Implementation of UE handover completed + } // End of function f_NGAP_gnb_UE_MMP_Initiate_Handover_Completed + + /** + * @desc + */ + function f_NGAP_gnb_UE_HasPendingDataTransmission() runs on gNBNGAPComponent return boolean { + //FIXME: Implementation of UE has pending data transmission leading to failed context suspension + return false; } // End of function f_NGAP_gnb_UE_HasPendingDataTransmission /** * @desc */ - function f_NGAP_gnb_UE_PDU_ResourceSetup() runs on NGAPComponent { + function f_NGAP_gnb_UE_PDU_ResourceSetup() runs on gNBNGAPComponent { //FIXME: Implementation of PDU session resource setup } // End of function f_NGAP_gnb_UE_PDU_ResourceSetup /** * @desc */ - function f_NGAP_gnb_UE_Has_Suspended_Context() runs on NGAPComponent { - //FIXME: Implementation of UE has suspended context + function f_NGAP_gnb_UE_Has_Suspended_Context() runs on gNBNGAPComponent return boolean { + //FIXME: Implementation of UE has suspended context + return false; } // End of function f_NGAP_amf_UE_hasSuspendedContext /** * @desc */ - function f_NGAP_gnb_UE_alreadyPreparedHandover() runs on NGAPComponent { - //FIXME: Implementation of UE halready prepared Handover + function f_NGAP_gnb_UE_alreadyPreparedHandover() runs on gNBNGAPComponent { + //FIXME: Implementation of UE already prepared Handover } // End of function f_NGAP_amf_UE_hasSuspendedContext + /** + * @desc + */ + function f_NGAP_gnb_UE_NoLongerAvailable() runs on gNBNGAPComponent { + //FIXME: Implementation of UE already prepared Handover + } // End of function f_NGAP_gnb_UE_NoLongerAvailable + + /** + * @desc + */ + function f_NGAP_gnb_UE_MMP_Handover_Completed() runs on gNBNGAPComponent { + //FIXME: Implementation of UE handover completed + } // End of function f_NGAP_gnb_UE_MMP_Handover_Completed + + /** + * @desc + */ + function f_NGAP_gnb_isTransitioningTo_RRC_INACTIVE() runs on gNBNGAPComponent { + } // End of function f_NGAP_gnb_isTransitioningTo_RRC_INACTIVE + + /** + * @desc + */ + function f_NGAP_gnb_UE_MMP_Initiate_Handover() runs on gNBNGAPComponent { + } // End of function f_NGAP_gnb_UE_MMP_Initiate_Handover + + /** + * @desc + */ + function f_NGAP_gnb_UE_MMP_Cancel_Initiated_Handover() runs on gNBNGAPComponent { + } // End of function f_NGAP_gnb_UE_MMP_Cancel_Initiated_Handover + + /** + * @desc + */ + function f_NGAP_gnb_UE_MMP_Initiate_UE_Uplink_RAN_Status_Transfer() runs on gNBNGAPComponent { + } // End of function f_NGAP_gnb_UE_MMP_Initiate_UE_Uplink_RAN_Status_Transfer + + /** + * @desc + */ + function f_NGAP_gnb_UE_MMP_Initiate_UE_Uplink_RAN_Early_Status_Transfer() runs on gNBNGAPComponent { + } // End of function f_NGAP_gnb_UE_MMP_Initiate_UE_Uplink_RAN_Early_Status_Transfer + + /** + * @desc + */ + function f_NGAP_gnb_UE_RRC_UL_Message() runs on gNBNGAPComponent { + } // End of function f_NGAP_gnb_UE_RRC_UL_Message + + /** + * @desc + */ + function f_NGAP_gnb_UE_RRC_UL_Message_Failure() runs on gNBNGAPComponent { + } // End of function f_NGAP_gnb_UE_RRC_UL_Message_Failure }//end group BehaviorFunctions + group ut_functions { // TODO FSCOM To be enhanced with only one external function for starting and one for terminating the test system + + external function fx_ut_start_gnb(in charstring p_binary_file, in charstring p_config_file) return integer; + + external function fx_ut_terminate_gnb() return integer; + + external function fx_ut_start_ue(in charstring p_binary_file, in charstring p_config_file) return integer; + + external function fx_ut_terminate_ue() return integer; + + external function fx_ut_start_open5gs(in charstring p_binary_file, in charstring p_config_file) return integer; + + external function fx_ut_terminate_open5gs() return integer; + + } // End of group ut_functions + } // End of module NGAP_Steps diff --git a/ttcn/AtsNGAP/NGAP_TCFunctions.ttcn b/ttcn/AtsNGAP/NGAP_TCFunctions.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..f98ab2af6a34c162acdc0977eb1e32ec22ee17c2 --- /dev/null +++ b/ttcn/AtsNGAP/NGAP_TCFunctions.ttcn @@ -0,0 +1,6651 @@ +/** + * @author ETSI / TTF T033, T048 + * @version $URL$ + * $Id$ + * @desc This module provides test functions for NGAP tests. + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * @see ETSI TS 138 413 / 3GPP TS 38.413 Release 16 + */ +module NGAP_TCFunctions { + + // LibCommon + import from LibCommon_Sync all; + import from LibCommon_VerdictControl all; + import from LibCommon_Time all; + + // NG_NAS + import from NG_NAS_TypeDefs all; + import from NG_NAS_MsgContainers all; + import from NG_NAS_Templates all; + + // LibNGAP + import from NGAP_IEs language "ASN.1:2002" all; + import from NGAP_Constants language "ASN.1:2002" all; + import from LibNGAP_Pixits all; + import from LibNGAP_Templates all; + import from LibNGAP_Functions all; + import from LibNGAP_Interface all; + import from LibNGAP_Steps all; + + // LibNG_NAS + import from Lib_NG_NAS_Templates all; + import from Lib_NG_NAS_Security_Functions all; + + // AtsNGAP + import from NGAP_TestSystem all; + import from NGAP_Steps all; + import from NGAP_Pixits all; + + group gNB_Role{ + //8.2 + group PDU_Session_Management_Procedures{ + //8.2.1 + group PDU_Session_Resource_Setup{ + + /** + * @desc Testcase function for TC_NGAP_gNB_PDU_01 + */ + function f_TC_NGAP_GNB_PDU_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // f_await_registration_request(); + f_NGAP_gnb_UE_Authentication(); // f_send_authentication_request_await_authentication_response + f_NGAP_gnb_UE_SecurityMode(); // f_send_security_mode_command_await_security_mode_complete + f_NGAP_gnb_UE_InitialContextSetup(); // f_send_initial_context_setup_request_await_initial_context_setup_response + f_NGAP_gnb_RegistrationComplete(); //f_await_registration_complete + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + var PDUSessionResourceSetupRequestTransfer v_pdu_session_resource_setup_request_transfer := valueof( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))); + log("v_pdu_session_resource_setup_request_transfer: ", v_pdu_session_resource_setup_request_transfer); + var octetstring v_os := bit2oct( + encvalue( + v_pdu_session_resource_setup_request_transfer + )); + log("v_os: ", v_os); + var PDUSessionResourceSetupItemSUReq v_pdu_session_resource_setup_item_su_req := valueof( + m_pDUSessionResourceSetupItemSUReq( + -, + m_s_NSSAI('00'O, '000000'O), + v_os + )); + log("v_pdu_session_resource_setup_item_su_req: ", v_pdu_session_resource_setup_item_su_req); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceSetupRequest( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + { v_pdu_session_resource_setup_item_su_req } + ))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PDUSessionResourceSetupResponse( + -, + -, + { + (mw_pDUSessionResourceSetupItemSURes( + ?,//template (present) PDUSessionID p_pDUSessionID, + decmatch ( + mw_pDUSessionResourceSetupResponseTransfer( + ?,//template (present) QosFlowPerTNLInformation p_dLQosFlowPerTNLInformation := ?, + *,//template QosFlowPerTNLInformationList p_additionalDLQosFlowPerTNLInformation := *, + *,//template SecurityResult p_securityResult := *, + *,//template QosFlowListWithCause p_qosFlowFailedToSetupList := *, + *//template PDUSessionResourceSetupResponseTransfer.iE_Extensions p_iE_Extensions := * + ) + ),// Decode&Match - In ASN1 it is OCTET STRING - PDUSessionResourceSetupResponseTransfer + *//template PDUSessionResourceSetupItemSURes.iE_Extensions p_iE_Extensions := * + ) + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_PDU_01 + + /** + * @desc Testcase function for TC_NGAP_gNB_PDU_02 + */ + function f_TC_NGAP_GNB_PDU_02() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceSetupRequest( + -, + -, + { + m_pDUSessionResourceSetupItemSUReq( + -, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))))), + m_pDUSessionResourceSetupItemSUReq( + -, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))))) + } + ))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PDUSessionResourceSetupResponseFailed( + -, + -, + { + mw_pDUSessionResourceFailedToSetupItemSURes( + ?,//template (present) PDUSessionID p_pDUSessionID := ?, + decmatch( + mw_pDUSessionResourceSetupUnsuccessfulTransfer( + mw_cause_misc(mw_causeMisc(?/*MultiplePDUSessionIDInstances*/)),//?,//template (present) Cause p_cause := ?, + *,//template CriticalityDiagnostics p_criticalityDiagnostics := *, + *//template PDUSessionResourceSetupUnsuccessfulTransfer.iE_Extensions p_iE_Extensions := * + ) + ),//Decode&Match - In ASN1 it is OCTET STRING - PDUSessionResourceSetupUnsuccessfulTransfer + *//template PDUSessionResourceFailedToSetupItemSURes.iE_Extensions p_iE_Extensions := * + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_PDU_02 + + /** + * @desc Testcase function for TC_NGAP_gNB_PDU_03 + */ + function f_TC_NGAP_GNB_PDU_03() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); //f_await_NGSetupRequest_send_NGSetupRespone + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceSetupRequest( + -, + -, + { + m_pDUSessionResourceSetupItemSUReq( + -, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))))) + } + ))); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PDUSessionResourceSetupResponse( + -, + -, + { + mw_pDUSessionResourceSetupItemSURes( + ?,//template (present) PDUSessionID p_pDUSessionID, + decmatch( + mw_pDUSessionResourceSetupResponseTransfer( + ?,//template (present) QosFlowPerTNLInformation p_dLQosFlowPerTNLInformation := ?, + *,//template QosFlowPerTNLInformationList p_additionalDLQosFlowPerTNLInformation := *, + *,//template SecurityResult p_securityResult := *, + *,//template QosFlowListWithCause p_qosFlowFailedToSetupList := *, + *//template PDUSessionResourceSetupResponseTransfer.iE_Extensions p_iE_Extensions := * + ) + ), //Decode&Match - In ASN1 it is OCTET STRING - PDUSessionResourceSetupResponseTransfer + *//template PDUSessionResourceSetupItemSURes.iE_Extensions p_iE_Extensions := * + ) + } + ) + ) + ); + + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceSetupRequest( + -, + -, + { + m_pDUSessionResourceSetupItemSUReq( + -, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))))) + } + ))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PDUSessionResourceSetupResponseFailed( + -, + -, + { + mw_pDUSessionResourceFailedToSetupItemSURes( + ?,//template (present) PDUSessionID p_pDUSessionID := ?, + decmatch( + mw_pDUSessionResourceSetupUnsuccessfulTransfer( + mw_cause_misc(mw_causeMisc(?/*MultiplePDUSessionIDInstances*/)),//?,//template (present) Cause p_cause := ?, + *,//template CriticalityDiagnostics p_criticalityDiagnostics := *, + *//template PDUSessionResourceSetupUnsuccessfulTransfer.iE_Extensions p_iE_Extensions := * + ) + ),//Decode&Match - In ASN1 it is OCTET STRING - PDUSessionResourceSetupUnsuccessfulTransfer + *//template PDUSessionResourceFailedToSetupItemSURes.iE_Extensions p_iE_Extensions := * + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_PDU_03 + + /** + * @desc Testcase function for TC_NGAP_gNB_PDU_04 + */ + function f_TC_NGAP_GNB_PDU_04() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceSetupRequest( + -, + -, + { + m_pDUSessionResourceSetupItemSUReq( + -, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, //FIXME nonGBRQosID + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))))) + } + ))); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PDUSessionResourceSetupResponseFailed( + -, + -, + { + mw_pDUSessionResourceFailedToSetupItemSURes( + ?,//template (present) PDUSessionID p_pDUSessionID := ?, + decmatch( + mw_pDUSessionResourceSetupUnsuccessfulTransfer( + mw_cause_misc(mw_causeMisc(?/*InvalidQoSCombination*/)),//?,//template (present) Cause p_cause := ?, + *,//template CriticalityDiagnostics p_criticalityDiagnostics := *, + *//template PDUSessionResourceSetupUnsuccessfulTransfer.iE_Extensions p_iE_Extensions := * + ) + ),//Decode&Match - In ASN1 it is OCTET STRING - PDUSessionResourceSetupUnsuccessfulTransfer + *//template PDUSessionResourceFailedToSetupItemSURes.iE_Extensions p_iE_Extensions := * + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_PDU_04 + + } // End of group PDU_Session_Resource_Setup + //8.2.2 + group PDU_Session_Resource_Release{ + + /** + * @desc Testcase function for TC_NGAP_gNB_PDU_05 + */ + function f_TC_NGAP_GNB_PDU_05() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceReleaseCommand( + -, + -, + { + m_pDUSessionResourceToReleaseItemRelCmd( + PX_PDU_SESSION_ID, + bit2oct( + encvalue( + m_pDUSessionResourceReleaseCommandTransfer( + m_cause_misc(m_causeMisc(-)), + -//in template (omit) PDUSessionResourceReleaseCommandTransfer.iE_Extensions p_iE_Extensions := omit + ) + ) + ), + - //in template (omit) PDUSessionResourceToReleaseItemRelCmd.iE_Extensions p_iE_Extensions := omit + ) + } + ))); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PDUSessionResourceReleaseResponse( + -,//template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + -,//template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + { + ( + mw_pDUSessionResourceReleasedItemRelRes( + PX_PDU_SESSION_ID,//template (present) PDUSessionID p_pDUSessionID := ?, + decmatch( + (mw_pDUSessionResourceReleaseResponseTransfer(*)) + ),//template (present) PDUSessionResourceReleasedItemRelRes.pDUSessionResourceReleaseResponseTransfer p_pDUSessionResourceReleaseResponseTransfer := ?, + //Decode&Match - In ASN1 it is OCTET STRING - pDUSessionResourceReleaseResponseTransfer + -//template PDUSessionResourceReleasedItemRelRes.iE_Extensions p_iE_Extensions := * + ) + + ) + }//template (present) PDUSessionResourceReleasedListRelRes p_pDUSessionResourceReleasedListRelRes := ? + ) + + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_PDU_05 + + /** + * @desc Testcase function for TC_NGAP_gNB_PDU_06 + */ + function f_TC_NGAP_GNB_PDU_06() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceReleaseCommand( + -, + -, + { + m_pDUSessionResourceToReleaseItemRelCmd( + PX_PDU_SESSION_ID, + bit2oct( + encvalue( + m_pDUSessionResourceReleaseCommandTransfer( + m_cause_misc(m_causeMisc(-)), + -//in template (omit) PDUSessionResourceReleaseCommandTransfer.iE_Extensions p_iE_Extensions := omit + ) + ) + ), + - //in template (omit) PDUSessionResourceToReleaseItemRelCmd.iE_Extensions p_iE_Extensions := omit + ), + m_pDUSessionResourceToReleaseItemRelCmd( + PX_PDU_SESSION_ID, + bit2oct( + encvalue( + m_pDUSessionResourceReleaseCommandTransfer( + m_cause_misc(m_causeMisc(-)), + -//in template (omit) PDUSessionResourceReleaseCommandTransfer.iE_Extensions p_iE_Extensions := omit + ) + ) + ), + - //in template (omit) PDUSessionResourceToReleaseItemRelCmd.iE_Extensions p_iE_Extensions := omit + ) + } + ))); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PDUSessionResourceReleaseResponse( + -,//template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + -,//template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + { + ( + mw_pDUSessionResourceReleasedItemRelRes( + PX_PDU_SESSION_ID,//template (present) PDUSessionID p_pDUSessionID := ?, + decmatch( + (mw_pDUSessionResourceReleaseResponseTransfer(*))//template (present) PDUSessionResourceReleasedItemRelRes.pDUSessionResourceReleaseResponseTransfer p_pDUSessionResourceReleaseResponseTransfer := ?, + ), //FIXME: Decode&Match - In ASN1 it is OCTET STRING - pDUSessionResourceReleaseResponseTransfer + -//template PDUSessionResourceReleasedItemRelRes.iE_Extensions p_iE_Extensions := * + ) + + ) + }//template (present) PDUSessionResourceReleasedListRelRes p_pDUSessionResourceReleasedListRelRes := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_PDU_06 + + } // End of group PDU_Session_Resource_Release + //8.2.3 + group PDU_Session_Resource_Modify{ + + /** + * @desc Testcase function for TC_NGAP_gNB_PDU_07 + */ + function f_TC_NGAP_GNB_PDU_07() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceModify( + -, + -, + { + m_pDUSessionResourceModifyItemModReq( + PX_PDU_SESSION_ID, + bit2oct( + encvalue( + m_pDUSessionResourceModifyRequestTransfer_options( + { + m_uL_NGU_UP_TNLModifyItem( + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel( + PX_TRANSPORT_LAYER_ADDRESS, + PX_GTP_TEID, + omit + ) + ),//in template (value) UPTransportLayerInformation p_uL_NGU_UP_TNLInformation, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel( + PX_TRANSPORT_LAYER_ADDRESS, + PX_GTP_TEID, + omit + ) + ),//in template (value) UPTransportLayerInformation p_dL_NGU_UP_TNLInformation, + -//in template (omit) UL_NGU_UP_TNLModifyItem.iE_Extensions p_iE_Extensions := omit + ) + },//in template (value) UL_NGU_UP_TNLModifyList p_uL_NGU_UP_TNLModifyList, + { + m_qosFlowAddOrModifyRequestItem( + PX_QOS_FLOW_IDENTIFIER, + -,//in template (omit) QosFlowLevelQosParameters p_qosFlowLevelQosParameters := omit, + -,//in template (omit) E_RAB_ID p_e_RAB_ID := omit, + -//in template (omit) QosFlowAddOrModifyRequestItem.iE_Extensions p_iE_Extensions := omit + ) + }//in template (value) QosFlowAddOrModifyRequestList p_qosFlowAddOrModifyRequestList + ) + ) + ), + //'00'O,//bit2oct( + // encvalue( + // m_pDUSessionResourceModifyRequestTransfer(//FIXME when template with mandatory IEs available + // -//in template (omit) PDUSessionResourceModifyRequestTransfer.protocolIEs p_protocolIEs + // ) + // ) + //), + -,//in template (omit) NAS_PDU p_nAS_PDU := omit, + -//in template (omit) PDUSessionResourceModifyItemModReq.iE_Extensions p_iE_Extensions := omit + ) + } + ))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PDUSessionResourceModifyResponse( + -,//template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + -,//template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + { + ( + mw_pDUSessionResourceModifyItemModRes( + PX_PDU_SESSION_ID,//template (present) PDUSessionID p_pDUSessionID := ?, + decmatch( + mw_pDUSessionResourceModifyResponseTransfer( + *,//template UPTransportLayerInformation p_dL_NGU_UP_TNLInformation := *, + *,//template UPTransportLayerInformation p_uL_NGU_UP_TNLInformation := *, + ?,//template QosFlowAddOrModifyResponseList p_qosFlowAddOrModifyResponseList := *, + *,//template QosFlowPerTNLInformationList p_additionalDLQosFlowPerTNLInformation := *, + *,//template QosFlowListWithCause p_qosFlowFailedToAddOrModifyList := *, + *//template PDUSessionResourceModifyResponseTransfer.iE_Extensions p_iE_Extensions := * + ) + ),//Decode&Match - In ASN1 it is OCTET STRING pDUSessionResourceModifyResponseTransfer + -//template PDUSessionResourceModifyItemModRes.iE_Extensions p_iE_Extensions := * + ) + + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_PDU_07 + + /** + * @desc Testcase function for TC_NGAP_gNB_PDU_10 + */ + function f_TC_NGAP_GNB_PDU_10() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceModify( + -, + -, + { + m_pDUSessionResourceModifyItemModReq( + PX_PDU_SESSION_ID, + '00'O,//bit2oct( + // encvalue( + // m_pDUSessionResourceModifyRequestTransfer(//FIXME when template with mandatory IEs available + // -//in template (omit) PDUSessionResourceModifyRequestTransfer.protocolIEs p_protocolIEs + // ) + // ) + //), + -,//in template (omit) NAS_PDU p_nAS_PDU := omit, + -//in template (omit) PDUSessionResourceModifyItemModReq.iE_Extensions p_iE_Extensions := omit + ), + m_pDUSessionResourceModifyItemModReq( + PX_PDU_SESSION_ID, + '00'O,//bit2oct( + // encvalue( + // m_pDUSessionResourceModifyRequestTransfer(//FIXME when template with mandatory IEs available + // -//in template (omit) PDUSessionResourceModifyRequestTransfer.protocolIEs p_protocolIEs + // ) + // ) + //), + -,//in template (omit) NAS_PDU p_nAS_PDU := omit, + -//in template (omit) PDUSessionResourceModifyItemModReq.iE_Extensions p_iE_Extensions := omit + ) + } + ))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PDUSessionResourceModifyResponseFailedToMod( + -,//template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + -,//template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + { + mw_pDUSessionResourceFailedToModifyItemModRes( + PX_PDU_SESSION_ID,//template (present) PDUSessionID p_pDUSessionID := ?, + decmatch( + mw_pDUSessionResourceModifyUnsuccessfulTransfer( + ?,//template (present) Cause p_cause := ?, + *,//template CriticalityDiagnostics p_criticalityDiagnostics := *, + *//template PDUSessionResourceModifyUnsuccessfulTransfer.iE_Extensions p_iE_Extensions := * + ) + ),//Decode&Match - In ASN1 it is OCTET STRING mw_pDUSessionResourceModifyUnsuccessfulTransfer + * + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_PDU_10 + + } // End of group PDU_Session_Resource_Modify + //8.2.4 + group PDU_Session_Resource_Notify{ + + /** + * @desc Testcase function for TC_NGAP_gNB_PDU_08 + */ + function f_TC_NGAP_GNB_PDU_08() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger PDU session resource NOTIFY!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_PDUSessionResourceNotify( + -,//template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + -,//template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + { + mw_pDUSessionResourceNotifyItem( + PX_PDU_SESSION_ID,//template (present) PDUSessionID p_pDUSessionID := ?, + ?,//template (present) PDUSessionResourceNotifyItem.pDUSessionResourceNotifyTransfer p_pDUSessionResourceNotifyTransfer, + -//template PDUSessionResourceNotifyItem.iE_Extensions p_iE_Extensions := * + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_PDU_08 + + } // End of group PDU_Session_Resource_Notify + //8.2.5 + group PDU_Session_Resource_Modify_Indication{ + + /** + * @desc Testcase function for TC_NGAP_gNB_PDU_09 + */ + function f_TC_NGAP_GNB_PDU_09() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger PDU session resource MODIFY!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_PDUSessionResourceModifyIndication( + -,//template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + -,//template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + { + ( + mw_pDUSessionResourceModifyItemModInd( + PX_PDU_SESSION_ID,//template (present) PDUSessionID p_pDUSessionID := ?, + decmatch( + mw_pDUSessionResourceModifyIndicationTransfer( + ?,//template (present) QosFlowPerTNLInformation p_dLQosFlowPerTNLInformation := ?, + *,//template QosFlowPerTNLInformationList p_additionalDLQosFlowPerTNLInformation := *, + *//template PDUSessionResourceModifyIndicationTransfer.iE_Extensions p_iE_Extensions := * + )//FIXME: Decode&Match - In ASN1 it is OCTET STRING - pDUSessionResourceModifyIndicationTransfer + ), + -//template PDUSessionResourceModifyItemModRes.iE_Extensions p_iE_Extensions := * + ) + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_PDU_09 + + } // End of group PDU_Session_Resource_Modify_Indication + } // End of group PDU_Session_Management_Procedures + //8.3 + group UE_Context_Management_Procedures{ + //8.3.1 + group Initial_Context_Setup{ + + /** + * @desc Testcase function for TP_NGAP_GNB_CMP_01 + */ + function f_TC_NGAP_GNB_CMP_01() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_InitialContextSetupRequest + ( + -, + -, + m_gUAMI, + { + { + PX_PDU_SESSION_ID, + omit, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))) + ), + omit + } + + }, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + m_uESecurityCapabilities, + - + ) + )); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_InitialContextSetupResponse( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_01 + + /** + * @desc Testcase function for TP_NGAP_GNB_CMP_02 + */ + function f_TC_NGAP_GNB_CMP_02() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + /* FIXME TODO To be fixed + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_InitialContextSetupRequest_noPDUSessionResourceSetupListCxtReq + ( + -, + -, + m_gUAMI, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + m_uESecurityCapabilities, + - + ))); +*/ + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_InitialContextSetupResponse_noPDUSessionResourceSetupListSURes( + -, + - + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_02 + + /** + * @desc Testcase function for TP_NGAP_GNB_CMP_03 + */ + function f_TC_NGAP_GNB_CMP_03() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_InitialContextSetupRequest_optional_TraceActivation + ( + -, + -, + m_gUAMI, + { + { + PX_PDU_SESSION_ID, + omit, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))) + ), + omit + } + + }, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + m_uESecurityCapabilities, + -, + m_traceActivation( + '0000000000000001'O,//in template (value) NGRANTraceID p_nGRANTraceID, + '00000000'B,//in template (value) InterfacesToTrace p_interfacesToTrace, + m_traceDepth(minimum), + PX_TRANSPORT_LAYER_ADDRESS, + omit//in template (omit) TraceActivation.iE_Extensions p_iE_Extensions := omit + ) + ))); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_InitialContextSetupResponse( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_03 + + /** + * @desc Testcase function for TP_NGAP_GNB_CMP_04 + */ + function f_TC_NGAP_GNB_CMP_04() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_InitialContextSetupRequest_optional_MobilityRestriction + ( + -, + -, + m_gUAMI, + { + { + PX_PDU_SESSION_ID, + omit, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))) + ), + omit + } + + }, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + m_uESecurityCapabilities, + -, + m_mobilityRestrictionList( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) + ) + ))); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_InitialContextSetupResponse( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_04 + + /** + * @desc Testcase function for TP_NGAP_GNB_CMP_05 + */ + function f_TC_NGAP_GNB_CMP_05() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_InitialContextSetupRequest_differentOptionals + ( + -, + -, + m_gUAMI, + { + { + PX_PDU_SESSION_ID, + omit, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))) + ), + omit + } + + }, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + m_uESecurityCapabilities, + -, + ''O, // UERadioCapability p_uERadioCapability, + -, // IndexToRFSP p_indexToRFSP := 1, + -, + ''O, // FIXME FSCOM NAS_PDU field shall be bit2oct(enc(???)) , + + m_emergencyFallbackIndicator(emergency_fallback_requested), // EmergencyFallbackIndicator p_emergencyFallbackIndicator, + m_rRCInactiveTransitionReportRequest, // RRCInactiveTransitionReportRequest p_rRCInactiveTransitionReportRequest, + m_redirectionVoiceFallback, // RedirectionVoiceFallback p_redirectionVoiceFallback, + m_locationReportingRequestType( + direct, + cell, + { + m_areaOfInterestItem( + m_areaOfInterest, + 1, + - + ), + m_areaOfInterestItem( + m_areaOfInterest, + 1, + - + ) + }, + -, + - + ), // LocationReportingRequestType p_locationReportingRequestType, + m_sRVCCOperationPossible, // SRVCCOperationPossible p_sRVCCOperationPossible, + m_iAB_Authorized, // IAB_Authorized p_iAB_Authorized, + m_enhanced_CoverageRestriction, // Enhanced_CoverageRestriction p_enhanced_CoverageRestriction, + -, // Extended_ConnectedTime p_extended_ConnectedTime := PX_EXTENDED_CONNECTED_TIME, + m_uE_DifferentiationInfo, // UE_DifferentiationInfo p_uE_DifferentiationInfo, + m_nRUESidelinkAggregateMaximumBitrate, // NRUESidelinkAggregateMaximumBitrate p_nRUESidelinkAggregateMaximumBitrate, + m_lTEUESidelinkAggregateMaximumBitrate, // LTEUESidelinkAggregateMaximumBitrate p_lTEUESidelinkAggregateMaximumBitrate, + PX_U_E_RADIO_CAPABILITY_ID + + + ))); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_InitialContextSetupResponse( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_05 + + /** + * @desc Testcase function for TP_NGAP_GNB_CMP_06 + */ + function f_TC_NGAP_GNB_CMP_06() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + if (not(f_NGAP_gnb_UE_Has_EstablishedContextInproperly())) { + f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + log("*** " & __SCOPE__ & ": INFO: Preamble failure. ***"); + } else { + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + } + + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_InitialContextSetupRequest + ( + -, + -, + m_gUAMI, + { + { + PX_PDU_SESSION_ID, + omit, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))) + ), + omit + } + + }, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + m_uESecurityCapabilities, + - + ) + )); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_InitialContextSetupResponse_Failed( + -, + - + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_06 + + } // End of group Initial_Context_Setup + //8.3.2 + group UE_Context_Release_Request_NG_RAN_node_initiated{ + + /** + * @desc Testcase function for TC_NGAP_GNB_CMP_07 + */ + function f_TC_NGAP_GNB_CMP_07() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // f_await_registration_request(); + f_NGAP_gnb_UE_Authentication(); // f_send_authentication_request_await_authentication_response + f_NGAP_gnb_UE_SecurityMode(); // f_send_security_mode_command_await_security_mode_complete + f_NGAP_gnb_UE_InitialContextSetup(); // f_send_initial_context_setup_request_await_initial_context_setup_response + f_NGAP_gnb_RegistrationComplete(); //f_await_registration_complete + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger UE context release request"); + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextReleaseRequest( + -, + -, + - + ))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_07 + + /** + * @desc Testcase function for TC_NGAP_GNB_CMP_07_02 + */ + function f_TC_NGAP_GNB_CMP_07_02() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_InitialContextSetup(); + f_NGAP_gnb_RegistrationComplete(); // f_send_registration_complete + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger UE context release request"); + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextReleaseRequest( + -, + -, + - + + ))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + } // End of function f_TC_NGAP_GNB_CMP_07_02 + + } // End of group UE_Context_Release_Request_NG_RAN_node_initiated + //8.3.3 + group UE_Context_Release_AMF_initiated{ + + /** + * @desc Testcase function for TP_NGAP_GNB_CMP_08 + */ + function f_TC_NGAP_GNB_CMP_08() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_InitialContextSetup(); + f_NGAP_gnb_RegistrationComplete(); // f_send_registration_complete + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UEContextReleaseCommand + ( + m_uE_NGAP_IDs_uE_NGAP_ID_pair + ( + m_uE_NGAP_ID_pair + ), + - + ))); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_UEContextReleaseComplete + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_08 + + /** + * @desc Testcase function for f_TC_NGAP_GNB_CMP_09 + */ + function f_TC_NGAP_GNB_CMP_09() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_InitialContextSetup(); + f_NGAP_gnb_RegistrationComplete(); // f_send_registration_complete + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UEContextReleaseCommand + ( + m_uE_NGAP_IDs_aMF_UE_NGAP_ID + ( + - + ), + - + ))); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_UEContextReleaseComplete + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_09 + + } // End of group UE_Context_Release_AMF_initiated + //8.3.4 + group UE_Context_Modification{ + + + /** + * @desc Testcase function for f_TC_NGAP_GNB_CMP_10 + */ + function f_TC_NGAP_GNB_CMP_10() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_NoLongerAvailable(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UEContextModificationRequest + ( + -, + - + ))); + + + f_recv_NGAP_PDU( + mw_ngap_unsuccMsg( + mw_n2_UEContextModificationFailure + ( + -, + -, + - + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_10 + + + /** + * @desc Testcase function for f_TC_NGAP_GNB_CMP_11 + */ + function f_TC_NGAP_GNB_CMP_11() runs on gNBNGAPComponent { + + // Preamble + + + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_InitialContextSetup(); + f_NGAP_gnb_UE_alreadyPreparedHandover(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UEContextModificationRequest + ( + -, + - + ))); + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_UEContexModificationResponse + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_11 + + + /** + * @desc Testcase function for f_TC_NGAP_GNB_CMP_12 + */ + function f_TC_NGAP_GNB_CMP_12() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_InitialContextSetup(); + f_NGAP_gnb_RegistrationComplete(); // f_send_registration_complete + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UEContextModificationRequest_optional1 + ( + -, + -, + -, + - + ))); + + + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_UEContexModificationResponse + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_12 + + + /** + * @desc Testcase function for f_TC_NGAP_GNB_CMP_13 + */ + function f_TC_NGAP_GNB_CMP_13() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_InitialContextSetup(); + f_NGAP_gnb_RegistrationComplete(); // f_send_registration_complete + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UEContextModificationRequest_optional2 + ( + -, // AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, + -, // RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, + -, // RANPagingPriority p_rANPagingPriority, // RAN_Paging_Priority + -, // IndexToRFSP p_indexToRFSP, // Index_to_RAT_Frequency_Selection_Priority, + m_uEAggregateMaximumBitRate, // UEAggregateMaximumBitRate p_uEAggregateMaximumBitRate, // UE_Aggregate_Maximum_Bit_Rate containing + m_uESecurityCapabilities, // UESecurityCapabilities p_uESecurityCapabilities, // UE_Security_Capabilities containing + m_emergencyFallbackIndicator(emergency_fallback_requested), // EmergencyFallbackIndicator p_emergencyFallbackIndicator, // Emergency_Fallback_Indicator, + m_gUAMI, // GUAMI p_gUAMI, // New_GUAMI containing + m_iAB_Authorized, // IAB_Authorized p_iAB_Authorized, // IAB_Authorized, + m_pC5QoSParameters( + { m_pC5QoSFlowItem } + ),// PC5QoSParameters p_pC5QoSParameters, // PC5_QoS_Parameters containing + -, // UERadioCapabilityID p_uERadioCapabilityID := PX_U_E_RADIO_CAPABILITY_ID, // UE_Radio_Capability_ID, + - // RGLevelWirelineAccessCharacteristics p_rGLevelWirelineAccessCharacteristics // RG_Level_Wireline_Access_Characteristics + ))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_UEContextReleaseComplete + ( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_13 + + + } // End of group UE_Context_Modification + //8.3.5 + group RRC_Inactive_Transition_Report{ + + /** + * @desc Testcase function for f_TC_NGAP_GNB_CMP_14 + */ + function f_TC_NGAP_GNB_CMP_14() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_isTransitioningTo_RRC_INACTIVE(); + + // TODO: isTransitioningTo the RRC_INACTIVE + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + action("Trigger a RRC inactive transition report"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_RRCInactiveTransitionReport + ( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + mw_rRCState(inactive), + ? + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_14 + + } // End of group RRC_Inactive_Transition_Report + //8.3.6 + group Connection_Establishment_Indication{ + } // End of group Connection_Establishment_Indication + //8.3.7 + group AMF_CP_Relocation_Indication{ + } // End of group AMF_CP_Relocation_Indication + //8.3.8 + group RAN_CP_Relocation_Indication{ + + /** + * @desc Testcase function for f_TC_NGAP_GNB_CMP_15 + */ + function f_TC_NGAP_GNB_CMP_15() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_InitialContextSetup(); + f_NGAP_gnb_RegistrationComplete(); // f_send_registration_complete + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + action("Trigger a RAN CP relocation indication procedure"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_RANCPRelocationIndication + ( + PX_RAN_UE_NGAP_ID, + ?, + ?, + ?, + ? + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_15 + + } // End of group RAN_CP_Relocation_Indication + //8.3.9 + group Retrieve_UE_Information{ + } // End of group Retrieve_UE_Information + //8.3.10 + group UE_Information_Transfer{ + } // End of group UE_Information_Transfer + //8.3.11 + group UE_Context_Suspend{ + + /** + * @desc Testcase function for f_TC_NGAP_GNB_CMP_16 + */ + function f_TC_NGAP_GNB_CMP_16() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_InitialContextSetup(); + f_NGAP_gnb_RegistrationComplete(); // f_send_registration_complete + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + action("Trigger a UE context suspend request"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextSuspendRequest_noPDUSession + ( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_16 + + } // End of group UE_Context_Suspend + //8.3.12 + group UE_Context_Resume{ + + /** + * @desc Testcase function for f_TC_NGAP_GNB_CMP_17 + */ + function f_TC_NGAP_GNB_CMP_17() runs on gNBNGAPComponent { + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + if (not(f_NGAP_gnb_UE_Has_Suspended_Context())) { + f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + log("*** " & __SCOPE__ & ": INFO: Preamble failure. ***"); + } else { + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + } + + // Test Body + action("Trigger a UE context resume request"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextResumeRequest + ( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + ? + ) + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_CMP_17 + } // End of group UE_Context_Resume + } // End of group UE_Context_Management_Procedures + //8.4 + group UE_Mobility_Management_Procedures{ + //8.4.1 + group Handover_Preparation{ + + function f_TC_NGAP_GNB_MMP_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_MMP_Initiate_Handover(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_HandoverRequired( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + PX_HANDOVER_TYPE, + -, + mw_targetID_targeteNB_ID, // FIXME FSCOM To be check + { + *, + mw_pDUSessionResourceItemHORqd( // TODO FSCOM Make the template more restrictive + PX_PDU_SESSION_ID + ), + * + } + ))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_MMP_01 + + } // End of group Handover_Preparation + //8.4.2 + group Handover_Resource_Allocation{ + + function f_TC_NGAP_GNB_MMP_02() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_MMP_Initiate_Handover_Completed(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_HandoverRequest( + -, -, -, + m_uEAggregateMaximumBitRate, + m_uESecurityCapabilities, + m_securityContext, + { + m_pDUSessionResourceSetupItemHOReq( + -, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))))) + }, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + PX_SOURCE_TO_TARGET_TRANSPARENT_CONTAINER, // FIXME FSCOM Should be a bit2oct(enc(???)) + m_gUAMI + ))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_HandoverRequestAcknowledge( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + { + *, + mw_pDUSessionResourceAdmittedItem( // TODO FSCOM Make the template more restrictive + PX_PDU_SESSION_ID + ), + * + } + ))); + + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_MMP_02 + + function f_TC_NGAP_GNB_MMP_03() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_MMP_Initiate_Handover_Completed(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_NGAP_gnb_UE_NoLongerAvailable(); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_HandoverRequest( + -, -, -, + m_uEAggregateMaximumBitRate, + m_uESecurityCapabilities, + m_securityContext, + { + m_pDUSessionResourceSetupItemHOReq( + -, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))))) + }, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + PX_SOURCE_TO_TARGET_TRANSPARENT_CONTAINER, // FIXME FSCOM Should be a bit2oct(enc(???)) + m_gUAMI + ))); + + f_recv_NGAP_PDU( + mw_ngap_unsuccMsg( + mw_n2_HandoverFailure( + PX_AMF_UE_NGAP_ID + ))); + + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_MMP_03 + + function f_TC_NGAP_GNB_MMP_04() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_MMP_Initiate_Handover_Completed(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_HandoverRequest_full( + -, -, -, + m_uEAggregateMaximumBitRate, + m_uESecurityCapabilities, + m_securityContext, + { + m_pDUSessionResourceSetupItemHOReq( + -, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))))) + }, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + PX_SOURCE_TO_TARGET_TRANSPARENT_CONTAINER, // FIXME FSCOM Should be a bit2oct(enc(???)) + m_gUAMI, + m_coreNetworkAssistanceInformationForInactive( + m_uEIdentityIndexValue_indexLength10(PX_UE_IDENTITY_INDEX_VALUE), + -, + { + m_tAIListForInactiveItem( + m_tAI + ) + } + ), + m_newSecurityContextInd, + ''O, // FIXME FSCOM NAS_PDU field shall be bit2oct(enc(???)) + m_traceActivation( + -, -, + m_traceDepth + ), + m_rRCInactiveTransitionReportRequest, + m_redirectionVoiceFallback, + m_cNAssistedRANTuning, + m_sRVCCOperationPossible, + m_enhanced_CoverageRestriction, + m_uE_DifferentiationInfo, + m_nRV2XServicesAuthorized, + m_lTEV2XServicesAuthorized, + m_nRUESidelinkAggregateMaximumBitrate, + m_lTEUESidelinkAggregateMaximumBitrate, + m_pC5QoSParameters( + { m_pC5QoSFlowItem } + ), + m_cEmodeBrestricted, + m_uE_UP_CIoT_Support, + { fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) } + ))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_HandoverRequestAcknowledge( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + { + *, + mw_pDUSessionResourceAdmittedItem( // TODO FSCOM Make the template more restrictive + PX_PDU_SESSION_ID + ), + * + } + ))); + + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_MMP_04 + + function f_TC_NGAP_GNB_MMP_05() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_MMP_Initiate_Handover_Completed(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_NGAP_gnb_UE_NoLongerAvailable(); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_HandoverRequest( + -, -, -, + m_uEAggregateMaximumBitRate, + m_uESecurityCapabilities, + m_securityContext, + { + m_pDUSessionResourceSetupItemHOReq( + -, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_handover( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + ), + m_dataForwardingNotPossible, + m_securityIndication( + m_integrityProtectionIndication, + m_confidentialityProtectionIndication, + m_maximumIntegrityProtectedDataRate + )))))) + }, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + PX_SOURCE_TO_TARGET_TRANSPARENT_CONTAINER, // FIXME FSCOM Should be a bit2oct(enc(???)) + m_gUAMI + ))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_HandoverRequestAcknowledge( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + { + *, + mw_pDUSessionResourceAdmittedItem( // TODO FSCOM Make the template more restrictive + PX_PDU_SESSION_ID + ), + * + } + ))); + + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_MMP_05 + + function f_TC_NGAP_GNB_MMP_06() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_MMP_Initiate_Handover_Completed(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_NGAP_gnb_UE_NoLongerAvailable(); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_HandoverRequest( + -, -, -, + m_uEAggregateMaximumBitRate, + m_uESecurityCapabilities, + m_securityContext, + { + m_pDUSessionResourceSetupItemHOReq( + -, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_handover_1( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel), + m_directForwardingPathAvailability + ))))) + }, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + PX_SOURCE_TO_TARGET_TRANSPARENT_CONTAINER, // FIXME FSCOM Should be a bit2oct(enc(???)) + m_gUAMI + ))); + + f_recv_NGAP_PDU( + mw_ngap_unsuccMsg( + mw_n2_HandoverFailure( + PX_AMF_UE_NGAP_ID + ))); + + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_MMP_06 + + } // End of group Handover_Resource_Allocation + //8.4.3 + group Handover_Notification{ + + function f_TC_NGAP_GNB_MMP_07() runs on gNBNGAPComponent { + + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_NGAP_gnb_UE_MMP_Handover_Completed(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_HandoverNotify( + -, + -, + ? + ))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_MMP_07 + + } // End of group Handover_Notification + //8.4.4 + group Path_Switch_Request{ + + function f_TC_NGAP_GNB_MMP_08() runs on gNBNGAPComponent { + + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_PDU_ResourceSetup(); + f_NGAP_gnb_UE_MMP_Handover_Completed(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_PathSwitchRequest( + PX_RAN_UE_NGAP_ID, + PX_AMF_UE_NGAP_ID + ))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_MMP_08 + + } // End of group Path_Switch_Request + //8.4.5 + group Handover_Cancellation{ + + function f_TC_NGAP_GNB_MMP_09() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_MMP_Initiate_Handover(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_NGAP_gnb_UE_MMP_Cancel_Initiated_Handover(); + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_HandoverCancel( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID + ))); + + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_MMP_09 + + } // End of group Handover_Cancellation + //8.4.6 + group Uplink_RAN_Status_Transfer{ + + function f_TC_NGAP_GNB_MMP_10() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_MMP_Initiate_UE_Uplink_RAN_Status_Transfer(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_NGAP_gnb_UE_MMP_Cancel_Initiated_Handover(); + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkRANStatusTransfer( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + mw_rANStatusTransfer_TransparentContainer + ))); + + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_MMP_10 + + } // End of group Uplink_RAN_Status_Transfer + //8.4.7 + group Downlink_RAN_Status_Transfer{ + } // End of group Downlink_RAN_Status_Transfer + //8.4.8 + group Handover_Success{ + } // End of group Handover_Success + //8.4.9 + group Uplink_RAN_Early_Status_Transfer{ + + function f_TC_NGAP_GNB_MMP_11() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_MMP_Initiate_UE_Uplink_RAN_Status_Transfer(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_NGAP_gnb_UE_MMP_Initiate_UE_Uplink_RAN_Early_Status_Transfer(); + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkRANEarlyStatusTransfer( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + mw_earlyStatusTransfer_TransparentContainer + ))); + + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_MMP_11 + + } // End of group Uplink_RAN_Early_Status_Transfer + //8.4.10 + group Downlink_RAN_Early_Status_Transfer{ + } // End of group Downlink_RAN_Early_Status_Transfer + } // End of group UE_Mobility_Management_Procedures + //8.5 + group Paging_Procedures{ + //8.5.1 + group Paging{ + } // End of group Paging + } // End of group Paging_Procedures + //8.6 + group Transport_of_NAS_Messages_Procedures{ + //8.6.1 + group Initial_UE_Message{ + + function f_TC_NGAP_GNB_NAS_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_NGAP_gnb_UE_NAS_Initiate(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_initialUeMessage( + PX_RAN_UE_NGAP_ID + ))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_NAS_01 + + } // End of group Initial_UE_Message + //8.6.2 + group Downlink_NAS_Transport{ + } // End of group Downlink_NAS_Transport + //8.6.3 + group Uplink_NAS_Transport{ + + function f_TC_NGAP_GNB_NAS_02() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_NGAP_gnb_UE_RRC_UL_Message(); + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID + ))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_NAS_02 + + } // End of group Uplink_NAS_Transport + //8.6.4 + group NAS_Non_Delivery_Indication{ + + function f_TC_NGAP_GNB_NAS_03() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_NGAP_gnb_UE_RRC_UL_Message_Failure(); + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_NASNonDeliveryIndication( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID + ))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_GNB_NAS_03 + + } // End of group NAS_Non_Delivery_Indication + //8.6.5 + group Rerout_NAS_Request{ + } // End of group Rerout_NAS_Request + } // End of group Transport_of_NAS_Messages_Procedures + //8.7 + group Interface_Management_Procedures{ + //8.7.1 + group NG_Setup{ + + /** + * @desc Testcase function for TC_NGAP_gNB_IMP_01 + */ + function f_TC_NGAP_GNB_IMP_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + //f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger NG SETUP REQUEST!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_NGSetupRequest( + ?, + PX_RAN_NODE_NAME, + { + *, + mw_supportedTAItem( + ?,//template (present) TAC p_tAC := ?, + { + mw_ie_broadcastPLMNItem( + ?, + ?, + * + ) + },//?,//template (present) BroadcastPLMNList p_broadcastPLMNList := ?, + *//template SupportedTAItem.iE_Extensions p_iE_Extensions := * + ), + * + }, + mw_pagingDRX(?) + ))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_NGAP_gnb_UE_ErrorIndication(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_IMP_01 + + } // End of group NG_Setup + //8.7.2 + group RAN_Configuration_Update{ + } // End of group RAN_Configuration_Update + //8.7.3 + group AMF_Configuration_Update{ + } // End of group AMF_Configuration_Update + //8.7.4 + group NG_Reset{ + + /** + * @desc Testcase function for TC_NGAP_gNB_IMP_05 + */ + function f_TC_NGAP_GNB_IMP_05() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_NGReset( + m_cause_radioNetwork(PX_NG_SETUP_FAILURE), + m_resetType_nG_Interface( + m_resetAll(reset_all) + )))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGResetAcknowledge + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_IMP_05 + + /** + * @desc Testcase function for TC_NGAP_gNB_IMP_05 + */ + function f_TC_NGAP_GNB_IMP_05_02() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_NGReset( + m_cause_radioNetwork(PX_NG_SETUP_FAILURE), + m_resetType_nG_Interface( + m_resetAll(reset_all) + )))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGResetAcknowledge + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_IMP_05_02 + + } // End of group NG_Reset + //8.7.5 + group Error_Indication{ + } // End of group Error_Indication + //8.7.6 + group AMF_Status_Indication{ + } // End of group AMF_Status_Indication + //8.7.7 + group Overload_Start{ + } // End of group Overload_Start + //8.7.8 + group Overload_Stop{ + } // End of group Overload_Stop + } // End of group Interface_Management_Procedures + //8.8 + group Configuration_Transfer_Procedures{ + //8.8.1 + group Uplink_RAN_Configuration_Transfer{ + + /** + * @desc Testcase function for TC_NGAP_gNB_CTP_01 + */ + function f_TC_NGAP_GNB_CTP_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger Uplink_RAN_Configuration_Transfer!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkRANConfigurationTransfer + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + } + } // End of group Uplink_RAN_Configuration_Transfer + //8.8.2 + group Downlink_RAN_Configuration_Transfer{ + + /** + * @desc Testcase function for TC_NGAP_AMF_CTP_01 + */ + function f_TC_NGAP_AMF_CTP_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger Downlink_RAN_Configuration_Transfer!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkRANConfigurationTransfer + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + } + + } // End of group Downlink_RAN_Configuration_Transfer + } // End of group Configuration_Transfer_Procedures + //8.9 + group Warning_Message_Transmission_Procedures{ + //8.9.1 + group Write_Replace_Warning{ + + /** + * @desc Testcase function for TC_NGAP_gNB_WTP_01 + */ + function f_TC_NGAP_GNB_WTP_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_WriteReplaceWarningRequest( + PX_MESSAGE_IDENTIFIER, + PX_SERIAL_NUMBER, + PX_REPETITION_PERIOD, + PX_NUMBER_OF_BROADCASTS_REQUESTED + ) + )); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_WriteReplaceWarningResponse( + PX_MESSAGE_IDENTIFIER, + PX_SERIAL_NUMBER + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_WTP_01 + + /** + * @desc Testcase function for TC_NGAP_gNB_WTP_02 + */ + function f_TC_NGAP_GNB_WTP_02() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_WriteReplaceWarningRequest( + PX_MESSAGE_IDENTIFIER, // indicating value "different from already being broadcasted", + PX_SERIAL_NUMBER, //indicating value "different from already being broadcasted", + PX_REPETITION_PERIOD, + PX_NUMBER_OF_BROADCASTS_REQUESTED + ) + )); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_WriteReplaceWarningResponse( + PX_MESSAGE_IDENTIFIER, + PX_SERIAL_NUMBER + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_WTP_02 + + } // End of group Write_Replace_Warning + //8.9.2 + group PWS_Cancel{ + + /** + * @desc Testcase function for TC_NGAP_gNB_WTP_03 + */ + function f_TC_NGAP_GNB_WTP_03() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + //f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PWSCancelRequest( + PX_MESSAGE_IDENTIFIER, + PX_SERIAL_NUMBER + ) + )); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PWSCancelResponse( + PX_MESSAGE_IDENTIFIER, + PX_SERIAL_NUMBER + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_WTP_03 + + } // End of group PWS_Cancel + //8.9.3 + group PWS_Restart_Indication{ + + /** + * @desc Testcase function for TC_NGAP_gNB_WTP_04 + */ + function f_TC_NGAP_GNB_WTP_04() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + //f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger PWS_Restart_Indication!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_PWSRestartIndication( + ?,//in template (value) CellIDListForRestart p_cellIDListForRestart, + ?,//in template (value) GlobalRANNodeID p_globalRANNodeID, + ?,//in template (value) TAIListForRestart p_tAIListForRestart, + ?//in template (value) EmergencyAreaIDListForRestart p_emergencyAreaIDListForRestart + ) + ) + ); + + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_WTP_04 + + } // End of group PWS_Restart_Indication + //8.9.4 + group PWS_Failure_Indication{ + + /** + * @desc Testcase function for TC_NGAP_gNB_WTP_05 + */ + function f_TC_NGAP_GNB_WTP_05() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger PWS_Failure_Indication!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_PWSFailureIndication( + ?,//template (present) PWSFailedCellIDList p_pWSFailedCellIDList := ?, + ?//template (present) GlobalRANNodeID p_globalRANNodeID := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_WTP_05 + + } // End of group PWS_Failure_Indication + } // End of group Warning_Message_Transmission_Procedures + //8.10 + group NRPPa_Transport_Procedures{ + + /** + * @desc Testcase function for TC_NGAP_gNB_NTP_01 + */ + function f_TC_NGAP_GNB_NTP_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger NRPPA transport procedure!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkUEAssociatedNRPPaTransport( + ?, + ?, + ?,//template (present) RoutingID p_routingID := ?, + ?//template (present) NRPPa_PDU p_nRPPa_PDU := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_NTP_01 + + /** + * @desc Testcase function for TC_NGAP_gNB_NTP_02 + */ + function f_TC_NGAP_GNB_NTP_02() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger NRPPA transport procedure!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNonUEAssociatedNRPPaTransport( + ?,//template (present) RoutingID p_routingID := ?, + ?//template (present) NRPPa_PDU p_nRPPa_PDU := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_NTP_02 + + } // End of group NRPPa_Transport_Procedures + //8.11 + group Trace_Procedures{ + //8.11.1 + group Trace_Start{ + + /** + * @desc Testcase function for TC_NGAP_gNB_TRP_01 + */ + function f_TC_NGAP_GNB_TRP_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + //f_NGAP_gnb_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_TraceStart( + -, + -, + m_traceActivation( + '0000000000000001'O,//in template (value) NGRANTraceID p_nGRANTraceID, + '00000000'B,//in template (value) InterfacesToTrace p_interfacesToTrace, + m_traceDepth(minimum), + PX_TRANSPORT_LAYER_ADDRESS, + omit//in template (omit) TraceActivation.iE_Extensions p_iE_Extensions := omit + ) + ) + ) + ); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_TraceFailureIndication( + -, + -, + ?, + ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_TRP_01 + + } // End of group Trace_Start + //8.11.2 + group Trace_Failure_Indication{ + } // End of group Trace_Failure_Indication + //8.11.3 + group Deactivate_Trace{ + + /** + * @desc Testcase function for TC_NGAP_gNB_TRP_02 + */ + function f_TC_NGAP_GNB_TRP_02() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + //f_NGAP_gnb_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_DeactivateTrace( + -, + -, + '0000000000000001'O//in template (value) NGRANTraceID p_NGRANTraceID + ) + ) + ); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_TraceFailureIndication( + -, + -, + ?, + ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_TRP_02 + + } // End of group Deactivate_Trace + //8.11.4 + group Cell_Traffic_Trace{ + + /** + * @desc Testcase function for TC_NGAP_gNB_TRP_03 + */ + function f_TC_NGAP_GNB_TRP_03() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + //f_NGAP_gnb_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger CELL TRAFFIC TRACE!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_CellTrafficTrace( + ?, + ?, + ?, + ?, + ?, + ?, + ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_TRP_03 + + } // End of group Cell_Traffic_Trace + } // End of group Trace_Procedures + //8.12 + group Location_Reporting_Procedures{ + //8.12.1 + group Location_Reporting_Control{ + } // End of group Location_Reporting_Control + //8.12.2 + group Location_Reporting_Failure_Indication{ + + /** + * @desc Testcase function for TC_NGAP_LRP_01 + */ + function f_TC_NGAP_GNB_LRP_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_LocationReportingControl( + -, + -, + m_locationReportingRequestType( + direct, + cell, + { + m_areaOfInterestItem( + m_areaOfInterest, + 1, + - + ), + m_areaOfInterestItem( + m_areaOfInterest, + 1, + - + ) + }, + -, + - + ) + ) + ) + ); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_LocationReportingFailureIndication(-,-,m_cause_radioNetwork(PX_CAUSE_MULTIPLE_LOCATION_REPORTING)) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_LRP_01 + + } // End of group Location_Reporting_Failure_Indication + //8.12.3 + group Location_Report{ + + /** + * @desc Testcase function for TC_NGAP_LRP_02 + */ + function f_TC_NGAP_GNB_LRP_02() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_LocationReportingControl( + -, + -, + m_locationReportingRequestType(direct,cell) + ) + ) + ); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_LocationReport(-,-,-,-) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_LRP_02 + + } // End of group Location_Report + } // End of group Location_Reporting_Procedures + //8.13 + group UE_TNLA_Binding_Procedures{ + //8.13.1 + group UE_TNLA_Binding_Release{ + } // End of group UE_TNLA_Binding_Release + } // End of group UE_TNLA_Binding_Procedures + //8.14 + group UE_Radio_Capability_Management_Procedures{ + //8.14.1 + group UE_Radio_Capability_Info_Indication{ + + /** + * @desc Testcase function for TC_NGAP_gNB_URP_01 + */ + function f_TC_NGAP_GNB_URP_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + //f_NGAP_gnb_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger UE Radio Capability Management procedure!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UERadioCapabilityInfoIndication( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_URP_01 + + } // End of group UE_Radio_Capability_Info_Indication + //8.14.2 + group UE_Radio_Capability_Check{ + + /** + * @desc Testcase function for TC_NGAP_gNB_URP_02 + */ + function f_TC_NGAP_GNB_URP_02() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + //f_NGAP_gnb_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UERadioCapabilityCheckRequest( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID + ) + ) + ); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_UERadioCapabilityCheckResponse( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + ?// template (present) IMSVoiceSupportIndicator p_iMSVoiceSupportIndicator := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_URP_02 + + } // End of group UE_Radio_Capability_Check + //8.14.3 + group UE_Radio_Capability_ID_Mapping{ + + /** + * @desc Testcase function for TC_NGAP_gNB_URP_03 + */ + function f_TC_NGAP_GNB_URP_03() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + //f_NGAP_bng_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger UE_RADIO_CAPABILITY_ID_MAPPING_REQUEST !"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UERadioCapabilityIDMappingRequest( + ?//template (present) UERadioCapabilityID p_uERadioCapabilityID := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_URP_03 + + } // End of group UE_Radio_Capability_ID_Mapping + } // End of group UE_Radio_Capability_Management_Procedures + //8.15 + group Data_Usage_Reporting_Procedures{ + //8.15.1 + group Secondary_RAT_Data_Usage_Report{ + + /** + * @desc Testcase function for TC_NGAP_gNB_DRP_01 + */ + function f_TC_NGAP_GNB_DRP_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + //f_NGAP_gnb_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger SECONDARY_RAT_DATA_USAGE_REPORT !"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_SecondaryRATDataUsageReport( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + ?//template (present) PDUSessionResourceSecondaryRATUsageList p_pDUSessionResourceSecondaryRATUsageList := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_DRP_01 + + } // End of group Secondary_RAT_Data_Usage_Report + } // End of group Data_Usage_Reporting_Procedures + //8.16 + group RIM_Information_Transfer_Procedures{ + //8.16.1 + group Uplink_RIM_Information_Transfer{ + + /** + * @desc Testcase function for TC_NGAP_gNB_RIP_01 + */ + function f_TC_NGAP_GNB_RIP_01() runs on gNBNGAPComponent { + // Local variables + + // Preamble + f_NGAP_gnb_init(); + f_NGAP_gnb_UE_Register(); + //f_NGAP_gnb_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger a uplink RIM Information Transfer procedure!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkRIMInformationTransfer( + ?//template (present) RIMInformationTransfer p_rIMInformationTransfer := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_gNB_RIP_01 + + } // End of group Uplink_RIM_Information_Transfer + //8.16.2 + group Downlink_RIM_Information_Transfer{ + } // End of group Downlink_RIM_Information_Transfer + } // End of group RIM_Information_Transfer_Procedures + } // End of group gNB_Role + + group aMF_Role{ + //8.2 + group PDU_Session_Management_Procedures{ + //8.2.1 + group PDU_Session_Resource_Setup{ + + /** + * @desc Testcase function for TC_NGAP_aMF_PDU_01 + */ + function f_TC_NGAP_AMF_PDU_01() runs on aMFNGAPComponent { + // Local + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // f_send_registration_request(); + f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger PDU session resource SETUP!"); + f_NGAP_amf_UE_PDU_SessionEstablishmentRequest(); // f_send_pdu_session_establishment_request + f_NGAP_amf_ConfigurationUpdateCommand(); // f_await_configuration_update_command + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_PDUSessionResourceSetupRequest( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + var integer numOfIEs := lengthof(vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs) + log("*** " & __SCOPE__ & ": DBG: numOfIEs: ", numOfIEs, " ***"); + for (var integer i :=0 ; i < numOfIEs; i := i + 1) { // Loop over the protocolIEs found + if ((vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs[i].id) == 74 /*id_NAS_PDU*/) { + var integer numOfItems := lengthof(vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs[i].value_.pDUSessionResourceSetupListSUReq) + log("*** " & __SCOPE__ & ": DBG: Number of items in pDUSessionResourceSetupListSUReq: ", numOfItems); + if (numOfItems > 0) { + vc_pdu_session_resource_setup_list_su_req := vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs[i].value_.pDUSessionResourceSetupListSUReq; + for (var integer j :=0; j < numOfItems; j := j + 1) { // Loop over the PDUSessionResourceSetupListSUReq items + log("*** " & __SCOPE__ & ": DBG: pDUSessionNAS_PDU of item ", j, ": ", vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs[i].value_.pDUSessionResourceSetupListSUReq[j].pDUSessionNAS_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs[i].value_.pDUSessionResourceSetupListSUReq[j].pDUSessionNAS_PDU, + mw_NG_DL_NAS_TRANSPORT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: NG_PDU_SESSION_ESTABLISHMENT_ACCEPT mismatch. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": DBG: v_message.dl_Nas_Transport ", v_message.dl_Nas_Transport); + var bitstring v_bs := oct2bit(v_message.dl_Nas_Transport.payload.payload); + var NG_PDU_SESSION_ESTABLISHMENT_ACCEPT v_ng_pdu_session_establishment_accept; + if (decvalue(v_bs, v_ng_pdu_session_establishment_accept) != 0) { + log("*** " & __SCOPE__ & ": INCONC: Failed to decode dl_Nas_Transport payload ***"); + setverdict(inconc); + } else { + log("*** " & __SCOPE__ & ": DBG: v_ng_pdu_session_establishment_accept: ", v_ng_pdu_session_establishment_accept); + var NG_NAS_DL_Message_Type v_expected_message; + v_expected_message.pdu_Session_Establishment_Accept := v_ng_pdu_session_establishment_accept; + if (not(match(v_expected_message, mw_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT_noPTI))) { + log(match(v_expected_message, mw_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT_noPTI)); // Log mismatch + log("*** " & __SCOPE__ & ": FAIL: NG_PDU_SESSION_ESTABLISHMENT_ACCEPT mismatch. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_PDU_SESSION_ESTABLISHMENT_ACCEPT ***"); + setverdict(pass); + } + } + } + } // End of 'for' statement + } else { + log("*** " & __SCOPE__ & ": FAIL: No items in pDUSessionResourceSetupListSUReq. ***"); + setverdict(fail); + } + break; // Break the loop as the relevant IE has been processed + } + } // End of 'for' statement + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_NGAP_amf_UE_PDU_SessionResourceSetupResponse(); // f_send_pdu_session_resource_setup_response + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_PDU_01 + + /** + * @desc Testcase function for TC_NGAP_aMF_PDU_01_02 + */ + function f_TC_NGAP_AMF_PDU_01_02() runs on aMFNGAPComponent { + // Local + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // f_send_registration_request(); + f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger PDU session resource SETUP!"); + f_NGAP_amf_UE_PDU_SessionEstablishmentRequest(); // f_send_pdu_session_establishment_request + f_NGAP_amf_ConfigurationUpdateCommand(); // f_await_configuration_update_command + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + f_mw_n2_PDUSessionResourceSetupRequest( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + -, + ?, + { + mw_pDUSessionResourceSetupItemSUReq( + PX_PDU_SESSION_ID, + mw_s_NSSAI( + PX_SST/*, + PX_SD, + -*/ + ), + decmatch( + mw_pDUSessionResourceSetupRequestTransfer( + mw_pDUSessionResourceSetupRequestTransfer_mandatories( + -, + mw_pDUSessionType, + { + *, + mw_qosFlowSetupRequestItem( + 1, + mw_qosFlowLevelQosParameters( + mw_qosCharacteristics_nonDynamic5QI + )), + * + } + )))) + } + ))); + f_NGAP_amf_UE_PDU_SessionResourceSetupResponse(); // f_send_pdu_session_resource_setup_response + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_PDU_01_02 + + } // End of group PDU_Session_Resource_Setup + //8.2.2 + group PDU_Session_Resource_Release{ + + /** + * @desc Testcase function for TC_NGAP_AMF_PDU_02 + */ + function f_TC_NGAP_AMF_PDU_02() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // f_send_registration_request(); + f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + f_NGAP_amf_UE_PDU_SessionEstablishmentRequest(); // f_send_pdu_session_establishment_request + f_NGAP_amf_ConfigurationUpdateCommand(); // f_await_configuration_update_command + f_NGAP_amf_UE_PDU_SessionResourceSetup(); // f_await_pdu_session_resource_setup_request + f_NGAP_amf_UE_PDU_SessionResourceSetupResponse(); // f_send_pdu_session_resource_setup_response + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + f_sleep(1.0); // Sleep for a while to ensure the previous procedure is completed before triggering the release + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger PDU session resource RELEASE!"); + f_NGAP_amf_UE_PDU_SessionResourceReleaseRequest(); // f_send_pdu_session_resource_release_request + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_PDUSessionResourceReleaseCommand( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_DL_NAS_TRANSPORT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_PDU_SESSION_RELEASE_COMMAND ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": DBG: vc_inner_message ", vc_inner_message); + log("*** " & __SCOPE__ & ": DBG: v_message.dl_Nas_Transport ", v_message.dl_Nas_Transport); + var bitstring v_bs := oct2bit(v_message.dl_Nas_Transport.payload.payload); + var NG_PDU_SESSION_RELEASE_COMMAND v_ng_pdu_session_release_command; + if (decvalue(v_bs, v_ng_pdu_session_release_command) != 0) { + log("*** " & __SCOPE__ & ": INCONC: Failed to decode dl_Nas_Transport payload ***"); + setverdict(inconc); + } else { + log("*** " & __SCOPE__ & ": DBG: v_ng_pdu_session_release_command: ", v_ng_pdu_session_release_command); + var NG_NAS_DL_Message_Type v_expected_message; + v_expected_message.pdu_Session_Release_Command := v_ng_pdu_session_release_command; + if (not(match(v_expected_message, mw_NG_PDU_SESSION_RELEASE_COMMAND(cs_NG_PDU_SessionId(int2oct(vc_pdu_session_resource_setup_list_su_req[0].pDUSessionID, 1), omit))))) { + log(match(v_expected_message, mw_NG_PDU_SESSION_RELEASE_COMMAND(cs_NG_PDU_SessionId(int2oct(vc_pdu_session_resource_setup_list_su_req[0].pDUSessionID, 1), omit)))); // Log mismatch + log("*** " & __SCOPE__ & ": FAIL: NG_PDU_SESSION_RELEASE_COMMAND mismatch. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_PDU_SESSION_RELEASE_COMMAND ***"); + setverdict(pass); + } + } + } + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_NGAP_amf_UE_ContextRealeaseComplete(); // f_send_ue_context_release_complete + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_PDU_02 + + /** + * @desc Testcase function for TC_NGAP_AMF_PDU_02_02 + */ + function f_TC_NGAP_AMF_PDU_02_02() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // f_send_registration_request(); + f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + f_NGAP_amf_UE_PDU_SessionEstablishmentRequest(); // f_send_pdu_session_establishment_request + f_NGAP_amf_ConfigurationUpdateCommand(); // f_await_configuration_update_command + f_NGAP_amf_UE_PDU_SessionResourceSetup(); // f_await_pdu_session_resource_setup_request + f_NGAP_amf_UE_PDU_SessionResourceSetupResponse(); // f_send_pdu_session_resource_setup_response + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + f_sleep(1.0); // Sleep for a while to ensure the previous procedure is completed before triggering the release + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger PDU session resource RELEASE!"); + f_NGAP_amf_UE_PDU_SessionResourceReleaseRequest(); // f_send_pdu_session_resource_release_request + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_PDUSessionResourceReleaseCommand( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_DL_NAS_TRANSPORT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_PDU_SESSION_RELEASE_COMMAND ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": DBG: vc_inner_message ", vc_inner_message); + log("*** " & __SCOPE__ & ": DBG: v_message.dl_Nas_Transport ", v_message.dl_Nas_Transport); + var bitstring v_bs := oct2bit(v_message.dl_Nas_Transport.payload.payload); + var NG_PDU_SESSION_RELEASE_COMMAND v_ng_pdu_session_release_command; + if (decvalue(v_bs, v_ng_pdu_session_release_command) != 0) { + log("*** " & __SCOPE__ & ": INCONC: Failed to decode dl_Nas_Transport payload ***"); + setverdict(inconc); + } else { + log("*** " & __SCOPE__ & ": DBG: v_ng_pdu_session_release_command: ", v_ng_pdu_session_release_command); + var NG_NAS_DL_Message_Type v_expected_message; + v_expected_message.pdu_Session_Release_Command := v_ng_pdu_session_release_command; + if (not(match(v_expected_message, mw_NG_PDU_SESSION_RELEASE_COMMAND(cs_NG_PDU_SessionId(int2oct(vc_pdu_session_resource_setup_list_su_req[0].pDUSessionID, 1), omit))))) { + log(match(v_expected_message, mw_NG_PDU_SESSION_RELEASE_COMMAND(cs_NG_PDU_SessionId(int2oct(vc_pdu_session_resource_setup_list_su_req[0].pDUSessionID, 1), omit)))); // Log mismatch + log("*** " & __SCOPE__ & ": FAIL: NG_PDU_SESSION_RELEASE_COMMAND mismatch. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": INFO: Expected NG_PDU_SESSION_RELEASE_COMMAND ***"); + } + } + } + // Wait if no error_indication message is sent by the IUT + tc_noac.start + alt { + [] N2_gNBaMF_P.receive( + mw_ngap_initMsg( + mw_n2_ErrorIndication + )) { + log("*** " & __SCOPE__ & ": FAIL: IUT entity did not accept a PDU_SESSION_RESOURCE_RELEASE_RESPONSE ***"); + setverdict(fail); + } + [] tc_noac.timeout { + log("*** " & __SCOPE__ & ": PASS: IUT entity accepted a PDU_SESSION_RESOURCE_RELEASE_RESPONSE ***"); + setverdict(pass); + } + } + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_NGAP_amf_UE_ContextRealeaseComplete(); // f_send_ue_context_release_complete + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_PDU_02_02 + + } // End of group PDU_Session_Resource_Release + //8.2.3 + group PDU_Session_Resource_Modify{ + + /** + * @desc Testcase function for TC_NGAP_AMF_PDU_03 + */ + function f_TC_NGAP_AMF_PDU_03() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // f_send_registration_request(); + f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + f_NGAP_amf_UE_PDU_SessionEstablishmentRequest(); // f_send_pdu_session_establishment_request + f_NGAP_amf_ConfigurationUpdateCommand(); // f_await_configuration_update_command + f_NGAP_amf_UE_PDU_SessionResourceSetup(); // f_await_pdu_session_resource_setup_request + f_NGAP_amf_UE_PDU_SessionResourceSetupResponse(); // f_send_pdu_session_resource_setup_response + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger PDU session resource MODIFY!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_PDUSessionResourceModify( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + { + mw_pDUSessionResourceModifyItemModReq( + PX_PDU_SESSION_ID, + ?,//decmatch(mw_pDUSessionResourceModifyRequestTransfer(*)),OCTETSTRING + -,//template NAS_PDU p_nAS_PDU := *, + -//template PDUSessionResourceModifyItemModReq.iE_Extensions p_iE_Extensions := * + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_PDU_03 + + } // End of group PDU_Session_Resource_Modify + //8.2.4 + group PDU_Session_Resource_Notify{ + } // End of group PDU_Session_Resource_Notify + //8.2.5 + group PDU_Session_Resource_Modify_Indication{ + + /** + * @desc Testcase function for TC_NGAP_AMF_PDU_04 + */ + function f_TC_NGAP_AMF_PDU_04() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + f_NGAP_amf_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceModifyIndication( + PX_AMF_UE_NGAP_ID,//template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + PX_RAN_UE_NGAP_ID,//template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + { + m_pDUSessionResourceModifyItemModInd( + PX_PDU_SESSION_ID,//template (present) PDUSessionID p_pDUSessionID := ?, + bit2oct(encvalue( + m_pDUSessionResourceModifyIndicationTransfer( + m_qosFlowPerTNLInformation( + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel( + PX_TRANSPORT_LAYER_ADDRESS, + PX_GTP_TEID, + omit + ) + ), + { + m_associatedQosFlowItem( + PX_QOS_FLOW_IDENTIFIER, + omit, + omit + ) + },//in template (value) AssociatedQosFlowList p_associatedQosFlowList, + omit//in template (omit) QosFlowPerTNLInformation.iE_Extensions p_iE_Extensions := omit + ),//template (present) QosFlowPerTNLInformation p_dLQosFlowPerTNLInformation := ?, + omit,//template QosFlowPerTNLInformationList p_additionalDLQosFlowPerTNLInformation := *, + omit//template PDUSessionResourceModifyIndicationTransfer.iE_Extensions p_iE_Extensions := * + ))), + omit//template PDUSessionResourceModifyItemModRes.iE_Extensions p_iE_Extensions := * + ) + } + ) + ) + ); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PDUSessionResourceModifyConfirm( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + { + mw_pDUSessionResourceModifyItemModCfm( + PX_PDU_SESSION_ID, + decmatch( + mw_pDUSessionResourceModifyConfirmTransfer( + ?,//template (present) QosFlowModifyConfirmList p_qosFlowModifyConfirmList := ?, + ?,//template (present) UPTransportLayerInformation p_uLNGU_UP_TNLInformation := ?, + -,//template UPTransportLayerInformationPairList p_additionalNG_UUPTNLInformation := *, + -,//template QosFlowListWithCause p_qosFlowFailedToModifyList := *, + -//template PDUSessionResourceModifyConfirmTransfer.iE_Extensions p_iE_Extensions := * + ) + ),// OCTETSTRING + -//template PDUSessionResourceModifyItemModCfm.iE_Extensions p_iE_Extensions := * + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_PDU_04 + + /** + * @desc Testcase function for TC_NGAP_AMF_PDU_05 + */ + function f_TC_NGAP_AMF_PDU_05() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + f_NGAP_amf_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceModifyIndication( + PX_AMF_UE_NGAP_ID,//template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + PX_RAN_UE_NGAP_ID,//template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + { + ( + m_pDUSessionResourceModifyItemModInd( + PX_PDU_SESSION_ID,//template (present) PDUSessionID p_pDUSessionID := ?, + bit2oct(encvalue( + m_pDUSessionResourceModifyIndicationTransfer( + m_qosFlowPerTNLInformation( + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel( + PX_TRANSPORT_LAYER_ADDRESS, + PX_GTP_TEID, + omit + ) + ), + { + m_associatedQosFlowItem( + PX_QOS_FLOW_IDENTIFIER, + omit, + omit + ) + },//in template (value) AssociatedQosFlowList p_associatedQosFlowList, + omit//in template (omit) QosFlowPerTNLInformation.iE_Extensions p_iE_Extensions := omit + ),//template (present) QosFlowPerTNLInformation p_dLQosFlowPerTNLInformation := ?, + omit,//template QosFlowPerTNLInformationList p_additionalDLQosFlowPerTNLInformation := *, + omit//template PDUSessionResourceModifyIndicationTransfer.iE_Extensions p_iE_Extensions := * + ))), + omit//template PDUSessionResourceModifyItemModRes.iE_Extensions p_iE_Extensions := * + ) + ) + } + ) + ) + ); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + //? //FIXME missing template mw_n2_PDUSessionResourceFailedToModifyListModCfm + mw_n2_PDUSessionResourceModifyConfirm_failed( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + { + mw_pDUSessionResourceFailedToModifyItemModCfm( + PX_PDU_SESSION_ID,//template (present) PDUSessionID p_pDUSessionID := ?, + decmatch( + mw_pDUSessionResourceModifyIndicationUnsuccessfulTransfer( + ?,//template (present) Cause p_cause := ?, + -//template PDUSessionResourceModifyIndicationUnsuccessfulTransfer.iE_Extensions p_iE_Extensions := * + )//OCTETSTRINGtemplate (present) PDUSessionResourceFailedToModifyItemModCfm.pDUSessionResourceModifyIndicationUnsuccessfulTransfer p_pDUSessionResourceModifyIndicationUnsuccessfulTransfer := ?, + ), + *//template PDUSessionResourceFailedToModifyItemModCfm.iE_Extensions p_iE_Extensions := * + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_PDU_05 + + } // End of group PDU_Session_Resource_Modify_Indication + } // End of group PDU_Session_Management_Procedures + //8.3 + group UE_Context_Management_Procedures{ + //8.3.1 + group Initial_Context_Setup{ + + /** + * @desc Testcase function for TP_NGAP_AMF_CMP_01 + */ + function f_TC_NGAP_AMF_CMP_01() runs on aMFNGAPComponent { + + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // f_send_registration_request(); + f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // Test Body + action("Trigger a PDU initial context setup procedure!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_InitialContextSetupRequest/*_withPDUSessionList*/( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + mw_gUAMI + ( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_AMF_REGION_ID, + PX_AMF_SET_ID, + PX_AMF_POINTER, + * + )/*, + { + mw_pDUSessionResourceSetupItemCxtReq + ( + PX_PDU_SESSION_ID, + mw_s_NSSAI + ( + PX_SST + ), + ?, + *, + * + ) + }, + ?, + ?, + ? */ + ))); + // Check security + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_REGISTRATION_ACCEPT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: mw_NG_REGISTRATION_ACCEPT mismatch. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected mw_NG_REGISTRATION_ACCEPT ***"); + setverdict(pass); + } + log("v_message: ", v_message); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + // Send error response to release the UE context + f_NGAP_amf_UE_PDU_InitialContextSetupFailure(); + f_NGAP_amf_UE_ContextRealease_ContextRealeaseComplete(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_CMP_01 + + } // End of group Initial_Context_Setup + //8.3.2 + group UE_Context_Release_Request_NG_RAN_node_initiated{ + } // End of group UE_Context_Release_Request_NG_RAN_node_initiated + //8.3.3 + group UE_Context_Release_AMF_initiated{ + + /** + * @desc Testcase function for TP_NGAP_AMF_CMP_02 + */ + function f_TC_NGAP_AMF_CMP_02() runs on aMFNGAPComponent { + + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // f_send_registration_request(); + f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger a UE context release command!"); + f_sleep(1.0); // Sleep for a while to make sure the previous procedure is completed + f_NGAP_amf_UE_ContextRealeaseRequest(); // f_send_ue_context_release_request + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextReleaseCommand( + mw_uE_NGAP_IDs_uE_NGAP_ID_pair( + mw_uE_NGAP_ID_pair ( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + * + + ))))); + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_NGAP_amf_UE_ContextRealeaseComplete(); // f_send_ue_context_release_complete + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + } // End of function f_TC_NGAP_AMF_CMP_02 + + /** + * @desc Testcase function for TP_NGAP_AMF_CMP_03 + */ + function f_TC_NGAP_AMF_CMP_03() runs on aMFNGAPComponent { + + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // f_send_registration_request(); + f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger a UE context release command!"); + f_sleep(1.0); // Sleep for a while to make sure the previous procedure is completed + f_NGAP_amf_UE_ContextRealeaseRequest(); // f_send_ue_context_release_request + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextReleaseCommand( + mw_uE_NGAP_IDs_uE_NGAP_ID_pair( + mw_uE_NGAP_ID_pair( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + * + )), + mw_cause_radioNetwork(PX_UE_CONTEXT_RELEASE_COMMAND_CAUSE) + ))); + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_NGAP_amf_UE_ContextRealeaseComplete(); // f_send_ue_context_release_complete + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_CMP_03 + + + } // End of group UE_Context_Release_AMF_initiated + //8.3.4 + group UE_Context_Modification{ + + /** + * @desc Testcase function for TP_NGAP_AMF_CMP_04 + */ + // function f_TC_NGAP_AMF_CMP_04() runs on aMFNGAPComponent { + + // // Local variables + + // // Preamble + // f_NGAP_amf_init(); + // f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // // f_send_registration_request(); + // f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + // f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + // f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + // f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + + // // TODO: hasEstablishedInitialContext + // if (not(f_NGAP_amf_UE_Has_EstablishedContextInproperly())) { // TODO FSCOM To check, not sure it address hasEstablishedInitialContext properly + // f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + // log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + // } else { + // f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + // } + + // // Test Body + // action("Trigger a PDU UE context modification procedure!"); + + // f_recv_NGAP_PDU( + // mw_ngap_initMsg( + // mw_n2_UEContextModificationRequest( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID + // ))); + // f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // // Postamble + // f_postamble_NGAP_AMF(); + // f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + // } // End of function f_TC_NGAP_AMF_CMP_04 + + } // End of group UE_Context_Modification + //8.3.5 + group RRC_Inactive_Transition_Report{ + } // End of group RRC_Inactive_Transition_Report + //8.3.6 + group Connection_Establishment_Indication{ + + /** + * @desc Testcase function for TP_NGAP_AMF_CMP_05 + */ + // function f_TC_NGAP_AMF_CMP_05() runs on aMFNGAPComponent { + + // // Local variables + + // // Preamble + // f_NGAP_amf_init(); + // f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // // f_send_registration_request(); + // f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + // f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + // f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + // f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + + // f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // // Test Body + // action("Trigger a PDU UE context modification procedure!"); + + // f_recv_NGAP_PDU( + // mw_ngap_initMsg( + // mw_n2_ConnectionEstablishmentIndication( + // PX_AMF_UE_NGAP_ID, + // PX_RAN_UE_NGAP_ID + // ))); + + // f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // // Postamble + // f_postamble_NGAP_AMF(); + // f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + // } // End of function f_TC_NGAP_AMF_CMP_05 + + } // End of group Connection_Establishment_Indication + + //8.3.7 + group AMF_CP_Relocation_Indication{ + + /** + * @desc Testcase function for TP_NGAP_AMF_CMP_06 + */ + // function f_TC_NGAP_AMF_CMP_06() runs on aMFNGAPComponent { + + // // Local variables + + // // Preamble + // f_NGAP_amf_init(); + // f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // // f_send_registration_request(); + // f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + // f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + // f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + // f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + + // f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // // Test Body + // action("Trigger a AMF CP relocation indication procedure!"); + + // f_recv_NGAP_PDU( + // mw_ngap_initMsg( + // mw_n2_AMFCPRelocationIndication( + // PX_AMF_UE_NGAP_ID, + // PX_RAN_UE_NGAP_ID + // ))); + // f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // // Postamble + // f_postamble_NGAP_AMF(); + // f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + // } // End of function f_TC_NGAP_AMF_CMP_06 + + } // End of group AMF_CP_Relocation_Indication + //8.3.8 + group RAN_CP_Relocation_Indication{ + } // End of group RAN_CP_Relocation_Indication + //8.3.9 + group Retrieve_UE_Information{ + + /** + * @desc Testcase function for TP_NGAP_AMF_CMP_07 + */ + // function f_TC_NGAP_AMF_CMP_07() runs on aMFNGAPComponent { + + // // Local variables + + // // Preamble + // f_NGAP_amf_init(); + // f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // // f_send_registration_request(); + // f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + // f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + // f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + // f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + + // f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // // Test Body + // f_send_NGAP_PDU( + // m_ngap_initMsg( + // m_n2_RetrieveUEInformation( + // m_fiveG_S_TMSI( // FiveG_S_TMSI + // PX_AMF_SET_ID, + // PX_AMF_POINTER, + // '00000001'O, + // omit + // )))); + + // f_recv_NGAP_PDU( + // mw_ngap_initMsg( + // mw_n2_UEInformationTransfer( + // mw_fiveG_S_TMSI( + // PX_AMF_SET_ID, + // PX_AMF_POINTER, + // ?, + // * + // )))); + // f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // // Postamble + // f_postamble_NGAP_AMF(); + // f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + // } // End of function f_TC_NGAP_AMF_CMP_07 + } // End of group Retrieve_UE_Information + //8.3.10 + group UE_Information_Transfer{ + } // End of group UE_Information_Transfer + //8.3.11 + group UE_Context_Suspend{ + + /** + * @desc Testcase function for TP_NGAP_AMF_CMP_08 + */ + // function f_TC_NGAP_AMF_CMP_08() runs on aMFNGAPComponent { + + // // Local variables + + // // Preamble + // f_NGAP_amf_init(); + // f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // // f_send_registration_request(); + // f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + // f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + // f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + // f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + + // f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + + // // Test Body + // f_send_NGAP_PDU( + // m_ngap_initMsg( + // m_n2_UEContextSuspendRequest( + // -, + // -, + // { + // m_pDUSessionResourceSuspendItemSUSReq( + // -, + // bit2oct( + // encvalue( + // m_uEContextSuspendRequestTransfer + // )), + // - + // ) + // } + // ))); + + // f_recv_NGAP_PDU( + // mw_ngap_succMsg( + // mw_n2_UEContextSuspendResponse + // )); + // f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // // Postamble + // f_postamble_NGAP_AMF(); + // f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + // } // End of function f_TC_NGAP_AMF_CMP_08 + + /** + * @desc Testcase function for TP_NGAP_AMF_CMP_09 + */ + // function f_TC_NGAP_AMF_CMP_09() runs on aMFNGAPComponent { + + // // Local variables + + // // Preamble + // f_NGAP_amf_init(); + // f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // // f_send_registration_request(); + // f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + // f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + // f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + // f_NGAP_amf_RegistrationComplete(); // f_send_registration_complete + + // if (not(f_NGAP_amf_UE_HasPendingDataTransmission())) { + // log("*** " & __SCOPE__ & ": INFO: Preamble failed. ***"); + // f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + // } else { + // log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + // f_selfOrClientSyncAndVerdict(c_prDone, e_success); + // } + + // // Test Body + // f_send_NGAP_PDU( + // m_ngap_initMsg( + // m_n2_UEContextSuspendRequest( + // -, + // -, + // { + // m_pDUSessionResourceSuspendItemSUSReq( + // -, + // bit2oct( + // encvalue( + // m_uEContextSuspendRequestTransfer(-,-) + // )), + // - + // ) + // } + // ))); + + // f_recv_NGAP_PDU( + // mw_ngap_unsuccMsg( + // mw_n2_UEContextSuspendFailure( + // ?, + // ?, + // ? + // ))); + // f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // // Postamble + // f_postamble_NGAP_AMF(); + // f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + // } // End of function f_TC_NGAP_AMF_CMP_09 + + } // End of group UE_Context_Suspend + //8.3.12 + group UE_Context_Resume{ + + /** + * @desc Testcase function for TP_NGAP_AMF_CMP_10 + */ + // function f_TC_NGAP_AMF_CMP_10() runs on aMFNGAPComponent { + + // // Local variables + + // // Preamble + // f_NGAP_amf_init(); + // f_NGAP_amf_UE_Register(); + // if (not(f_NGAP_amf_UE_Has_Suspended_Context())) { + // f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + // log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + // return; + // } + + // f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // // Test Body + // f_send_NGAP_PDU( + // m_ngap_initMsg( + // m_n2_UEContextResumeRequest + // )); + + // f_recv_NGAP_PDU( + // mw_ngap_succMsg( + // mw_n2_UEContextResumeResponse( + // ?, + // ? + // ))); + // f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // // Postamble + // f_postamble_NGAP_AMF(); + // f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + // } // End of function f_TC_NGAP_AMF_CMP_10 + + /** + * @desc Testcase function for TP_NGAP_AMF_CMP_11 + */ + // function f_TC_NGAP_AMF_CMP_11() runs on aMFNGAPComponent { + + // // Local variables + + // // Preamble + // f_NGAP_amf_init(); + // f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // // f_send_registration_request(); + // f_NGAP_amf_UE_Authentication(); // f_await_authentication_request_send_authentication_response(); + // f_NGAP_amf_UE_SecurityMode(); // f_await_security_mode_command_send_security_mode_complete(); + // f_NGAP_amf_UE_InitialContextSetup(); // f_await_initial_context_setup_request_send_initial_context_setup_resonse + // if (not(f_NGAP_amf_UE_Has_Suspended_Context())) { + // f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + // log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + // return; + // } + + // f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // // Test Body + // f_send_NGAP_PDU( + // m_ngap_initMsg( + // m_n2_UEContextResumeRequest + // )); + + // f_recv_NGAP_PDU( + // mw_ngap_unsuccMsg( + // mw_n2_UEContextResumeFailure( + // ?, + // ?, + // ? + // ))); + // f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // // Postamble + // f_postamble_NGAP_AMF(); + // f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + // log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + // } // End of function f_TC_NGAP_AMF_CMP_11 + + + } // End of group UE_Context_Resume + } // End of group UE_Context_Management_Procedures + //8.4 + group UE_Mobility_Management_Procedures{ + //8.4.1 + group Handover_Preparation{ + + /** + * @desc Testcase function for TC_NGAP_aMF_MMP_01 + */ + function f_TC_NGAP_AMF_MMP_01() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_HandoverRequired( + -, -, -, -, + m_targetID_targetRANNodeID( + m_targetRANNodeID( + m_globalRANNodeID_globalGNB_ID( + m_ie_globalGnbId( + -, + PX_GNB_ID + )), + m_tAI + )), + { + m_pDUSessionResourceItemHORqd( + -, + ''O // FIXME FSCOM Shall be bit2oct(encvalue(???)) + ) + }, + ''O // FIXME FSCOM Shall be bit2oct(encvalue(???)) + ))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_HandoverCommand( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + -, + ?/* FIXME FSCOM { + m_pDUSessionResourceHandoverItem( + bit2oct(encvalue(m_handoverCommandTransfer(???)))) + }*/ + ))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_MMP_01 + + /** + * @desc Testcase function for TC_NGAP_aMF_MMP_02 + */ + function f_TC_NGAP_AMF_MMP_02() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_NGAP_amf_UE_Not_Available(); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_HandoverRequired( + -, -, -, -, + m_targetID_targetRANNodeID( + m_targetRANNodeID( + m_globalRANNodeID_globalGNB_ID( + m_ie_globalGnbId( + -, + PX_GNB_ID + )), + m_tAI + )), + { + m_pDUSessionResourceItemHORqd( + -, + ''O // FIXME FSCOM Shall be bit2oct(encvalue(???)) + ) + }, + ''O // FIXME FSCOM Shall be bit2oct(encvalue(???)) + ))); + + f_recv_NGAP_PDU( + mw_ngap_unsuccMsg( + mw_n2_HandoverFailure( + PX_AMF_UE_NGAP_ID + ))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_MMP_02 + + } // End of group Handover_Preparation + //8.4.2 + group Handover_Resource_Allocation{ + + /** + * @desc Testcase function for TC_NGAP_aMF_MMP_03 + */ + function f_TC_NGAP_AMF_MMP_03() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_MMP_03 + + } // End of group Handover_Resource_Allocation + //8.4.3 + group Handover_Notification{ + } // End of group Handover_Notification + //8.4.4 + group Path_Switch_Request{ + + /** + * @desc Testcase function for TC_NGAP_aMF_MMP_04 + */ + function f_TC_NGAP_AMF_MMP_04() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_MMP_04 + + /** + * @desc Testcase function for TC_NGAP_aMF_MMP_05 + */ + function f_TC_NGAP_AMF_MMP_05() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_MMP_05 + + } // End of group Path_Switch_Request + //8.4.5 + group Handover_Cancellation{ + + /** + * @desc Testcase function for TC_NGAP_aMF_MMP_06 + */ + function f_TC_NGAP_AMF_MMP_06() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_HandoverCancel + )); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_HandoverCancelAcknowledge + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_MMP_06 + + } // End of group Handover_Cancellation + //8.4.6 + group Uplink_RAN_Status_Transfer{ + } // End of group Uplink_RAN_Status_Transfer + //8.4.7 + group Downlink_RAN_Status_Transfer{ + + /** + * @desc Testcase function for TC_NGAP_aMF_MMP_07 + */ + function f_TC_NGAP_AMF_MMP_07() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("the IUT entity indicate a Downlink RAN Status Transfer procedure"); + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkRANStatusTransfer( + -, + -, + mw_rANStatusTransfer_TransparentContainer( + { + *, + mw_dRBsSubjectToStatusTransferItem( + PX_DRB_ID, + mw_dRBStatusUL_dRBStatusUL12, + mw_dRBStatusDL_dRBStatusDL12 + ), + * + } + )))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_MMP_07 + + } // End of group Downlink_RAN_Status_Transfer + //8.4.8 + group Handover_Success{ + + /** + * @desc Testcase function for TC_NGAP_aMF_MMP_08 + */ + function f_TC_NGAP_AMF_MMP_08() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("the IUT entity indicate the initiation \"of an UE handover success procedure\""); + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_HandoverSuccess + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_MMP_08 + + } // End of group Handover_Success + //8.4.9 + group Uplink_RAN_Early_Status_Transfer{ + } // End of group Uplink_RAN_Early_Status_Transfer + //8.4.10 + group Downlink_RAN_Early_Status_Transfer{ + + /** + * @desc Testcase function for TC_NGAP_aMF_MMP_09 + */ + function f_TC_NGAP_AMF_MMP_09() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("the IUT entity indicate a Downlink RAN Early Status Transfer procedure"); + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkRANEarlyStatusTransfer( + -, + -, + mw_earlyStatusTransfer_TransparentContainer( + mw_procedureStageChoice_firstDLCount( + mw_firstDLCount( + { + *, + mw_dRBsSubjectToEarlyStatusTransfer_Item( + PX_DRB_ID, + mw_dRBStatusDL_dRBStatusDL12 + ), + * + } + )))))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_MMP_09 + + } // End of group Downlink_RAN_Early_Status_Transfer + } // End of group UE_Mobility_Management_Procedures + //8.5 + group Paging_Procedures{ + //8.5.1 + group Paging{ + + /** + * @desc Testcase function for TC_NGAP_AMF_PAG_01 + */ + function f_TC_NGAP_AMF_PAG_01() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger Paging!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_Paging( + mw_uEPagingIdentity_fiveG_S_TMSI( + mw_fiveG_S_TMSI(-,-,-,-) + ),{ + mw_tAIListForPagingItem( + mw_tAI(-,-,-) + )} + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + } + + } // End of group Paging + } // End of group Paging_Procedures + //8.6 + group Transport_of_NAS_Messages_Procedures{ + //8.6.1 + group Initial_UE_Message{ + } // End of group Initial_UE_Message + //8.6.2 + group Downlink_NAS_Transport{ + + /** + * @desc Testcase function for TC_NGAP_AMF_NAS_01 + */ + function f_TC_NGAP_AMF_NAS_01() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); // f_await_NGSetupRequest_send_NGSetupRespone(); + // f_send_registration_request(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + ?, + vc_RAN_UE_ID, + ? // AuthorizationRequest + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_REQUEST( + ?,//'100'B, + -, + mw_GMM_AuthRAND, + mw_GSM_AUTN + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST"); + } + log("v_message: ", v_message); + if (not(isbound(v_message))) { + setverdict(fail); + return; + } + // Extract AMF_UE_NGAP_ID for termination + vc_AMF_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[0].value_.aMF_UE_NGAP_ID; + log("vc_AMF_UE_ID: ", vc_AMF_UE_ID); + // Extract RAN_UE_NGAP_ID for termination + vc_RAN_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[1].value_.rAN_UE_NGAP_ID; + log("vc_RAN_UE_ID: ", vc_RAN_UE_ID); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_NAS_01 + + } // End of group Downlink_NAS_Transport + //8.6.3 + group Uplink_NAS_Transport{ + } // End of group Uplink_NAS_Transport + //8.6.4 + group NAS_Non_Delivery_Indication{ + } // End of group NAS_Non_Delivery_Indication + } // End of group Transport_of_NAS_Messages_Procedures + //8.7 + group Interface_Management_Procedures{ + //8.7.1 + group NG_Setup{ + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_01 + */ + function f_TC_NGAP_AMF_IMP_01() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + // Send NGSetupRequest + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_NGSetupRequest( + m_globalRANNodeID_globalGNB_ID( + m_ie_globalGnbId( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_GNB_ID + )), + { + m_supportedTAItem( + PX_TACode, + { + m_ie_broadcastPLMNItem( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + { + m_sliceSupportItem( + m_s_NSSAI( + PX_SST, + PX_SD + ) + ) + }) + }) + }, + PX_PAGING_DRX + ))); + // Await NGSetupResponse + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGSetupResponse( + mw_aMFName(PX_AMF_NAME), + { + *, + mw_servedGUAMIItem( + mw_gUAMI( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) + )), + * + } + ))); + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + //f_NGAP_amf_UE_ErrorIndication(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_01 + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_01_02 + */ + function f_TC_NGAP_AMF_IMP_01_02() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + // Send NGSetupRequest + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_NGSetupRequest_RanNodeName_ExtRanNodeName( + m_globalRANNodeID_globalGNB_ID( + m_ie_globalGnbId( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_GNB_ID + )), + PX_RAN_NODE_NAME, + { + m_supportedTAItem( + PX_TACode, + { + m_ie_broadcastPLMNItem( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + { + m_sliceSupportItem( + m_s_NSSAI( + PX_SST, + PX_SD + )) + }) + }) + }, + PX_PAGING_DRX, + m_extended_RANNodeName( + "RANNodeNameVisibleString"/*, + oct2unichar(char2oct("NodeName"))*/ // Dynamic test case error: Internal error: While PER-encoding type '@NGAP-PDU-Descriptions.NGAP-PDU': No BER descriptor available for type '@NGAP-IEs.Extended-RANNodeName.rANNodeNameUTF8String' + )))); + // Await NGSetupResponse + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGSetupResponse( + mw_aMFName(PX_AMF_NAME), + { + *, + mw_servedGUAMIItem( + mw_gUAMI( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) + )), + * + } + ))); + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + //f_NGAP_amf_UE_Authentication_Failure(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_01_02 + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_01_03 + */ + function f_TC_NGAP_AMF_IMP_01_03() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + // Send NGSetupRequest + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_NGSetupRequest_RanNodeName( + m_globalRANNodeID_globalGNB_ID( + m_ie_globalGnbId( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_GNB_ID + )), + -, + { + m_supportedTAItem( + PX_TACode, + { + m_ie_broadcastPLMNItem( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + { + m_sliceSupportItem( + m_s_NSSAI( + PX_SST, + PX_SD + )) + }) + }) + }, + PX_PAGING_DRX + ))); + // Await NGSetupResponse + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGSetupResponse_iab( + mw_aMFName(PX_AMF_NAME), + { + *, + mw_servedGUAMIItem( + mw_gUAMI( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) + )), + * + }, + 1 + ))); + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + //f_NGAP_amf_UE_Authentication_Failure(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_01_03 + + /** + * @desc Testcase function for TC_NGAP_AMF_IMP_02 + */ + function f_TC_NGAP_AMF_IMP_02() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_NGSetupRequest( + m_globalRANNodeID_globalGNB_ID( + m_ie_globalGnbId( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_GNB_ID + )), + { + m_supportedTAItem( + PX_TACode, + { + m_ie_broadcastPLMNItem( + fl_NasNN_MCC2PlmnId( + PX_NAS_MCC, + '99'H + ), + { + m_sliceSupportItem( + m_s_NSSAI( + PX_SST/*, + PX_SD*/ + ) + ) + } + ) + } + ) + }, + PX_PAGING_DRX + ))); + + f_recv_NGAP_PDU( + mw_ngap_unsuccMsg( + f_mw_n2_NGSetupFailure( + mw_cause_misc( + unknown_PLMN_or_SNPN + )))); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + } // End of function f_TC_NGAP_AMF_IMP_02 + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_03 + */ + function f_TC_NGAP_AMF_IMP_03() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_NGSetupRequest_UERetentionInf( + m_globalRANNodeID_globalGNB_ID( + m_ie_globalGnbId( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + '0000000000000000000000'B,//in template (value) bitstring p_gnbId, + -//in template (omit) GlobalGNB_ID.iE_Extensions p_iE_Extensions := omit + ) + ), + { + m_supportedTAItem( + PX_TACode, + { + m_ie_broadcastPLMNItem( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC),//m_ie_pLMNIdentity('00f110'O), + { + m_sliceSupportItem( + m_s_NSSAI( + PX_SST, + -,// in template (omit) SD p_sD := omit, + -// in template (omit) S_NSSAI.iE_Extensions p_iE_Extensions := omit + ), + -//in template (omit) SliceSupportItem.iE_Extensions p_iE_Extensions := omit + ) + } + ) + },//in template (value) BroadcastPLMNList p_broadcastPLMNList, + -//in template (omit) SupportedTAItem.iE_Extensions p_iE_Extensions := omit + ) + }, + PX_PAGING_DRX, + m_uERetentionInformation(-)//UERetention_Information template m_uERetentionInformation(in UERetentionInformation p_value := ues_retained) + ) + ) + ); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGSetupResponse_UERetentionInf( + ?, + { + mw_servedGUAMIItem( + mw_gUAMI( + ?,//template (present) PLMNIdentity p_pLMNIdentity := ?, + ?,//template (present) AMFRegionID p_aMFRegionID := ?, + ?,//template (present) AMFSetID p_aMFSetID := ?, + ?,//template (present) AMFPointer p_aMFPointer := ?, + *//template GUAMI.iE_Extensions p_iE_Extensions := * + ),//template (present) GUAMI p_gUAMI := ?, + *,//template AMFName p_backupAMFName := *, + *//template ServedGUAMIItem.iE_Extensions p_iE_Extensions := * + ) + },//template (present) ServedGUAMIList p_servedGUAMIList := ?, + ?,//template (present) RelativeAMFCapacity p_relativeAmfCap:= ?, + { + mw_pLMNSupportItem( + ?,//template (present) PLMNIdentity p_pLMNIdentity := ?, + { + mw_sliceSupportItem( + mw_s_NSSAI( + ?,//template (present) SST p_sST := ?, + *,//template SD p_sD := *, + *//template S_NSSAI.iE_Extensions p_iE_Extensions := * + ),//template (present) S_NSSAI p_s_NSSAI := ?, + ?//template SliceSupportItem.iE_Extensions p_iE_Extensions := * + ) + },//template (present) SliceSupportList p_sliceSupportList := ?, + *//template PLMNSupportItem.iE_Extensions p_iE_Extensions := * + ) + },//template (present) PLMNSupportList p_plmnSuppList := ? + ?//UERetention_Information template mw_uERetentionInformation(template (present) UERetentionInformation p_value := ues_retained) + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_03 + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_04 + */ + function f_TC_NGAP_AMF_IMP_04() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_NGSetupRequest_ExtRanNodeName( + m_globalRANNodeID_globalGNB_ID( + m_ie_globalGnbId( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_GNB_ID + )), + { + m_supportedTAItem( + PX_TACode, + { + m_ie_broadcastPLMNItem( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC),//m_ie_pLMNIdentity('00f110'O), + { + m_sliceSupportItem( + m_s_NSSAI( + PX_SST/*, + PX_SD*/ + )) + } + ) + } + ) + }, + PX_PAGING_DRX, + m_extended_RANNodeName( + "RANNodeNameVisibleString"/*, + oct2unichar(char2oct("NodeName"))*/ // Dynamic test case error: Internal error: While PER-encoding type '@NGAP-PDU-Descriptions.NGAP-PDU': No BER descriptor available for type '@NGAP-IEs.Extended-RANNodeName.rANNodeNameUTF8String' + )))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGSetupResponse_ExtAmfName( + mw_aMFName(PX_AMF_NAME), + { + *, + mw_servedGUAMIItem( + mw_gUAMI( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) + )), + * + } + ))); + // ?,//template (present) RelativeAMFCapacity p_relativeAmfCap:= ?, + // { + // mw_pLMNSupportItem( + // ?,//template (present) PLMNIdentity p_pLMNIdentity := ?, + // { + // mw_sliceSupportItem( + // mw_s_NSSAI( + // ?,//template (present) SST p_sST := ?, + // *,//template SD p_sD := *, + // *//template S_NSSAI.iE_Extensions p_iE_Extensions := * + // ),//template (present) S_NSSAI p_s_NSSAI := ?, + // ?//template SliceSupportItem.iE_Extensions p_iE_Extensions := * + // ) + // },//template (present) SliceSupportList p_sliceSupportList := ?, + // *//template PLMNSupportItem.iE_Extensions p_iE_Extensions := * + // ) + // },//template (present) PLMNSupportList p_plmnSuppList := ? + // ?//Extended_RAN_Node_Name containing RAN_Node_Name_Visible;;; mw_extended_RANNodeName... + // ) + // ) + // ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_04 + + } // End of group NG_Setup + //8.7.2 + group RAN_Configuration_Update{ + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_05 + */ + function f_TC_NGAP_AMF_IMP_05() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_GNB_Setup(); + + //f_NGAP_amf_UE_Register(); + //f_NGAP_amf_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_RANConfigurationUpdate_SupportedTAList( + { + m_supportedTAItem( + PX_TACode, + { + m_ie_broadcastPLMNItem( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC),//m_ie_pLMNIdentity('00f110'O), + { + m_sliceSupportItem( + m_s_NSSAI( + PX_SST/*, + PX_Sxx*/ + )) + } + ) + } + ) + } + ))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_RANConfigurationUpdateAcknowledge + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_05 + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_06 + */ + function f_TC_NGAP_AMF_IMP_06() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_GNB_Setup(); + + //f_NGAP_amf_UE_Register(); + //f_NGAP_amf_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_RANConfigurationUpdate_SupportedTAList( + { + m_supportedTAItem( + PX_TACode, + { + m_ie_broadcastPLMNItem( + fl_NasNN_MCC2PlmnId( + PX_NAS_MCC, + '99'H + ), + { + m_sliceSupportItem( + m_s_NSSAI( + PX_SST + )) + } + ) + } + ) + } + ))); + + f_recv_NGAP_PDU( + mw_ngap_unsuccMsg( + mw_n2_RANConfigurationUpdateFailure + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_06 + + } // End of group RAN_Configuration_Update + //8.7.3 + group AMF_Configuration_Update{ + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_07 + */ + function f_TC_NGAP_AMF_IMP_07() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + //f_NGAP_amf_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger AMF CONFIGURATION UPDATE !"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_AMFConfigurationUpdate_options( + ?,//template (present) AMFName p_aMFName := ? + { + mw_servedGUAMIItem( + mw_gUAMI( + ?,//template (present) PLMNIdentity p_pLMNIdentity := ?, + ?,//template (present) AMFRegionID p_aMFRegionID := ?, + ?,//template (present) AMFSetID p_aMFSetID := ?, + ?,//template (present) AMFPointer p_aMFPointer := ?, + *//template GUAMI.iE_Extensions p_iE_Extensions := * + ),//template (present) GUAMI p_gUAMI := ?, + *,//template AMFName p_backupAMFName := *, + *//template ServedGUAMIItem.iE_Extensions p_iE_Extensions := * + ) + },//template (present) ServedGUAMIList p_servedGUAMIList := ?, + { + mw_pLMNSupportItem( + ?,//template (present) PLMNIdentity p_pLMNIdentity := ?, + { + mw_sliceSupportItem( + mw_s_NSSAI( + ?,//template (present) SST p_sST := ?, + *,//template SD p_sD := *, + *//template S_NSSAI.iE_Extensions p_iE_Extensions := * + ),//template (present) S_NSSAI p_s_NSSAI := ?, + ?//template SliceSupportItem.iE_Extensions p_iE_Extensions := * + ) + },//template (present) SliceSupportList p_sliceSupportList := ?, + *//template PLMNSupportItem.iE_Extensions p_iE_Extensions := * + ) + }//template (present) PLMNSupportList p_plmnSuppList := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_07 + + } // End of group AMF_Configuration_Update + //8.7.4 + group NG_Reset{ + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_08 + */ + function f_TC_NGAP_AMF_IMP_08() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_GNB_Setup(); + + //f_NGAP_amf_UE_Register(); + //f_NGAP_amf_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_NGReset( + m_cause_misc( + m_causeMisc + ), + m_resetType_nG_Interface( + m_resetAll( + reset_all + + ))))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGResetAcknowledge + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_08 + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_08_02 + */ + function f_TC_NGAP_AMF_IMP_08_02() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_GNB_Setup(); + + //f_NGAP_amf_UE_Register(); + //f_NGAP_amf_UE_PDU_ResourceSetup(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_NGReset( + m_cause_misc( + m_causeMisc + ), + m_resetType_partOfNG_Interface( + { + m_uE_associatedLogicalNG_connectionItem + } + + + )))); + + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGResetAcknowledge + )); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_08_02 + + } // End of group NG_Reset + //8.7.5 + group Error_Indication{ + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_09 + */ + function f_TC_NGAP_AMF_IMP_09() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_InitialContextSetupRequest( + -, + -, + m_gUAMI, + { + { + PX_PDU_SESSION_ID, + omit, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))) + ), + omit + } + }, + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + m_uESecurityCapabilities, + - + ) + ) + ); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_ErrorIndication_ids( + ?, + ?, + ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_09 + + } // End of group Error_Indication + //8.7.6 + group AMF_Status_Indication{ + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_10 + */ + function f_TC_NGAP_AMF_IMP_10() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger AMF STATUS INDICATION !"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_AMFStatusIndication( + { + mw_unavailableGUAMIItem( + mw_gUAMI( + ?, + ?, + ?, + ?, + * + ),//template (present) GUAMI p_gUAMI := ?, + *,//template TimerApproachForGUAMIRemoval p_timerApproachForGUAMIRemoval := *, + *,//template AMFName p_backupAMFName := *, + *//template UnavailableGUAMIItem.iE_Extensions p_iE_Extensions := * + ) + } + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_10 + + } // End of group AMF_Status_Indication + //8.7.7 + group Overload_Start{ + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_11 + */ + function f_TC_NGAP_AMF_IMP_11() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger OVERLOAD START !"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_OverloadStart_NSSAIList(?) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_11 + + } // End of group Overload_Start + //8.7.8 + group Overload_Stop{ + + /** + * @desc Testcase function for TC_NGAP_AMF_IMF_12 + */ + function f_TC_NGAP_AMF_IMP_12() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger OVERLOAD STOP !"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_OverloadStop + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_IMP_12 + + } // End of group Overload_Stop + } // End of group Interface_Management_Procedures + //8.8 + group Configuration_Transfer_Procedures{ + //8.8.1 + group Uplink_RAN_Configuration_Transfer{ + } // End of group Uplink_RAN_Configuration_Transfer + //8.8.2 + group Downlink_RAN_Configuration_Transfer{ + } // End of group Downlink_RAN_Configuration_Transfer + } // End of group Configuration_Transfer_Procedures + //8.9 + group Warning_Message_Transmission_Procedures{ + //8.9.1 + group Write_Replace_Warning{ + + /** + * @desc Testcase function for TC_NGAP_aMF_WTP_01 + */ + function f_TC_NGAP_AMF_WTP_01() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger WRITE REPLACE WARNING REQUEST !"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_WriteReplaceWarningRequest( + ?,// template (present) MessageIdentifier p_messageIdentifier :=?, + ?,// template (present) SerialNumber p_serialNumber := ?, + ?,// template (present) RepetitionPeriod p_repetitionPeriod := ?, + ?// template (present) NumberOfBroadcastsRequested p_numberOfBroadcastsRequested := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_WTP_01 + + } // End of group Write_Replace_Warning + //8.9.2 + group PWS_Cancel{ + + /** + * @desc Testcase function for TC_NGAP_aMF_WTP_02 + */ + function f_TC_NGAP_AMF_WTP_02() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger PWS CANCEL REQUEST !"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_PWSCancelRequest( + ?,//template (present) MessageIdentifier p_messageIdentifier := ?, + ?// template (present) SerialNumber p_serialNumber := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_WTP_02 + + } // End of group PWS_Cancel + //8.9.3 + group PWS_Restart_Indication{ + } // End of group PWS_Restart_Indication + //8.9.4 + group PWS_Failure_Indication{ + } // End of group PWS_Failure_Indication + } // End of group Warning_Message_Transmission_Procedures + //8.10 + group NRPPa_Transport_Procedures{ + + /** + * @desc Testcase function for TC_NGAP_aMF_NTP_01 + */ + function f_TC_NGAP_AMF_NTP_01() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger DOWNLINK_UE_ASSOCIATED_NRPPA_TRANSPORT !"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkUEAssociatedNRPPaTransport( + ?,//template (present) AMF_UE_NGAP_ID p_AMF_UE_NGAP_ID := ?, + ?,//template (present) RAN_UE_NGAP_ID p_rAN_UE_NGAP_ID := ?, + ?,//template (present) RoutingID p_routingID := ?, + ?//template (present) NRPPa_PDU p_nRPPa_PDU := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_NTP_01 + + /** + * @desc Testcase function for TC_NGAP_aMF_NTP_02 + */ + function f_TC_NGAP_AMF_NTP_02() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger DOWNLINK_NON_UE_ASSOCIATED_NRPPA_TRANSPORT !"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNonUEAssociatedNRPPaTransport( + ?,//template (present) RoutingID p_routingID := ?, + ?//template (present) NRPPa_PDU p_nRPPa_PDU := ? + ) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_NTP_02 + + } // End of group NRPPa_Transport_Procedures + //8.11 + group Trace_Procedures{ + //8.11.1 + group Trace_Start{ + } // End of group Trace_Start + //8.11.2 + group Trace_Failure_Indication{ + } // End of group Trace_Failure_Indication + //8.11.3 + group Deactivate_Trace{ + } // End of group Deactivate_Trace + //8.11.4 + group Cell_Traffic_Trace{ + } // End of group Cell_Traffic_Trace + } // End of group Trace_Procedures + //8.12 + group Location_Reporting_Procedures{ + //8.12.1 + group Location_Reporting_Control{ + + /** + * @desc Testcase function for TC_NGAP_AMF_LRP_01 + */ + function f_TC_NGAP_AMF_LRP_01() runs on aMFNGAPComponent { + // Local variables + + // Preamble + f_NGAP_amf_init(); + f_NGAP_amf_UE_Register(); + + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + + // Test Body + action("Trigger Location Reporting Control procedure!"); + + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_LocationReportingControl(-,-,-) + ) + ); + + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + + // Postamble + f_postamble_NGAP_AMF(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + + } // End of function f_TC_NGAP_AMF_LRP_01 + + } // End of group Location_Reporting_Control + //8.12.2 + group Location_Reporting_Failure_Indication{ + } // End of group Location_Reporting_Failure_Indication + //8.12.3 + group Location_Report{ + } // End of group Location_Report + } // End of group Location_Reporting_Procedures + //8.13 + group UE_TNLA_Binding_Procedures{ + //8.13.1 + group UE_TNLA_Binding_Release{ + } // End of group UE_TNLA_Binding_Release + } // End of group UE_TNLA_Binding_Procedures + //8.14 + group UE_Radio_Capability_Management_Procedures{ + //8.14.1 + group UE_Radio_Capability_Info_Indication{ + } // End of group UE_Radio_Capability_Info_Indication + //8.14.2 + group UE_Radio_Capability_Check{ + } // End of group UE_Radio_Capability_Check + //8.14.3 + group UE_Radio_Capability_ID_Mapping{ + } // End of group UE_Radio_Capability_ID_Mapping + } // End of group UE_Radio_Capability_Management_Procedures + //8.15 + group Data_Usage_Reporting_Procedures{ + //8.15.1 + group Secondary_RAT_Data_Usage_Report{ + } // End of group Secondary_RAT_Data_Usage_Report + } // End of group Data_Usage_Reporting_Procedures + //8.16 + group RIM_Information_Transfer_Procedures{ + //8.16.1 + group Uplink_RIM_Information_Transfer{ + } // End of group Uplink_RIM_Information_Transfer + //8.16.2 + group Downlink_RIM_Information_Transfer{ + } // End of group Downlink_RIM_Information_Transfer + } // End of group RIM_Information_Transfer_Procedures + } // End of group aMF_Role + +} // End of module NGAP_TCFunctions \ No newline at end of file diff --git a/ttcn/AtsNGAP/NGAP_TestCases.ttcn b/ttcn/AtsNGAP/NGAP_TestCases.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..0ce29b95d28876de05385d297640d6e02509bc2e --- /dev/null +++ b/ttcn/AtsNGAP/NGAP_TestCases.ttcn @@ -0,0 +1,3631 @@ +/** + * @author ETSI / TTF T033, T048 + * @version $URL$ + * $Id$ + * @desc This module provides test cases for NGAP tests. + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * @see ETSI TS 138 413 / 3GPP TS 38.413 Release 16 + */ +module NGAP_TestCases { + + // LibCommon + import from LibCommon_Sync all ; + + // LibNGAP + import from NGAP_Constants language "ASN.1:2002" all; + import from NGAP_CommonDataTypes language "ASN.1:2002" all; + import from NGAP_IEs language "ASN.1:2002" all; + import from NGAP_PDU_Contents language "ASN.1:2002" all; + import from NGAP_PDU_Descriptions language "ASN.1:2002" all; + import from NGAP_Containers language "ASN.1:2002" all; + + import from LibNGAP_TypesAndValues all; + import from LibNGAP_Templates all; + import from LibNGAP_Pixits all; + import from LibNGAP_Interface all; + + // AtsNGAP + import from LibNGAP_TypesAndValues all; + import from NGAP_TestConfiguration all; + import from NGAP_TestSystem all; + import from NGAP_TCFunctions all; + import from NGAP_Pics all; + + group gNB_Role{ + + /** + * @see ETSI TS 138 413 V16.12.0 (2023-05) 8.1 List of NGAP Elementary Procedures + */ + group PDU_Session_Management_Procedures{ + + /** + * @see ETSI TS 138 413 V16.12.0 (2023-05) 8.2.1 PDU Session Resource Setup + */ + group PDU_Session_Resource_Setup{ + + /** + * @desc Verify that the GNB successfully processes a PDU_SESSION_RESOURCE_SETUP_REQUEST and answers with PDU_SESSION_RESOURCE_SETUP_RESPONSE for successfully established PDU session + */ + testcase TC_NGAP_GNB_PDU_01() runs on gNBNGAPComponent system TestAdapter { + + // Local variables + var gNBNGAPComponent v_ngap_amf; + + // Test control + if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_1_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_1_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_gNB_Up(v_ngap_amf); + + // Start + v_ngap_amf.start(f_TC_NGAP_GNB_PDU_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_GNB_PDU_01 + + // /** + // * @desc Test objective "Verify that the NG-RAN node reports the establishment of the corresponding PDU session as failed if a PDU SESSION RESOURCE SETUP REQUEST contains several PDU Session ID IEs set to the same value." + // */ + // testcase TC_NGAP_GNB_PDU_02() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_1_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_1_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_PDU_02()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_PDU_02 + + // /** + // * @desc Test objective "Verify that the NG-RAN node reports the establishment of the new PDU session as failed if a PDU SESSION RESOURCE SETUP REQUEST contains a PDU Session ID IE set to value that identifies an active PDU Session. NOTE: Run TP_NGAP_GNB_PDU_01 before this TP " + // */ + // testcase TC_NGAP_GNB_PDU_03() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_1_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_1_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_PDU_03()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_PDU_03 + + // /** + // * @desc Test objective "Verify that the NG-RAN node reports the establishment of the corresponding PDU session as failed if a PDU SESSION RESOURCE SETUP REQUEST contains a QoS Flow Setup Request List IE in the PDU Session Resource Setup Request Transfer IE including at least one Non-GBR QoS flow but the PDU Session Aggregate Maximum Bit Rate IE is not present. " + // */ + // testcase TC_NGAP_GNB_PDU_04() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_1_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_1_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_PDU_04()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_PDU_04 + + } // End of group PDU_Session_Resource_Setup + + //8.2.2 + group PDU_Session_Resource_Release{ + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a PDU SESSION RESOURCE RELEASE COMMAND contains mandatory IEs and answers with PDU SESSION RESOURCE RELEASE RESPONSE to release PDU session." + // */ + // testcase TC_NGAP_GNB_PDU_05() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_1_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_1_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_PDU_05()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_PDU_05 + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a PDU SESSION RESOURCE RELEASE COMMAND containing multiple PDU Session ID IEs set to the same value and ignore the duplication." + // */ + // testcase TC_NGAP_GNB_PDU_06() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_1_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_1_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_PDU_06()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_PDU_06 + + } // End of group PDU_Session_Resource_Release + //8.2.3 + group PDU_Session_Resource_Modify{ + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a PDU SESSION RESOURCE MODIFY REQUEST contains mandatory IEs and answers with PDU SESSION RESOURCE MODIFY RESPONSE for successfully modified PDU session." + // */ + // testcase TC_NGAP_GNB_PDU_07() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_1_3)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_1_3' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_PDU_07()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_PDU_07 + + // /** + // * @desc Test objective "Verify that the NG-RAN node reports the modification of the corresponding PDU session as failed if a PDU SESSION RESOURCE MODIFY REQUEST contains several PDU Session ID IEs set to the same value." + // */ + // testcase TC_NGAP_GNB_PDU_10() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_1_3)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_1_3' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_PDU_10()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_PDU_10 + + } // End of group PDU_Session_Resource_Modify + //8.2.4 + group PDU_Session_Resource_Notify{ + + // /** + // * @desc Test objective "Verify that the IUT can send a PDU_SESSION_RESOURCE_NOTIFY that already established QoS flow or PDU session for given UE are release." + // */ + // testcase TC_NGAP_GNB_PDU_08() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_1_4)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_1_4' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_PDU_08()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_PDU_08 + + } // End of group PDU_Session_Resource_Notify + //8.2.5 + group PDU_Session_Resource_Modify_Indication{ + + // /** + // * @desc Test objective "Verify that the IUT can send a PDU_SESSION_RESOURCE_MODIFY_INDICATION to request modification of established PDU session." + // */ + // testcase TC_NGAP_GNB_PDU_09() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_1_5)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_1_5' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_PDU_09()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_PDU_09 + + } // End of group PDU_Session_Resource_Modify_Indication + } // End of group PDU_Session_Management_Procedures + //8.3 + group UE_Context_Management_Procedures{ + //8.3.1 + group Initial_Context_Setup{ + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a INITIAL CONTEXT SETUP REQUEST contains optional PDU Session Resource Setup Request List field mandatory IEs and answers with INITIAL CONTEXT SETUP RESPONSE with successfully established UE context." + // */ + // testcase TC_NGAP_GNB_CMP_01() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_01()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_01 + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a INITIAL CONTEXT SETUP REQUEST contains mandatory IEs and answers with INITIAL CONTEXT SETUP RESPONSE with successfully established UE context." + // */ + // testcase TC_NGAP_GNB_CMP_02() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_02()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_02 + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a INITIAL CONTEXT SETUP REQUEST with optional field Trace Activation and answers with INITIAL CONTEXT SETUP RESPONSE with successfully established UE context." + // */ + // testcase TC_NGAP_GNB_CMP_03() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_03()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_03 + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a INITIAL CONTEXT SETUP REQUEST with optional field Mobility Restriction List and answers with INITIAL CONTEXT SETUP RESPONSE with successfully established UE context." + // */ + // testcase TC_NGAP_GNB_CMP_04() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_04()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_04 + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a INITIAL CONTEXT SETUP REQUEST with different optional fields and answers with INITIAL CONTEXT SETUP RESPONSE with successfully established UE context." + // */ + // testcase TC_NGAP_GNB_CMP_05() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_05()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_05 + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a INITIAL CONTEXT SETUP REQUEST contains mandatory IEs and answers with INITIAL CONTEXT SETUP RESPONSE with failed PDU session." + // */ + // testcase TC_NGAP_GNB_CMP_06() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_06()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_06 + + } // End of group Initial_Context_Setup + //8.3.2 + group UE_Context_Release_Request_NG_RAN_node_initiated{ + + /** + * @desc Test objective "Verify that the NG-RAN node successfully requests the AMF to release the UE-associated logical NG-connection." + */ + testcase TC_NGAP_GNB_CMP_07() runs on gNBNGAPComponent system TestAdapter { + + // Local variables + var gNBNGAPComponent v_ngap_amf; + + // Test control + if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_2)) { + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_2' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_gNB_Up(v_ngap_amf); + + // Start + v_ngap_amf.start(f_TC_NGAP_GNB_CMP_07()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_GNB_CMP_07 + + /** + * @desc Verify that the GNB successfully requests the AMF to release the UE-associated logical NG-connection after rejected registration procedure." + */ + testcase TC_NGAP_GNB_CMP_07_02() runs on gNBNGAPComponent system TestAdapter { + + // Local variables + var gNBNGAPComponent v_ngap_amf; + + // Test control + if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_2)) { + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_2' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_gNB_Up(v_ngap_amf); + + // Start + v_ngap_amf.start(f_TC_NGAP_GNB_CMP_07_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_GNB_CMP_07_02 + + } // End of group UE_Context_Release_Request_NG_RAN_node_initiated + //8.3.3 + group UE_Context_Release_AMF_initiated{ + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a UE CONTEXT RELEASE COMMAND that contains both the AMF UE NGAP ID IE and the RAN UE NGAP ID IE and answers with UE CONTEXT RELEASE COMPLETE with successfully release UE context."" + // */ + // testcase TC_NGAP_GNB_CMP_08() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_3)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_3' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_08()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_08 + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a UE CONTEXT RELEASE COMMAND where only the AMF UE NGAP ID IE is available and answers with UE CONTEXT RELEASE COMPLETE with successfully release UE context." + // */ + // testcase TC_NGAP_GNB_CMP_09() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_3)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_3' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_09()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_09 + + } // End of group UE_Context_Release_AMF_initiated + //8.3.4 + group UE_Context_Modification{ + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a UE CONTEXT MODIFICATION REQUEST contains mandatory IEs and answers with UE CONTEXT MODIFICATION FAILURE because the UE is no longer available." + // */ + // testcase TC_NGAP_GNB_CMP_10() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_4)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_4' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_10()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_10 + + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a UE CONTEXT MODIFICATION REQUEST contains mandatory IEs and answers with UE CONTEXT MODIFICATION RESPONSE with successfully modify UE context." + // */ + // testcase TC_NGAP_GNB_CMP_11() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_4)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_4' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_11()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_11 + + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a UE CONTEXT MODIFICATION REQUEST contains optional fields Security Key and Security Capabilities and answers with UE CONTEXT MODIFICATION RESPONSE with successfully modify UE context." + // */ + // testcase TC_NGAP_GNB_CMP_12() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_4)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_4' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_12()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_12 + + + // /** + // * @desc Test objective "Verify that the NG-RAN node successfully processes a UE CONTEXT MODIFICATION REQUEST contains different optional fields and answers with UE CONTEXT MODIFICATION RESPONSE with successfully modify UE context." + // */ + // testcase TC_NGAP_GNB_CMP_13() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_4)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_4' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_13()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_13 + + } // End of group UE_Context_Modification + //8.3.5 + group RRC_Inactive_Transition_Report{ + + // /** + // * @desc Test objective "Verify that the IUT can send a RRC INACTIVE TRANSITION REPORT that contains mandatory IEs" + // */ + // testcase TC_NGAP_GNB_CMP_14() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_5)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_5' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_14()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_14 + + } // End of group RRC_Inactive_Transition_Report + //8.3.6 + group Connection_Establishment_Indication{ + } // End of group Connection_Establishment_Indication + //8.3.7 + group AMF_CP_Relocation_Indication{ + } // End of group AMF_CP_Relocation_Indication + //8.3.8 + group RAN_CP_Relocation_Indication{ + + // /** + // * @desc Test objective "Verify that the IUT can send a RAN CP Relocation Indication that contains mandatory IEs" + // */ + // testcase TC_NGAP_GNB_CMP_15() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_8)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_8' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_15()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_15 + + } // End of group RAN_CP_Relocation_Indication + //8.3.9 + group Retrieve_UE_Information{ + } // End of group Retrieve_UE_Information + //8.3.10 + group UE_Information_Transfer{ + } // End of group UE_Information_Transfer + //8.3.11 + group UE_Context_Suspend{ + + // /** + // * @desc Test objective "Verify that the IUT can send a UE CONTEXT SUSPEND REQUEST contains mandatory IEs" + // */ + // testcase TC_NGAP_GNB_CMP_16() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_11)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_11' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_16()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_16 + } // End of group UE_Context_Suspend + //8.3.12 + group UE_Context_Resume{ + + // /** + // * @desc Test objective "Verify that the IUT can send a UE CONTEXT RESUME REQUEST contains mandatory IEs" + // */ + // testcase TC_NGAP_GNB_CMP_17() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_2_12)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_2_12' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CMP_17()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CMP_17 + + } // End of group UE_Context_Resume + } // End of group UE_Context_Management_Procedures + //8.4 + group UE_Mobility_Management_Procedures{ + //8.4.1 + group Handover_Preparation{ + + // /** + // * @desc Verify that the IUT can send a HANDOVER REQUIRED message containing mandatory IEs. + // */ + // testcase TC_NGAP_GNB_MMP_01() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_1_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_1_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_MMP_01()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_MMP_01 + + } // End of group Handover_Preparation + //8.4.2 + group Handover_Resource_Allocation{ + + // /** + // * @desc Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains mandatory IEs and answers with HANDOVER REQUEST ACKNOWLEDGE to acknowledge the handover. + // */ + // testcase TC_NGAP_GNB_MMP_02() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_3_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_3_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_MMP_02()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_MMP_02 + + // /** + // * @desc Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains mandatory IEs and answers with HANDOVER REQUEST FAILURE because the UE is not longer available. + // */ + // testcase TC_NGAP_GNB_MMP_03() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_3_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_3_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_MMP_03()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_MMP_03 + + // /** + // * @desc Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains optional IEs and answers with HANDOVER REQUEST ACKNOWLEDGE to acknowledge the handover. + // */ + // testcase TC_NGAP_GNB_MMP_04() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_3_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_3_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_MMP_04()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_MMP_04 + + // /** + // * @desc Verify that the GNB node successfully processes a HANDOVER REQUEST message that contains optional IEs within the Handover Request Transfer IEs and answers with correct HANDOVER REQUEST ACKNOWLEDGE. + // */ + // testcase TC_NGAP_GNB_MMP_05() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_3_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_3_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_MMP_05()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_MMP_05 + + // /** + // * @desc Verify that the GNB node successfully processes a HANDOVER REQUEST message for an intra-system handover and answers with HANDOVER REQUEST ACKNOWLEDGE to acknowledge the handover. + // */ + // testcase TC_NGAP_GNB_MMP_06() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_3_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_3_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_MMP_06()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_MMP_06 + + } // End of group Handover_Resource_Allocation + //8.4.3 + group Handover_Notification{ + + // /** + // * @desc Verify that the AMF node successfully sends a HANDOVER NOTIFICATION message that contains mandatory IEs to the AMF. + // */ + // testcase TC_NGAP_GNB_MMP_07() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_3_3)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_3_3' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_MMP_07()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_MMP_07 + + } // End of group Handover_Notification + //8.4.4 + group Path_Switch_Request{ + + // /** + // * @desc Verify that the AMF node successfully sends a PATH SWITCH REQUEST message that contains mandatory IEs to the AMF. + // */ + // testcase TC_NGAP_GNB_MMP_08() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_3_4)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_3_4' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_MMP_08()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_MMP_08 + + } // End of group Path_Switch_Request + //8.4.5 + group Handover_Cancellation{ + + // /** + // * @desc Verify that the NG-RAN node successfully send a UPLINK RAN STATUS TRANSFER message to the AMF. + // */ + // testcase TC_NGAP_GNB_MMP_09() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_3_5)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_3_5' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_MMP_09()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_MMP_09 + + } // End of group Handover_Cancellation + //8.4.6 + group Uplink_RAN_Status_Transfer{ + + // /** + // * @desc Verify that the NG-RAN node successfully send a UPLINK RAN STATUS TRANSFER message to the AMF. + // */ + // testcase TC_NGAP_GNB_MMP_10() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_3_6)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_3_6' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_MMP_10()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_MMP_10 + + } // End of group Uplink_RAN_Status_Transfer + //8.4.7 + group Downlink_RAN_Status_Transfer{ + } // End of group Downlink_RAN_Status_Transfer + //8.4.8 + group Handover_Success{ + } // End of group Handover_Success + //8.4.9 + group Uplink_RAN_Early_Status_Transfer{ + + // /** + // * @desc Verify that the NG-RAN node successfully sends a UPLINK RAN EARLY STATUS TRANSFER message to the AMF. + // */ + // testcase TC_NGAP_GNB_MMP_11() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_3_9)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_3_9' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_MMP_11()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_MMP_11 + + } // End of group Uplink_RAN_Early_Status_Transfer + //8.4.10 + group Downlink_RAN_Early_Status_Transfer{ + } // End of group Downlink_RAN_Early_Status_Transfer + } // End of group UE_Mobility_Management_Procedures + //8.5 + group Paging_Procedures{ + //8.5.1 + group Paging{ + } // End of group Paging + } // End of group Paging_Procedures + //8.6 + group Transport_of_NAS_Messages_Procedures{ + //8.6.1 + group Initial_UE_Message{ + + // /** + // * @desc Verify that the IUT can send an INITIAL UE MESSAGE to indicate the initiation of a NAS Transport procedure. + // */ + // testcase TC_NGAP_GNB_NAS_01() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_5_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_5_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_NAS_01()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_NAS_01 + + } // End of group Initial_UE_Message + //8.6.2 + group Downlink_NAS_Transport{ + } // End of group Downlink_NAS_Transport + //8.6.3 + group Uplink_NAS_Transport{ + + // /** + // * @desc Verify that the IUT can send an UPLINK NAS TRANSPORT message to the AMF. + // */ + // testcase TC_NGAP_GNB_NAS_02() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_5_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_5_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_NAS_02()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_NAS_02 + + } // End of group Uplink_NAS_Transport + //8.6.4 + group NAS_Non_Delivery_Indication{ + + // /** + // * @desc Verify that the IUT can send a NAS NON DELIVERY INDICATION message to the AMF. + // */ + // testcase TC_NGAP_GNB_NAS_03() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_5_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_5_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_NAS_03()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_NAS_03 + + } // End of group NAS_Non_Delivery_Indication + //8.6.5 + group Rerout_NAS_Request{ + } // End of group Rerout_NAS_Request + } // End of group Transport_of_NAS_Messages_Procedures + //8.7 + group Interface_Management_Procedures{ + //8.7.1 + group NG_Setup{ + } // End of group NG_Setup + //8.7.2 + group RAN_Configuration_Update{ + + /** + * @desc "Verify that the GNB sends an NG_SETUP_REQUEST message to the AMF after TNL establishment." + */ + testcase TC_NGAP_GNB_IMP_01() runs on gNBNGAPComponent system TestAdapter { + + // Local variables + var gNBNGAPComponent v_ngap_amf; + + // Test control + if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_6_4)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_6_4' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_gNB_Up(v_ngap_amf); + + // Start + v_ngap_amf.start(f_TC_NGAP_GNB_IMP_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_GNB_IMP_01 + + } // End of group RAN_Configuration_Update + //8.7.3 + group AMF_Configuration_Update{ + } // End of group AMF_Configuration_Update + //8.7.4 + group NG_Reset{ + + /** + * @desc "Verify that the GNB node successfully processes a NG RESET message that contains mandatory IEs and answers with NG RESET ACKNOWLEDGE to acknowledge the reset." + */ + testcase TC_NGAP_GNB_IMP_05() runs on gNBNGAPComponent system TestAdapter { + + // Local variables + var gNBNGAPComponent v_ngap_amf; + + // Test control + if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_6_4)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_6_4' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_gNB_Up(v_ngap_amf); + + // Start + v_ngap_amf.start(f_TC_NGAP_GNB_IMP_05()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_GNB_IMP_05 + + /** + * @desc "Verify that the GNB node successfully processes a NG RESET message that contains mandatory IEs and answers with NG RESET ACKNOWLEDGE to acknowledge the reset." + */ + testcase TC_NGAP_GNB_IMP_05_02() runs on gNBNGAPComponent system TestAdapter { + + // Local variables + var gNBNGAPComponent v_ngap_amf; + + // Test control + if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_6_4)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_6_4' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_gNB_Up(v_ngap_amf); + + // Start + v_ngap_amf.start(f_TC_NGAP_GNB_IMP_05_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_GNB_IMP_05_02 + + } // End of group NG_Reset + //8.7.5 + group Error_Indication{ + } // End of group Error_Indication + //8.7.6 + group AMF_Status_Indication{ + } // End of group AMF_Status_Indication + //8.7.7 + group Overload_Start{ + } // End of group Overload_Start + //8.7.8 + group Overload_Stop{ + } // End of group Overload_Stop + } // End of group Interface_Management_Procedures + //8.8 + group Configuration_Transfer_Procedures{ + //8.8.1 + group Uplink_RAN_Configuration_Transfer{ + + // /** + // * @desc Verify that the IUT can send an Uplink RAN Configuration Transfer message to transfer RAN configuration information to the AMF. + // */ + // testcase TC_NGAP_GNB_CTP_01() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_7_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_7_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_CTP_01()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_CTP_01 + + } // End of group Uplink_RAN_Configuration_Transfer + //8.8.2 + group Downlink_RAN_Configuration_Transfer{ + + // /** + // * @desc Verify that the IUT can send an DOWNLINK RAN CONFIGURATION TRANSFER message to transfer RAN configuration information to the NG-RAN. + // */ + // testcase TC_NGAP_AMF_CTP_01() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_gnb; + + // // Test control + // if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_7_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_7_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_gnb); + + // // Start + // v_ngap_gnb.start(f_TC_NGAP_AMF_CTP_01()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + // } // End of testcase TC_NGAP_AMF_CTP_01 + + } // End of group Downlink_RAN_Configuration_Transfer + } // End of group Configuration_Transfer_Procedures + //8.9 + group Warning_Message_Transmission_Procedures{ + + //8.9.1 + group Write_Replace_Warning{ + + // /** + // * @desc Verify that the NG-RAN node successfully processes a WRITE-REPLACE WARNING REQUEST containing mandatory IEs and answers with WRITE-REPLACE WARNING RESPONSE to start broadcasting of warning messages. + // */ + // testcase TC_NGAP_GNB_WTP_01() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_8_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_8_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_WTP_01()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_WTP_01 + + // /** + // * @desc "Verify that the NG-RAN node successfully processes a WRITE-REPLACE WARNING REQUEST containing Message Identifier IE and/or Serial Number IE different from those in the warning message being broadcast and if Concurent Warning Message Indicator is not present then IUT node answers with WRITE-REPLACE WARNING RESPONSE and replaces the warning message being broadcast with newly received one for that area." + // */ + // testcase TC_NGAP_GNB_WTP_02() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_8_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_8_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_WTP_02()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_WTP_02 + + } // End of group Write_Replace_Warning + //8.9.2 + group PWS_Cancel{ + + // /** + // * @desc "Verify that the NG-RAN node successfully processes a PWS CANCEL REQUEST containing mandatory IEs and answers with PWS CANCEL RESPONSE to cancel an already ongoing broadcast warning messages in all of the cells in the NG-RAN." + // */ + // testcase TC_NGAP_GNB_WTP_03() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_8_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_8_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_WTP_03()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_WTP_03 + + } // End of group PWS_Cancel + //8.9.3 + group PWS_Restart_Indication{ + + // /** + // * @desc "Verify that the IUT can send a PWS RESTART INDICATION to inform AMF that PWS information for some or all cells may be reloaded from the CBC if needed." + // */ + // testcase TC_NGAP_GNB_WTP_04() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_8_3)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_8_3' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_WTP_04()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_WTP_04 + + } // End of group PWS_Restart_Indication + //8.9.4 + group PWS_Failure_Indication{ + + // /** + // * @desc "Verify that the IUT can send a PWS FAILURE INDICATION to inform AMF that ongoing PWS operation for one or more cells has failed." + // */ + // testcase TC_NGAP_GNB_WTP_05() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_8_4)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_8_4' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_WTP_05()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_WTP_05 + + } // End of group PWS_Failure_Indication + } // End of group Warning_Message_Transmission_Procedures + + //8.10 + group NRPPa_Transport_Procedures{ + + // /** + // * @desc "Verify that the IUT can send a UPLINK_UE_ASSOCIATED_NRPPA_TRANSPORT to carry NRPPA signaling between NG-RAN and LMF(Location Management Functionality)." + // */ + // testcase TC_NGAP_GNB_NTP_01() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_9_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_9_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_NTP_01()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_NTP_01 + + // /** + // * @desc "Verify that the IUT can send a UPLINK_NON_UE_ASSOCIATED_NRPPA_TRANSPORT to carry NRPPA signaling between NG-RAN and LMF(Location Management Functionality)." + // */ + // testcase TC_NGAP_GNB_NTP_02() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_9_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_9_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_NTP_02()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_NTP_02 + + } // End of group NRPPa_Transport_Procedures + //8.11 + group Trace_Procedures{ + //8.11.1 + group Trace_Start{ + + // /** + // * @desc Test objective "Verify that the IUT can send a TRACE_FAILURE_INDICATION to inform AMF that Trace Start procedure has failed due to an interaction with handover procedure." + // */ + // testcase TC_NGAP_GNB_TRP_01() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_10_1) and (not PICS_A3_10_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_10_1 and PICS_A3_10_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_TRP_01()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_TRP_01 + + } // End of group Trace_Start + //8.11.2 + group Trace_Failure_Indication{ + } // End of group Trace_Failure_Indication + //8.11.3 + group Deactivate_Trace{ + + // /** + // * @desc Test objective "Verify that the IUT can send a TRACE_FAILURE_INDICATION to inform AMF that a Deactivate Trace procedure has failed due to an interaction with handover procedure." + // */ + // testcase TC_NGAP_GNB_TRP_02() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_10_2) and (not PICS_A3_10_3)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_10_2 and PICS_A3_10_3' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_TRP_02()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_TRP_02 + + } // End of group Deactivate_Trace + //8.11.4 + group Cell_Traffic_Trace{ + + // /** + // * @desc Test objective "Verify that the IUT can send a CELL_TRAFFIC_TRACE to send the allocated Trace Recording Session Reference and Trace Reference to AMF." + // */ + // testcase TC_NGAP_GNB_TRP_03() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_10_4)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_10_4' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_TRP_03()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_TRP_03 + + } // End of group Cell_Traffic_Trace + } // End of group Trace_Procedures + //8.12 + group Location_Reporting_Procedures{ + //8.12.1 + group Location_Reporting_Control{ + } // End of group Location_Reporting_Control + //8.12.2 + group Location_Reporting_Failure_Indication{ + + // /** + // * @desc "Verify that the IUT can send a LOCATION REPORTING FAILURE INDICATION message after that contains mandatory IEs receiving a LOCATION REPORTING CONTROL message with two identical Location Reporting Reference IDs." + // */ + // testcase TC_NGAP_GNB_LRP_01() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_11_3)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_11_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_LRP_01()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_LRP_01 + + } // End of group Location_Reporting_Failure_Indication + //8.12.3 + group Location_Report{ + + // /** + // * @desc "Verify that the IUT can send a LOCATION REPORT message that contains mandatory IEs to provide the UE's current location." + // */ + // testcase TC_NGAP_GNB_LRP_02() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_11_3)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_11_3' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_LRP_02()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_LRP_02 + + } // End of group Location_Report + } // End of group Location_Reporting_Procedures + //8.13 + group UE_TNLA_Binding_Procedures{ + //8.13.1 + group UE_TNLA_Binding_Release{ + } // End of group UE_TNLA_Binding_Release + } // End of group UE_TNLA_Binding_Procedures + //8.14 + group UE_Radio_Capability_Management_Procedures{ + //8.14.1 + group UE_Radio_Capability_Info_Indication{ + + /** + * @desc Test objective "Verify that the IUT can send a UE_RADIO_CAPABILITY_INFO_INDICATION." + */ + testcase TC_NGAP_GNB_URP_01() runs on gNBNGAPComponent system TestAdapter { + + // Local variables + var gNBNGAPComponent v_ngap_amf; + + // Test control + if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_13_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_13_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_gNB_Up(v_ngap_amf); + + // Start + v_ngap_amf.start(f_TC_NGAP_GNB_URP_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_GNB_URP_01 + + } // End of group UE_Radio_Capability_Info_Indication + //8.14.2 + group UE_Radio_Capability_Check{ + + // /** + // * @desc Test objective "Verify that the IUT can send a UE RADIO CAPABILITY CHECK RESPONSE message that contains mandatory IEs to provide the UE radio capabilities." + // */ + // testcase TC_NGAP_GNB_URP_02() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_13_2)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_13_2' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_URP_02()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_URP_02 + + } // End of group UE_Radio_Capability_Check + //8.14.3 + group UE_Radio_Capability_ID_Mapping{ + + // /** + // * @desc Test objective "Verify that the IUT can send a UE RADIO CAPABILITY ID MAPPING REQUEST." + // */ + // testcase TC_NGAP_GNB_URP_03() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_13_3)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_13_3' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_URP_03()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_URP_03 + + } // End of group UE_Radio_Capability_ID_Mapping + } // End of group UE_Radio_Capability_Management_Procedures + //8.15 + group Data_Usage_Reporting_Procedures{ + //8.15.1 + group Secondary_RAT_Data_Usage_Report{ + + // /** + // * @desc Test objective "Verify that the IUT can send a SECONDARY RAT DATA USAGE REPORT." + // */ + // testcase TC_NGAP_GNB_DRP_01() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_14_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_14_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_DRP_01()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_DRP_01 + + } // End of group Secondary_RAT_Data_Usage_Report + } // End of group Data_Usage_Reporting_Procedures + //8.16 + group RIM_Information_Transfer_Procedures{ + //8.16.1 + group Uplink_RIM_Information_Transfer{ + + // /** + // * @desc Test objective "Verify that the IUT can send a UPLINK RIM INFORMATION TRANSFER." + // */ + // testcase TC_NGAP_GNB_RIP_01() runs on gNBNGAPComponent system TestAdapter { + + // // Local variables + // var gNBNGAPComponent v_ngap_amf; + + // // Test control + // if ((not PICS_NGAP_GNB_IUT) and (not PICS_A3_15_1)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_GNB_IUT and PICS_A3_15_1' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_gNB_Up(v_ngap_amf); + + // // Start + // v_ngap_amf.start(f_TC_NGAP_GNB_RIP_01()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_GNB_RIP_01 + + } // End of group Uplink_RIM_Information_Transfer + //8.16.2 + group Downlink_RIM_Information_Transfer{ + } // End of group Downlink_RIM_Information_Transfer + } // End of group RIM_Information_Transfer_Procedures + } // End of group gNB_Role + + group aMF_Role{ + //8.2 + group PDU_Session_Management_Procedures{ + //8.2.1 + group PDU_Session_Resource_Setup{ + + /** + * @desc "Verify that the IUT can send a PDU SESSION RESOURCE SETUP REQUEST with at least one PDU session resource list to established PDU session." + */ + testcase TC_NGAP_AMF_PDU_01() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_1_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_1_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_PDU_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_PDU_01 + + /** + * @desc "Verify that the IUT successfully receives and processes the PDU_SESSION_RESOURCE_SETUP_RESPONSE message and completes the PDU Session Resource Setup procedure for a single PDU_Session_Resource." + */ + testcase TC_NGAP_AMF_PDU_01_02() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_1_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_1_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_PDU_01_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_PDU_01_02 + + } // End of group PDU_Session_Resource_Setup + //8.2.2 + group PDU_Session_Resource_Release{ + + /** + * @desc "Verify that the IUT can send a PDU_SESSION_RESOURCE_RELEASE_COMMAND to release PDU session." + */ + testcase TC_NGAP_AMF_PDU_02() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_1_2)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_1_2' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_PDU_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_PDU_02 + + /** + * @desc "Verify that the IUT successfully receives and processes the PDU_SESSION_RESOURCE_RELEASE_RESPONSE message and completes the PDU Session Resource Release procedure for a single PDU_Session_Resource." + */ + testcase TC_NGAP_AMF_PDU_02_02() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_1_2)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_1_2' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_PDU_02_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_PDU_02_02 + + } // End of group PDU_Session_Resource_Release + //8.2.3 + group PDU_Session_Resource_Modify{ + + /** + * @desc "Verify that the IUT can send a PDU_SESSION_RESOURCE_MODIFY_REQUEST to modify PDU session." + */ + testcase TC_NGAP_AMF_PDU_03() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_1_3)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_1_3' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_PDU_03()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_PDU_03 + + } // End of group PDU_Session_Resource_Modify + //8.2.4 + group PDU_Session_Resource_Notify{ + } // End of group PDU_Session_Resource_Notify + //8.2.5 + group PDU_Session_Resource_Modify_Indication{ + + /** + * @desc "Verify that the AMF node successfully processes a PDU_SESSION_RESOURCE_MODIFY_INDICATION contains mandatory IEs and answers with PDU_SESSION_RESOURCE_MODIFY_CONFIRM for successfully modified PDU session." + */ + testcase TC_NGAP_AMF_PDU_04() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_1_5)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_1_5' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_PDU_04()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_PDU_04 + + /** + * @desc "Verify that the AMF node processes a PDU_SESSION_RESOURCE_MODIFY_INDICATION contains mandatory IEs and answers with PDU_SESSION_RESOURCE_MODIFY_CONFIRM for not successfully modified PDU session." + */ + testcase TC_NGAP_AMF_PDU_05() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_1_5)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_1_5' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_PDU_05()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_PDU_05 + + } // End of group PDU_Session_Resource_Modify_Indication + } // End of group PDU_Session_Management_Procedures + //8.3 + group UE_Context_Management_Procedures{ + //8.3.1 + group Initial_Context_Setup{ + + /** + * @desc "Verify the IUT correctly sets the UE Context after Authentication and Security procedure has been executed." + */ + testcase TC_NGAP_AMF_CMP_01() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_2_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_2_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_CMP_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_CMP_01 + + } // End of group Initial_Context_Setup + //8.3.2 + group UE_Context_Release_Request_NG_RAN_node_initiated{ + } // End of group UE_Context_Release_Request_NG_RAN_node_initiated + //8.3.3 + group UE_Context_Release_AMF_initiated{ + + /** + * @desc "Verify that the IUT can send a UE CONTEXT RELEASE COMMAND that contains both the AMF_UE_NGAP_ID IE and the RAN_UE_NGAP_ID IE or only AMF_UE_NGAP_ID." + */ + testcase TC_NGAP_AMF_CMP_02() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_2_3)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_2_3' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_CMP_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_CMP_02 + + /** + * @desc "Verify that the IUT sends a UE CONTEXT RELEASE COMMAND after UE_CONTEXT_RELEASE_REQUEST to release the UE-associated logic NG-connection due to NG-RAN node generated reasons." + */ + testcase TC_NGAP_AMF_CMP_03() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_2_3)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_2_3' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_CMP_03()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_CMP_03 + + } // End of group UE_Context_Release_AMF_initiated + //8.3.4 + group UE_Context_Modification{ + + /** + * @desc "Verify that the IUT can send a UE CONTEXT MODIFICATION REQUEST containing mandatory IEs." + */ + // testcase TC_NGAP_AMF_CMP_04() runs on aMFNGAPComponent system TestAdapter { + + // // Local variables + // var aMFNGAPComponent v_ngap_gnb; + + // // Test control + // if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_2_4)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_2_4' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // // Start + // v_ngap_gnb.start(f_TC_NGAP_AMF_CMP_04()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_AMF_CMP_04 + + } // End of group UE_Context_Modification + //8.3.5 + group RRC_Inactive_Transition_Report{ + } // End of group RRC_Inactive_Transition_Report + //8.3.6 + group Connection_Establishment_Indication{ + + /** + * @desc "Verify that the IUT can send a CONNECTION ESTABLISHMENT INDICATION that contains mandatory IEs." + */ + // testcase TC_NGAP_AMF_CMP_05() runs on aMFNGAPComponent system TestAdapter { + + // // Local variables + // var aMFNGAPComponent v_ngap_gnb; + + // // Test control + // if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_2_6)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_2_6' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // // Start + // v_ngap_gnb.start(f_TC_NGAP_AMF_CMP_05()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_AMF_CMP_05 + + } // End of group Connection_Establishment_Indication + //8.3.7 + group AMF_CP_Relocation_Indication{ + + /** + * @desc "Verify that the IUT can send an AMF CP RELOCATION INDICATION that contains mandatory IEs." + */ + // testcase TC_NGAP_AMF_CMP_06() runs on aMFNGAPComponent system TestAdapter { + + // // Local variables + // var aMFNGAPComponent v_ngap_gnb; + + // // Test control + // if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_2_7)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_2_6' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // // Start + // v_ngap_gnb.start(f_TC_NGAP_AMF_CMP_06()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_AMF_CMP_06 + + } // End of group AMF_CP_Relocation_Indication + //8.3.8 + group RAN_CP_Relocation_Indication{ + } // End of group RAN_CP_Relocation_Indication + //8.3.9 + group Retrieve_UE_Information{ + + /** + * @desc "Verify that the IUT can successfully request UE information from the AMF." + */ + // testcase TC_NGAP_AMF_CMP_07() runs on aMFNGAPComponent system TestAdapter { + + // // Local variables + // var aMFNGAPComponent v_ngap_gnb; + + // // Test control + // if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_2_10)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_2_10' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // // Start + // v_ngap_gnb.start(f_TC_NGAP_AMF_CMP_07()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_AMF_CMP_07 + + } // End of group Retrieve_UE_Information + //8.3.10 + group UE_Information_Transfer{ + } // End of group UE_Information_Transfer + //8.3.11 + group UE_Context_Suspend{ + + /** + * @desc "Verify that the AMF node successfully processes a UE CONTEXT SUSPEND REQUEST contains mandatory IEs and answers with UE CONTEXT SUSPEND REQUEST RESPONSE with successfully suspend UE context." + */ + // testcase TC_NGAP_AMF_CMP_08() runs on aMFNGAPComponent system TestAdapter { + + // // Local variables + // var aMFNGAPComponent v_ngap_gnb; + + // // Test control + // if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_2_11)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_2_11' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // // Start + // v_ngap_gnb.start(f_TC_NGAP_AMF_CMP_08()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_AMF_CMP_08 + + /** + * @desc "Verify that the AMF node successfully processes a UE CONTEXT SUSPEND REQUEST contains mandatory IEs and answers with UE CONTEXT SUSPEND FAILURE with failed suspension." + */ + // testcase TC_NGAP_AMF_CMP_09() runs on aMFNGAPComponent system TestAdapter { + + // // Local variables + // var aMFNGAPComponent v_ngap_gnb; + + // // Test control + // if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_2_11)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_2_11' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // // Start + // v_ngap_gnb.start(f_TC_NGAP_AMF_CMP_09()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_AMF_CMP_09 + + } // End of group UE_Context_Suspend + //8.3.12 + group UE_Context_Resume{ + + /** + * @desc "Verify that the AMF node successfully processes a UE CONTEXT RESUME REQUEST containing mandatory IEs and answers with UE CONTEXT RESUME RESPONSE with successfully resume UE context." + */ + // testcase TC_NGAP_AMF_CMP_10() runs on aMFNGAPComponent system TestAdapter { + + // // Local variables + // var aMFNGAPComponent v_ngap_gnb; + + // // Test control + // if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_2_12)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_2_12' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // // Start + // v_ngap_gnb.start(f_TC_NGAP_AMF_CMP_10()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_AMF_CMP_10 + + /** + * @desc "Verify that the AMF node successfully processes a UE CONTEXT RESUME REQUEST containing mandatory IEs and answers with UE CONTEXT RESUME FAILURE with failing to resume UE context." + */ + // testcase TC_NGAP_AMF_CMP_11() runs on aMFNGAPComponent system TestAdapter { + + // // Local variables + // var aMFNGAPComponent v_ngap_gnb; + + // // Test control + // if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_2_12)){ + // log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_2_12' shall be set to true for executing the TC. ***"); + // stop; + // } + + // // Test component configuration + // f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // // Start + // v_ngap_gnb.start(f_TC_NGAP_AMF_CMP_11()); + + // // synchronize PTC on 1 sychronization points + // f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + // f_cf_Down/*gNBoraMF*/(); + + // } // End of testcase TC_NGAP_AMF_CMP_11 + + } // End of group UE_Context_Resume + } // End of group UE_Context_Management_Procedures + //8.4 + group UE_Mobility_Management_Procedures{ + //8.4.1 + group Handover_Preparation{ + + /** + * @desc "Verify that the AMF node successfully processes a HANDOVER REQUIRED message contains mandatory IEs and answers with HANDOVER COMMAND with successfully handover." + */ + testcase TC_NGAP_AMF_MMP_01() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_3_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_3_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_MMP_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_MMP_01 + + /** + * @desc "Verify that the AMF node successfully processes a HANDOVER REQUIRED message contains mandatory IEs and answers with HANDOVER PREPARATION FAILURE because the UE is not longer available." + */ + testcase TC_NGAP_AMF_MMP_02() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_3_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_3_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_MMP_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_MMP_02 + + } // End of group Handover_Preparation + //8.4.2 + group Handover_Resource_Allocation{ + + /** + * @desc "Verify that the AMF node successfully sends a HANDOVER REQUEST message that contains mandatory IEs to the GNB." + */ + testcase TC_NGAP_AMF_MMP_03() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_3_2)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_3_2' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_MMP_03()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_MMP_03 + + } // End of group Handover_Resource_Allocation + //8.4.3 + group Handover_Notification{ + } // End of group Handover_Notification + //8.4.4 + group Path_Switch_Request{ + + /** + * @desc "Verify that the AMF node successfully processes a PATH SWITCH REQUEST message that contains mandatory IEs and answers with PATH SWITCH REQUEST ACKNOWLEDGE to acknowledge the path switch." + */ + testcase TC_NGAP_AMF_MMP_04() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_3_4)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_3_4' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_MMP_04()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_MMP_04 + + /** + * @desc "Verify that the AMF node successfully processes a PATH SWITCH REQUEST message that contains mandatory IEs and two PDU Sessions with same ID and answers with PATH SWITCH REQUEST FAILURE." + */ + testcase TC_NGAP_AMF_MMP_05() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_3_4)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_3_4' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_MMP_05()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_MMP_05 + + } // End of group Path_Switch_Request + //8.4.5 + group Handover_Cancellation{ + + /** + * @desc "Verify that the AMF node successfully processes a HANDOVER CANCEL message that contains mandatory IEs and answers with HANDOVER CANCEL ACKNOWLEDGE to confirm that the ongoing handover was cancelled." + */ + testcase TC_NGAP_AMF_MMP_06() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_3_5)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_3_5' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_MMP_06()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_MMP_06 + + } // End of group Handover_Cancellation + //8.4.6 + group Uplink_RAN_Status_Transfer{ + } // End of group Uplink_RAN_Status_Transfer + //8.4.7 + group Downlink_RAN_Status_Transfer{ + + /** + * @desc "Verify that the AMF node successfully sends a DOWNLINK RAN STATUS TRANSFER message that contains mandatory IEs." + */ + testcase TC_NGAP_AMF_MMP_07() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_3_6)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_3_6' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_MMP_07()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_MMP_07 + + } // End of group Downlink_RAN_Status_Transfer + //8.4.8 + group Handover_Success{ + + /** + * @desc "Verify that the NG-RAN node successfully sends a Handover Success message to the AMF." + */ + testcase TC_NGAP_AMF_MMP_08() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A3_3_8)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A3_3_8' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_MMP_08()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_MMP_08 + + } // End of group Handover_Success + //8.4.9 + group Uplink_RAN_Early_Status_Transfer{ + } // End of group Uplink_RAN_Early_Status_Transfer + //8.4.10 + group Downlink_RAN_Early_Status_Transfer{ + + /** + * @desc "Verify that the AMF node successfully sends a DOWNLINK RAN EARLY STATUS TRANSFER message that contains mandatory IEs." + */ + testcase TC_NGAP_AMF_MMP_09() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_3_9)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_3_9' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_MMP_09()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_MMP_09 + + } // End of group Downlink_RAN_Early_Status_Transfer + + } // End of group UE_Mobility_Management_Procedures + //8.5 + group Paging_Procedures{ + //8.5.1 + group Paging{ + + /** + * @desc "Verify that the IUT can send a PAGING message to enable the AMF to page a UE." + */ + testcase TC_NGAP_aMF_PAG_01() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_4_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_4_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_PAG_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + } // End of testcase TC_NGAP_aMF_PAG_01 + + } // End of group Paging + } // End of group Paging_Procedures + //8.6 + group Transport_of_NAS_Messages_Procedures{ + //8.6.1 + group Initial_UE_Message{ + } // End of group Initial_UE_Message + //8.6.2 + group Downlink_NAS_Transport{ + + /** + * @desc "Verify that the IUT can send an DOWNLINK NAS TRANSPORT message to carry NAS information over the NG interface." + */ + testcase TC_NGAP_AMF_NAS_01() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_5_2)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_5_2' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_NAS_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_NAS_01 + + } // End of group Downlink_NAS_Transport + //8.6.3 + group Uplink_NAS_Transport{ + } // End of group Uplink_NAS_Transport + //8.6.4 + group NAS_Non_Delivery_Indication{ + } // End of group NAS_Non_Delivery_Indication + } // End of group Transport_of_NAS_Messages_Procedures + //8.7 + group Interface_Management_Procedures{ + //8.7.1 + group NG_Setup{ + + /** + * @desc "Verify that the AMF node successfully processes a NG SETUP REQEST message that contains mandatory IEs and answers with NG SETUP RESPONSE to acknowledge the setup." + */ + testcase TC_NGAP_AMF_IMP_01() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_01 + + /** + * @desc "Verify that the AMF node successfully processes an NG_SETUP_REQUEST message containing the PLMN identity, TAC, supported slice IEs and Extended RAN Node Name, and responds with an NG_SETUP_RESPONSE message to acknowledge the setup." + */ + testcase TC_NGAP_AMF_IMP_01_02() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_01_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_01_02 + + /** + * @desc "# Verify that the AMF with IAB support successfully processes an NG_SETUP_REQUEST message containing the PLMN identity, TAC and supported slice IEs, and responds with an NG_SETUP_RESPONSE message containing IAB Supported IE to acknowledge the setup." + */ + testcase TC_NGAP_AMF_IMP_01_03() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_1) and (not PICS_A4_6_1_2)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_1 and PICS_A4_6_1_2' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_01_03()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_01_03 + + /** + * @desc "Verify that the AMF node successfully decline a NG RESET REQEST message and answers with NG SETUP FAILURE when the AMF is not able to handle the request." + */ + testcase TC_NGAP_AMF_IMP_02() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_02 + + /** + * @desc "Verify that the AMF node successfully processes a NG SETUP REQEST message with optional field UE Retention Information and answers with NG SETUP RESPONSE to acknowledge the setup." + */ + testcase TC_NGAP_AMF_IMP_03() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_03()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_03 + + /** + * @desc "Verify that the AMF node successfully processes an NG_SETUP_REQUEST message including the appropriate data and answers with NG_SETUP_RESPONSE to acknowledge the setup." + */ + testcase TC_NGAP_AMF_IMP_04() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_04()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_04 + + } // End of group NG_Setup + //8.7.2 + group RAN_Configuration_Update{ + + /** + * @desc "Verify that the AMF node successfully processes a RAN_CONFIGURATION_UPDATE message containing new slice with RAN_CONFIGURATION_UPDATE_ACKNOWLEDGE to acknowledge the update with supported slice at AMF." + */ + testcase TC_NGAP_AMF_IMP_05() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_2)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_2' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_05()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_05 + + /** + * @desc "Verify that the AMF node successfully declines a RAN CONFIGURATION UPDATE message with RAN CONFIGURATION UPDATE FAILURE when the AMF is not able to handle the request." + */ + testcase TC_NGAP_AMF_IMP_06() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_2)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_2' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_06()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_06 + + } // End of group RAN_Configuration_Update + //8.7.3 + group AMF_Configuration_Update{ + + /** + * @desc "Verify that the IUT can send a AMF CONFIGURATION UPDATE message to the AMF." + */ + testcase TC_NGAP_AMF_IMP_07() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_3)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_3' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_07()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_07 + + } // End of group AMF_Configuration_Update + //8.7.4 + group NG_Reset{ + + /** + * @desc "Verify that the AMF node successfully processes a NG RESET message that contains mandatory IEs and answers with NG RESET ACKNOWLEDGE to acknowledge the reset." + */ + testcase TC_NGAP_AMF_IMP_08() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_4)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_4' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_08()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_08 + + /** + * @desc "Verify that the AMF node successfully processes a partial NG_RESET message and answers with NG_RESET_ACKNOWLEDGE to acknowledge the partial reset." + */ + testcase TC_NGAP_AMF_IMP_08_02() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_4)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_4' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_08_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_08_02 + + } // End of group NG_Reset + //8.7.5 + group Error_Indication{ + + /** + * @desc "Verify that the AMF can send a ERROR INDICATION to the GNB when a error occurs." + */ + testcase TC_NGAP_AMF_IMP_09() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_5)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_5' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_09()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_09 + + } // End of group Error_Indication + //8.7.6 + group AMF_Status_Indication{ + + /** + * @desc "Verify that the AMF can send a AMF STATUS INDICATION to the GNB when a error occurs." + */ + testcase TC_NGAP_AMF_IMP_10() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_6)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_6' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_10()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_10 + + } // End of group AMF_Status_Indication + //8.7.7 + group Overload_Start{ + + /** + * @desc "Verify that the AMF can send a OVERLOAD START to the GNB." + */ + testcase TC_NGAP_AMF_IMP_11() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_7)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_7' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_11()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_11 + + } // End of group Overload_Start + //8.7.8 + group Overload_Stop{ + + /** + * @desc "Verify that the AMF can send a OVERLOAD STOP to the GNB." + */ + testcase TC_NGAP_AMF_IMP_12() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_6_8)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_6_8' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_IMP_12()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_IMP_12 + + } // End of group Overload_Stop + } // End of group Interface_Management_Procedures + //8.8 + group Configuration_Transfer_Procedures{ + //8.8.1 + group Uplink_RAN_Configuration_Transfer{ + } // End of group Uplink_RAN_Configuration_Transfer + //8.8.2 + group Downlink_RAN_Configuration_Transfer{ + } // End of group Downlink_RAN_Configuration_Transfer + } // End of group Configuration_Transfer_Procedures + //8.9 + group Warning_Message_Transmission_Procedures{ + //8.9.1 + group Write_Replace_Warning{ + + /** + * @desc "Verify that the IUT can send a WRITE REPLACE WARNING REQUEST to start broadcasting of warning messages." + */ + testcase TC_NGAP_AMF_WTP_01() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_8_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_8_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_WTP_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_WTP_01 + + } // End of group Write_Replace_Warning + //8.9.2 + group PWS_Cancel{ + + /** + * @desc "Verify that the IUT can send a PWS CANCEL REQUEST to cancel broadcasting of warning messages." + */ + testcase TC_NGAP_AMF_WTP_02() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_8_2)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_8_2' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_WTP_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_WTP_02 + + } // End of group PWS_Cancel + //8.9.3 + group PWS_Restart_Indication{ + } // End of group PWS_Restart_Indication + //8.9.4 + group PWS_Failure_Indication{ + } // End of group PWS_Failure_Indication + } // End of group Warning_Message_Transmission_Procedures + //8.10 + group NRPPa_Transport_Procedures{ + + /** + * @desc "Verify that the IUT can send a DOWNLINK UE ASSOCIATED NRPPA TRANSPORT to carry NRPPA signaling between NG-RAN and LMF(Location Management Functionality)." + */ + testcase TC_NGAP_AMF_NTP_01() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_9_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_9_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_NTP_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_NTP_01 + + /** + * @desc "Verify that the IUT can send a DOWNLINK_NON_UE_ASSOCIATED_NRPPA_TRANSPORT to carry NRPPA signaling between NG-RAN and LMF(Location Management Functionality)." + */ + testcase TC_NGAP_AMF_NTP_02() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_9_3)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_9_3' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_NTP_02()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } // End of testcase TC_NGAP_AMF_NTP_02 + + } // End of group NRPPa_Transport_Procedures + //8.11 + group Trace_Procedures{ + //8.11.1 + group Trace_Start{ + } // End of group Trace_Start + //8.11.2 + group Trace_Failure_Indication{ + } // End of group Trace_Failure_Indication + //8.11.3 + group Deactivate_Trace{ + } // End of group Deactivate_Trace + //8.11.4 + group Cell_Traffic_Trace{ + } // End of group Cell_Traffic_Trace + } // End of group Trace_Procedures + //8.12 + group Location_Reporting_Procedures{ + //8.12.1 + group Location_Reporting_Control{ + + /** + * @desc "Verify that the IUT can send a LOCATION REPORTING CONTROL message that contains mandatory IEs to request a report of the UE's current location." + */ + testcase TC_NGAP_AMF_LRP_01() runs on aMFNGAPComponent system TestAdapter { + + // Local variables + var aMFNGAPComponent v_ngap_gnb; + + // Test control + if ((not PICS_NGAP_AMF_IUT) and (not PICS_A4_11_1)){ + log("*** " & __SCOPE__ & ": ERROR: 'PICS_NGAP_AMF_IUT and PICS_A4_11_1' shall be set to true for executing the TC. ***"); + stop; + } + + // Test component configuration + f_cf_NGAP_aMF_Up(v_ngap_gnb); + + // Start + v_ngap_gnb.start(f_TC_NGAP_AMF_LRP_01()); + + // synchronize PTC on 1 sychronization points + f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); + + f_cf_Down/*gNBoraMF*/(); + + } + } // End of group Location_Reporting_Control + //8.12.2 + group Location_Reporting_Failure_Indication{ + } // End of group Location_Reporting_Failure_Indication + //8.12.3 + group Location_Report{ + } // End of group Location_Report + } // End of group Location_Reporting_Procedures + //8.13 + group UE_TNLA_Binding_Procedures{ + //8.13.1 + group UE_TNLA_Binding_Release{ + } // End of group UE_TNLA_Binding_Release + } // End of group UE_TNLA_Binding_Procedures + //8.14 + group UE_Radio_Capability_Management_Procedures{ + //8.14.1 + group UE_Radio_Capability_Info_Indication{ + } // End of group UE_Radio_Capability_Info_Indication + //8.14.2 + group UE_Radio_Capability_Check{ + } // End of group UE_Radio_Capability_Check + //8.14.3 + group UE_Radio_Capability_ID_Mapping{ + } // End of group UE_Radio_Capability_ID_Mapping + } // End of group UE_Radio_Capability_Management_Procedures + //8.15 + group Data_Usage_Reporting_Procedures{ + //8.15.1 + group Secondary_RAT_Data_Usage_Report{ + } // End of group Secondary_RAT_Data_Usage_Report + } // End of group Data_Usage_Reporting_Procedures + //8.16 + group RIM_Information_Transfer_Procedures{ + //8.16.1 + group Uplink_RIM_Information_Transfer{ + } // End of group Uplink_RIM_Information_Transfer + //8.16.2 + group Downlink_RIM_Information_Transfer{ + } // End of group Downlink_RIM_Information_Transfer + } // End of group RIM_Information_Transfer_Procedures + } // End of group aMF_Role + +} // End of module NGAP_TestCases diff --git a/ttcn/AtsNGAP/NGAP_TestConfiguration.ttcn b/ttcn/AtsNGAP/NGAP_TestConfiguration.ttcn index d30f0d5b77f6da91fcf2de671e94879ea4192bb7..22ad28a58420bfc34d9cb2f24eec202ad68529cc 100644 --- a/ttcn/AtsNGAP/NGAP_TestConfiguration.ttcn +++ b/ttcn/AtsNGAP/NGAP_TestConfiguration.ttcn @@ -1,5 +1,5 @@ /** -* @author ETSI / TTF033 +* @author ETSI / TTF T033, T048 * @version $URL$ * $Id$ * @desc This module provides test configuration description for NGAP tests. @@ -15,23 +15,31 @@ module NGAP_TestConfiguration { import from LibCommon_Sync all; import from LibCommon_VerdictControl all; - // NGAP_Ats - import from NGAP_TestSystem all; // LibNGAP import from LibNGAP_Interface all; + import from LibNGAP_Pics all; + import from LibNGAP_Pixits all; + + // AtsNGAP + import from NGAP_TestSystem all; + import from NGAP_Steps all; group cfUp { /** - * @desc Creates test configuration of cf_NGAP_AMF - gNB is SUT + * @desc Creates test configuration of cf_NGAP_AMF - aMF is SUT * @param p_NGAPComponent_mme */ function f_cf_NGAP_aMF_Up( - out aMFNGAPComponent p_NGAPComponent_amf - ) runs on aMFNGAPComponent system TestAdapter { + out aMFNGAPComponent p_NGAPComponent_amf + ) runs on aMFNGAPComponent system TestAdapter { //Variables var FncRetCode v_ret := e_success; + if (PICS_USE_OPEN5GS) { + fx_ut_start_open5gs(PX_OPEN5GS_BINARY_FILE, PX_OPEN5GS_CONFIG_FILE); + } + //Create p_NGAPComponent_amf := aMFNGAPComponent.create ; @@ -48,7 +56,7 @@ module NGAP_TestConfiguration { } // End of function f_cf_NGAP_AMF_Up /** - * @desc Creates test configuration of cf_NGAP_gNB - AMF is SUT + * @desc Creates test configuration of cf_NGAP_gNB - gNB is SUT * @param p_NGAPComponent_gnb */ function f_cf_NGAP_gNB_Up( @@ -110,7 +118,11 @@ module NGAP_TestConfiguration { * @desc Deletes configuration * @param */ - function f_cf_Down() runs on NGAPComponent system TestAdapter { + function f_cf_Down() runs on NGNASComponent system TestAdapter { + if (PICS_USE_OPEN5GS) { + fx_ut_terminate_open5gs(); + } + // Deactivate all deactivate; // Unmap all diff --git a/ttcn/AtsNGAP/NGAP_TestControl.ttcn b/ttcn/AtsNGAP/NGAP_TestControl.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..dd8b4a67645e2238f73ad967943cf74ab372b1f8 --- /dev/null +++ b/ttcn/AtsNGAP/NGAP_TestControl.ttcn @@ -0,0 +1,27 @@ +/** +* @author ETSI / TTF T033, T048 +* @version $URL$ +* $Id$ +* @desc This module provides execution part for NGAP tests. +* @copyright ETSI Copyright Notification +* No part may be reproduced except as authorized by written permission. +* The copyright and the foregoing restriction extend to reproduction in all media. +* All rights reserved. +* @see ETSI TS +*/ +module NGAP_TestControl { + + // NGAP + import from NGAP_Pics all; + import from NGAP_TestCases all; + + control { + + if (PICS_NGAP_GNB_IUT) { + } + if (PICS_NGAP_AMF_IUT) { + } + + } // End of 'Control' statement + +} // End of module NGAP_TestControl diff --git a/ttcn/AtsNGAP/NGAP_TestSystem.ttcn b/ttcn/AtsNGAP/NGAP_TestSystem.ttcn index b435c1741354237b8a338c5669aca5db83930e55..fd1afe414665391a00847473a319accfa939749e 100644 --- a/ttcn/AtsNGAP/NGAP_TestSystem.ttcn +++ b/ttcn/AtsNGAP/NGAP_TestSystem.ttcn @@ -1,5 +1,5 @@ /** -* @author ETSI / TTF033 +* @author ETSI / TTF T033, T048 * @version $URL$ * $Id$ * @desc This module provides the types and ports used by the test component for NGAP tests. @@ -36,15 +36,7 @@ module NGAP_TestSystem { } // End of group TestSystemInterfaces - type component gNBNGAPComponent extends ServerSyncComp, NGAPComponent { - //component variables - } // End of type component gNBNGAPComponent - - type component aMFNGAPComponent extends ServerSyncComp, NGAPComponent { - //component variables - } // End of type component aMFNGAPComponent - - //type component NGAP extends ServerSyncComp, NGAPComponent { + //type component NGAP extends ServerSyncComp, NGNASComponent { // //component variables //} // End of component NGAP diff --git a/ttcn/AtsNGAP/module.mk b/ttcn/AtsNGAP/module.mk new file mode 100644 index 0000000000000000000000000000000000000000..b54851967caf3d6702bb07df29cf72f1b99b81a1 --- /dev/null +++ b/ttcn/AtsNGAP/module.mk @@ -0,0 +1,42 @@ +suite := AtsNGAP +pdu := NGAP_PDU + +sources:= \ + NGAP_TestCases.ttcn \ + NGAP_Pics.ttcn \ + NGAP_Pixits.ttcn \ + NGAP_Steps.ttcn \ + NGAP_TestSystem.ttcn \ + NGAP_TestConfiguration.ttcn \ + NGAP_TestControl.ttcn \ + NGAP_TCFunctions.ttcn + +modules := \ + ../Lib_NG_NAS \ + ../LibNGAP \ + ../LibCommon \ + ../Lib3GPP \ + ../../titan-test-system-framework/ttcn/LibHelpers \ + ../../titan-test-system-framework/ttcn/LibSecurity \ + ../../titan-test-system-framework/ttcn/LibXsd \ + ../../titan-test-system-framework/ccsrc/Protocols/Pcap \ + ../../titan-test-system-framework/ccsrc/Protocols/LinuxFrame \ + ../../titan-test-system-framework/ccsrc/Protocols/ETH \ + ../../titan-test-system-framework/ccsrc/Protocols/IP \ + ../../titan-test-system-framework/ccsrc/Protocols/Sctp \ + ../../titan-test-system-framework/ccsrc/Protocols/Xml \ + ../../titan-test-system-framework/ccsrc/Framework \ + ../../titan-test-system-framework/ccsrc/Helpers \ + ../../titan-test-system-framework/ccsrc/loggers \ + ../../titan-test-system-framework/ccsrc/security \ + ../../ccsrc/EncDec \ + ../../ccsrc/Externals \ + ../../ccsrc/Ports/LibNAS \ + ../../ccsrc/Ports/LibNGAP \ + ../../ccsrc/framework \ + ../../ccsrc/Protocols/NGAP_layer \ + ../../ccsrc/Protocols/NGAP \ + ../../ccsrc/Protocols/NG_NAS \ + ../../ccsrc/Protocols/FiveG_AKA \ + ../modules/titan.TestPorts.Common_Components.Abstract_Socket + diff --git a/ttcn/AtsNGAP/module.mk_ b/ttcn/AtsNGAP/module.mk_ deleted file mode 100644 index fbb1ae3f179f98c441a513d3100ec9e11579c9a5..0000000000000000000000000000000000000000 --- a/ttcn/AtsNGAP/module.mk_ +++ /dev/null @@ -1,26 +0,0 @@ -#suite := AtsNGAP -#pdu := NGAP_PDU - -sources:= \ - NGAP_Pics.ttcn \ - NGAP_Pixits.ttcn \ - NGAP_Steps.ttcn \ - NGAP_TestSystem.ttcn \ - NGAP_TestConfiguration.ttcn - -#modules := \ -# ../LibNGAP \ -# ../LibCommon \ -# ../../titan-test-system-framework/ccsrc/Protocols/Pcap \ -# ../../titan-test-system-framework/ccsrc/Protocols/ETH \ -# ../../ccsrc/Ports/LibNGAP \ -# ../../ccsrc/EncDec \ -# ../../titan-test-system-framework/ccsrc/Framework \ -# ../../titan-test-system-framework/ccsrc/loggers \ -# ../../ccsrc/Protocols/NGAP_layer \ -# ../../ccsrc/Protocols/NGAP \ -# ../../ccsrc/Asn1c \ -# ../../ccsrc/framework \ -# ../modules/titan.TestPorts.Common_Components.Abstract_Socket - - diff --git a/ttcn/Ats_NG_NAS/NG_NAS_Pics.ttcn b/ttcn/Ats_NG_NAS/NG_NAS_Pics.ttcn index 6e5069ae20be7da48ba38ea2ec3ac3b73e0de377..d4870fe1feef86cadd755cba8cf28f458c7ef2a0 100755 --- a/ttcn/Ats_NG_NAS/NG_NAS_Pics.ttcn +++ b/ttcn/Ats_NG_NAS/NG_NAS_Pics.ttcn @@ -1,5 +1,5 @@ /** -* @author ETSI / TTF041 +* @author ETSI / TTF T041, T048 * @version $URL$ * $Id$ * @desc This module provides PICS for NGAP tests. diff --git a/ttcn/Ats_NG_NAS/NG_NAS_Steps.ttcn b/ttcn/Ats_NG_NAS/NG_NAS_Steps.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..8266a12b6ba7a796434f359aedbd4918392abed5 --- /dev/null +++ b/ttcn/Ats_NG_NAS/NG_NAS_Steps.ttcn @@ -0,0 +1,175 @@ +module NG_NAS_Steps { + + // LibCommon + import from LibCommon_Sync all; + import from LibCommon_VerdictControl all; + import from LibCommon_Time all; + + // Lib_NG_NAS + import from Lib_NG_NAS_Templates all; + import from Lib_NG_NAS_Security_Functions all; + import from Lib_NG_NAS_Functions all; + import from Lib_NG_NAS_Pixits all; + + // Lib3GPP + import from NAS_CommonTypeDefs all; + import from NAS_CommonTemplates all; + import from NG_NAS_TypeDefs all; + import from NG_NAS_TestSystem all; + import from NG_NAS_Templates all; + import from NG_NAS_Templates all; + import from NG_NAS_MsgContainers all; + + // LibNGAP + import from NGAP_IEs language "ASN.1:2002" all; + import from NGAP_Constants language "ASN.1:2002" all; + import from NGAP_PDU_Descriptions language "ASN.1:2002" all; + import from LibNGAP_Pixits all; + import from LibNGAP_Pics all; + import from LibNGAP_Templates all; + import from LibNGAP_Interface all; + import from LibNGAP_Steps all; + import from LibNGAP_Functions all; + import from NGAP_TestSystem all; + + // LibFramwork + import from LibHelpers_Functions all; + + // AtsNGAP + import from NGAP_Pixits all; + // import from NGAP_Steps all; + + group GlobalSteps { + + /** + * @desc This is a test step that init global variables + * This procedure will be use when the Test System acts as AMF (SUT is gNB) + */ + function f_NGNAS_amf_init() + runs on aMF_NGNAS_NGAPComponent { + + // Defaults + vc_default_ngap := activate (a_defaultNGAP()); + + // Base LibNGAP init function if there will be any base initialisation + f_NGAP_Init_Component(); + + vc_ETS_address := PX_NGAP_ETS_IPADDR; + vc_ETS_port := PX_NGAP_ETS_PORT; + vc_SUT_address := PX_NGAP_SUT_IPADDR; + vc_SUT_port := PX_NGAP_SUT_PORT; + + } // End of function f_NGNAS_amf_init + + } // End of group GlobalSteps + + group Preambles{ + + /** + * @desc + */ + function f_preamble_NGNAS_AMF() runs on aMF_NGNAS_NGAPComponent { + var default v_def_ngap_; + + f_NGNAS_amf_init(); + //f_preambleNGAPClient(); + } // End of function f_preamble_NGNAS_AMF + + } // End of group Preambles + + group Postambles { + + /** + * @desc + */ + function f_postamble_NGAP_AMF( + in template (value) Cause p_Cause := m_cause_nas(authentication_failure) + ) runs on aMF_NGNAS_NGAPComponent { + + f_postambleNGAP_AMF(p_Cause); + + // Deactivate defaults + deactivate; + } // End of function f_postamble_NGAP_AMF + + } // End of group Postambles + + group amf { + + function f_NG_NAS_amf_UE_Register() runs on aMF_NGNAS_NGAPComponent { + log(">>> f_NG_NAS_amf_UE_Register"); + if (PICS_OFFLINE_MODE) { + f_await_NGSetupRequest_await_NGSetupResponse(); + } else { + f_send_NGSetupRequest_await_NGSetupResponse(); + } + log("f_NG_NAS_amf_UE_Register: f_send_registration_request done"); + if (PICS_OFFLINE_MODE) { + f_await_registration_request(); + } else { + f_send_registration_request(); + } + log("<<< f_NG_NAS_amf_UE_Register"); + } // End of function f_NG_NAS_amf_UE_Register + + function f_NG_NAS_amf_UE_Authentication() runs on aMF_NGNAS_NGAPComponent { + log(">>> f_NG_NAS_amf_UE_Authentication"); + if (PICS_OFFLINE_MODE) { + f_await_authentication_request_await_authentication_response(); + } else { + f_await_authentication_request_send_authentication_response(); + } + } // End of function f_NG_NAS_amf_UE_Authentication + + function f_NG_NAS_amf_UE_Authentication_with_invalid_response() runs on aMF_NGNAS_NGAPComponent { + log(">>> f_NG_NAS_amf_UE_Authentication_with_invalid_response"); + if (PICS_OFFLINE_MODE) { + f_await_authentication_request_await_authentication_reject(); + } else { + f_await_authentication_request_send_authentication_response_with_invalid_response(); + } + } // End of function f_NG_NAS_amf_UE_Authentication + + function f_NG_NAS_amf_UE_SecurityMode() runs on aMF_NGNAS_NGAPComponent { + log(">>> f_NG_NAS_amf_UE_SecurityMode"); + if (PICS_OFFLINE_MODE) { + f_await_security_mode_command_await_security_mode_complete(); + } else { // Await security mode and send response + f_await_security_mode_command_send_security_mode_complete(); + } + log("<<< f_NG_NAS_amf_UE_SecurityMode"); + } // End of function f_NG_NAS_amf_UE_SecurityMode + + function f_NG_NAS_amf_UE_InitialContextSetup() runs on aMF_NGNAS_NGAPComponent { + log(">>> f_NG_NAS_amf_UE_InitialContextSetup"); + if (PICS_OFFLINE_MODE) { + f_await_initial_context_setup_request_await_initial_context_setup_resonse(); + } else { + f_await_initial_context_setup_request_send_initial_context_setup_resonse(); + } + } // End of function f_NG_NAS_amf_UE_InitialContextSetup + + function f_NG_NAS_amf_RegistrationComplete() runs on aMF_NGNAS_NGAPComponent { + log(">>> f_NG_NAS_amf_RegistrationComplete"); + if (PICS_OFFLINE_MODE) { + f_await_registration_complete(); + } else { + f_send_registration_complete(); + } + } // End of function f_NG_NAS_amf_RegistrationComplete + + /** + * @desc + */ + function f_NG_NAS_amf_UE_ContextRealease_ContextRealeaseComplete() runs on aMFNGAPComponent { + if (PICS_OFFLINE_MODE) { + f_await_ue_context_release_command_await_ue_context_release_complete(); + } else { + f_await_ue_context_release_command_send_ue_context_release_complete(); + } + } // End of function f_await_ue_context_release_command_send_ue_context_release_complete + + + } // End of group amf + +} // End of module NG_NAS_Steps \ No newline at end of file diff --git a/ttcn/Ats_NG_NAS/NG_NAS_TCFunctions.ttcn b/ttcn/Ats_NG_NAS/NG_NAS_TCFunctions.ttcn index 7fa779a50a08f42bda239a99211c83dca2ff12a5..0a2481a0014faded505ec6857415e0df08c45b49 100755 --- a/ttcn/Ats_NG_NAS/NG_NAS_TCFunctions.ttcn +++ b/ttcn/Ats_NG_NAS/NG_NAS_TCFunctions.ttcn @@ -1,5 +1,5 @@ /** - * @author ETSI / TTF041 + * @author ETSI / TTF T041, T048 * @version $URL$ * $Id$ * @desc This module provides test functions for NG_NAS tests. @@ -18,19 +18,18 @@ module NG_NAS_TCFunctions { import from LibCommon_Time all; // Lib_NG_NAS - import from Lib_NG_NAS_Interface all; import from Lib_NG_NAS_Templates all; - import from LIB_NG_NAS_Functions all; - import from NAS_CommonTemplates all; + import from Lib_NG_NAS_Security_Functions all; + import from Lib_NG_NAS_Functions all; + import from Lib_NG_NAS_Pixits all; - // NG_NAS + // Lib3GPP + import from NAS_CommonTypeDefs all; + import from NAS_CommonTemplates all; import from NG_NAS_TypeDefs all; import from NG_NAS_TestSystem all; import from NG_NAS_Templates all; - import from NAS_CommonTypeDefs all; import from NG_NAS_Templates all; - - // Lib3GPP import from NG_NAS_MsgContainers all; // LibNGAP @@ -38,17 +37,18 @@ module NG_NAS_TCFunctions { import from NGAP_Constants language "ASN.1:2002" all; import from NGAP_PDU_Descriptions language "ASN.1:2002" all; import from LibNGAP_Pixits all; + import from LibNGAP_Pics all; import from LibNGAP_Templates all; import from LibNGAP_Interface all; import from LibNGAP_Steps all; + import from LibNGAP_Functions all; // LibFramwork import from LibHelpers_Functions all; - // NGAP_Ats - import from NGAP_Pixits all; - import from NGAP_Steps all; - import from Lib_NG_NAS_Pixits all; + // Ats_NG_NAS + import from NG_NAS_Pics all; + import from NG_NAS_Steps all; // interface at AMF group TP_AMF_NGAP { @@ -60,22 +60,21 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_AUT_REQ_01 */ - function f_TC_5GNAS_AMF_AUT_REQ_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_AUT_REQ_01() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_send_NasRegistrationRequest(); + f_NGNAS_amf_init(); + f_NG_NAS_amf_UE_Register(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, + ?, + vc_RAN_UE_ID, ? // AuthorizationRequest ))); f_NASPDU_Get(vc_recvNGAP_PDU); @@ -83,23 +82,29 @@ module NG_NAS_TCFunctions { if (f_Check_5GAKA_NAS_DL_Message( vc_recvNAS_PDU, mw_NG_AUTHENTICATION_REQUEST( - '111'B, + ?, -, - ?, // Authentication_parameter_RAND - ? // Authentication_parameter_AUTN + mw_GMM_AuthRAND, + mw_GSM_AUTN ), - v_message + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message ) == false) { - setverdict(fail); log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_AUTHENTICATION_REQUEST ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); // Postamble // Terminate call with rejection - f_terminate_NasRegistrationRequest_with_reject(); - //TODO: f_postamble_NGAP_gNB(); + f_send_error_indication(m_cause_nas(authentication_failure)); + f_postamble_NGAP_AMF(); f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); } // End of function f_TC_5GNAS_AMF_AUT_REQ_01 @@ -107,38 +112,46 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_AUT_REQ_02 */ - function f_TC_5GNAS_AMF_AUT_REQ_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_AUT_REQ_02() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_send_NasRegistrationRequest(); - f_await_NasAuthorizationRequest_send_NasAuthorizationResponse(); + f_NGNAS_amf_init(); + f_NG_NAS_amf_UE_Register(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body + f_NG_NAS_amf_UE_Authentication_with_invalid_response(); + f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, - ? // SecurityModeCommand + vc_AMF_UE_ID, + vc_RAN_UE_ID, + ? // AuthorizationReject ))); f_NASPDU_Get(vc_recvNGAP_PDU); var NG_NAS_DL_Message_Type v_message; - if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, mw_NG_SECURITY_MODE_COMMAND, v_message) == false) { + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_REJECT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: NG_AUTHENTICATION_REJECT mismatch. ***"); setverdict(fail); - log("*** " & __SCOPE__ & ": FAIL: NG_SECURITY_MODE_COMMAND mismatch. ***"); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_AUTHENTICATION_REJECT ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); // Postamble - // Terminate call with rejection - f_terminate_NasRegistrationRequest_with_reject(); - //TODO: f_postamble_NGAP_gNB(); + f_postamble_NGAP_AMF(); f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); } // End of function f_TC_5GNAS_AMF_AUT_REQ_02 @@ -146,43 +159,57 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_AUT_REQ_03 */ - function f_TC_5GNAS_AMF_AUT_REQ_03() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_AUT_REQ_03() runs on aMF_NGNAS_NGAPComponent { // Local variables var NGAP_PDU v_PDU; - var integer v_start_time_ms; + var float v_start_time_ms; + var float v_max_wait_time_ms := 6.0 * 1000.0 * int2float(PX_TIMER_T3560); // Set a maximum wait time of 6 seconds for the test body to prevent infinite waiting in case of failure // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_send_NasRegistrationRequest(); + f_NGNAS_amf_init(); + f_NG_NAS_amf_UE_Register(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body tc_noac.start; - v_start_time_ms := f_getCurrentTimeUtc(); // FSCOM: TTCN-3 timer are in seconds (ETSI ES 201 873-1 V4.16.1 (2024-10) Clause 12 Declaring timers) + v_start_time_ms := int2float(f_getCurrentTimeUtc()); alt { - [] N2_gNBaMF_P.receive { - // Skip message and check that timer T3560 has not expired (in milliseconds) - if ((f_getCurrentTimeUtc() - v_start_time_ms) < PX_TIMER_T3560) { - repeat; - } else { - tc_noac.stop; + [] N2_gNBaMF_P.receive( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + ?, + vc_RAN_UE_ID, + ? // AuthorizationRequest + ))) -> value v_PDU { + tc_noac.stop; + + f_NGAPPDU_Get(v_PDU) + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_REQUEST, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == true) { + // Do not reply to trigger T3560 expiry at AMF and verify that no unexpected messages are received after timer expiry + if ((int2float(f_getCurrentTimeUtc()) - v_start_time_ms) < v_max_wait_time_ms) { + tc_noac.start; + repeat; + } else { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST after T3560 timer expiry ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + } } } - [] tc_noac.timeout { - setverdict(fail); - log("*** " & __SCOPE__ & ": FAIL: T3560 shall be expired. ***"); - } - } // End of 'alt'statement - N2_gNBaMF_P.clear; // Remove enqueued messages - tc_noac.start; - alt { [] N2_gNBaMF_P.receive( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, + ?, + vc_RAN_UE_ID, ? // AuthorizationRequest ))) -> value v_PDU { tc_noac.stop; @@ -190,19 +217,40 @@ module NG_NAS_TCFunctions { f_NGAPPDU_Get(v_PDU) f_NASPDU_Get(vc_recvNGAP_PDU); var NG_NAS_DL_Message_Type v_message; - if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, mw_NG_AUTHENTICATION_REQUEST, v_message) == true) { - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); - log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST after T3560 timer expiry ***"); + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_REJECT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == true) { + // Do not reply to trigger T3560 expiry at AMF and verify that no unexpected messages are received after timer expiry + if ((int2float(f_getCurrentTimeUtc()) - v_start_time_ms) < v_max_wait_time_ms) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REJECT before T3560 timer expiration ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + } else { + setverdict(pass); + log("*** " & __SCOPE__ & ": PASS: T3560 timer expired and no unexpected messages received. ***"); + } } } + [] N2_gNBaMF_P.receive { + tc_noac.stop; + setverdict(inconc); + log("*** " & __SCOPE__ & ": INCONC: Unexpected message recieved. ***"); + } [] tc_noac.timeout { - f_selfOrClientSyncAndVerdict(c_tbDone, e_success); - log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + if ((int2float(f_getCurrentTimeUtc()) - v_start_time_ms) < v_max_wait_time_ms) { + setverdict(inconc); + log("*** " & __SCOPE__ & ": FAIL: T3560 shall be expired. ***"); + } else { + } } } // End of 'alt'statement // Postamble - //TODO: f_postamble_NGAP_gNB(); + f_postamble_NGAP_AMF(); f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); } // End of function f_TC_5GNAS_AMF_AUT_REQ_03 @@ -210,17 +258,46 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_AUT_REQ_04 */ - function f_TC_5GNAS_AMF_AUT_REQ_04() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_AUT_REQ_04() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_send_NasRegistrationRequest(); + f_NGNAS_amf_init(); + f_NG_NAS_amf_UE_Register(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body + // Await AuthenticationRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + ?, + vc_RAN_UE_ID, + ? // AuthorizationRequest + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_REQUEST( + ?, + -, + mw_GMM_AuthRAND, + mw_GSM_AUTN + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST ***"); + setverdict(fail); + return; + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_AUTHENTICATION_REQUEST ***"); + setverdict(pass); + } // Send error message vt_NgNasUl_Msg := m_NG_AUTHENTICATION_FAILURE( m_GMM_GSM_Cause( @@ -231,41 +308,46 @@ module NG_NAS_TCFunctions { f_send_NGAP_PDU( m_ngap_initMsg( m_n2_UplinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, + -, + -, vc_sendNAS_PDU, m_uPTransportLayerInformation_userLocationInformationNR( m_userLocationInformationNR( m_nR_CGI, m_tAI ))))); - // Await response + // Await new AuthenticationRequest due to authentication failure f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, + ?, + vc_RAN_UE_ID, ? // IdentityRequest ))); f_NASPDU_Get(vc_recvNGAP_PDU); - var NG_NAS_DL_Message_Type v_message; if (f_Check_5GAKA_NAS_DL_Message( vc_recvNAS_PDU, mw_NG_AUTHENTICATION_REQUEST( '111'B // Identity type ), - v_message + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message ) == false) { - setverdict(fail); log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_IDENTITY_REQUEST ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_IDENTITY_REQUEST ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); // Postamble // Terminate call with rejection - f_terminate_NasRegistrationRequest_with_reject(); - //TODO: f_postamble_NGAP_gNB(); + f_send_error_indication(m_cause_nas(authentication_failure)); + f_postamble_NGAP_AMF(); f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); } // End of function f_TC_5GNAS_AMF_AUT_REQ_04 @@ -273,21 +355,47 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_AUT_REQ_05 */ - function f_TC_5GNAS_AMF_AUT_REQ_05() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_AUT_REQ_05() runs on aMF_NGNAS_NGAPComponent { // Local variables - var NG_NAS_DL_Message_Type v_NG_NAS_DL_Message_Type; - var NAS_KsiValue ngKSI; // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_send_NasRegistrationRequest(); - f_decode_5G_NAS_DL_Message(vc_recvNAS_PDU, v_NG_NAS_DL_Message_Type); - ngKSI := v_NG_NAS_DL_Message_Type.authentication_Request.ngNasKeySetId.nasKeySetId; + f_NGNAS_amf_init(); + f_NG_NAS_amf_UE_Register(); + action("Send invalid response to trigger NAS authentication failure and verify that AMF initiates a new authentication procedure with new KSI value"); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body + // Await AuthenticationRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + ?, + vc_RAN_UE_ID, + ? // AuthorizationRequest + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_REQUEST( + ?, + -, + mw_GMM_AuthRAND, + mw_GSM_AUTN + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST ***"); + setverdict(fail); + return; + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_AUTHENTICATION_REQUEST ***"); + setverdict(pass); + } // Send error message vt_NgNasUl_Msg := m_NG_AUTHENTICATION_FAILURE( m_GMM_GSM_Cause( @@ -298,40 +406,46 @@ module NG_NAS_TCFunctions { f_send_NGAP_PDU( m_ngap_initMsg( m_n2_UplinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, + -, + -, vc_sendNAS_PDU, m_uPTransportLayerInformation_userLocationInformationNR( m_userLocationInformationNR( m_nR_CGI, m_tAI ))))); - // Await response + // Await new AuthenticationRequest due to authentication failure f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, + ?, + vc_RAN_UE_ID, ? ))); f_NASPDU_Get(vc_recvNGAP_PDU); - var NG_NAS_DL_Message_Type v_message; if (f_Check_5GAKA_NAS_DL_Message( vc_recvNAS_PDU, mw_NG_AUTHENTICATION_REQUEST( - complement(ngKSI) + complement(vc_ngKSI) ), - v_message) == false) { - setverdict(fail); + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_IDENTITY_REQUEST ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_IDENTITY_REQUEST ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); // Postamble // Terminate call with rejection - f_terminate_NasRegistrationRequest_with_reject(); - //TODO: f_postamble_NGAP_gNB(); + f_send_error_indication(m_cause_nas(authentication_failure)); + f_postamble_NGAP_AMF(); f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); } // End of function f_TC_5GNAS_AMF_AUT_REQ_05 @@ -339,17 +453,15 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_AUT_ABN_01 */ - function f_TC_5GNAS_AMF_AUT_ABN_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_AUT_ABN_01() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_send_NasRegistrationRequest(); + f_NG_NAS_amf_UE_Register(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body // Send error message vt_NgNasUl_Msg := m_NG_AUTHENTICATION_FAILURE( m_GMM_GSM_Cause( @@ -372,7 +484,7 @@ module NG_NAS_TCFunctions { f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ? // IdentityRequest ))); @@ -383,18 +495,24 @@ module NG_NAS_TCFunctions { mw_NG_IDENTITY_REQUEST( // TODO ), - v_message + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message ) == false) { - setverdict(fail); log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_IDENTITY_REQUEST ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_IDENTITY_REQUEST ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); // Postamble // Terminate call with rejection - f_terminate_NasRegistrationRequest_with_reject(); - //TODO: f_postamble_NGAP_gNB(); + f_send_NasAuthenticationFailure(); + f_send_ue_context_release_request_await_ue_context_release_response(m_cause_nas(authentication_failure)); f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); } // End of function f_TC_5GNAS_AMF_AUT_ABN_01 @@ -404,24 +522,23 @@ module NG_NAS_TCFunctions { group /*5_4_2_*/Security_mode_control_procedure { /** - * @desc Testcase function for TC_NGNAS_AMF_AUT_SEQ_01 + * @desc Testcase function for TC_5GNAS_AMF_SEC_COM_01 */ - function f_TC_NGNAS_AMF_AUT_SEQ_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_SEC_COM_01() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_await_NasAuthorizationRequest_send_NasAuthorizationResponse(); + f_NG_NAS_amf_UE_Register(); + f_NG_NAS_amf_UE_Authentication(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body // Await SecurityModeCommand f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ? // Security mode command ))); @@ -430,50 +547,59 @@ module NG_NAS_TCFunctions { if (f_Check_5GAKA_NAS_DL_Message( vc_recvNAS_PDU, mw_NG_SECURITY_MODE_COMMAND, - v_message + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message ) == false) { - setverdict(fail); log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_SECURITY_MODE_COMMAND ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_SECURITY_MODE_COMMAND ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); // Postamble // Terminate call with rejection - f_terminate_NasRegistrationRequest_with_reject(); - //TODO: f_postamble_NGAP_gNB(); + f_send_NasAuthenticationFailure(); + f_send_ue_context_release_request_await_ue_context_release_response(m_cause_nas(authentication_failure)); f_selfOrClientSyncAndVerdict(c_poDone, e_success); log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); - } // End of function f_TC_NGNAS_AMF_AUT_SEQ_01 + } // End of function f_TC_5GNAS_AMF_SEC_COM_01 /** * @desc Testcase function for TC_5GNAS_AMF_SEC_ACC_01 */ - function f_TC_5GNAS_AMF_SEC_ACC_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_SEC_ACC_01() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_await_NasAuthorizationRequest_send_NasAuthorizationResponse(); - f_await_NasSecurityModeCommand_send_NasSecurityModeComplete(); + f_NG_NAS_amf_UE_Register(); + f_NG_NAS_amf_UE_Authentication(); + f_NG_NAS_amf_UE_SecurityMode(); + f_NG_NAS_amf_RegistrationComplete(); + // FIXME Optional f_send_NGUERadioCApabilityInfoIndication(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body // Await next command (InitialContextSetupRequest) with NAS encrypted payload f_recv_NGAP_PDU( mw_ngap_initMsg( - mw_n2_InitialContextSetupRequest_withPDUSessionList( - PX_AMF_UE_NGAP_ID, + mw_n2_InitialContextSetupRequest/*_withPDUSessionList*/( + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ? // Security mode command ))); f_NASPDU_Get(vc_recvNGAP_PDU); if (f_Check_5GAKA_NAS_UL_Message_is_encrypted(vc_recvNAS_PDU) == false) { - setverdict(fail); log("*** " & __SCOPE__ & ": FAIL: Message is not encrypted ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Message is encrypted ***"); + setverdict(pass); } // FIXME FSCOM Add NAS_PDU message check f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -481,8 +607,8 @@ module NG_NAS_TCFunctions { // Postamble // Terminate call with rejection - f_terminate_NasRegistrationRequest_with_reject(); - //TODO: f_postamble_NGAP_gNB(); + f_send_NasAuthenticationFailure(); + f_send_ue_context_release_request_await_ue_context_release_response(m_cause_nas(authentication_failure)); f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); } // End of function f_TC_5GNAS_AMF_SEC_ACC_01 @@ -490,19 +616,17 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_SEC_REJ_01 */ - function f_TC_5GNAS_AMF_SEC_REJ_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_SEC_REJ_01() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_await_NasAuthorizationRequest_send_NasAuthorizationResponse(); + f_NG_NAS_amf_UE_Register(); + f_NG_NAS_amf_UE_Authentication(); f_await_NasSecurityModeCommand(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body // Send SecurityModeComplete vt_NgNasUl_Msg := m_NG_SECURITY_MODE_REJECT( m_GMM_GSM_Cause( @@ -536,67 +660,71 @@ module NG_NAS_TCFunctions { group /*5_4_5_*/NAS_transport_procedure { - /** - * @desc Testcase function for TC_5GNAS_AMF_DLN_ACC_01 - */ - function f_TC_5GNAS_AMF_DLN_ACC_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { - // Local variables + /** + * @desc Testcase function for TC_5GNAS_AMF_DLN_ACC_01 + */ + function f_TC_5GNAS_AMF_DLN_ACC_01() runs on aMF_NGNAS_NGAPComponent { + // Local variables - // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_await_NasAuthorizationRequest_send_NasAuthorizationResponse(); - f_await_NasSecurityModeCommand_send_NasSecurityModeComplete(); - f_await_NGInitialContextSetupRequest_send_NGInitialContextSetupRespone(); - f_send_NGUERadioCApabilityInfoIndication(); - f_await_registration_accept(); - f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); - log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); + // Preamble + f_NG_NAS_amf_UE_Register(); + f_NG_NAS_amf_UE_Authentication(); + f_NG_NAS_amf_UE_SecurityMode(); + f_NG_NAS_amf_RegistrationComplete(); + f_NG_NAS_amf_UE_InitialContextSetup(); + // FIXME Optional f_send_NGUERadioCApabilityInfoIndication(); + f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body - vt_NgNasUl_Msg := m_NG_PDU_SESSION_ESTABLISHMENT_REQUEST( - cs_NG_PDU_SessionId, - tsc_PTI_1 - ); - vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); - f_send_NGAP_PDU( - m_ngap_initMsg( - m_n2_UplinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, - vc_sendNAS_PDU, - m_uPTransportLayerInformation_userLocationInformationNR( - m_userLocationInformationNR( - m_nR_CGI, - m_tAI - ))))); - // Await PDU SESSION ESTABLISHMENT ACCEPT with NAS encrypted payload - f_recv_NGAP_PDU( + // Test Body + vt_NgNasUl_Msg := m_NG_PDU_SESSION_ESTABLISHMENT_REQUEST( + cs_NG_PDU_SessionId, + tsc_PTI_1 + ); + vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UplinkNASTransport( + PX_AMF_UE_NGAP_ID, + PX_RAN_UE_NGAP_ID, + vc_sendNAS_PDU, + m_uPTransportLayerInformation_userLocationInformationNR( + m_userLocationInformationNR( + m_nR_CGI, + m_tAI + ))))); + // Await PDU SESSION ESTABLISHMENT ACCEPT with NAS encrypted payload + f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ? // PDU SESSION ESTABLISHMENT ACCEPT - ))); + ))); f_NASPDU_Get(vc_recvNGAP_PDU); var NG_NAS_DL_Message_Type v_message; if (f_Check_5GAKA_NAS_DL_Message( - vc_recvNAS_PDU, - mw_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT, - v_message - ) == false) { + vc_recvNAS_PDU, + mw_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { setverdict(fail); return; + } else { + setverdict(pass); } - f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); - log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); - // Postamble - //TODO: f_postamble_NGAP_gNB(); - f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); - log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); - } // End of function f_TC_5GNAS_AMF_DLN_ACC_01 + // Postamble + //TODO: f_postamble_NGAP_gNB(); + f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); + log("*** " & __SCOPE__ & ": INFO: Postamble done. ***"); + } // End of function f_TC_5GNAS_AMF_DLN_ACC_01 } // End of group /*5__4_5_*/NAS_transport_procedure @@ -607,19 +735,18 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_REG_ACC_01 */ - function f_TC_5GNAS_AMF_REG_ACC_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_REG_ACC_01() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_await_NasAuthorizationRequest_send_NasAuthorizationResponse(); - f_await_NasSecurityModeCommand_send_NasSecurityModeComplete(); - f_send_NGUERadioCApabilityInfoIndication(); + f_NG_NAS_amf_UE_Register(); + f_NG_NAS_amf_UE_Authentication(); + f_NG_NAS_amf_UE_SecurityMode(); + // FIXME Optional f_send_NGUERadioCApabilityInfoIndication(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body vt_NgNasUl_Msg := m_NG_REGISTRATION_REQUEST( {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType, @@ -685,30 +812,36 @@ module NG_NAS_TCFunctions { f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ? // AuthorizationRequest ))); f_NASPDU_Get(vc_recvNGAP_PDU); var NG_NAS_DL_Message_Type v_message; if (f_Check_5GAKA_NAS_DL_Message( - vc_recvNAS_PDU, - mw_NG_REGISTRATION_ACCEPT( - -, - ?, - mw_PLMN_List( - -, -, - { - *, - PX_PLMN_IDENTITY, - * - } - ), - -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, - ? - ), - v_message) == false) { + vc_recvNAS_PDU, + mw_NG_REGISTRATION_ACCEPT( + -, + ?, + mw_PLMN_List( + -, -, + { + *, + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + * + } + ), + -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, + ? + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { setverdict(fail); + } else { + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); @@ -722,19 +855,18 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_REG_ACC_02 */ - function f_TC_5GNAS_AMF_REG_ACC_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_REG_ACC_02() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_await_NasAuthorizationRequest_send_NasAuthorizationResponse(); - f_await_NasSecurityModeCommand_send_NasSecurityModeComplete(); - f_send_NGUERadioCApabilityInfoIndication(); + f_NG_NAS_amf_UE_Register(); + f_NG_NAS_amf_UE_Authentication(); + f_NG_NAS_amf_UE_SecurityMode(); + // FIXME Optional f_send_NGUERadioCApabilityInfoIndication(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body vt_NgNasUl_Msg := m_NG_REGISTRATION_REQUEST( {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType, @@ -800,36 +932,42 @@ module NG_NAS_TCFunctions { f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ? // AuthorizationRequest ))); f_NASPDU_Get(vc_recvNGAP_PDU); var NG_NAS_DL_Message_Type v_message; if (f_Check_5GAKA_NAS_DL_Message( - vc_recvNAS_PDU, - mw_NG_REGISTRATION_ACCEPT( - cs_RegistrationResult('000'B,//B3_Type p_Result, - '0'B,//B1_Type p_SMS, - '0'B,//B1_Type p_EmergencyRegistered, - '0'B,//B1_Type p_NssaaPerformed, - '0'B),//B1_Type p_DisasterRoamingResult),//-, - ?, - mw_PLMN_List( - -, -, - { - *, - PX_PLMN, - * - } - ), - ?/*TAIList*/,-,-,-,-,-,-,-,-,-,-,-,?/*GPRSTimer3512*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, - ? - ), - v_message) == false) { + vc_recvNAS_PDU, + mw_NG_REGISTRATION_ACCEPT( + cs_RegistrationResult('000'B,//B3_Type p_Result, + '0'B,//B1_Type p_SMS, + '0'B,//B1_Type p_EmergencyRegistered, + '0'B,//B1_Type p_NssaaPerformed, + '0'B),//B1_Type p_DisasterRoamingResult),//-, + ?, + mw_PLMN_List( + -, -, + { + *, + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + * + } + ), + ?/*TAIList*/,-,-,-,-,-,-,-,-,-,-,-,?/*GPRSTimer3512*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, + ? + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_ACCEPT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_REGISTRATION_ACCEPT match. ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -844,19 +982,18 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_REG_ACC_03 */ - function f_TC_5GNAS_AMF_REG_ACC_03() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_REG_ACC_03() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_await_NasAuthorizationRequest_send_NasAuthorizationResponse(); - f_await_NasSecurityModeCommand_send_NasSecurityModeComplete(); - f_send_NGUERadioCApabilityInfoIndication(); + f_NG_NAS_amf_UE_Register(); + f_NG_NAS_amf_UE_Authentication(); + f_NG_NAS_amf_UE_SecurityMode(); + // FIXME Optional f_send_NGUERadioCApabilityInfoIndication(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body vt_NgNasUl_Msg := m_NG_REGISTRATION_REQUEST( {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType, @@ -922,39 +1059,44 @@ module NG_NAS_TCFunctions { f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ? // AuthorizationRequest ))); f_NASPDU_Get(vc_recvNGAP_PDU); var NG_NAS_DL_Message_Type v_message; if (f_Check_5GAKA_NAS_DL_Message( - vc_recvNAS_PDU, - mw_NG_REGISTRATION_ACCEPT( - cs_RegistrationResult('000'B,//B3_Type p_Result, - '0'B,//B1_Type p_SMS, - '0'B,//B1_Type p_EmergencyRegistered, - '0'B,//B1_Type p_NssaaPerformed, - '0'B),//B1_Type p_DisasterRoamingResult),//-, - ?, - mw_PLMN_List( - -, -, - { - *, - PX_PLMN, - * - } - ), - ?/*TAIList*/,-,-,-,-,-,-,-,-,-,-,-,?/*GPRSTimer3512*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, - ? - ), - v_message) == false) { + vc_recvNAS_PDU, + mw_NG_REGISTRATION_ACCEPT( + cs_RegistrationResult('000'B,//B3_Type p_Result, + '0'B,//B1_Type p_SMS, + '0'B,//B1_Type p_EmergencyRegistered, + '0'B,//B1_Type p_NssaaPerformed, + '0'B),//B1_Type p_DisasterRoamingResult),//-, + ?, + mw_PLMN_List( + -, -, + { + *, + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + * + } + ), + ?/*TAIList*/,-,-,-,-,-,-,-,-,-,-,-,?/*GPRSTimer3512*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, + ? + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_ACCEPT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_REGISTRATION_ACCEPT match. ***"); + setverdict(pass); } - f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); @@ -967,19 +1109,18 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_REG_ACC_04 */ - function f_TC_5GNAS_AMF_REG_ACC_04() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_REG_ACC_04() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_await_NasAuthorizationRequest_send_NasAuthorizationResponse(); - f_await_NasSecurityModeCommand_send_NasSecurityModeComplete(); - f_send_NGUERadioCApabilityInfoIndication(); + f_NG_NAS_amf_UE_Register(); + f_NG_NAS_amf_UE_Authentication(); + f_NG_NAS_amf_UE_SecurityMode(); + // FIXME Optional f_send_NGUERadioCApabilityInfoIndication(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body vt_NgNasUl_Msg := m_NG_REGISTRATION_REQUEST( {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType, @@ -1045,32 +1186,38 @@ module NG_NAS_TCFunctions { f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ? // AuthorizationRequest ))); f_NASPDU_Get(vc_recvNGAP_PDU); var NG_NAS_DL_Message_Type v_message; if (f_Check_5GAKA_NAS_DL_Message( - vc_recvNAS_PDU, - mw_NG_REGISTRATION_ACCEPT( - -, - ?, - mw_PLMN_List( - -, -, - { - *, - PX_PLMN, - * - } - ), - -,?/*AllowedNSSAI*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, - ? - ), - v_message) == false) { + vc_recvNAS_PDU, + mw_NG_REGISTRATION_ACCEPT( + -, + ?, + mw_PLMN_List( + -, -, + { + *, + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + * + } + ), + -,?/*AllowedNSSAI*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, + ? + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_ACCEPT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_REGISTRATION_ACCEPT match. ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -1085,19 +1232,18 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_REG_ACC_05 */ - function f_TC_5GNAS_AMF_REG_ACC_05() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_REG_ACC_05() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); - f_send_NGSetupRequest_await_NGSetupRespone(); - f_await_NasAuthorizationRequest_send_NasAuthorizationResponse(); - f_await_NasSecurityModeCommand_send_NasSecurityModeComplete(); - f_send_NGUERadioCApabilityInfoIndication(); + f_NG_NAS_amf_UE_Register(); + f_NG_NAS_amf_UE_Authentication(); + f_NG_NAS_amf_UE_SecurityMode(); + // FIXME Optional f_send_NGUERadioCApabilityInfoIndication(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body vt_NgNasUl_Msg := m_NG_REGISTRATION_REQUEST( {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType, @@ -1163,32 +1309,38 @@ module NG_NAS_TCFunctions { f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ? // AuthorizationRequest ))); f_NASPDU_Get(vc_recvNGAP_PDU); var NG_NAS_DL_Message_Type v_message; if (f_Check_5GAKA_NAS_DL_Message( - vc_recvNAS_PDU, - mw_NG_REGISTRATION_ACCEPT( - -, - ?, - mw_PLMN_List( - -, -, - { - *, - PX_PLMN, - * - } - ), - -,-,?/*RejectedNSSAI*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, - ? - ), - v_message) == false) { + vc_recvNAS_PDU, + mw_NG_REGISTRATION_ACCEPT( + -, + ?, + mw_PLMN_List( + -, -, + { + *, + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + * + } + ), + -,-,?/*RejectedNSSAI*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, + ? + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_ACCEPT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_REGISTRATION_ACCEPT match. ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -1203,25 +1355,38 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TP_5GNAS_AMF_REG_REJ_01 */ - function f_TC_5GNAS_AMF_REG_REJ_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_REG_REJ_01() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); + if (PICS_OFFLINE_MODE) { + f_send_NGSetupRequest_await_NGSetupResponse(); + } else { + f_send_NGSetupRequest_await_NGSetupResponse(); + } f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body + var octetstring v_other_digits := // ETSI TS 124 501 Figure 9.11.3.4.3: 5GS mobile identity information element for type of identity "SUCI" and SUPI format "IMSI" + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) & + '0000'O & // Routing Indicator + '00'O & // Protection scheme + '00'O & // Home network public key identifier + PX_MSIN; + log("f_TC_5GNAS_AMF_REG_REJ_01: v_other_digits: ", v_other_digits); + log("f_TC_5GNAS_AMF_REG_REJ_01: m_NG_MobileIdentitySUCI: ", m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID)); vt_NgNasUl_Msg := m_NG_REGISTRATION_REQUEST( {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType, '111'B,//in template (value) NAS_KsiValue p_KeySetId, '0'B,//in template (value) B1_Type p_Tsc, - m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT,PX_SUPI_DIGITS)//in template (value) NG_MobileIdentity p_MobileId, // 24.501 cl. 9.11.3.4 + m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID),//in template (value) NG_MobileIdentity p_MobileId, // 24.501 cl. 9.11.3.4 - /* in template (omit) NAS_KeySetIdentifier p_NonCurrentKSI := omit, - in template (omit) NG_GMM_Cap p_GMM_Cap := omit, - in template (omit) NG_UE_SecurityCapability p_UESecurityCap := omit, + -,/* in template (omit) NAS_KeySetIdentifier p_NonCurrentKSI := omit,*/ + -,/*in template (omit) NG_GMM_Cap p_GMM_Cap := omit,*/ + m_ng_ue_security_capability + /*in template (omit) NG_UE_SecurityCapability p_UESecurityCap := omit, in template (omit) NSSAI p_ReqNSSAI := omit, in template (omit) NG_TrackingAreaId p_TAI := omit, in template (omit) UE_NetworkCap p_UE_NetworkCap := omit, @@ -1261,7 +1426,7 @@ module NG_NAS_TCFunctions { ) vc_sendNAS_PDU := bit2oct(encvalue( vt_NgNasUl_Msg )); - var bitstring s := encvalue( vt_NgNasUl_Msg ); + /*var bitstring s := encvalue( vt_NgNasUl_Msg ); //int i := decvalue(encvalue( vt_NgNasUl_Msg),vt_NgNasUl_Msg); log(vt_NgNasUl_Msg); log(vc_sendNAS_PDU); @@ -1269,7 +1434,7 @@ module NG_NAS_TCFunctions { var integer i; i := decvalue(s,rec); log(i); - log(rec); + log(rec);*/ f_send_NGAP_PDU( m_ngap_initMsg( @@ -1287,14 +1452,16 @@ module NG_NAS_TCFunctions { f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ?//template (present) NAS_PDU p_nasPdu := ? )) ); f_NASPDU_Get(vc_recvNGAP_PDU); - if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, mw_NG_REGISTRATION_REJECT( cr_GMM_GSM_Cause(*,'00010110'B),//tsc_NR5GCCause_Congestion //template (present) GMM_GSM_Cause p_Cause := ?, ?//template GPRS_Timer2 p_T3346 := * @@ -1308,48 +1475,57 @@ module NG_NAS_TCFunctions { template GPRS_Timer3 p_LowerBoundTimerValue := *, template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *, template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := **/ - )) == false) { + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_REJECT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_REGISTRATION_REJECT match. ***"); + setverdict(pass); } + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); - log(vc_recvNGAP_PDU); - f_NASPDU_Get(vc_recvNGAP_PDU); - s := oct2bit(vc_recvNAS_PDU); - log(s); - var NG_NAS_DL_Message_Type recdl; - var integer ir; - ir := decvalue(s,recdl); - log(ir); - log(recdl); - - vt_NgNasDl_Msg := - m_NG_REGISTRATION_REJECT( - cs_GMM_GSM_Cause(omit, - '00001101'B/*;tsc_Cause_Roaming_NotAllowed*/) - /*in template (omit) GPRS_Timer2 p_T3346 := omit, - in template (omit) GPRS_Timer2 p_T3502 := omit, - in template (omit) EAP_Message p_EAP := omit, - in template (omit) RejectedNSSAI p_RejectedNSSAI := omit, - in template (omit) CAGInfoList p_CAGInfoList := omit, - in template (omit) ExtdRejectedNSSAI p_ExtdRejectedNSSAI := omit, - in template (omit) RegistrationWaitRange p_DisasterReturnWaitRange := omit, - in template (omit) ExtdCAGInfoList p_ExtdCAGInfoList := omit, - in template (omit) GPRS_Timer3 p_LowerBoundTimerValue := omit, - in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_Roaming := omit, - in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := omit - */); - vc_sendNAS_PDU := bit2oct(encvalue( vt_NgNasDl_Msg )); - s := encvalue( vt_NgNasDl_Msg ); - //int i := decvalue(encvalue( vt_NgNasUl_Msg),vt_NgNasUl_Msg); - log(vt_NgNasDl_Msg); - log(vc_sendNAS_PDU); - var NG_NAS_DL_Message_Type recdl1; + // log(vc_recvNGAP_PDU); + // f_NASPDU_Get(vc_recvNGAP_PDU); + // s := oct2bit(vc_recvNAS_PDU); + // log(s); + // var NG_NAS_DL_Message_Type recdl; + // var integer ir; + // ir := decvalue(s,recdl); + // log(ir); + // log(recdl); + + // vt_NgNasDl_Msg := + // m_NG_REGISTRATION_REJECT( + // cs_GMM_GSM_Cause(omit, + // '00001101'B/*;tsc_Cause_Roaming_NotAllowed*/) + // /*in template (omit) GPRS_Timer2 p_T3346 := omit, + // in template (omit) GPRS_Timer2 p_T3502 := omit, + // in template (omit) EAP_Message p_EAP := omit, + // in template (omit) RejectedNSSAI p_RejectedNSSAI := omit, + // in template (omit) CAGInfoList p_CAGInfoList := omit, + // in template (omit) ExtdRejectedNSSAI p_ExtdRejectedNSSAI := omit, + // in template (omit) RegistrationWaitRange p_DisasterReturnWaitRange := omit, + // in template (omit) ExtdCAGInfoList p_ExtdCAGInfoList := omit, + // in template (omit) GPRS_Timer3 p_LowerBoundTimerValue := omit, + // in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_Roaming := omit, + // in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := omit + // */); + // vc_sendNAS_PDU := bit2oct(encvalue( vt_NgNasDl_Msg )); + // s := encvalue( vt_NgNasDl_Msg ); + // //int i := decvalue(encvalue( vt_NgNasUl_Msg),vt_NgNasUl_Msg); + // log(vt_NgNasDl_Msg); + // log(vc_sendNAS_PDU); + // var NG_NAS_DL_Message_Type recdl1; - i := decvalue(s,recdl1); - log(i); - log(recdl1); + // i := decvalue(s,recdl1); + // log(i); + // log(recdl1); f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -1365,25 +1541,37 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TP_5GNAS_AMF_REG_REJ_02 */ - function f_TC_5GNAS_AMF_REG_REJ_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_REG_REJ_02() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); + if (PICS_OFFLINE_MODE) { + f_send_NGSetupRequest_await_NGSetupResponse(); + } else { + f_send_NGSetupRequest_await_NGSetupResponse(); + } f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body + var octetstring v_other_digits := // ETSI TS 124 501 Figure 9.11.3.4.3: 5GS mobile identity information element for type of identity "SUCI" and SUPI format "IMSI" + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) & + '0000'O & // Routing Indicator + '00'O & // Protection scheme + '00'O & // Home network public key identifier + PX_MSIN; + log("f_TC_5GNAS_AMF_REG_REJ_02: v_other_digits: ", v_other_digits); + log("f_TC_5GNAS_AMF_REG_REJ_02: m_NG_MobileIdentitySUCI: ", m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID)); vt_NgNasUl_Msg := m_NG_REGISTRATION_REQUEST( {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType, '111'B,//in template (value) NAS_KsiValue p_KeySetId, '0'B,//in template (value) B1_Type p_Tsc, - m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT,PX_SUPI_DIGITS),//in template (value) NG_MobileIdentity p_MobileId, + m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID),//in template (value) NG_MobileIdentity p_MobileId, omit, // in template (omit) NAS_KeySetIdentifier p_NonCurrentKSI := omit, omit, // in template (omit) NG_GMM_Cap p_GMM_Cap := omit, - omit //in template (omit) NG_UE_SecurityCapability p_UESecurityCap := omit, + m_ng_ue_security_capability //in template (omit) NG_UE_SecurityCapability p_UESecurityCap := omit, //in template (omit) NSSAI p_ReqNSSAI := omit, /*in template (omit) NG_TrackingAreaId p_TAI := omit, in template (omit) UE_NetworkCap p_UE_NetworkCap := omit, @@ -1439,14 +1627,16 @@ module NG_NAS_TCFunctions { f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ?//template (present) NAS_PDU p_nasPdu := ? )) ); f_NASPDU_Get(vc_recvNGAP_PDU); - if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, mw_NG_REGISTRATION_REJECT( cr_GMM_GSM_Cause(*,'00111110'B)//tsc_Cause_NoNetworkSlices_Available //template (present) GMM_GSM_Cause p_Cause := ?, /*template GPRS_Timer2 p_T3346 := * @@ -1460,10 +1650,18 @@ module NG_NAS_TCFunctions { template GPRS_Timer3 p_LowerBoundTimerValue := *, template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *, template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := **/ - )) == false) { + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_REJECT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_REGISTRATION_REJECT match. ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -1483,15 +1681,23 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_DRG_ACC_01 */ - function f_TC_5GNAS_AMF_DRG_ACC_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_DRG_ACC_01() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); + f_NG_NAS_amf_UE_Register(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body + var octetstring v_other_digits := // ETSI TS 124 501 Figure 9.11.3.4.3: 5GS mobile identity information element for type of identity "SUCI" and SUPI format "IMSI" + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) & + '0000'O & // Routing Indicator + '00'O & // Protection scheme + '00'O & // Home network public key identifier + PX_MSIN; + log("f_TC_5GNAS_AMF_DRG_ACC_01: v_other_digits: ", v_other_digits); + log("f_TC_5GNAS_AMF_DRG_ACC_01: m_NG_MobileIdentitySUCI: ", m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID)); vt_NgNasUl_Msg := m_NG_DEREGISTRATION_REQUEST_MO( crs_DeregisterType ('0'B,//B1_Type p_SwitchOff, @@ -1499,7 +1705,7 @@ module NG_NAS_TCFunctions { '01'B//B2_Type p_Access := '01'B),//in template (value) DeregisterType p_DeregisterType, ), cs_NAS_KeySetIdentifier_lv('111'B,'1'B),//in template (value) NAS_KeySetIdentifier p_KSI, - m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT,PX_SUPI_DIGITS)//in template (value) NG_MobileIdentity p_MobileId, + m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID)//in template (value) NG_MobileIdentity p_MobileId, ); f_send_NGAP_PDU( m_ngap_initMsg( @@ -1517,19 +1723,28 @@ module NG_NAS_TCFunctions { f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ?//template (present) NAS_PDU p_nasPdu := ? )) ); f_NASPDU_Get(vc_recvNGAP_PDU); - if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, - mw_NG_DEREGISTRATION_ACCEPT_MO + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_DEREGISTRATION_ACCEPT_MO, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_ACCEPT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_DEREGISTRATION_ACCEPT match. ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -1545,15 +1760,23 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_DRG_ACC_02 */ - function f_TC_5GNAS_AMF_DRG_ACC_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_DRG_ACC_02() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); + f_NG_NAS_amf_UE_Register(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body + var octetstring v_other_digits := // ETSI TS 124 501 Figure 9.11.3.4.3: 5GS mobile identity information element for type of identity "SUCI" and SUPI format "IMSI" + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) & + '0000'O & // Routing Indicator + '00'O & // Protection scheme + '00'O & // Home network public key identifier + PX_MSIN; + log("f_TC_5GNAS_AMF_DRG_ACC_02: v_other_digits: ", v_other_digits); + log("f_TC_5GNAS_AMF_DRG_ACC_02: m_NG_MobileIdentitySUCI: ", m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID)); vt_NgNasUl_Msg := m_NG_DEREGISTRATION_REQUEST_MO( crs_DeregisterType ('1'B,//B1_Type p_SwitchOff, @@ -1561,7 +1784,7 @@ module NG_NAS_TCFunctions { '01'B//B2_Type p_Access := '01'B),//in template (value) DeregisterType p_DeregisterType, ), cs_NAS_KeySetIdentifier_lv('111'B,'1'B),//in template (value) NAS_KeySetIdentifier p_KSI, - m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT,PX_SUPI_DIGITS)//in template (value) NG_MobileIdentity p_MobileId, + m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID)//in template (value) NG_MobileIdentity p_MobileId, ); f_send_NGAP_PDU( m_ngap_initMsg( @@ -1579,19 +1802,28 @@ module NG_NAS_TCFunctions { f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ?//template (present) NAS_PDU p_nasPdu := ? )) ); f_NASPDU_Get(vc_recvNGAP_PDU); - if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, - mw_NG_DEREGISTRATION_ACCEPT_MO + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_DEREGISTRATION_ACCEPT_MO, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_ACCEPT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_DEREGISTRATION_ACCEPT match. ***"); + setverdict(pass) } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -1611,27 +1843,30 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_DRG_REQ_01 */ - function f_TC_5GNAS_AMF_DRG_REQ_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_DRG_REQ_01() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); + f_NG_NAS_amf_UE_Register(); + // TODO f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); //USER REGISTRATION log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ?//template (present) NAS_PDU p_nasPdu := ? )) ); f_NASPDU_Get(vc_recvNGAP_PDU); - if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, mw_NG_DEREGISTRATION_REQUEST_MT( crs_DeregisterType ('0'B,//B1_Type p_SwitchOff, '0'B,//B1_Type p_ReReg, @@ -1647,11 +1882,20 @@ module NG_NAS_TCFunctions { //template GPRS_Timer3 p_LowerBoundTimerValue := *, //template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *, //template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := * - )) == false) { + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_REQUEST_MT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_DEREGISTRATION_REQUEST_MT match. ***"); + setverdict(pass); } + f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); @@ -1665,26 +1909,29 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_DRG_REQ_02 */ - function f_TC_5GNAS_AMF_DRG_REQ_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_DRG_REQ_02() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); + f_NG_NAS_amf_UE_Register(); + // TODO f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ?//template (present) NAS_PDU p_nasPdu := ? )) ); f_NASPDU_Get(vc_recvNGAP_PDU); - if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, mw_NG_DEREGISTRATION_REQUEST_MT( //template (present) DeregisterType p_Type := ?, //template GMM_GSM_Cause p_Cause := *, @@ -1697,23 +1944,32 @@ module NG_NAS_TCFunctions { //template GPRS_Timer3 p_LowerBoundTimerValue := *, //template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *, //template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := * - )) == false) { + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_REQUEST_MT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_DEREGISTRATION_REQUEST_MT match. ***"); + setverdict(pass); } - //Not sent sesponse and again wait for deregistration_request + //Not sent response and again wait for deregistration_request f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ?//template (present) NAS_PDU p_nasPdu := ? )) ); f_NASPDU_Get(vc_recvNGAP_PDU); - if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, mw_NG_DEREGISTRATION_REQUEST_MT( crs_DeregisterType ('0'B,//B1_Type p_SwitchOff, '0'B,//B1_Type p_ReReg, @@ -1729,10 +1985,18 @@ module NG_NAS_TCFunctions { //template GPRS_Timer3 p_LowerBoundTimerValue := *, //template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *, //template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := * - )) == false) { + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_REQUEST_MT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_DEREGISTRATION_REQUEST_MT match. ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); @@ -1747,26 +2011,29 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GNAS_AMF_DRG_REQ_03 */ - function f_TC_5GNAS_AMF_DRG_REQ_03() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GNAS_AMF_DRG_REQ_03() runs on aMF_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); + f_NG_NAS_amf_UE_Register(); + // TODO f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body f_recv_NGAP_PDU( mw_ngap_initMsg( mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, + ?,//PX_AMF_UE_NGAP_ID, PX_RAN_UE_NGAP_ID, ?//template (present) NAS_PDU p_nasPdu := ? )) ); f_NASPDU_Get(vc_recvNGAP_PDU); - if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, mw_NG_DEREGISTRATION_REQUEST_MT( crs_DeregisterType ('0'B,//B1_Type p_SwitchOff, '1'B,//B1_Type p_ReReg, @@ -1782,10 +2049,18 @@ module NG_NAS_TCFunctions { //template GPRS_Timer3 p_LowerBoundTimerValue := *, //template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *, //template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := * - )) == false) { + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_REQUEST_MT mismatch. ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: NG_DEREGISTRATION_REQUEST_MT match. ***"); + setverdict(pass); } f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Testbody done. ***"); @@ -1815,15 +2090,14 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GAP_ICS_01 */ - function f_TC_5GAP_ICS_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GAP_ICS_01() runs on gNB_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body // TODO f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -1838,15 +2112,14 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GAP_ICS_02 */ - function f_TC_5GAP_ICS_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GAP_ICS_02() runs on gNB_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body // TODO f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -1861,15 +2134,14 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GAP_DNA_01 */ - function f_TC_5GAP_DNA_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GAP_DNA_01() runs on gNB_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body // TODO f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -1884,15 +2156,14 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GAP_DNA_02 */ - function f_TC_5GAP_DNA_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GAP_DNA_02() runs on gNB_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body // TODO f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); @@ -1907,15 +2178,14 @@ module NG_NAS_TCFunctions { /** * @desc Testcase function for TC_5GAP_PDU_01 */ - function f_TC_5GAP_PDU_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ { + function f_TC_5GAP_PDU_01() runs on gNB_NGNAS_NGAPComponent { // Local variables // Preamble - f_NGAP_gnb_init(); f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); log("*** " & __SCOPE__ & ": INFO: Preamble done. ***"); - // Body + // Test Body // TODO f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); diff --git a/ttcn/Ats_NG_NAS/NG_NAS_TestCases.ttcn b/ttcn/Ats_NG_NAS/NG_NAS_TestCases.ttcn index ebff74a426bebca57dba4728df1fdd9c06ce8182..ec1790d571afc9f71396b50e293335f7c6f3d84d 100644 --- a/ttcn/Ats_NG_NAS/NG_NAS_TestCases.ttcn +++ b/ttcn/Ats_NG_NAS/NG_NAS_TestCases.ttcn @@ -1,5 +1,5 @@ /** - * @author ETSI / TTF041 + * @author ETSI / TTF T041, T048 * @version $URL$ * $Id$ * @desc This module provides testcases for NG_NAS tests. @@ -15,33 +15,47 @@ module NG_NAS_TestCases { // LibCommon import from LibCommon_Sync all ; - // NG_NAS + // Lib3GPP + import from CommonDefs all; + + // Lib3GPP/NAS + import from NAS_CommonTypeDefs all; + import from NAS_AuthenticationCommon all; + + // Lib3GPP/NG_NAS + import from NG_NAS_SecurityFunctions all; + + // Lib3GPP/Common4G5G + import from EUTRA_NR_SecurityFunctions all; + + // Lib3GPP/NasEmulation + import from NG_SecurityDefinitionsAndExternalFunctions all; + + // Lib_NG_NAS import from Lib_NG_NAS_Interface all; + import from Lib_NG_NAS_Security_Functions all; + import from Lib_NG_NAS_Functions all; + + // NG_NAS import from NG_NAS_TCFunctions all; import from NG_NAS_Pics all; import from NG_NAS_TestConfiguration all; import from NG_NAS_TestSystem all; + import from NG_NAS_TestConfiguration all; // LibNGAP - import from NGAP_Constants language "ASN.1:2002" all; - import from NGAP_CommonDataTypes language "ASN.1:2002" all; - import from NGAP_IEs language "ASN.1:2002" all; - import from NGAP_PDU_Contents language "ASN.1:2002" all; - import from NGAP_PDU_Descriptions language "ASN.1:2002" all; - import from NGAP_Containers language "ASN.1:2002" all; - - //import from LibNGAP_TypesAndValues all; - //import from LibNGAP_Templates all; - //import from LibNGAP_Pixits all; - - // NGAP_Ats - //import from LibNGAP_TypesAndValues all; - //import from NGAP_TestConfiguration all; + import from NGAP_Constants language "ASN.1:2002" all; + import from NGAP_CommonDataTypes language "ASN.1:2002" all; + import from NGAP_IEs language "ASN.1:2002" all; + import from NGAP_PDU_Contents language "ASN.1:2002" all; + import from NGAP_PDU_Descriptions language "ASN.1:2002" all; + import from NGAP_Containers language "ASN.1:2002" all; + import from LibNGAP_Interface all; + + // AtsNGAP import from NGAP_TestSystem all; - //import from NGAP_TCFunctions all; - //import from NGAP_Pics all; - group TC_AMF { + group TC_AMF { // AMF is the IUT group /*5_4_*/fiveGMM_Common_Procedures { @@ -51,10 +65,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT sends an AUTHENTICATION REQUEST message correctly upon receipt of a NAS Registration without an active security context * @see ETSI TS 124 501 [1], Clauses 5.4.1.3.2 and 8.2.1 */ - testcase TC_5GNAS_AMF_AUT_REQ_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_AUT_REQ_01() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -63,7 +77,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_AUT_REQ_01()); @@ -76,13 +90,13 @@ module NG_NAS_TestCases { } // End of testcase TC_5GNAS_AMF_AUT_REQ_01 /** - * @desc Verify that the IUT sends an AUTHENTICATION REQUEST message correctly upon receipt of a NAS Registration without an active security context + * @desc Verify that the IUT sends an AUTHENTICATION_REJECT message upon receipt of an AUTHENTICATION_RESPONSE containing an invalid authentication response value, when the UE was identified with SUCI in the initial NAS message * @see ETSI TS 124 501 [1], Clause 5.4.1.3.5 and 8.2.5 */ - testcase TC_5GNAS_AMF_AUT_REQ_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_AUT_REQ_02() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -91,7 +105,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_AUT_REQ_02()); @@ -104,13 +118,13 @@ module NG_NAS_TestCases { } // End of testcase TC_5GNAS_AMF_AUT_REQ_02 /** - * @desc Verify that the IUT stops re-sending an AUTHENTICATION REQUEST message if no AUTHENTICATION RESPONSE message is received on the fifth expiry of timer T3560 + * @desc Verify that the IUT stops re-sending an AUTHENTICATION_REQUEST message if no AUTHENTICATION_RESPONSE message is received on the fifth expire of timer T3560 * @see ETSI TS 124 501 [1], Clauses 5.4.1.3.7 b) and Table 10.3.1 */ - testcase TC_5GNAS_AMF_AUT_REQ_03() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_AUT_REQ_03() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -119,7 +133,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_AUT_REQ_03()); @@ -132,13 +146,13 @@ module NG_NAS_TestCases { } // End of testcase TC_5GNAS_AMF_AUT_REQ_03 /** - * @desc Verify that the IUT sends an IDENTITY REQUEST message correctly upon receipt of an AUTHENTICATION FAILURE message indicating a 5GMM cause value #20 - MAC failure + * @desc Verify that the IUT sends an IDENTITY_REQUEST message correctly upon receipt of an AUTHENTICATION_FAILURE message indicating a 5GMM cause value #20 - MAC failure * @see ETSI TS 124 501 [1], Clauses 5.4.1.3.7 c) and 8.2.4 */ - testcase TC_5GNAS_AMF_AUT_REQ_04() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_AUT_REQ_04() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -147,7 +161,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_AUT_REQ_04()); @@ -160,13 +174,13 @@ module NG_NAS_TestCases { } // End of testcase TC_5GNAS_AMF_AUT_REQ_04 /** - * @desc Verify that the IUT sends a new AUTHENTICATION REQUEST message with new ngKSI value to re-initiate the 5G AKA based primary authentication upon receipt of an AUTHENTICATION FAILURE message indicating a 5GMM cause value #71 - ngKSI already in use + * @desc Verify that the IUT sends a new AUTHENTICATION_REQUEST message with new ngKSI value to re-initiate the 5G AKA based primary authentication upon receipt of an AUTHENTICATION_FAILURE message indicating a 5GMM cause value #71 - ngKSI already in use * @see ETSI TS 124 501 [1], Clauses 5.4.1.3.7 e) and 8.2.4 */ - testcase TC_5GNAS_AMF_AUT_REQ_05() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_AUT_REQ_05() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -175,7 +189,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_AUT_REQ_05()); @@ -188,13 +202,13 @@ module NG_NAS_TestCases { } // End of testcase TC_5GNAS_AMF_AUT_REQ_05 /** - * @desc Verify that the IUT sends a new IDENTITY REQUEST message to obtain the SUCI from the UE upon receipt of an AUTHENTICATION FAILURE message indicating a 5GMM cause value #26 - non-5G authentication unacceptable + * @desc Verify that the IUT sends an IDENTITY_REQUEST message to obtain the SUCI from the UE upon receipt of an AUTHENTICATION_FAILURE message indicating a 5GMM cause value #26 - non-5G authentication unacceptable * @see ETSI TS 124 501 [1], Clauses 5.4.1.3.7 and 8.2.4 */ - testcase TC_5GNAS_AMF_AUT_ABN_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_AUT_ABN_01() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -203,7 +217,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_AUT_ABN_01()); @@ -223,10 +237,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT sends a SECURITY MODE COMMAND message correctly to indicate NAS security mode procedure upon receipt of a NAS AUTHENTICATION RESPONSE * @see ETSI TS 124 501 [1], Clause 5.4.1.2 */ - testcase TC_NGNAS_AMF_AUT_SEQ_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_SEC_COM_01() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -235,26 +249,26 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start - v_ngnas_ngap_gnb.start(f_TC_NGNAS_AMF_AUT_SEQ_01()); + v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_SEC_COM_01()); // synchronize PTC on 1 sychronization points f_serverSyncNClientsAndStop(1, {c_prDone, c_tbDone, c_poDone}); //f_cf_Down/*gNBoraMF*/(); - } // End of testcase TC_NGNAS_AMF_AUT_SEQ_01 + } // End of testcase TC_5GNAS_AMF_SEC_COM_01 /** * @desc Verify that the IUT, upon receiving the NAS SECURITY MODE COMPLETE message after completing the NAS Authentication and Security procedure, successfully completes the registration process by accepting the registration * @see ETSI TS 124 501 [1], Clause 5.4.2 and 8.2.25 */ - testcase TC_5GNAS_AMF_SEC_ACC_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_SEC_ACC_01() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -263,7 +277,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_SEC_ACC_01()); @@ -279,10 +293,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT, upon receiving the NAS SECURITY MODE REJECT Message after a failed NAS Authentication and security procedure, successfully aborts the registration process by rejecting the registration * @see ETSI TS 124 501 [1], Clause 5.4.2 and 8.2.25 */ - testcase TC_5GNAS_AMF_SEC_REJ_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_SEC_REJ_01() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -291,7 +305,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_SEC_REJ_01()); @@ -311,10 +325,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT correctly handles a UL NAS transport message containing a PDU SESSION ESTABLISHMENT REQUEST from the UE and responds with a DL NAS transport message containing a PDU SESSION ESTABLISHMENT ACCEPT * @see ETSI TS 124 501 [1], Clause 5.4.5 and 8.2.10, 8.2.11 */ - testcase TC_5GNAS_AMF_DLN_ACC_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_DLN_ACC_01() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -323,7 +337,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_DLN_ACC_01()); @@ -345,10 +359,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT sends a REGISTRATION ACCEPT message containing the 5GS registration result, TAI list, 5G-GUTI and T3512 when initial registration is accepted by the network * @see ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7 */ - testcase TC_5GNAS_AMF_REG_ACC_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_REG_ACC_01() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -357,7 +371,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_REG_ACC_01()); @@ -373,10 +387,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT sends a REGISTRATION ACCEPT message indicating SMS over NAS allowed when initial registration with SMS over NAS is requested and network allows SMS service * @see ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7 */ - testcase TC_5GNAS_AMF_REG_ACC_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_REG_ACC_02() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -385,7 +399,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_REG_ACC_02()); @@ -401,10 +415,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT sends a REGISTRATION ACCEPT message indicating SMS over NAS not allowed when initial registration with SMS over NAS is requested and network does not support SMS service * @see ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7 */ - testcase TC_5GNAS_AMF_REG_ACC_03() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_REG_ACC_03() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -413,7 +427,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_REG_ACC_03()); @@ -429,10 +443,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT includes the allowed NSSAI in the REGISTRATION ACCEPT message when the UE includes a requested NSSAI in the REGISTRATION REQUEST message and the network allows one or more S-NSSAIs from the requested NSSAI * @see ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7 */ - testcase TC_5GNAS_AMF_REG_ACC_04() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_REG_ACC_04() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -441,7 +455,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_REG_ACC_04()); @@ -457,10 +471,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT optionally includes rejected NSSAI in the REGISTRATION ACCEPT message when the network rejects one or more S-NSSAIs from the requested NSSAI * @see ETSI TS 124 501 [1], Clauses 5.5.1.2.4 and 8.2.7 */ - testcase TC_5GNAS_AMF_REG_ACC_05() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_REG_ACC_05() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -469,7 +483,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_REG_ACC_05()); @@ -485,10 +499,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT rejects initial registration request due to general NAS level mobility management congestion control with 5GMM cause value #22 - congestion and assign a value for back-off timer T3346 * @see ETSI TS 124 501 [1], Clauses 5.5.1.2.5 and 8.2.9 */ - testcase TC_5GNAS_AMF_REG_REJ_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_REG_REJ_01() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -497,7 +511,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_REG_REJ_01()); @@ -513,10 +527,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT rejects initial registration request because all the S-NSSAI(s) included in the requested NSSAI are either rejected for current PLMN, rejected for the current registration area or rejected due to failed or revoked NSSAIs * @see ETSI TS 124 501 [1], Clauses 5.5.1.2.5 and 8.2.9 */ - testcase TC_5GNAS_AMF_REG_REJ_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_REG_REJ_02() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -525,7 +539,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_REG_REJ_02()); @@ -545,10 +559,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT, upon receiving a DEREGISTRATION REQUEST message containing the De-registration type IE with Normal de-registration from the UE, sends a DEREGISTRATION ACCEPT message * @see ETSI TS 124 501 [1], Clauses 5.5.2.2.3, 8.2.12 and 8.2.13 */ - testcase TC_5GNAS_AMF_DRG_ACC_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_DRG_ACC_01() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -557,7 +571,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_DRG_ACC_01()); @@ -573,10 +587,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT, upon receiving a DEREGISTRATION REQUEST message containing the De-registration type IE with Switch-off from the UE, does not send a DEREGISTRATION ACCEPT message and IUT completes de-registration procedure * @see ETSI TS 124 501 [1], Clauses 5.5.2.2.3, 8.2.12 and 8.2.13 */ - testcase TC_5GNAS_AMF_DRG_ACC_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_DRG_ACC_02() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -585,7 +599,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_DRG_ACC_02()); @@ -605,10 +619,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT initiates network de-registration by sending a DEREGISTRATION REQUEST message containing De-registration type IE with re-registration not required and the access type based on the UE’s registration status (3GPP access only). **NOTE:** explicit network deregistration triggered by O&M - deactivation of UE * @see ETSI TS 124 501 [1], Clauses 5.5.2.3.1 and 8.2.14 */ - testcase TC_5GNAS_AMF_DRG_REQ_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_DRG_REQ_01() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -617,7 +631,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_DRG_REQ_01()); @@ -633,10 +647,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT initiates network de-registration by sending a DEREGISTRATION REQUEST message and if UE does not send DEREGISTRATION ACCEPT then IUT retransmits DEREGISTRATION REQUEST message after timer T3522 expiration. **NOTE:** explicit network deregistration triggered by O&M - UE deregistration * @see ETSI TS 124 501 [1], Clauses 5.5.2.3.1 and 8.2.14 */ - testcase TC_5GNAS_AMF_DRG_REQ_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_DRG_REQ_02() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -645,7 +659,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_DRG_REQ_02()); @@ -661,10 +675,10 @@ module NG_NAS_TestCases { * @desc Verify that the IUT initiates network de-registration by sending DEREGISTRATION REQUEST message containing De-registration type IE with re-registration required and the access type based on the UE’s registration status (3GPP access only). **NOTE 1:** UE sends DEREGISTRATION ACCEPT and starts with re-registration procedure.(also used ref 5.5.2.3.2 1st paragraph) **NOTE 2:** explicit network deregistration triggered by O&M - UE deregistration" * @see ETSI TS 124 501 [1], Clauses 5.5.2.3.1, 5.5.2.3.2 and 8.2.14 */ - testcase TC_5GNAS_AMF_DRG_REQ_03() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + testcase TC_5GNAS_AMF_DRG_REQ_03() runs on aMF_NGNAS_NGAPComponent system TestAdapter { // Local variables - var gNB_NGNAS_NGAPComponent v_ngnas_ngap_gnb; + var aMF_NGNAS_NGAPComponent v_ngnas_ngap_gnb; // Test control if (not PICS_NGNAS) { @@ -673,7 +687,7 @@ module NG_NAS_TestCases { } // Test component configuration - f_cf_NGNAS_gNB_Up(v_ngnas_ngap_gnb); + f_cf_NGNAS_aMF_Up(v_ngnas_ngap_gnb); // Start v_ngnas_ngap_gnb.start(f_TC_5GNAS_AMF_DRG_REQ_03()); @@ -833,4 +847,2307 @@ module NG_NAS_TestCases { } // End of group TC_AMF_NGAP + /** + * @see https://www.ericsson.com/en/blog/2021/9/authentication-and-key-agreements + */ + group fiveG_AKA_Crypto_Functions { + + /** + * @desc Verify that OP is set correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Annex 2: Specification of the Block Cipher Algorithm Rijndael + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 3.3 Test Set 1 + */ + testcase TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_01_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 3.3 Test Set 1 + var O16_Type v_key := '465b5ce8b199b49faa5f0a2ee238a6bc'O; + var O16_Type v_plain_text := 'ee36f7cf037d37d3692f7f0399e7949a'O; + var O16_Type v_cypher := '9e2980c59739da67b136355e3cede6a2'O; + + var O16_Type v_cypher_computed; + var integer v_result := f_rijndael_encrypt(v_key, v_plain_text, v_cypher_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_rijndael_encrypt' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_cypher_computed, v_cypher))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_cypher_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_cypher_computed' returned the expected value ***"); + setverdict(pass); + } + } + + } // End of testcase TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_01 + + /** + * @desc Verify that OP is set correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Annex 2: Specification of the Block Cipher Algorithm Rijndael + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 3.4. Test Set 2 + */ + testcase TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_01_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 3.4. Test Set 2 + var O16_Type v_key := '0396eb317b6d1c36f19c1c84cd6ffd16'O; + var O16_Type v_plain_text := '93cc3640c5d6a521d81235bd0882bf0a'O; + var O16_Type v_cypher := '009a9e0996561525f611667bbf79e226'O; + + var O16_Type v_cypher_computed; + var integer v_result := f_rijndael_encrypt(v_key, v_plain_text, v_cypher_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_rijndael_encrypt' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_cypher_computed, v_cypher))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_cypher_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_cypher_computed' returned the expected value ***"); + setverdict(pass); + } + } + + } // End of testcase TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_02 + + /** + * @desc Verify that OP is set correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Annex 2: Specification of the Block Cipher Algorithm Rijndael + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 3.5. Test Set 3 + */ + testcase TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_01_03() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 3.5. Test Set 3 + var O16_Type v_key := 'fec86ba6eb707ed08905757b1bb44b8f'O; + var O16_Type v_plain_text := '8f7a8f0d108b7f2d97a53eacc1d958d9'O; + var O16_Type v_cypher := '5d9bce854decaf0da93d28b7e35f608c'O; + + var O16_Type v_cypher_computed; + var integer v_result := f_rijndael_encrypt(v_key, v_plain_text, v_cypher_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_rijndael_encrypt' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_cypher_computed, v_cypher))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_cypher_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_cypher_computed' returned the expected value ***"); + setverdict(pass); + } + } + + } // End of testcase TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_03 + + /** + * @desc Verify that OP is set correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Annex 2: Specification of the Block Cipher Algorithm Rijndael + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 3.6 Test Set 4 + */ + testcase TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_01_04() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 3.6 Test Set 4 + var O16_Type v_key := '9e5944aea94b81165c82fbf9f32db751'O; + var O16_Type v_plain_text := '68c98bbfab628ec1adf2a3d90c34a751'O; + var O16_Type v_cypher := 'db2944cce8e683cd03fff19931a12135'O; + + var O16_Type v_cypher_computed; + var integer v_result := f_rijndael_encrypt(v_key, v_plain_text, v_cypher_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_rijndael_encrypt' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_cypher_computed, v_cypher))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_cypher_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_cypher_computed' returned the expected value ***"); + setverdict(pass); + } + } + + } // End of testcase TC_5G_AKA_RIJNDAEL_FUNCTIONS_TEST_04 + + /** + * @desc Verify that OP is set correctly + * @see ETSI TS 135 205 V16.0.0 (2020-08) Clause 8.3 Analysis of the role of OP and OPc + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var O16_Type v_test; + + f_set_op(v_op); + + f_get_op(v_test); + if (not(match(v_test, v_op))) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_get_op' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'fx_get_op' returned the expected value ***"); + setverdict(pass); + } + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_01 + + /** + * @desc Verify that computing of OPC is working fine + * @see ETSI TS 135 205 V16.0.0 (2020-08) Clause 8.3 Analysis of the role of OP and OPc + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_02_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var O16_Type v_opc := 'cd63cb71954a9f4e48a5994e37a02baf'O; + + var O16_Type v_opc_computed; + + f_set_op(v_op); + var integer v_result := f_compute_opc(v_K, v_opc_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_compute_opc' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_opc, v_opc_computed))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_opc_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_opc_computed' returned the expected value ***"); + setverdict(pass); + } + } + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_02_01 + + /** + * @desc Verify that computing of OPC is working fine + * @see ETSI TS 135 205 V16.0.0 (2020-08) Clause 8.3 Analysis of the role of OP and OPc + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.4 Test Set 2 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_02_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.4 Test Set 2 + var O16_Type v_K := '0396eb317b6d1c36f19c1c84cd6ffd16'O; // The long-term key: Subscriber key + var O16_Type v_op := 'ff53bade17df5d4e793073ce9d7579fa'O; // Operator Variant Algorithm Configuration Field + var O16_Type v_opc := '53c15671c60a4b731c55b4a441c0bde2'O; + + var O16_Type v_opc_computed; + + f_set_op(v_op); + var integer v_result := f_compute_opc(v_K, v_opc_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_compute_opc' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_opc, v_opc_computed))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_opc_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_opc_computed' returned the expected value ***"); + setverdict(pass); + } + } + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_02_02 + + /** + * @desc Verify that computing of OPC is working fine + * @see ETSI TS 135 205 V16.0.0 (2020-08) Clause 8.3 Analysis of the role of OP and OPc + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.5 Test Set 3 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_02_03() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.5 Test Set 3 + var O16_Type v_K := 'fec86ba6eb707ed08905757b1bb44b8f'O; // The long-term key: Subscriber key + var O16_Type v_op := 'dbc59adcb6f9a0ef735477b7fadf8374'O; // Operator Variant Algorithm Configuration Field + var O16_Type v_opc := '1006020f0a478bf6b699f15c062e42b3'O; + + var O16_Type v_opc_computed; + + f_set_op(v_op); + var integer v_result := f_compute_opc(v_K, v_opc_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_compute_opc' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_opc, v_opc_computed))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_opc_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_opc_computed' returned the expected value ***"); + setverdict(pass); + } + } + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_02_03 + + /** + * @desc Verify that the f_extract_xxx_from_autn functions are working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Clause 3.1 Definitions + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_03() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var B48_Type v_sqn := oct2bit('ff9bb4d0b607'O); + var B16_Type v_amf := oct2bit('b9b9'O); // AMF: Authentication Management Field + var B64_Type v_mac := oct2bit('4a9ffac354dfafb3'O); // MAC: Message Authentication Code + + // Rebuild AUTN, the Authentication Token: AUTN = SQN ⊕ AK || AMF || MAC + var B128_Type v_autn := v_sqn & v_amf & v_mac; + + // Extract SQN from v_sqn_ak and XOR it with calculated MAC + var B48_Type v_sqn_ex := f_extract_sqn_ak_from_autn(v_autn); + var B16_Type v_amf_ex := f_extract_amf_from_autn(v_autn); + var B64_Type v_mac_ex := f_extract_mac_from_autn(v_autn); + + if (not(match(v_sqn_ex, v_sqn))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_sqn_ex' mismatch. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_sqn_ex' is as expected. ***"); + } + + if (not(match(v_amf_ex, v_amf))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_amf_ex' mismatch. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_amf_ex' is as expected. ***"); + } + + if (not(match(v_mac_ex, v_mac))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_ex' mismatch. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_ex' is as expected. ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_03 + + /** + * @desc Verify that the f1 functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_04_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var B48_Type v_sqn := oct2bit('ff9bb4d0b607'O); + var B16_Type v_amf := oct2bit('b9b9'O); // AMF: Authentication Management Field + var B64_Type v_mac_a := oct2bit('4a9ffac354dfafb3'O); // MAC-A: Network authentication code + + f_set_op(v_op); + var B64_Type v_mac_a_computed; + var integer v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_mac_a_computed, v_mac_a))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_a_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_a_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_04_01 + + /** + * @desc Verify that the f1 functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.4 Test Set 2 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_04_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '0396eb317b6d1c36f19c1c84cd6ffd16'O; // The long-term key: Subscriber key + var O16_Type v_op := 'ff53bade17df5d4e793073ce9d7579fa'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('c00d603103dcee52c4478119494202e8'O); + var B48_Type v_sqn := oct2bit('fd8eef40df7d'O); + var B16_Type v_amf := oct2bit('af17'O); // AMF: Authentication Management Field + var B64_Type v_mac_a := oct2bit('5df5b31807e258b0'O); // MAC-A: Network authentication code + + f_set_op(v_op); + var B64_Type v_mac_a_computed; + var integer v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_mac_a_computed, v_mac_a))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_a_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_a_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_04_02 + + /** + * @desc Verify that the f1 functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.5 Test Set 3 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_04_03() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := 'fec86ba6eb707ed08905757b1bb44b8f'O; // The long-term key: Subscriber key + var O16_Type v_op := 'dbc59adcb6f9a0ef735477b7fadf8374'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('9f7c8d021accf4db213ccff0c7f71a6a'O); + var B48_Type v_sqn := oct2bit('9d0277595ffc'O); + var B16_Type v_amf := oct2bit('725c'O); // AMF: Authentication Management Field + var B64_Type v_mac_a := oct2bit('9cabc3e99baf7281'O); // MAC-A: Network authentication code + + f_set_op(v_op); + var B64_Type v_mac_a_computed; + var integer v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_mac_a_computed, v_mac_a))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_a_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_a_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_04_03 + + /** + * @desc Verify that the f1* functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_05_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var B48_Type v_sqn := oct2bit('ff9bb4d0b607'O); + var B16_Type v_amf := oct2bit('b9b9'O); // AMF: Authentication Management Field + var B64_Type v_mac_s := oct2bit('01cfaf9ec4e871e9'O); // MAC-S: Resynch authentication code + + f_set_op(v_op); + var B64_Type v_mac_s_computed; + var integer v_result := f_f1star(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_s_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_mac_s_computed, v_mac_s))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_s_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_s_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_05_01 + + /** + * @desc Verify that the f1* functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.4 Test Set 2 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_05_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '0396eb317b6d1c36f19c1c84cd6ffd16'O; // The long-term key: Subscriber key + var O16_Type v_op := 'ff53bade17df5d4e793073ce9d7579fa'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('c00d603103dcee52c4478119494202e8'O); + var B48_Type v_sqn := oct2bit('fd8eef40df7d'O); + var B16_Type v_amf := oct2bit('af17'O); // AMF: Authentication Management Field + var B64_Type v_mac_s := oct2bit('a8c016e51ef4a343'O); // MAC-S: Resynch authentication code + + f_set_op(v_op); + var B64_Type v_mac_s_computed; + var integer v_result := f_f1star(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_s_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_mac_s_computed, v_mac_s))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_s_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_s_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_05_02 + + /** + * @desc Verify that the f1* functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.5 Test Set 3 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_05_03() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := 'fec86ba6eb707ed08905757b1bb44b8f'O; // The long-term key: Subscriber key + var O16_Type v_op := 'dbc59adcb6f9a0ef735477b7fadf8374'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('9f7c8d021accf4db213ccff0c7f71a6a'O); + var B48_Type v_sqn := oct2bit('9d0277595ffc'O); + var B16_Type v_amf := oct2bit('725c'O); // AMF: Authentication Management Field + var B64_Type v_mac_s := oct2bit('95814ba2b3044324'O); // MAC-S: Resynch authentication code + + f_set_op(v_op); + var B64_Type v_mac_s_computed; + var integer v_result := f_f1star(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_s_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_mac_s_computed, v_mac_s))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_s_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_s_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_05_03 + + /** + * @desc Verify that the f2 functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_06_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var B64_Type v_xres := oct2bit('a54211d5e3ba50bf'O); // Response. f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ck := oct2bit('b40ba9a3c58b2a05bbf0d987b21bf8cb'O); // Confidentiality key. f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ik := oct2bit('f769bcd751044604127672711c6d3441'O); // Integrity key + var B48_Type v_ak := oct2bit('aa689c648370'O); // Anonymity key + + f_set_op(v_op); + var B64_Type v_res_computed; + var B128_Type v_ck_computed; + var B128_Type v_ik_computed; + var B48_Type v_ak_computed; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_res_computed, v_ck_computed, v_ik_computed, v_ak_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_res_computed, v_xres))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_res_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_res_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_06_01 + + /** + * @desc Verify that the f2 functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 2 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_06_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 2 + var O16_Type v_K := '0396eb317b6d1c36f19c1c84cd6ffd16'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('c00d603103dcee52c4478119494202e8'O); + var O16_Type v_op := 'ff53bade17df5d4e793073ce9d7579fa'O; // Operator Variant Algorithm Configuration Field + var B64_Type v_xres := oct2bit('d3a628ed988620f0'O); // Response. f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ck := oct2bit('58c433ff 7a7082ac d424220f 2b67c556'O); // Confidentiality key. f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ik := oct2bit('21a8c1f929702adb3e738488b9f5c5da'O); // Integrity key + var B48_Type v_ak := oct2bit('c47783995f72'O); // Anonymity key + + f_set_op(v_op); + var B64_Type v_res_computed; + var B128_Type v_ck_computed; + var B128_Type v_ik_computed; + var B48_Type v_ak_computed; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_res_computed, v_ck_computed, v_ik_computed, v_ak_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_res_computed, v_xres))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_res_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_res_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_06_02 + + /** + * @desc Verify that the f3 functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_07_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var B64_Type v_xres := oct2bit('a54211d5e3ba50bf'O); // Response. f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ck := oct2bit('b40ba9a3c58b2a05bbf0d987b21bf8cb'O); // Confidentiality key. f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ik := oct2bit('f769bcd751044604127672711c6d3441'O); // Integrity key + var B48_Type v_ak := oct2bit('aa689c648370'O); // Anonymity key + + f_set_op(v_op); + var B64_Type v_res_computed; + var B128_Type v_ck_computed; + var B128_Type v_ik_computed; + var B48_Type v_ak_computed; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_res_computed, v_ck_computed, v_ik_computed, v_ak_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_ck_computed, v_ck))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_ck_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_ck_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_07_01 + + /** + * @desc Verify that the f3 functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 2 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_07_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 2 + var O16_Type v_K := '0396eb317b6d1c36f19c1c84cd6ffd16'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('c00d603103dcee52c4478119494202e8'O); + var O16_Type v_op := 'ff53bade17df5d4e793073ce9d7579fa'O; // Operator Variant Algorithm Configuration Field + var B64_Type v_xres := oct2bit('d3a628ed988620f0'O); // Response. f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ck := oct2bit('58c433ff 7a7082ac d424220f 2b67c556'O); // Confidentiality key. f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ik := oct2bit('21a8c1f929702adb3e738488b9f5c5da'O); // Integrity key + var B48_Type v_ak := oct2bit('c47783995f72'O); // Anonymity key + + f_set_op(v_op); + var B64_Type v_res_computed; + var B128_Type v_ck_computed; + var B128_Type v_ik_computed; + var B48_Type v_ak_computed; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_res_computed, v_ck_computed, v_ik_computed, v_ak_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_ck_computed, v_ck))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_ck_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_ck_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_07_02 + + /** + * @desc Verify that the f4 functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_08_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var B64_Type v_xres := oct2bit('a54211d5e3ba50bf'O); // Response. f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ck := oct2bit('b40ba9a3c58b2a05bbf0d987b21bf8cb'O); // Confidentiality key. f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ik := oct2bit('f769bcd751044604127672711c6d3441'O); // Integrity key + var B48_Type v_ak := oct2bit('aa689c648370'O); // Anonymity key + + f_set_op(v_op); + var B64_Type v_res_computed; + var B128_Type v_ck_computed; + var B128_Type v_ik_computed; + var B48_Type v_ak_computed; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_res_computed, v_ck_computed, v_ik_computed, v_ak_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_ik_computed, v_ik))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_ik_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_ik_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_08_01 + + /** + * @desc Verify that the f4 functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 2 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_08_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 2 + var O16_Type v_K := '0396eb317b6d1c36f19c1c84cd6ffd16'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('c00d603103dcee52c4478119494202e8'O); + var O16_Type v_op := 'ff53bade17df5d4e793073ce9d7579fa'O; // Operator Variant Algorithm Configuration Field + var B64_Type v_xres := oct2bit('d3a628ed988620f0'O); // Response. f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ck := oct2bit('58c433ff 7a7082ac d424220f 2b67c556'O); // Confidentiality key. f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ik := oct2bit('21a8c1f929702adb3e738488b9f5c5da'O); // Integrity key + var B48_Type v_ak := oct2bit('c47783995f72'O); // Anonymity key + + f_set_op(v_op); + var B64_Type v_res_computed; + var B128_Type v_ck_computed; + var B128_Type v_ik_computed; + var B48_Type v_ak_computed; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_res_computed, v_ck_computed, v_ik_computed, v_ak_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_ik_computed, v_ik))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_ik_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_ik_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_08_02 + + /** + * @desc Verify that the f5 functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_09_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var B64_Type v_xres := oct2bit('a54211d5e3ba50bf'O); // Response. f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ck := oct2bit('b40ba9a3c58b2a05bbf0d987b21bf8cb'O); // Confidentiality key. f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ik := oct2bit('f769bcd751044604127672711c6d3441'O); // Integrity key + var B48_Type v_ak := oct2bit('aa689c648370'O); // Anonymity key + + f_set_op(v_op); + var B64_Type v_res_computed; + var B128_Type v_ck_computed; + var B128_Type v_ik_computed; + var B48_Type v_ak_computed; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_res_computed, v_ck_computed, v_ik_computed, v_ak_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_ak_computed, v_ak))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_ak_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_ak_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_09_01 + + /** + * @desc Verify that the f5 functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 2 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_09_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 2 + var O16_Type v_K := '0396eb317b6d1c36f19c1c84cd6ffd16'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('c00d603103dcee52c4478119494202e8'O); + var O16_Type v_op := 'ff53bade17df5d4e793073ce9d7579fa'O; // Operator Variant Algorithm Configuration Field + var B64_Type v_xres := oct2bit('d3a628ed988620f0'O); // Response. f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ck := oct2bit('58c433ff7a7082acd424220f2b67c556'O); // Confidentiality key. f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ik := oct2bit('21a8c1f929702adb3e738488b9f5c5da'O); // Integrity key + var B48_Type v_ak := oct2bit('c47783995f72'O); // Anonymity key + + f_set_op(v_op); + var B64_Type v_res_computed; + var B128_Type v_ck_computed; + var B128_Type v_ik_computed; + var B48_Type v_ak_computed; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_res_computed, v_ck_computed, v_ik_computed, v_ak_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_ak_computed, v_ak))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_ak_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_ak_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_09_02 + + /** + * @desc Verify that the f5* functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.3 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_10_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B48_Type v_ak_s := oct2bit('451e8beca43b'O); // Anonymity key for the re-synchronisation + + f_set_op(v_op); + var B48_Type v_ak_s_computed; + var integer v_result := f_f5star(oct2bit(v_K), v_rand, v_ak_s_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f5star' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_ak_s_computed, v_ak_s))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_ak_s_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_ak_s_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_10_01 + + /** + * @desc Verify that the f5* functions is working correctly + * @see ETSI TS 135 206 V16.0.0 (2020-08) Clause 4.1 Algorithm Framework + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.3 Test Set 2 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_10_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 6.3 Test Set 1 + var O16_Type v_K := '0396eb317b6d1c36f19c1c84cd6ffd16'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('c00d603103dcee52c4478119494202e8'O); + var O16_Type v_op := 'ff53bade17df5d4e793073ce9d7579fa'O; // Operator Variant Algorithm Configuration Field + var B48_Type v_ak_s := oct2bit('30f1197061c1'O); // Anonymity key for the re-synchronisation + + f_set_op(v_op); + var B48_Type v_ak_s_computed; + var integer v_result := f_f5star(oct2bit(v_K), v_rand, v_ak_s_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f5star' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } else { + if (not(match(v_ak_s_computed, v_ak_s))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_ak_s_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_ak_s_computed' returned the expected value ***"); + } + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_10_02 + + /** + * @desc Verify that the KeyDerivationFunctions is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_11() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var B256_Type v_Ks := oct2bit('efa09b59f3995f1a4ec7e99816290253c01ce4d774b21e1e141379d59c665ee3'O); // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + var octetstring v_S := '06D540050123456789000f00000002'O; + var B256_Type v_derived_key := oct2bit('0c01ec8210931fdaa57448583b69e8f0ce99db7560d07dd3719765d26bf4c12f'O); + + var B256_Type v_derived_key_computed := fx_KeyDerivationFunction(1, v_Ks, v_S); + if (not(match(v_derived_key_computed, v_derived_key))) { // Verified by https://cryptii.com/pipes/hmac + log("*** " & __SCOPE__ & ": ERROR: 'v_derived_key_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_derived_key_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_11 + + /** + * @desc Verify that the fl_GetServingNetworkName function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_12_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + var hexstring v_NID := '000138'H; // NID: Network Identifier + var octetstring v_P0 := fl_GetServingNetworkName(v_PLMN, v_NID); + log("v_P0 =", oct2char(v_P0)); + if (v_P0 != '35473A6D6E633030312E6D63633030312E336770706E6574776F726B2E6F72673A303030313338'O) { + log("*** " & __SCOPE__ & ": ERROR: 'fl_GetServingNetworkName' returned an unexpected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'fl_GetServingNetworkName' returned: " & oct2char(v_P0) & " ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_12_01 + + /** + * @desc Verify that the fl_GetServingNetworkName function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_12_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var NAS_PlmnId v_PLMN := '641010'O; // PLMN ID: 001-01 + var octetstring v_P0 := fl_GetServingNetworkName(v_PLMN); + log("v_P0 =", oct2char(v_P0)); + if (v_P0 != '35473a6d6e633031312e6d63633436302e336770706e6574776f726b2e6f7267'O) { + log("*** " & __SCOPE__ & ": ERROR: 'fl_GetServingNetworkName' returned an unexpected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'fl_GetServingNetworkName' returned: " & oct2char(v_P0) & " ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_12_02 + + /** + * @desc Verify that the fl_GetServingNetworkName function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_13() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + var NAS_Mcc v_nas_mcc := '001'H; // MCC: Mobile Country Code, + var hexstring v_nas_mnc := '01'H; // MNC: Mobile Network Code + var NAS_PlmnId v_plmn := fl_NasNN_MCC2PlmnId(v_nas_mcc, v_nas_mnc); + if (v_plmn != '00f110'O) { + log("*** " & __SCOPE__ & ": ERROR: 'fl_NasNN_MCC2PlmnId' returned an unexpected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'fl_NasNN_MCC2PlmnId' returned: ", v_plmn, " ***"); + } + + v_nas_mcc := '505'H; // MCC: Mobile Country Code, + v_nas_mnc := '93'H; // MNC: Mobile Network Code + v_plmn := fl_NasNN_MCC2PlmnId(v_nas_mcc, v_nas_mnc); + if (v_plmn != '05f539'O) { + log("*** " & __SCOPE__ & ": ERROR: 'fl_NasNN_MCC2PlmnId' returned an unexpected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'fl_NasNN_MCC2PlmnId' returned: ", v_plmn, " ***"); + } + + v_nas_mcc := '999'H; // MCC: Mobile Country Code, + v_nas_mnc := '70'H; // MNC: Mobile Network Code + v_plmn := fl_NasNN_MCC2PlmnId(v_nas_mcc, v_nas_mnc); + if (v_plmn != '99f907'O) { + log("*** " & __SCOPE__ & ": ERROR: 'fl_NasNN_MCC2PlmnId' returned an unexpected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'fl_NasNN_MCC2PlmnId' returned: ", v_plmn, " ***"); + } + + v_nas_mcc := '732'H; // MCC: Mobile Country Code, + v_nas_mnc := '123'H; // MNC: Mobile Network Code + v_plmn := fl_NasNN_MCC2PlmnId(v_nas_mcc, v_nas_mnc); + if (v_plmn != '373221'O) { + log("*** " & __SCOPE__ & ": ERROR: 'fl_NasNN_MCC2PlmnId' returned an unexpected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'fl_NasNN_MCC2PlmnId' returned: ", v_plmn, " ***"); + } + + setverdict(pass); + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_13 + + /** + * @desc Verify that the fx__CalculateFCS32 function is working correctly + * @see https://crccalc.com/?crc=aaaaaaaaaaaa5555555555550004deadbeef&method=CRC-32&datatype=hex&outtype=hex + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_14_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var bitstring v_crc := oct2bit('855D5CB0'O); + + var bitstring v_crc_computed := fx_CalculateFCS32(oct2bit('aaaaaaaaaaaa5555555555550004deadbeef'O)); + log(v_crc); + log(v_crc_computed); + if (not(match(v_crc_computed, v_crc))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_crc_computed' returned an unexpected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_crc_computed' returned: ", bit2oct(v_crc_computed), " ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_14_01 + + /** + * @desc Verify that the fx__CalculateFCS32 function is working correctly + * @see https://crccalc.com/?crc=35473A6D6E633030312E6D63633030312E336770706E6574776F726B2E6F72673A303030313338&method=CRC-32&datatype=hex&outtype=hex + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_14_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var bitstring v_crc := oct2bit('C2FE72FD'O); + + var bitstring v_crc_computed := fx_CalculateFCS32(oct2bit('35473A6D6E633030312E6D63633030312E336770706E6574776F726B2E6F72673A303030313338'O)); + log(match(v_crc_computed, v_crc)); + if (not(match(v_crc_computed, v_crc))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_crc_computed' returned an unexpected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_crc_computed' returned: ", bit2oct(v_crc_computed), " ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_14_02 + + /** + * @desc Verify that the KAUSF derivation function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_15_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var B48_Type v_sqn_ak := oct2bit('ff9bb4d0b607'O); // SQN: Sequence Number + var B16_Type v_amf := oct2bit('b9b9'O); + var B64_Type v_xres := oct2bit('a54211d5e3ba50bf'O); // Response. f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ck := oct2bit('b40ba9a3c58b2a05bbf0d987b21bf8cb'O); // Confidentiality key. f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ik := oct2bit('f769bcd751044604127672711c6d3441'O); // Integrity key + var B48_Type v_ak := oct2bit('aa689c648370'O); // Anonymity key + var B64_Type v_mac_a := oct2bit('9cabc3e99baf7281'O); // MAC-A: Network authentication code + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + var hexstring v_NID := '000138'H; // NID: Network Identifier + + f_set_op(v_op); + + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + var B256_Type v_k_ausf := oct2bit('F42CFB5BCF426A3715BB5412E16F1177DB0EECF1EC2A21AE9826E941CA2B23EC'O); + var B256_Type v_k_ausf_computed := f_NG_Authentication_A2(v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks, v_PLMN, v_NID); + if (not(match(v_k_ausf_computed, v_k_ausf))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_k_ausf_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_k_ausf_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_15_01 + + /** + * @desc Verify that the CK' and IK' derivation function is working correctly + * @see ETSI TS 133 402 V16.0.0 (2020-08) A.2 Function for the derivation of CK’, IK’ from CK, IK + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.3 CK' and IK' derivation function + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_16_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var B48_Type v_sqn_ak := oct2bit('ff9bb4d0b607'O); // SQN: Sequence Number + var B16_Type v_amf := oct2bit('b9b9'O); + var B64_Type v_xres := oct2bit('a54211d5e3ba50bf'O); // Response. f2/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ck := oct2bit('b40ba9a3c58b2a05bbf0d987b21bf8cb'O); // Confidentiality key. f3/e entry in ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 table + var B128_Type v_ik := oct2bit('f769bcd751044604127672711c6d3441'O); // Integrity key + var B48_Type v_ak := oct2bit('aa689c648370'O); // Anonymity key + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + var hexstring v_NID := '000138'H; // NID: Network Identifier + var B128_Type v_ck_p := oct2bit('8b9be2d9e808246a2f3ad44094c374fe'O); + var B128_Type v_ik_p := oct2bit('154fad1c3c57a85cbdbbcf7db7549f03'O); + var B64_Type v_mac_a := oct2bit('0000000000000000'O); // Dummy value + + f_set_op(v_op); + + var B256_Type v_derived_key := oct2bit('8B9BE2D9E808246A2F3AD44094C374FE154FAD1C3C57A85CBDBBCF7DB7549F03'O); + + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + var B256_Type v_derived_key_computed := f_NG_Authentication_A3(v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks, v_PLMN, v_NID); + if (not(match(v_derived_key_computed, v_derived_key))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_derived_key_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_derived_key_computed' returned the expected value: ", v_derived_key_computed, " ***"); + var B128_Type v_Ck_computed := substr (v_derived_key_computed, 0, 128); + log("*** " & __SCOPE__ & ": v_Ck_computed: ", v_Ck_computed, " ***"); + var B128_Type v_Ik_computed := substr (v_derived_key_computed, 128, 128); + log("*** " & __SCOPE__ & ": v_Ik_computed: ", v_Ik_computed, " ***"); + if (not(match(v_Ck_computed, v_ck_p))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_Ck_computed' did not return the expected value. ***"); + setverdict(fail); + } + if (not(match(v_Ik_computed, v_ik_p))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_Ik_computed' did not return the expected value. ***"); + setverdict(fail); + } + + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_16_01 + + /** + * @desc Verify that the RES* and XRES* derivation functions are working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.4 RES* and XRES* derivation function + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see https://www.eurecom.fr/publication/6408/download/comsys-publi-6408.pdf + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From https://www.eurecom.fr/publication/6408/download/comsys-publi-6408.pdf DATA 1 + var O16_Type v_K := '00112233445566778899aabbccddeeff'O; // The long-term key: Subscriber key + var O16_Type v_op := '000102030405060708090a0b0c0d0e0f'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('6a8959fb188c73308d679f7bc8313d65'O); + var B48_Type v_sqn_ak := oct2bit('97779b305686'O); + var NAS_PlmnId v_PLMN := '641010'O; // PLMN ID: 641-010 + + f_set_op(v_op); + + var B64_Type v_xres := oct2bit('609696B02F696DDF'O); + var B64_Type v_xres_computed; + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_xres_computed, v_ck, v_ik, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + if (not(match(v_xres_computed, v_xres))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_xres_computed' did not return the expected value. ***"); + setverdict(fail); + } + + var B256_Type v_Ks := oct2bit('12757da1c0747d4a88b7d8b86446244b7f64a6ccf95b98b25e9a41f007037d86'O); + var B256_Type v_Ks_computed := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + if (not(match(v_Ks_computed, v_Ks))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_Ks_computed' did not return the expected value. ***"); + setverdict(fail); + } + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + v_auth_params.XRES := v_xres; + v_auth_params.XRESLength := lengthof(v_xres); + + var B64_Type v_RESstar := oct2bit('03f8627a00448408'O); + var B64_Type v_XRESstar := oct2bit('6f35398f7c56df32'O); + + var B128_Type v_res := f_NG_Authentication_A4(v_PLMN, v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks); + var B64_Type v_RESstar_computed := substr(v_res, 0, 64); + var B64_Type v_XRESstar_computed := substr(v_res, 64, 64); + if (not(match(v_RESstar_computed, v_RESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_RESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_RESstar_computed' returned the expected value ***"); + } + if (not(match(v_XRESstar_computed, v_XRESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_XRESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_XRESstar_computed' returned the expected value ***"); + } + + var octetstring v_S := '6b35473a6d6e633031312e6d63633436302e336770706e6574776f726b2e6f726700206a8959fb188c73308d679f7bc8313d6500106283ace5e894a0ad0008'O; + var B256_Type v_k_ausf := oct2bit('117cc3da749fb0b92c6fc4f4547a1e7af9499391028d80d75bfe88eb813ead4c'O); + var B256_Type v_k_ausf_computed := fx_KeyDerivationFunction(1, v_Ks, v_S); + if (not(match(v_k_ausf_computed, v_k_ausf))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_k_ausf_computed' did not return the expected value. ***"); + setverdict(fail); + } + var B256_Type v_k_ausf_A2 := f_NG_Authentication_A2(v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks, v_PLMN); + log("v_k_ausf (f_NG_Authentication_A2): ", bit2oct(v_k_ausf_A2)); + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_01 + + /** + * @desc Verify that the RES* and XRES* derivation functions are working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.4 RES* and XRES* derivation function + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var B48_Type v_sqn_ak := oct2bit('ff9bb4d0b607'O); + var B16_Type v_amf := oct2bit('b9b9'O); // AMF: Authentication Management Field + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + var hexstring v_NID := '000138'H; // NID: Network Identifier + + f_set_op(v_op); + + var B64_Type v_xres; + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_xres, v_ck, v_ik, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + var B48_Type v_sqn := v_sqn_ak xor4b v_ak; // SQN = SQN_AK ⊕ AK + var B64_Type v_mac_a; + v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + var B64_Type v_mac_s; + v_result := f_f1star(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_s); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + v_auth_params.XRES := v_xres; + v_auth_params.XRESLength := lengthof(v_xres); + + var B64_Type v_RESstar := oct2bit('53D333860BCDFA0C'O); + var B64_Type v_XRESstar := oct2bit('55FB0452F974E0C9'O); + + var B128_Type v_res := f_NG_Authentication_A4(v_PLMN, v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks, v_NID); + var B64_Type v_RESstar_computed := substr(v_res, 0, 64); + var B64_Type v_XRESstar_computed := substr(v_res, 64, 64); + log("v_RESstar_computed =", bit2oct(v_RESstar_computed)); + log("v_XRESstar_computed =", bit2oct(v_XRESstar_computed)); + if (not(match(v_RESstar_computed, v_RESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_RESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_RESstar_computed' returned the expected value ***"); + } + if (not(match(v_XRESstar_computed, v_XRESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_XRESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_XRESstar_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_02 + + /** + * @desc Verify that the RES* and XRES* derivation functions are working correctly with Kontron Wireshark captures + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.4 RES* and XRES* derivation function + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_03() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From Kontron Wireshark captures: UI=001014444333000 + var O16_Type v_K := '00000000000000000000000000000000'O; // The long-term key: Subscriber key + var O16_Type v_opc := '00000000000000000000000000000000'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('807df0fdd3ef28786d10f425df603f3b'O); + var B48_Type v_sqn_ak := oct2bit('b22bfb46d847'O); + var B16_Type v_amf := oct2bit('8000'O); // AMF: Authentication Management Field + var B64_Type v_mac_a := oct2bit('5cd041c2fc08f6da'O); + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + + f_force_opc(v_opc); + + var B64_Type v_xres; + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_xres, v_ck, v_ik, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + log("v_xres =", bit2oct(v_xres)); + log("v_ck =", bit2oct(v_ck)); + log("v_ik =", bit2oct(v_ik)); + log("v_ak =", bit2oct(v_ak)); + + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + v_auth_params.XRES := v_xres; + v_auth_params.XRESLength := lengthof(v_xres); + + var B48_Type v_sqn := v_sqn_ak xor4b v_ak; // SQN = SQN_AK ⊕ AK + log("v_sqn =", bit2oct(v_sqn)); + var B64_Type v_mac_a_computed; + v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + if (not(match(v_mac_a_computed, v_mac_a))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_a_computed' did not return the expected value. ***"); + setverdict(fail); + stop; + } + + var B64_Type v_RESstar := oct2bit('26F37F6C2DC1E002'O); + var B64_Type v_XRESstar := oct2bit('A3FB2BF1A695413A'O); + var B128_Type v_res := f_NG_Authentication_A4(v_PLMN, v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks); + var B64_Type v_RESstar_computed := substr(v_res, 0, 64); + var B64_Type v_XRESstar_computed := substr(v_res, 64, 64); + log("v_RESstar_computed =", bit2oct(v_RESstar_computed)); + log("v_XRESstar_computed =", bit2oct(v_XRESstar_computed)); + if (not(match(v_RESstar_computed, v_RESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_RESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_RESstar_computed' returned the expected value ***"); + } + if (not(match(v_XRESstar_computed, v_XRESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_XRESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_XRESstar_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_03 + + /** + * @desc Verify that the RES* and XRES* derivation functions are working correctly with Kontron Wireshark captures + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.4 RES* and XRES* derivation function + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_04() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From Kontron Wireshark captures: UI=001014444333000 + var O16_Type v_K := '00000000000000000000000000000000'O; // The long-term key: Subscriber key + var O16_Type v_opc := '00000000000000000000000000000000'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('a218b7e415a50b63b4f5afd7db2c9529'O); + var B48_Type v_sqn_ak := oct2bit('e4ca34194b42'O); + var B16_Type v_amf := oct2bit('8000'O); // AMF: Authentication Management Field + var B64_Type v_mac_a := oct2bit('f058119c1778db23'O); + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + + f_force_opc(v_opc); + + var B64_Type v_xres; + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_xres, v_ck, v_ik, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + log("v_xres =", bit2oct(v_xres)); + log("v_ck =", bit2oct(v_ck)); + log("v_ik =", bit2oct(v_ik)); + log("v_ak =", bit2oct(v_ak)); + + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + v_auth_params.XRES := v_xres; + v_auth_params.XRESLength := lengthof(v_xres); + + var B48_Type v_sqn := v_sqn_ak xor4b v_ak; // SQN = SQN_AK ⊕ AK + log("v_sqn =", bit2oct(v_sqn)); + var B64_Type v_mac_a_computed; + v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a_computed); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + if (not(match(v_mac_a_computed, v_mac_a))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_a_computed' did not return the expected value. ***"); + setverdict(fail); + stop; + } + + var B64_Type v_RESstar := oct2bit('a7c39d021cc80709'O); + var B64_Type v_XRESstar := oct2bit('60775ce133f05be3'O); + var B128_Type v_res := f_NG_Authentication_A4(v_PLMN, v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks); + var B64_Type v_RESstar_computed := substr(v_res, 0, 64); + var B64_Type v_XRESstar_computed := substr(v_res, 64, 64); + log("v_RESstar_computed =", bit2oct(v_RESstar_computed)); + log("v_XRESstar_computed =", bit2oct(v_XRESstar_computed)); + if (not(match(v_RESstar_computed, v_RESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_RESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_RESstar_computed' returned the expected value ***"); + } + if (not(match(v_XRESstar_computed, v_XRESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_XRESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_XRESstar_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_17_04 + + /** + * @desc Verify that the HRES* and HXRES* derivation function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.6 KSEAF derivation function + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_18_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var B48_Type v_sqn_ak := oct2bit('ff9bb4d0b607'O); + var B16_Type v_amf := oct2bit('b9b9'O); // AMF: Authentication Management Field + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + var hexstring v_NID := '000138'H; // NID: Network Identifier + + f_set_op(v_op); + + var B64_Type v_xres; + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_xres, v_ck, v_ik, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + + var B48_Type v_sqn := v_sqn_ak xor4b v_ak; // SQN = SQN_AK ⊕ AK + log("v_sqn =", bit2oct(v_sqn)); + var B64_Type v_mac_a; + v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + var B64_Type v_mac_s; + v_result := f_f1star(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_s); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + v_auth_params.XRES := v_xres; + v_auth_params.XRESLength := lengthof(v_xres); + + var B128_Type v_res := f_NG_Authentication_A4(v_PLMN, v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks, v_NID); + var B64_Type v_RESstar := substr(v_res, 0, 64); + var B64_Type v_XRESstar := substr(v_res, 64, 64); + log("v_RESstar: ", bit2oct(v_RESstar)); + log("v_XRESstar: ", bit2oct(v_XRESstar)); + + // Using RES* + var B64_Type v_HRESstar := oct2bit('73DE4773A2C4222A'O); + var B64_Type v_HXRESstar := oct2bit('8E36B2B676510129'O); + var B128_Type v_hres := f_NG_Authentication_A5(v_rand, v_RESstar, tsc_KDF_HMAC_SHA_256, v_Ks); + var B64_Type v_HRESstar_computed := substr(v_hres, 0, 64); + var B64_Type v_HXRESstar_computed := substr(v_hres, 64, 64); + log("v_HRESstar_computed: ", bit2oct(v_HRESstar_computed)); + log("v_HXRESstar_computed: ", bit2oct(v_HXRESstar_computed)); + if (not(match(v_HRESstar_computed, v_HRESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_HRESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_HRESstar_computed' returned the expected value ***"); + } + if (not(match(v_HXRESstar_computed, v_HXRESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_HXRESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_HXRESstar_computed' returned the expected value ***"); + } + + var bitstring v_S := v_rand & v_HXRESstar; + var B256_Type v_sha256 := fx_sha256(bit2oct(v_S)); + log("v_sha256: ", bit2oct(v_sha256)); + log("High 128 bits (1): ", bit2oct(substr(v_sha256, 0, 128))); + log("Low 128 bits (1) : ", bit2oct(substr(v_sha256, 128, 128))); + + // Using XRES* + v_HRESstar := oct2bit('4DF167EA4AF5720C'O); + v_HXRESstar := oct2bit('66597478359DA9FA'O); + v_hres := f_NG_Authentication_A5(v_rand, v_XRESstar, tsc_KDF_HMAC_SHA_256, v_Ks); + v_HRESstar_computed := substr(v_hres, 0, 64); + v_HXRESstar_computed := substr(v_hres, 64, 64); + log("v_HRESstar_computed: ", bit2oct(v_HRESstar_computed)); + log("v_HXRESstar_computed: ", bit2oct(v_HXRESstar_computed)); + if (not(match(v_HRESstar_computed, v_HRESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_HRESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_HRESstar_computed' returned the expected value ***"); + } + if (not(match(v_HXRESstar_computed, v_HXRESstar))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_HXRESstar_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_HXRESstar_computed' returned the expected value ***"); + } + + v_S := v_rand & v_HXRESstar; + v_sha256 := fx_sha256(bit2oct(v_S)); + log("v_sha256: ", bit2oct(v_sha256)); + log("High 128 bits (2): ", bit2oct(substr(v_sha256, 0, 128))); + log("Low 128 bits (2) : ", bit2oct(substr(v_sha256, 128, 128))); + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_18_01 + + /** + * @desc Verify that the KSEAF derivation function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.6 KSEAF derivation function + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_19_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 5.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B48_Type v_sqn_ak := oct2bit('ff9bb4d0b607'O); + var B16_Type v_amf := oct2bit('b9b9'O); // AMF: Authentication Management Field + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + var hexstring v_NID := '000138'H; // NID: Network Identifier + + f_set_op(v_op); + + var B64_Type v_xres; + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_xres, v_ck, v_ik, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + + var B48_Type v_sqn := v_sqn_ak xor4b v_ak; // SQN = SQN_AK ⊕ AK + log("v_sqn =", bit2oct(v_sqn)); + var B64_Type v_mac_a; + v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + var B64_Type v_mac_s; + v_result := f_f1star(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_s); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + v_auth_params.XRES := v_xres; + v_auth_params.XRESLength := lengthof(v_xres); + + var B256_Type v_k_ausf := f_NG_Authentication_A2(v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks, v_PLMN, v_NID); + log("v_k_ausf: ", bit2oct(v_k_ausf)); + + var B256_Type v_k_seaf := oct2bit('B435F90FEA784700244C12804C53E087E0E2B90C8E9DDCE76EC4D3811FDEB901'O); + var B256_Type v_k_seaf_computed := f_NG_Authentication_A6(v_PLMN, v_k_ausf, tsc_KDF_HMAC_SHA_256, v_NID); + if (not(match(v_k_seaf_computed, v_k_seaf))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_k_seaf_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_k_seaf_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_19_01 + + /** + * @desc Verify that the KAMF derivation function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.7 KAMF derivation function + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_20_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B48_Type v_sqn_ak := oct2bit('ff9bb4d0b607'O); + var B16_Type v_amf := oct2bit('b9b9'O); // AMF: Authentication Management Field + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + var hexstring v_NID := '000138'H; // NID: Network Identifier + var charstring v_supi := "001014444333000"; + + f_set_op(v_op); + + var B64_Type v_xres; + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_xres, v_ck, v_ik, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } + + var B48_Type v_sqn := v_sqn_ak xor4b v_ak; // SQN = SQN_AK ⊕ AK + log("v_sqn =", bit2oct(v_sqn)); + var B64_Type v_mac_a; + v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + v_auth_params.XRES := v_xres; + v_auth_params.XRESLength := lengthof(v_xres); + + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + var B256_Type v_k_ausf := f_NG_Authentication_A2(v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks, v_PLMN, v_NID); + + var B256_Type v_k_seaf := f_NG_Authentication_A6(v_PLMN, v_k_ausf, tsc_KDF_HMAC_SHA_256, v_NID); + + var B256_Type v_k_amf := oct2bit('9379A99B1ED68C2F0643EBA74692E617563A21CDA85C5619D8686CF661FC8995'O); // KAMF: Authentication Management Field Key + var B256_Type v_k_amf_computed := f_NG_Authentication_A7(v_supi, v_k_seaf, bit2oct(v_amf), tsc_KDF_HMAC_SHA_256) + if (not(match(v_k_amf_computed, v_k_amf))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_k_amf_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_k_amf_computed' returned the expected value ***"); + } + + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_20_01 + + /** + * @desc Verify that the KNASenc derivation function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Clause 5.11.1.1 Ciphering algorithm identifier values + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.8 Algorithm key derivation functions + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_21_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B48_Type v_sqn_ak := oct2bit('ff9bb4d0b607'O); + var B16_Type v_amf := oct2bit('b9b9'O); // AMF: Authentication Management Field + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + var hexstring v_NID := '000138'H; // NID: Network Identifier + var charstring v_supi := "001014444333000"; + + f_set_op(v_op); + + var B64_Type v_xres; + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_xres, v_ck, v_ik, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } + + var B48_Type v_sqn := v_sqn_ak xor4b v_ak; // SQN = SQN_AK ⊕ AK + log("v_sqn =", bit2oct(v_sqn)); + var B64_Type v_mac_a; + v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + v_auth_params.XRES := v_xres; + v_auth_params.XRESLength := lengthof(v_xres); + + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + var B256_Type v_k_ausf := f_NG_Authentication_A2(v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks, v_PLMN, v_NID); + var B256_Type v_k_seaf := f_NG_Authentication_A6(v_PLMN, v_k_ausf, tsc_KDF_HMAC_SHA_256, v_NID); + var B256_Type v_k_amf := f_NG_Authentication_A7(v_supi, v_k_seaf, bit2oct(v_amf), tsc_KDF_HMAC_SHA_256) + + var B128_Type v_k_nas_enc := oct2bit('38254CAFDE124D5156041D8B640CD341'O); // KNASenc: NAS Cyphering Key + var B128_Type v_k_nas_enc_computed := f_NG_Authentication_A8(tsc_NAS_Enc_Alg, + '0010'B, //128-NEA2 128-bit AES based algorithm + v_k_amf, + tsc_KDF_HMAC_SHA_256) + if (not(match(v_k_nas_enc_computed, v_k_nas_enc))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_k_nas_enc_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_k_nas_enc_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_21_01 + + /** + * @desc Verify that the KNASint derivation function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Clause 5.11.1.1 Ciphering algorithm identifier values + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.8 Algorithm key derivation functions + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_22_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B48_Type v_sqn_ak := oct2bit('ff9bb4d0b607'O); + var B16_Type v_amf := oct2bit('b9b9'O); // AMF: Authentication Management Field + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + var hexstring v_NID := '000138'H; // NID: Network Identifier + var charstring v_supi := "001014444333000"; + + f_set_op(v_op); + + var B64_Type v_xres; + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_xres, v_ck, v_ik, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } + + var B48_Type v_sqn := v_sqn_ak xor4b v_ak; // SQN = SQN_AK ⊕ AK + log("v_sqn =", bit2oct(v_sqn)); + var B64_Type v_mac_a; + v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + v_auth_params.XRES := v_xres; + v_auth_params.XRESLength := lengthof(v_xres); + + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + var B256_Type v_k_ausf := f_NG_Authentication_A2(v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks, v_PLMN, v_NID); + var B256_Type v_k_seaf := f_NG_Authentication_A6(v_PLMN, v_k_ausf, tsc_KDF_HMAC_SHA_256, v_NID); + var B256_Type v_k_amf := f_NG_Authentication_A7(v_supi, v_k_seaf, bit2oct(v_amf), tsc_KDF_HMAC_SHA_256) + + var B128_Type v_k_nas_enc := oct2bit('94F7B2EC0D79F26D593C352328A92281'O); // KNASenc: NAS Cyphering Key + var B128_Type v_k_nas_enc_computed := f_NG_Authentication_A8(tsc_NAS_Int_Alg, + '0010'B, //128-NEA2 128-bit AES based algorithm + v_k_amf, + tsc_KDF_HMAC_SHA_256) + if (not(match(v_k_nas_enc_computed, v_k_nas_enc))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_k_nas_enc_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_k_nas_enc_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_22_01 + + /** + * @desc Verify that the SoR-MAC-IAUSF derivation function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.17 SoR-MAC-IAUSF generation function + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_23_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B48_Type v_sqn_ak := oct2bit('ff9bb4d0b607'O); + var B16_Type v_amf := oct2bit('b9b9'O); // AMF: Authentication Management Field + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + var hexstring v_NID := '000138'H; // NID: Network Identifier + var charstring v_supi := "001014444333000"; + var O1_Type v_sor_header := '00'O; // FIXME Not sure about this value + var O2_Type v_counter_sor := '0000'O; // FIXME Not sure about this value + + f_set_op(v_op); + + var B64_Type v_xres; + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_xres, v_ck, v_ik, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } + + var B48_Type v_sqn := v_sqn_ak xor4b v_ak; // SQN = SQN_AK ⊕ AK + log("v_sqn =", bit2oct(v_sqn)); + var B64_Type v_mac_a; + v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + v_auth_params.XRES := v_xres; + v_auth_params.XRESLength := lengthof(v_xres); + + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + var B256_Type v_k_ausf := f_NG_Authentication_A2(v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks, v_PLMN, v_NID); + + var B128_Type v_sor_mac_i_ausf := oct2bit('14FAA726B4F25EBFC0CC58877B42CDC8'O); // SoR-MAC-Iausf + var B128_Type v_sor_mac_i_ausf_computed := f_NG_Authentication_A17(v_sor_header, v_k_ausf, v_counter_sor, -, tsc_KDF_HMAC_SHA_256) + if (not(match(v_sor_mac_i_ausf_computed, v_sor_mac_i_ausf))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_sor_mac_i_ausf_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_sor_mac_i_ausf_computed' returned the expected value ***"); + } + + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_23_01 + + /** + * @desc Verify that the SoR-MAC-IUE derivation function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Figure 6.2.2-2: Key distribution and key derivation scheme for 5G for the UE + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.18 SoR-MAC-IUE generation function + * @see https://cryptii.com/pipes/hmac + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_24_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + // From ETSI TS 135 207 V16.0.0 (2020-08) Clause 4.3 Test Set 1 + var O16_Type v_K := '465b5ce8b199b49faa5f0a2ee238a6bc'O; // The long-term key: Subscriber key + var B128_Type v_rand := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + var O16_Type v_op := 'cdc202d5123e20f62b6d676ac72cb318'O; // Operator Variant Algorithm Configuration Field + var B48_Type v_sqn_ak := oct2bit('ff9bb4d0b607'O); + var B16_Type v_amf := oct2bit('b9b9'O); // AMF: Authentication Management Field + var NAS_PlmnId v_PLMN := '00f110'O; // PLMN ID: 001-01 + var hexstring v_NID := '000138'H; // NID: Network Identifier + var charstring v_supi := "001014444333000"; + var O2_Type v_counter := '0000'O; // FIXME Not sure about this value + + f_set_op(v_op); + + var B64_Type v_xres; + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var integer v_result := f_f2345(oct2bit(v_K), v_rand, v_xres, v_ck, v_ik, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } + + var B48_Type v_sqn := v_sqn_ak xor4b v_ak; // SQN = SQN_AK ⊕ AK + log("v_sqn =", bit2oct(v_sqn)); + var B64_Type v_mac_a; + v_result := f_f1(oct2bit(v_K), v_rand, v_sqn, v_amf, v_mac_a); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + stop; + } + + var Common_AuthenticationParams_Type v_auth_params := valueof(cs_CommonAuthParams_Init(v_rand)); + v_auth_params.AUTN := v_sqn_ak & v_amf & v_mac_a; // ETSI TS 135 205 V16.0.0 (2020-08) 7.2 Use of the algorithms on the AuC side + v_auth_params.CK := v_ck; + v_auth_params.IK := v_ik; + v_auth_params.XRES := v_xres; + v_auth_params.XRESLength := lengthof(v_xres); + + var B256_Type v_Ks := v_ck & v_ik; // ETSI TS 133 501 V16.18.0 (2024-04) Annex A.2 KAUSF derivation function: Ks = CK || IK + var B256_Type v_k_ausf := f_NG_Authentication_A2(v_auth_params, tsc_KDF_HMAC_SHA_256, v_Ks, v_PLMN, v_NID); + + var B128_Type v_so_r_mac_iue := oct2bit('F38A33C13CF17CFDA4FCA7BDBEDB760A'O); // SoR-MAC-Iue + var B128_Type v_so_r_mac_iue_computed := f_NG_Authentication_A18(v_k_ausf, v_counter, tsc_KDF_HMAC_SHA_256) + log("v_so_r_mac_iue_computed=", v_so_r_mac_iue_computed); + if (not(match(v_so_r_mac_iue_computed, v_so_r_mac_iue))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_so_r_mac_iue_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_so_r_mac_iue_computed' returned the expected value ***"); + } + + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_24_01 + + /** + * @desc Verify that the NAS cypher function is working correctly - 128-EEA2 (AES-128 CTR) + * @see ETSI TS 133 401 V18.3.0 (2025-04) Security architecture + * @see ETSI TS 133 401 V18.3.0 (2025-04) C.1.1 Test Set 1 + * @see https://tool.hiofd.com/en/aes-encrypt-online/ + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_01_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var O16_Type v_k_nas_enc := 'd3c5d592327fb11c4035c6680af8c6d1'O; // Cypher key + var NasCount_Type v_nas_count := '398a59b4'O; // NAS Count + var bitstring v_nas_enc_alg := '0010'B ; // 128-NEA2 128-bit AES based algorithm + var B5_Type v_bearer_id := '10101'B; // Bearer ID (Signalling) + var octetstring v_plain_text := '981ba6824c1bfb1ab485472029b71d808ce33e2cc3c0b5fc1f3de8a6dc66b1f0'O; + var octetstring v_cyphered_text := 'e9fed8a63d155304d71df20bf3e82214b20ed7dad2f233dc3c22d7bdeeed8e78'O; // Expected cyphered text + + var octetstring v_cyphered_text_computed := fx_NG_NasCiphering(v_plain_text, v_nas_enc_alg, oct2bit(v_k_nas_enc), v_nas_count, v_bearer_id, 1) + if (not(match(v_cyphered_text_computed, v_cyphered_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_cyphered_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_cyphered_text_computed' returned the expected value ***"); + } + + var octetstring v_plain_text_computed := fx_NG_NasDeciphering(v_cyphered_text_computed, v_nas_enc_alg, oct2bit(v_k_nas_enc), v_nas_count, v_bearer_id, 1) + if (not(match(v_plain_text_computed, v_plain_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_plain_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_plain_text_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_01_01 + + /** + * @desc Verify that the NAS cypher function is working correctly - 128-EEA2 (AES-128 CTR) + * @see ETSI TS 133 401 V18.3.0 (2025-04) Security architecture + * @see ETSI TS 133 401 V18.3.0 (2025-04) C.1.2 Test Set 2 + * @see https://tool.hiofd.com/en/aes-encrypt-online/ + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_01_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var O16_Type v_k_nas_enc := '2bd6459f82c440e0952c49104805ff48'O; // Cypher key + var NasCount_Type v_nas_count := 'c675a64b'O; // NAS Count + var bitstring v_nas_enc_alg := '0010'B ; // 128-NEA2 128-bit AES based algorithm + var B5_Type v_bearer_id := '01100'B; // Bearer ID (Signalling) + var octetstring v_plain_text := '7ec61272743bf1614726446a6c38ced166f6ca76eb5430044286346cef130f92922b03450d3a9975e5bd2ea0eb55ad8e1b199e3ec4316020e9a1b285e762795359b7bdfd39bef4b2484583d5afe082aee638bf5fd5a606193901a08f4ab41aab9b134880'O; + var octetstring v_cyphered_text := '5961605353c64bdca15b195e288553a910632506d6200aa790c4c806c99904cf2445cc50bb1cf168a49673734e081b57e324ce5259c0e78d4cd97b870976503c0943f2cb5ae8f052c7b7d392239587b8956086bcab18836042e2e6ce42432a17105c53d3'O; // Expected cyphered text + + var octetstring v_cyphered_text_computed := fx_NG_NasCiphering(v_plain_text, v_nas_enc_alg, oct2bit(v_k_nas_enc), v_nas_count, v_bearer_id, 1) + if (not(match(v_cyphered_text_computed, v_cyphered_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_cyphered_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_cyphered_text_computed' returned the expected value ***"); + } + + var octetstring v_plain_text_computed := fx_NG_NasDeciphering(v_cyphered_text_computed, v_nas_enc_alg, oct2bit(v_k_nas_enc), v_nas_count, v_bearer_id, 1) + if (not(match(v_plain_text_computed, v_plain_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_plain_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_plain_text_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_01_02 + + /** + * @desc Verify that the NAS cypher function is working correctly - 128-EEA1 (SNOW 3G) + * @see ETSI TS 133 401 V18.3.0 (2025-04) Security architecture + * @see ETSI TS 133 401 V18.3.0 (2025-04) C.1.2 Test Set 2 + * @see https://asecuritysite.com/symmetric/snow + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_02_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var O16_Type v_k_nas_enc := '2bd6459f82c5b300952c49104881ff48'O; // Cypher key + var NasCount_Type v_nas_count := '72a4f20f'O; // NAS Count + var bitstring v_nas_enc_alg := '0001'B ; // 128-NEA1 128-bit SNOW 3G algorithm + var B5_Type v_bearer_id := '01100'B; // Bearer ID (Signalling) + var octetstring v_plain_text := '7ec61272743bf1614726446a6c38ced166f6ca76eb5430044286346cef130f92922b03450d3a9975e5bd2ea0eb55ad8e1b199e3ec4316020e9a1b285e762795359b7bdfd39bef4b2484583d5afe082aee638bf5fd5a606193901a08f4ab41aab9b134880'O; + var octetstring v_cyphered_text := '8ceba62943dced3a0990b06ea1b0a2c4fb3cedc71b369f42ba64c1eb6665e72aa1c9bb0deaa20fe86058b8baee2c2e7f0becce48b52932a53c9d5f931a3a7c532259af4325e2a65e3084ad5f6a513b7bddc1b65f0aa0d97a053db55a88c4c4f9605e4143'O; // Expected cyphered text + + var octetstring v_cyphered_text_computed := fx_NG_NasCiphering(v_plain_text, v_nas_enc_alg, oct2bit(v_k_nas_enc), v_nas_count, v_bearer_id, 1) + if (not(match(v_cyphered_text_computed, v_cyphered_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_cyphered_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_cyphered_text_computed' returned the expected value ***"); + } + + var octetstring v_plain_text_computed := fx_NG_NasDeciphering(v_cyphered_text_computed, v_nas_enc_alg, oct2bit(v_k_nas_enc), v_nas_count, v_bearer_id, 1) + if (not(match(v_plain_text_computed, v_plain_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_plain_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_plain_text_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_02_01 + + /** + * @desc Verify that the NAS cypher function is working correctly - 128-EEA3 (ZUC) + * @see ETSI TS 133 401 V18.3.0 (2025-04) Security architecture + * @see ETSI TS 133 401 V18.3.0 (2025-04) B.1.4 128-EEA3 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_03_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var O16_Type v_k_nas_enc := '173d14ba5003731d7a60049470f00a29'O; // Cypher key + var NasCount_Type v_nas_count := '66035492'O; // NAS Count + var bitstring v_nas_enc_alg := '0011'B ; // 128-NEA3 128-bit ZUC algorithm + var B5_Type v_bearer_id := '01111'B; // Bearer ID (Signalling) + var octetstring v_plain_text := '6cf65340735552ab0c9752fa6f9025fe0bd675d9005875b200'O; + var octetstring v_cyphered_text := 'a6c85fc66afb8533aafc2518dfe784940ee1e4b030238cc810'O; // Expected cyphered text + + var octetstring v_cyphered_text_computed := fx_NG_NasCiphering(v_plain_text, v_nas_enc_alg, oct2bit(v_k_nas_enc), v_nas_count, v_bearer_id, 0) + if (not(match(v_cyphered_text_computed, v_cyphered_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_cyphered_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_cyphered_text_computed' returned the expected value ***"); + } + + var octetstring v_plain_text_computed := fx_NG_NasDeciphering(v_cyphered_text_computed, v_nas_enc_alg, oct2bit(v_k_nas_enc), v_nas_count, v_bearer_id, 0) + if (not(match(v_plain_text_computed, v_plain_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_plain_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_plain_text_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_03_01 + + /** + * @desc Verify that the NAS integrity protection function is working correctly - 128-EEI1 (SNOW 3G) + * @see ETSI TS 133 401 V18.3.0 (2025-04) Security architecture + * @see ETSI TS 133 401 V18.3.0 (2025-04) C.4.1 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_01_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var O16_Type v_ik := '2bd6459f82c5b300952c49104881ff48'O; // Integrity key + var NasCount_Type v_nas_count := '38a6f056'O; // NAS Count + var bitstring v_nas_enc_alg := '0001'B ; // 128-NEA3 128-bit ZUC algorithm + var B5_Type v_bearer_id := '11111'B; // Bearer ID (Signalling) + var octetstring v_plain_text := '3332346263393861373479'O; + var O4_Type v_mac_text := '731f1165'O; // Expected mac text + + var octetstring v_mac_text_computed := fx_NG_NasIntegrityAlgorithm(v_plain_text, v_nas_enc_alg, oct2bit(v_ik), v_nas_count, v_bearer_id, 0) + if (not(match(v_mac_text_computed, v_mac_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_text_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_25_01_01 + + /** + * @desc Verify that the NAS integrity protection function is working correctly - 128-EEI1 (SNOW 3G) + * @see open5gs/tests/uint/security-test.c, security-test4 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_01_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var O16_Type v_ik := '2bd6459f82c5b300952c49104881ff48'O; // Integrity key + var NasCount_Type v_nas_count := '38a6f056'O; // NAS Count + var bitstring v_nas_enc_alg := '0001'B ; // 128-NEA3 128-bit ZUC algorithm + var B5_Type v_bearer_id := '11111'B; // Bearer ID (Signalling) + var octetstring v_plain_text := '3332346263393861373479'O; + var O4_Type v_mac_text := '731f1165'O; // Expected mac text + + var octetstring v_mac_text_computed := fx_NG_NasIntegrityAlgorithm(v_plain_text, v_nas_enc_alg, oct2bit(v_ik), v_nas_count, v_bearer_id, 0) + if (not(match(v_mac_text_computed, v_mac_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_text_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_01_02 + + /** + * @desc Verify that the NAS integrity protection function is working correctly - 128-EEI1 (SNOW 3G) + * @see ETSI TS 133 401 V18.3.0 (2025-04) Security architecture + * @see ETSI TS 133 401 V18.3.0 (2025-04) C.4.1 Test Set 1 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_01_03() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var O16_Type v_ik := '2bd6459f82c5b300952c49104881ff48'O; // Integrity key + var NasCount_Type v_nas_count := '38a6f056'O; // NAS Count + var bitstring v_nas_enc_alg := '0001'B ; // 128-NEA3 128-bit ZUC algorithm + var B5_Type v_bearer_id := '11111'B; // Bearer ID (Signalling) + var octetstring v_plain_text := '3332346263393861373479'O; + var O4_Type v_mac_text := '731f1165'O; // Expected mac text + + var octetstring v_mac_text_computed := fx_NG_NasIntegrityAlgorithm(v_plain_text, v_nas_enc_alg, oct2bit(v_ik), v_nas_count, v_bearer_id, 0) + if (not(match(v_mac_text_computed, v_mac_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_text_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_01_03 + + /** + * @desc Verify that the NAS integrity protection function is working correctly - 128-EEI2 (AES 128 CTR) + * @see ETSI TS 133 401 V18.3.0 (2025-04) Security architecture + * @see ETSI TS 133 401 V18.3.0 (2025-04) C.2.2 Test Set 2 + * @see RFC4493 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_02_02() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var O16_Type v_ik := 'd3c5d592327fb11c4035c6680af8c6d1'O; // Integrity key + var NasCount_Type v_nas_count := '398a59b4'O; // NAS Count + var bitstring v_nas_enc_alg := '0010'B ; // 128-NEA3 128-bit AES algorithm + var B5_Type v_bearer_id := '11010'B; // Bearer ID (Signalling) + var octetstring v_plain_text := '484583d5afe082ae'O; + var O4_Type v_mac_text := 'b93787e6'O; // Expected mac text + + var octetstring v_mac_text_computed := fx_NG_NasIntegrityAlgorithm(v_plain_text, v_nas_enc_alg, oct2bit(v_ik), v_nas_count, v_bearer_id, 1) + if (not(match(v_mac_text_computed, v_mac_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_text_computed-2' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_text_computed-2' returned the expected value ***"); + } + + //@see ETSI TS 133 401 V18.3.0 (2025-04) C.2.1 Test Set 1 + var O16_Type v_ik1 := '2bd6459f82c5b300952c49104881ff48'O; // Integrity key + var NasCount_Type v_nas_count1 := '38a6f056'O; // NAS Count + var bitstring v_nas_enc_alg1 := '0010'B ; // 128-NEA3 128-bit AES algorithm + var B5_Type v_bearer_id1 := '11000'B; // Bearer ID (Signalling) + var octetstring v_plain_text1 := '3332346263393840'O; + var O4_Type v_mac_text1 := '118c6eb8'O; // Expected mac text + + var octetstring v_mac_text_computed1 := fx_NG_NasIntegrityAlgorithm(v_plain_text1, v_nas_enc_alg1, oct2bit(v_ik1), v_nas_count1, v_bearer_id1, 0) + if (not(match(v_mac_text_computed1, v_mac_text1))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_text_computed-1' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_text_computed-1' returned the expected value ***"); + } + + //@see ETSI TS 133 401 V18.3.0 (2025-04) C.2.3 Test Set 3 + var O16_Type v_ik3 := '7e5e94431e11d73828d739cc6ced4573'O; // Integrity key + var NasCount_Type v_nas_count3 := '36af6144'O; // NAS Count + var bitstring v_nas_enc_alg3 := '0010'B ; // 128-NEA3 128-bit AES algorithm + var B5_Type v_bearer_id3 := '11000'B; // Bearer ID (Signalling) + var octetstring v_plain_text3 := 'b3d3c9170a4e1632f60f861013d22d84b726b6a278d802d1eeaf1321ba5929dc'O; + var O4_Type v_mac_text3 := '1f60b01d'O; // Expected mac text + + var octetstring v_mac_text_computed3 := fx_NG_NasIntegrityAlgorithm(v_plain_text3, v_nas_enc_alg3, oct2bit(v_ik3), v_nas_count3, v_bearer_id3, 1) + if (not(match(v_mac_text_computed3, v_mac_text3))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_text_computed-3' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_text_computed-3' returned the expected value ***"); + } + + //@see ETSI TS 133 401 V18.3.0 (2025-04) C.2.3 Test Set 4 + var O16_Type v_ik4 := 'd3419be821087acd02123a9248033359'O; // Integrity key + var NasCount_Type v_nas_count4 := 'c7590ea9'O; // NAS Count + var bitstring v_nas_enc_alg4 := '0010'B ; // 128-NEA3 128-bit AES algorithm + var B5_Type v_bearer_id4 := '10111'B; // Bearer ID (Signalling) + var octetstring v_plain_text4 := 'bbb057038809496bcff86d6fbc8ce5b135a06b166054f2d565be8ace75dc851e0bcdd8f07141c495872fb5d8c0c66a8b6da556663e4e461205d84580bee5bc7e'O; + var O4_Type v_mac_text4 := '6846a2f0'O; // Expected mac text + + var octetstring v_mac_text_computed4 := fx_NG_NasIntegrityAlgorithm(v_plain_text4, v_nas_enc_alg4, oct2bit(v_ik4), v_nas_count4, v_bearer_id4, 0) + if (not(match(v_mac_text_computed4, v_mac_text4))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_text_computed-4' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_text_computed-4' returned the expected value ***"); + } + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_02_02 + + /** + * @desc Verify that the NAS integrity protection function is working correctly - 128-EEI3 (ZUC) + * @see ETSI TS 133 401 V18.3.0 (2025-04) Security architecture + * @see ETSI TS 133 401 V18.3.0 (2025-04) B.2.4 128-EIA3 + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_03_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var O16_Type v_ik := 'c9e6cec4607c72db000aefa88385ab0a'O; // Integrity key + var NasCount_Type v_nas_count := 'a94059da'O; // NAS Count + var bitstring v_nas_enc_alg := '0011'B ; // 128-NEA3 128-bit ZUC algorithm + var B5_Type v_bearer_id := '01010'B; // Bearer ID (Signalling) + var octetstring v_plain_text := '983b41d47d780c9e1ad11d7eb70391b1de0b35da2dc62f83e7b78d6306ca0ea07e941b7be91348f9fcb170e2217fecd97f9f68adb16e5d7d21e569d280ed775cebde3f4093c5388100'O; + var O4_Type v_mac_text := '24a842b3'O; // Expected mac text + + var octetstring v_mac_text_computed := fx_NG_NasIntegrityAlgorithm(v_plain_text, v_nas_enc_alg, oct2bit(v_ik), v_nas_count, v_bearer_id, 1) + if (not(match(v_mac_text_computed, v_mac_text))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_mac_text_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_mac_text_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_26_03_01 + + /** + * @desc Verify that the KgNB derivation function is working correctly + * @see ETSI TS 133 501 V16.18.0 (2024-04) Annex A.9 KgNB, KWAGF, KTNGF, KTWIF and KN3IWF derivation function + */ + testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_27_01() runs on gNB_NGNAS_NGAPComponent system TestAdapter { + + var B256_Type v_k_amf := oct2bit('8a835993961d28c776296cd1ac821279e2f578586342139d5935d789166342ea'O); // K_AMF: Key for AMF ); + + var B256_Type v_k_gnb := oct2bit('3f558497ee61732039afb69ba104454e863f5740b0d3a79faf0278468c14a535'O); // KgNB + var B256_Type v_k_gnb_computed := f_NG_Authentication_A9(int2oct(0, 4), + v_k_amf, + Access_3GPP, + tsc_KDF_HMAC_SHA_256); + if (not(match(v_k_gnb_computed, v_k_gnb))) { + log("*** " & __SCOPE__ & ": ERROR: 'v_k_gnb_computed' did not return the expected value. ***"); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": 'v_k_gnb_computed' returned the expected value ***"); + } + + setverdict(pass) + + } // End of testcase TC_5G_AKA_CRYPTO_FUNCTIONS_TEST_27_01 + + } // End of group fiveG_AKA_Crypto_Functions + }// End of module NG_NAS_TestCases diff --git a/ttcn/Ats_NG_NAS/NG_NAS_TestConfiguration.ttcn b/ttcn/Ats_NG_NAS/NG_NAS_TestConfiguration.ttcn index 6e66fe40a3a23480c1f157ae5c52cc1f627ea78b..cff7e0d426b4a9d7767c53a16a90dcd33eab3f24 100755 --- a/ttcn/Ats_NG_NAS/NG_NAS_TestConfiguration.ttcn +++ b/ttcn/Ats_NG_NAS/NG_NAS_TestConfiguration.ttcn @@ -1,5 +1,5 @@ /** -* @author ETSI / TTF041 +* @author ETSI / TTF T041, T048 * @version $URL$ * $Id$ * @desc This module provides test configuration description for NG_NAS tests. @@ -27,31 +27,6 @@ module NG_NAS_TestConfiguration{ group cfUp { - /** - * @desc Creates test configuration of cf_NGAP_AMF - gNB is SUT - * @param p_NGAPComponent_mme - */ - /*function f_cf_NGAP_aMF_Up( - out aMFNGAPComponent p_NGAPComponent_amf - ) runs on aMFNGAPComponent system TestAdapter { - //Variables - var FncRetCode v_ret := e_success; - - //Create - p_NGAPComponent_amf := aMFNGAPComponent.create ; - - // Connect mtc sync port - connect(self:syncPort, self:syncPort); - // Connect client sync port - connect(p_NGAPComponent_amf:syncPort, self:syncPort) ; - //Map - map(p_NGAPComponent_amf:N2_gNBaMF_P, system:NGAP_AMF); - - activate(a_mtc_shutdown()); - - f_setVerdict(v_ret); - } // End of function f_cf_NGAP_AMF_Up*/ - /** * @desc Creates test configuration of cf_NGNAS_gNB - AMF is SUT * @param p_NGNAS_Component_gnb @@ -107,6 +82,31 @@ module NG_NAS_TestConfiguration{ f_setVerdict(v_ret); } // End of function f_cf_NGAP_2gNB_Up*/ + /** + * @desc Creates test configuration of cf_NGNAS_gNB - AMF is SUT + * @param p_NGNAS_Component_gnb + */ + function f_cf_NGNAS_aMF_Up( + out aMF_NGNAS_NGAPComponent p_NGNAS_Component_amf + ) runs on aMF_NGNAS_NGAPComponent system TestAdapter { + //Variables + var FncRetCode v_ret := e_success; + + //Create + p_NGNAS_Component_amf := aMF_NGNAS_NGAPComponent.create ; + + // Connect mtc sync port + connect(self:syncPort, self:syncPort); + // Connect client sync port + connect(p_NGNAS_Component_amf:syncPort, self:syncPort) ; + //Map + map(p_NGNAS_Component_amf:N2_gNBaMF_P, system:NGAP_AMF); + + activate(a_mtc_shutdown()); + + f_setVerdict(v_ret); + } // End of function f_cf_NG_NAS_aMF_Up + } // End of group cfUp group cfDown { diff --git a/ttcn/Ats_NG_NAS/NG_NAS_TestControl.ttcn b/ttcn/Ats_NG_NAS/NG_NAS_TestControl.ttcn index a67cdc4844a08f9d8279d8dc39391b1d58091c7e..177194d86198d552a7fc32695a02a375c6b33996 100644 --- a/ttcn/Ats_NG_NAS/NG_NAS_TestControl.ttcn +++ b/ttcn/Ats_NG_NAS/NG_NAS_TestControl.ttcn @@ -1,5 +1,5 @@ /** - * @author ETSI / TTF041 + * @author ETSI / TTF T041, T048 * @version $URL$ * $Id$ * @desc This module provides testcases for NG_NAS tests. @@ -27,7 +27,7 @@ module NG_NAS_TestControl { execute(TC_5GNAS_AMF_AUT_ABN_01()); - execute(TC_NGNAS_AMF_AUT_SEQ_01()); + execute(TC_5GNAS_AMF_SEC_COM_01()); execute(TC_5GNAS_AMF_SEC_ACC_01()); execute(TC_5GNAS_AMF_SEC_REJ_01()); diff --git a/ttcn/Ats_NG_NAS/NG_NAS_TestSystem.ttcn b/ttcn/Ats_NG_NAS/NG_NAS_TestSystem.ttcn index 35fd618b4182686ea443c5908df102d7cb3ae85f..84f26c4e3833b57135140f0893b9934f81b029d1 100755 --- a/ttcn/Ats_NG_NAS/NG_NAS_TestSystem.ttcn +++ b/ttcn/Ats_NG_NAS/NG_NAS_TestSystem.ttcn @@ -1,5 +1,5 @@ /** -* @author ETSI / TTF041 +* @author ETSI / TTF T041, T048 * @version $URL$ * $Id$ * @desc This module provides the types and ports used by the test component for NG_NAS tests. @@ -15,44 +15,30 @@ module NG_NAS_TestSystem { import from LibCommon_Sync all; // LibNGAP - //import from LibNGAP_Interface all; + import from LibNGAP_Interface all; - // Lib_NG_NAS - import from Lib_NG_NAS_Interface all; + // NGAP + import from NGAP_TestSystem all; group SystemConfiguration { group TestComponents { - // group TestSystemInterfaces { - - // /** - // * @desc The test system interface - // */ - // type component TestAdapter { - - // port - // NGAPPort NGAP_AMF, - // NGAP_gNB_1, - // NGAP_gNB_2 - // } // End of type TestAdapter - - // } // End of group TestSystemInterfaces - - type component gNB_NGNAS_NGAPComponent extends ServerSyncComp, NGNASComponent { - //component variables - } // End of type component gNBNGAPComponent - - //Not defined because tests implemented for network side - //type component aMF_NGNAS_NGAPComponent extends ServerSyncComp, NGNASComponent { - // //component variables - //} // End of type component aMFNGAPComponent - - //type component NGAP extends ServerSyncComp, NGAPComponent { - // //component variables - //} // End of component NGAP - - } // End of group TestComponents + /** + * @desc The NGAP AMF component, AMF is SUT + */ + type component aMF_NGNAS_NGAPComponent extends ServerSyncComp, aMFNGAPComponent { + //component variables + } // End of type component gNBNGAPComponent + + /** + * @desc The NGAP AMF component, gNodeB is SUT + */ + type component gNB_NGNAS_NGAPComponent extends ServerSyncComp, gNBNGAPComponent { + //component variables + } // End of type component gNBNGAPComponent + + } // End of group TestComponents } // End of group SystemConfiguration diff --git a/ttcn/Ats_NG_NAS/module.mk b/ttcn/Ats_NG_NAS/module.mk index 9014ba3125c61259ba5cf5d756286c74b9ac8b52..31c2ef848e5aad44d51ddb003cfc0dbd4fd15b3c 100644 --- a/ttcn/Ats_NG_NAS/module.mk +++ b/ttcn/Ats_NG_NAS/module.mk @@ -1,45 +1,47 @@ suite := Ats_NG_NAS pdu := NGAP-PDU -sources:= \ - NG_NAS_TestCases.ttcn \ - NG_NAS_TestControl.ttcn \ - NG_NAS_TCFunctions.ttcn \ - NG_NAS_Pics.ttcn \ - NG_NAS_TestSystem.ttcn \ - NG_NAS_TestConfiguration.ttcn \ - ../AtsNGAP/NGAP_Pics.ttcn \ - ../AtsNGAP/NGAP_Pixits.ttcn \ - ../AtsNGAP/NGAP_Steps.ttcn \ - ../AtsNGAP/NGAP_TestSystem.ttcn \ - ../AtsNGAP/NGAP_TestConfiguration.ttcn +sources:= \ + NG_NAS_TestCases.ttcn \ + NG_NAS_TestControl.ttcn \ + NG_NAS_TCFunctions.ttcn \ + NG_NAS_Steps.ttcn \ + NG_NAS_Pics.ttcn \ + NG_NAS_TestSystem.ttcn \ + NG_NAS_TestConfiguration.ttcn \ + ../AtsNGAP/NGAP_Pics.ttcn \ + ../AtsNGAP/NGAP_Pixits.ttcn \ + ../AtsNGAP/NGAP_Steps.ttcn \ + ../AtsNGAP/NGAP_TestSystem.ttcn \ + ../AtsNGAP/NGAP_TestConfiguration.ttcn -modules := \ - ../LibNGAP \ - ../Lib_NG_NAS \ - ../LibCommon \ - ../Lib3GPP \ - ../../titan-test-system-framework/ttcn/LibHelpers \ - ../../titan-test-system-framework/ttcn/LibSecurity \ - ../../titan-test-system-framework/ttcn/LibXsd \ - ../../titan-test-system-framework/ccsrc/Protocols/Pcap \ - ../../titan-test-system-framework/ccsrc/Protocols/ETH \ - ../../titan-test-system-framework/ccsrc/Protocols/IP \ - ../../titan-test-system-framework/ccsrc/Protocols/Sctp \ - ../../titan-test-system-framework/ccsrc/Protocols/Xml \ - ../../titan-test-system-framework/ccsrc/Framework \ - ../../titan-test-system-framework/ccsrc/Helpers \ - ../../titan-test-system-framework/ccsrc/loggers \ - ../../titan-test-system-framework/ccsrc/security \ - ../../ccsrc/EncDec \ - ../../ccsrc/Externals \ - ../../ccsrc/Ports/LibNAS \ - ../../ccsrc/Ports/LibNGAP \ - ../../ccsrc/framework \ - ../../ccsrc/Protocols/NGAP_layer \ - ../../ccsrc/Protocols/NGAP \ - ../../ccsrc/Protocols/NG_NAS \ - ../../ccsrc/Protocols/FiveG_AKA \ +modules := \ + ../LibNGAP \ + ../Lib_NG_NAS \ + ../LibCommon \ + ../Lib3GPP \ + ../../titan-test-system-framework/ttcn/LibHelpers \ + ../../titan-test-system-framework/ttcn/LibSecurity \ + ../../titan-test-system-framework/ttcn/LibXsd \ + ../../titan-test-system-framework/ccsrc/Protocols/Pcap \ + ../../titan-test-system-framework/ccsrc/Protocols/LinuxFrame \ + ../../titan-test-system-framework/ccsrc/Protocols/ETH \ + ../../titan-test-system-framework/ccsrc/Protocols/IP \ + ../../titan-test-system-framework/ccsrc/Protocols/Sctp \ + ../../titan-test-system-framework/ccsrc/Protocols/Xml \ + ../../titan-test-system-framework/ccsrc/Framework \ + ../../titan-test-system-framework/ccsrc/Helpers \ + ../../titan-test-system-framework/ccsrc/loggers \ + ../../titan-test-system-framework/ccsrc/security \ + ../../ccsrc/EncDec \ + ../../ccsrc/Externals \ + ../../ccsrc/Ports/LibNAS \ + ../../ccsrc/Ports/LibNGAP \ + ../../ccsrc/framework \ + ../../ccsrc/Protocols/NGAP_layer \ + ../../ccsrc/Protocols/NGAP \ + ../../ccsrc/Protocols/NG_NAS \ + ../../ccsrc/Protocols/FiveG_AKA \ ../modules/titan.TestPorts.Common_Components.Abstract_Socket diff --git a/ttcn/Lib3GPP/Common/CommonDefs.ttcn b/ttcn/Lib3GPP/Common/CommonDefs.ttcn index 2a54ee4000f8b70e3031ca7cedf0c81699158224..64c4a92d259c01fd48778b6792941ac0a70dadbe 100644 --- a/ttcn/Lib3GPP/Common/CommonDefs.ttcn +++ b/ttcn/Lib3GPP/Common/CommonDefs.ttcn @@ -1311,6 +1311,8 @@ module CommonDefs { SHA-256 encoding algorithm used as KEY Description Function @status APPROVED (LTE) */ + external function fx_sha256(octetstring p_String) return B256_Type; + external function fx_CalculateFCS32 (bitstring p_TMSI) return B32_Type; /* Cyclic Redundancy Check calculation according to ITU-T Recommendation V.42 of CRC-32 Algorithm @sic R5-172046 sic@ */ //---------------------------------------------------------------------------- diff --git a/ttcn/Lib3GPP/Common4G5G/EUTRA_NR_SecurityFunctions.ttcn b/ttcn/Lib3GPP/Common4G5G/EUTRA_NR_SecurityFunctions.ttcn index fb87157d35ba5fcc076eb89939701bfb8c459d54..b43a57f79dd3ba0217c9c9dcdfd22ac5ee337b33 100644 --- a/ttcn/Lib3GPP/Common4G5G/EUTRA_NR_SecurityFunctions.ttcn +++ b/ttcn/Lib3GPP/Common4G5G/EUTRA_NR_SecurityFunctions.ttcn @@ -153,14 +153,19 @@ module EUTRA_NR_SecurityFunctions { var octetstring v_S; // Generation of String v_S := const_S69_FC; + log("f_NG_Authentication_A8 (1): v_S=", v_S); //FC = 0x69 v_S := ( v_S & int2oct ( p_AlgTypeDistg, 1 ) ); + log("f_NG_Authentication_A8 (2): v_S=", v_S); //P0 = algorithm type distinguisher v_S := ( v_S & '0001'O ); + log("f_NG_Authentication_A8 (3): v_S=", v_S); //L0 = length of algorithm type distinguisher (i.e. 0x00 0x01)) v_S := ( v_S & bit2oct ( p_Alg ) ); + log("f_NG_Authentication_A8 (4): v_S=", v_S); //P1 = algorithm identity v_S := ( v_S & '0001'O ); + log("f_NG_Authentication_A8 (5): v_S=", v_S); //L1 = length of algorithm identity (i.e. 0x00 0x01) return substr(fx_KeyDerivationFunction(p_KDF_Type, p_Key, v_S), 128, 128); diff --git a/ttcn/Lib3GPP/NG_NAS/NG_NAS_EncdecDeclarations.ttcn b/ttcn/Lib3GPP/NG_NAS/NG_NAS_EncdecDeclarations.ttcn index d8d7202ae29048046bbb7cd3ceb71f4f8fdf1b48..8f98535622b1aaec50c57c6684dfd432fdc202fa 100644 --- a/ttcn/Lib3GPP/NG_NAS/NG_NAS_EncdecDeclarations.ttcn +++ b/ttcn/Lib3GPP/NG_NAS/NG_NAS_EncdecDeclarations.ttcn @@ -4,19 +4,19 @@ module NG_NAS_EncdecDeclarations { import from NG_NAS_TypeDefs all; import from EAP_TypeDefs all; - external function fx_enc_NG_NAS_UL_Message_Type (NG_NAS_UL_Message_Type p) return bitstring - //with {extension "prototype(convert) encode(NAS Types)"} + with {extension "prototype(convert) encode(RAW)"} external function fx_dec_NG_NAS_UL_Message_Type (inout bitstring pdu, out NG_NAS_UL_Message_Type p) return integer - //with {extension "prototype(sliding) decode(NAS Types)"} + with {extension "prototype(sliding) decode(RAW)"} external function fx_enc_NG_NAS_DL_Message_Type (NG_NAS_DL_Message_Type p) return bitstring - //with {extension "prototype(convert) encode(NAS Types)"} + with {extension "prototype(convert) encode(RAW)"} external function fx_dec_NG_NAS_DL_Message_Type (inout bitstring pdu, out NG_NAS_DL_Message_Type p) return integer - //with {extension "prototype(sliding) decode(NAS Types)"} + with {extension "prototype(sliding) decode(RAW)"} + //external function fx_dec_NG_NAS_DL_Message_Type (in octetstring pdu) return NG_NAS_DL_Message_Type //with {extension "prototype(convert)" // extension "decode(RAW)" diff --git a/ttcn/Lib3GPP/NG_NAS/NG_NAS_MsgContainers.ttcn b/ttcn/Lib3GPP/NG_NAS/NG_NAS_MsgContainers.ttcn index 9cbb3aecf5438827ba389617176b97a3f38b8066..f5504d4c1e1418150c4fdd825507a661e4d1a35a 100644 --- a/ttcn/Lib3GPP/NG_NAS/NG_NAS_MsgContainers.ttcn +++ b/ttcn/Lib3GPP/NG_NAS/NG_NAS_MsgContainers.ttcn @@ -58,10 +58,10 @@ module NG_NAS_MsgContainers UE_TEST_LOOP_NR_SIDELINK_COUNTER_RESPONSE test_Loop_Sidelink_Counter_Response // @sic R5-225291 sic@ } with { // FIXME FSCOM Check messageType for deregistration_RequestMO variant "TAG( - security_Protected_Nas_Message, securityHeaderType = '0001'B; - security_Protected_Nas_Message, securityHeaderType = '0010'B; - security_Protected_Nas_Message, securityHeaderType = '0011'B; - security_Protected_Nas_Message, securityHeaderType = '0100'B; + security_Protected_Nas_Message, securityHeaderType= '0001'B; + security_Protected_Nas_Message, securityHeaderType= '0010'B; + security_Protected_Nas_Message, securityHeaderType= '0011'B; //SECURITY MODE COMAND + security_Protected_Nas_Message, securityHeaderType= '0100'B; //SECURITY MODE COMPLETE authentication_Failure, messageType = '01011001'B; authentication_Response, messageType = '01010111'B; configuration_Update_Complete, messageType = '01010101'B; @@ -86,6 +86,7 @@ module NG_NAS_MsgContainers security_Mode_Reject, messageType = '01011111'B; service_Request, messageType = '01001100'B; ul_Nas_Transport, messageType = '01100111'B; + security_Protected_Nas_Message, OTHERWISE )" } @@ -136,10 +137,10 @@ module NG_NAS_MsgContainers } with { // FIXME FSCOM Check messageType for deregistration_RequestMT variant "TAG( - security_Protected_Nas_Message, securityHeaderType = '0001'B; - security_Protected_Nas_Message, securityHeaderType = '0010'B; - security_Protected_Nas_Message, securityHeaderType = '0011'B; - security_Protected_Nas_Message, securityHeaderType = '0100'B; + security_Protected_Nas_Message, securityHeaderType= '0001'B; + security_Protected_Nas_Message, securityHeaderType= '0010'B; + security_Protected_Nas_Message, securityHeaderType= '0011'B; //SECURITY MODE COMAND + security_Protected_Nas_Message, securityHeaderType= '0100'B; //SECURITY MODE COMPLETE authentication_Reject, messageType = '01011000'B; authentication_Request, messageType = '01010110'B; authentication_Result, messageType = '01011010'B; @@ -166,9 +167,10 @@ module NG_NAS_MsgContainers security_Mode_Command, messageType = '01011101'B; service_Accept, messageType = '01001110'B; service_Reject, messageType = '01001101'B; + security_Protected_Nas_Message, OTHERWISE )" } - + //**************************************************************************** // NAS SECURITY PROTECTION //**************************************************************************** diff --git a/ttcn/Lib3GPP/NG_NAS/NG_NAS_SecurityFunctions.ttcn b/ttcn/Lib3GPP/NG_NAS/NG_NAS_SecurityFunctions.ttcn index 5a90d5b1ed3d07c78fd281aeb585132e58e8263b..d631a71c5a2a7cd43985f3380c57575ed619e5cc 100644 --- a/ttcn/Lib3GPP/NG_NAS/NG_NAS_SecurityFunctions.ttcn +++ b/ttcn/Lib3GPP/NG_NAS/NG_NAS_SecurityFunctions.ttcn @@ -234,14 +234,19 @@ module NG_NAS_SecurityFunctions { { var charstring v_MNC := ""; var hexstring v_PLMN_hexstring := oct2hex(p_NAS_PlmnId); + log("fl_Nas2SNN_MNC: p_NAS_PlmnId=", p_NAS_PlmnId); + log("fl_Nas2SNN_MNC: v_PLMN_hexstring=", v_PLMN_hexstring); if (v_PLMN_hexstring[2] == 'F'H) { v_MNC := "0"; } + log("fl_Nas2SNN_MNC: v_MNC (1)=", v_MNC); v_MNC := v_MNC & hex2str(v_PLMN_hexstring[5]) & hex2str(v_PLMN_hexstring[4]); + log("fl_Nas2SNN_MNC: v_MNC (2)=", v_MNC); if (v_PLMN_hexstring[2] != 'F'H) { // add last digit if not F v_MNC := v_MNC & hex2str(v_PLMN_hexstring[2]); } + log("fl_Nas2SNN_MNC: v_MNC (3)=", v_MNC); return v_MNC; } @@ -255,8 +260,14 @@ module NG_NAS_SecurityFunctions { { var charstring v_MCC; var hexstring v_PLMN_hexstring := oct2hex(p_NAS_PlmnId); + log("fl_Nas2SNN_MCC: p_NAS_PlmnId=", p_NAS_PlmnId); + log("fl_Nas2SNN_MCC: v_PLMN_hexstring=", v_PLMN_hexstring); + log("fl_Nas2SNN_MCC: v_PLMN_hexstring[1]=", v_PLMN_hexstring[1]); + log("fl_Nas2SNN_MCC: v_PLMN_hexstring[0]=", v_PLMN_hexstring[0]); + log("fl_Nas2SNN_MCC: v_PLMN_hexstring[3]=", v_PLMN_hexstring[3]); v_MCC := hex2str(v_PLMN_hexstring[1]) & hex2str(v_PLMN_hexstring[0]) & hex2str(v_PLMN_hexstring[3]); + log("fl_Nas2SNN_MCC: v_MCC=", v_MCC); return v_MCC; } @@ -313,18 +324,28 @@ module NG_NAS_SecurityFunctions { var octetstring v_S; var octetstring v_P0; + log(">>> f_NG_Authentication_A2: p_PLMN=", p_PLMN); + log(">>> f_NG_Authentication_A2: p_AuthParams=", p_AuthParams); + log(">>> f_NG_Authentication_A2: p_KDF=", p_KDF); + log(">>> f_NG_Authentication_A2: p_Ks=", bit2oct(p_Ks)); + // Generation of String v_S := const_S6A_FC; + log("f_NG_Authentication_A2 (1): v_S=", v_S); //FC = 0x6A v_P0 := fl_GetServingNetworkName(p_PLMN, p_NID); // @sic R5s220753 sic@ v_S := (v_S & v_P0); + log("f_NG_Authentication_A2 (2): v_S=", v_S); //P0 = serving network ID v_S := (v_S & int2oct(lengthof(v_P0), 2)) ; + log("f_NG_Authentication_A2 (3): v_S=", v_S); //L0 = length of serving network ID (i.e. 0x00 0x03) v_S := ( v_S & ( substr (( bit2oct ( p_AuthParams.AUTN )) , 0,6 ))); + log("f_NG_Authentication_A2 (4): v_S=", v_S); //P1 = SQN XOR AK // to have MSB 6 bytes which is SQN xor AK and truncated as SQN xor AK is first 6 bytes of AUTN v_S := ( v_S & '0006'O ); + log("f_NG_Authentication_A2 (5): v_S=", v_S); //L1 = length of SQN XOR AK (i.e. 0x00 0x06) return fx_KeyDerivationFunction( p_KDF, p_Ks, v_S ); } @@ -350,18 +371,28 @@ module NG_NAS_SecurityFunctions { var octetstring v_S; var octetstring v_P0; + log(">>> f_NG_Authentication_A3: p_PLMN=", p_PLMN); + log(">>> f_NG_Authentication_A3: p_AuthParams=", p_AuthParams); + log(">>> f_NG_Authentication_A3: p_KDF=", p_KDF); + log(">>> f_NG_Authentication_A3: p_Ks=", bit2oct(p_Ks)); + // Generation of String v_S := const_S20_FC; + log("f_NG_Authentication_A3 (1): v_S=", v_S); //FC = 0x20 v_P0 := fl_GetServingNetworkName(p_PLMN, p_NID); // @sic R5s220753 sic@ v_S := (v_S & v_P0); + log("f_NG_Authentication_A3 (2): v_S=", v_S); //P0 = serving network ID v_S := (v_S & int2oct(lengthof(v_P0), 2)) ; + log("f_NG_Authentication_A3 (3): v_S=", v_S); //L0 = length of serving network ID (i.e. 0x00 0x03) v_S := ( v_S & ( substr (( bit2oct ( p_AuthParams.AUTN )) , 0,6 ))); + log("f_NG_Authentication_A3 (4): v_S=", v_S); //P1 = SQN XOR AK // to have MSB 6 bytes which is SQN xor AK and truncated as SQN xor AK is first 6 bytes of AUTN v_S := ( v_S & '0006'O ); + log("f_NG_Authentication_A3 (5): v_S=", v_S); //L1 = length of SQN XOR AK (i.e. 0x00 0x06) return fx_KeyDerivationFunction( p_KDF, p_Ks, v_S ); } @@ -391,37 +422,35 @@ module NG_NAS_SecurityFunctions { log(">>> f_NG_Authentication_A4: p_PLMN=", p_PLMN); log(">>> f_NG_Authentication_A4: p_AuthParams=", p_AuthParams); log(">>> f_NG_Authentication_A4: p_KDF=", p_KDF); - log(">>> f_NG_Authentication_A4: p_Key=", p_Key); - + log(">>> f_NG_Authentication_A4: p_Key=", bit2oct(p_Key)); + log(">>> f_NG_Authentication_A4: p_NID=", p_NID); // Generation of String v_S := const_S6B_FC; //FC = 0x6B + log("f_NG_Authentication_A4 (0): p_NID=", p_NID); v_P0 := fl_GetServingNetworkName(p_PLMN, p_NID); // @sic R5s220753 sic@ - log("f_NG_Authentication_A4: v_P0=", v_P0); + log("f_NG_Authentication_A4 (1): v_P0=", v_P0); v_S := (v_S & v_P0); - log("f_NG_Authentication_A4: v_S=", v_S); + log("f_NG_Authentication_A4 (2): v_S=", v_S); //P0 = serving network ID v_S := (v_S & int2oct(lengthof(v_P0), 2)) ; - log("f_NG_Authentication_A4: v_S=", v_S); + log("f_NG_Authentication_A4 (3): v_S=", v_S); //L0 = length of serving network ID v_S := ( v_S & bit2oct ( p_AuthParams.RandValue ) ); - log("f_NG_Authentication_A4: v_S=", v_S); + log("f_NG_Authentication_A4 (4): v_S=", v_S); //P1 = RAND v_S := ( v_S & '0010'O ); //L1 = length of RAND (i.e. 0x00 0x10) - log("f_NG_Authentication_A4: v_S=", v_S); + log("f_NG_Authentication_A4 (5): v_S=", v_S); v_S := ( v_S & bit2oct (substr(p_AuthParams.XRES, 0, px_NAS_5GC_XRES_Length*8))); // @sic R5s190394 sic@ - log("f_NG_Authentication_A4: v_S=", v_S); + log("f_NG_Authentication_A4 (6): v_S=", v_S); //P2 = RES or XRES v_S := ( v_S & int2oct(px_NAS_5GC_XRES_Length, 2) ); // @sic R5w190117 sic@ - log("f_NG_Authentication_A4: v_S=", v_S); + log("f_NG_Authentication_A4 (7): v_S=", v_S); //L2 = length of RES/XRES (e.g. 0x00 0x10) - - var bitstring bs := fx_KeyDerivationFunction(p_KDF, p_Key, v_S); // Already 128 bits length - - return bs; - //return substr(fx_KeyDerivationFunction(p_KDF, p_Key, v_S), 128, 128); + + return substr(fx_KeyDerivationFunction(p_KDF, p_Key, v_S), 128, 128); // returns LSB 128 bits[truncated] of the key generated } @@ -439,19 +468,26 @@ module NG_NAS_SecurityFunctions { function f_NG_Authentication_A6(NAS_PlmnId p_PLMN, B256_Type p_KAUSF, KDF_Type p_KDF_Type, - template (omit) hexstring p_NID := omit) return B256_Type + template (omit) hexstring p_NID := omit) return B256_Type { const octetstring const_S6C_FC :='6C'O; var octetstring v_S; var octetstring v_P0; + log(">>> f_NG_Authentication_A6: p_PLMN=", p_PLMN); + log(">>> f_NG_Authentication_A6: p_KAUSF=", bit2oct(p_KAUSF)); + log(">>> f_NG_Authentication_A6: p_KDF_Type=", p_KDF_Type); + // Generation of String v_S := const_S6C_FC; + log("f_NG_Authentication_A6 (1): v_S=", v_S); //FC = 0x6C v_P0 := fl_GetServingNetworkName(p_PLMN, p_NID); // @sic R5s220753 sic@ v_S := (v_S & v_P0); + log("f_NG_Authentication_A6 (2): v_S=", v_S); //P0 = serving network ID v_S := (v_S & int2oct(lengthof(v_P0), 2)) ; + log("f_NG_Authentication_A6 (3): v_S=", v_S); //L0 = length of serving network ID return fx_KeyDerivationFunction(p_KDF_Type, p_KAUSF, v_S); @@ -473,21 +509,32 @@ module NG_NAS_SecurityFunctions { octetstring p_ABBA, KDF_Type p_KDF_Type) return B256_Type { + log(">>> f_NG_Authentication_A7: p_SUPI: ", p_SUPI); + log(">>> f_NG_Authentication_A7: p_ABBA: ", p_ABBA); + const octetstring const_S6D_FC :='6D'O; var octetstring v_S; var octetstring v_P0 := char2oct(p_SUPI); // @sic R5s190109 sic@ var octetstring v_P1 := p_ABBA; - + + log("f_NG_Authentication_A7: v_P0: ", v_P0); + log("f_NG_Authentication_A7: v_P1: ", v_P1); + // Generation of String v_S := const_S6D_FC; + log("f_NG_Authentication_A7 (1): v_S=", v_S); //FC = 0x6D v_S := (v_S & v_P0); + log("f_NG_Authentication_A7 (2): v_S=", v_S); //P0 = serving network ID v_S := (v_S & int2oct(lengthof(v_P0), 2)) ; + log("f_NG_Authentication_A7 (3): v_S=", v_S); //L0 = length of SUPI v_S := (v_S & v_P1); + log("f_NG_Authentication_A7 (4): v_S=", v_S); //P0 = serving network ID v_S := (v_S & int2oct(lengthof(v_P1), 2)) ; + log("f_NG_Authentication_A7 (5): v_S=", v_S); //L1 = length of ABBA return fx_KeyDerivationFunction(p_KDF_Type, p_KSEAF, v_S); @@ -516,19 +563,27 @@ module NG_NAS_SecurityFunctions { // Generation of String v_S := const_S77_FC; + log("f_NG_Authentication_A17 (1): v_S=", v_S); //FC = 0x77 v_S := (v_S & p_SoRHeader); + log("f_NG_Authentication_A17 (2): v_S=", v_S); //P0 = SOR Header v_S := (v_S & '0001'O); + log("f_NG_Authentication_A17 (3): v_S=", v_S); //L0 = length of SOR Header v_S := (v_S & p_Counter); + log("f_NG_Authentication_A17 (4): v_S=", v_S); //P1 = Counter v_S := (v_S & '0002'O) ; + log("f_NG_Authentication_A17 (5): v_S=", v_S); //L1 = length of Counter if (lengthof (p_PLMNandAccessTechnologyList) > 0) { //P2 & L2 are optional v_S := (v_S & p_PLMNandAccessTechnologyList); + log("f_NG_Authentication_A17 (6-1): v_S=", v_S); v_S := (v_S & int2oct(lengthof(p_PLMNandAccessTechnologyList), 2)) ; + log("f_NG_Authentication_A17 (6-2): v_S=", v_S); } + log("f_NG_Authentication_A17 (7): v_S=", v_S); return substr(fx_KeyDerivationFunction(p_KDF_Type, p_KAUSF, v_S), 128, 128); // returns LSB 128 bits[truncated] of the key generated } @@ -552,14 +607,19 @@ module NG_NAS_SecurityFunctions { // Generation of String v_S := const_S78_FC; + log("f_NG_Authentication_A18 (1): v_S=", v_S); //FC = 0x78 v_S := (v_S & '01'O); + log("f_NG_Authentication_A18 (2): v_S=", v_S); //P0 = SOR Ack v_S := (v_S & '0001'O); + log("f_NG_Authentication_A18 (3): v_S=", v_S); //L0 = length of SOR Ack v_S := (v_S & p_Counter); + log("f_NG_Authentication_A18 (4): v_S=", v_S); //P1 = Counter v_S := (v_S & '0002'O) ; + log("f_NG_Authentication_A18 (5): v_S=", v_S); //L1 = length of Counter return substr(fx_KeyDerivationFunction(p_KDF_Type, p_KAUSF, v_S), 128, 128); diff --git a/ttcn/Lib3GPP/NG_NAS/NG_NAS_Templates.ttcn b/ttcn/Lib3GPP/NG_NAS/NG_NAS_Templates.ttcn index b6995818c236194e572f63fa19050b7eb04de1d6..0ac60d940739639b4d69ca1aaee5ea031dbf1b39 100644 --- a/ttcn/Lib3GPP/NG_NAS/NG_NAS_Templates.ttcn +++ b/ttcn/Lib3GPP/NG_NAS/NG_NAS_Templates.ttcn @@ -2150,6 +2150,81 @@ module NG_NAS_Templates { causeValue := p_Cause }; + template (omit) NG_GMM_Cap m_ng_gmm_cap( + in template (omit) IEI8_Type p_iei:= '10'O, + in B1_Type p_sgc := '0'B, + in B1_Type p_ngIPHC_CP_CIoT := '0'B, + in B1_Type p_n3Data := '0'B, + in B1_Type p_ng_CP_CIoT := '0'B, + in B1_Type p_restrictEC := '0'B, + in B1_Type p_lpp := '0'B, + in B1_Type p_hoAttach := '0'B, + in B1_Type p_s1Cap := '0'B + ) := { + iei := p_iei, + iel := '01'O, + sgc := p_sgc, + ngIPHC_CP_CIoT := p_ngIPHC_CP_CIoT, + n3Data := p_n3Data, + ng_CP_CIoT := p_ng_CP_CIoT, + restrictEC := p_restrictEC, + lpp := p_lpp, + hoAttach := p_hoAttach, + s1Cap := p_s1Cap, + racs := omit, + nssaa := omit, + ngLCS := omit, + v2xNPC5 := omit, + v2xEPC5 := omit, + v2x := omit, + ng_UP_CIoT := omit, + ngSRVCC := omit, + ngProSeL2relay := omit, + ngProSe_dc := omit, + ngProSe_dd := omit, + erNSSAI := omit, + ngEHC_CP_CIoT := omit, + multipleUP := omit, + wusa := omit, + cag := omit, + pr := omit, + rpr := omit, + piv := omit, + ncr := omit, + nrPSSI := omit, + ngProSeL3rmt := omit, + ngProSeL2rmt := omit, + ngProSeL3relay := omit, + mpsiu := omit, + uas := omit, + nsag := omit, + exCAG := omit, + ssnpnsi := omit, + eventNotification := omit, + mint := omit, + nssrg := omit, + spareBits := omit, + rcman := omit, + rcmap := omit, + spare := omit + }; + + template (omit) NG_UpdateType m_ng_update_type( + in template (omit) IEI8_Type p_iei := '53'O, + in template (value) B2_Type p_eps_PNB_CIoT := '00'B, + in template (value) B2_Type p_ng_PNB_CIoT := '00'B, + in template (value) B1_Type p_ngRAN_RCU := '0'B, + in template (value) B1_Type p_smsRequested := '0'B + ) := { + iei := p_iei, + iel := '01'O, + spare := '00'B, + eps_PNB_CIoT := p_eps_PNB_CIoT, + ng_PNB_CIoT := p_ng_PNB_CIoT, + ngRAN_RCU := p_ngRAN_RCU, + smsRequested := p_smsRequested + }; + template (value) ABBA cs_ABBA(octetstring p_ABBA, template (omit) IEI8_Type p_IEI := '38'O, Type4Length_Type p_Length := '02'O) := @@ -2168,6 +2243,16 @@ module NG_NAS_Templates { causeValue := p_Cause }; + template (omit) UE_UsageSetting m_ue_usagesetting( + in template (omit) IEI8_Type p_iei := '18'O, + in template (value) B1_Type p_ue_usage_setting := '0'B // Voice usage setting is not supported in NR5GC, so default to '0'B (not allowed) + ) := { + iei := p_iei, + iel := '01'O, + spare := '0000000'B, + ueUsageSetting := p_ue_usage_setting + }; + template (present) PDU_SessionStatus cr_PDU_SessionStatusAny (IEI8_Type p_IEI := '50'O) := { /* 24.501 cl. 9.11.3.44 */ /* @status APPROVED (NR5GC_IRAT) */ diff --git a/ttcn/Lib3GPP/NasEmulation/NG_SecurityDefinitionsAndExternalFunctions.ttcn b/ttcn/Lib3GPP/NasEmulation/NG_SecurityDefinitionsAndExternalFunctions.ttcn index c5292528d7aecc59d95ea48ce11f8a685425ecfe..767e22ecc0b92f48fb28a7ec420115e5da97d8c6 100644 --- a/ttcn/Lib3GPP/NasEmulation/NG_SecurityDefinitionsAndExternalFunctions.ttcn +++ b/ttcn/Lib3GPP/NasEmulation/NG_SecurityDefinitionsAndExternalFunctions.ttcn @@ -14,24 +14,26 @@ module NG_SecurityDefinitionsAndExternalFunctions { import from CommonDefs all; //============================================================================ - external function fx_NG_NasIntegrityAlgorithm(octetstring p_EncodedNasPdu, - B4_Type p_IntegrityAlgorithm, - B128_Key_Type p_KNASint, - NasCount_Type p_NasCount, - B5_Type p_BearerId, - MAC_Direction_Type p_Direction) return MessageAuthenticationCode; + external function fx_NG_NasIntegrityAlgorithm(in octetstring p_EncodedNasPdu, + in B4_Type p_IntegrityAlgorithm, + in B128_Key_Type p_KNASint, + in NasCount_Type p_NasCount, + in B5_Type p_BearerId, + in MAC_Direction_Type p_Direction) return MessageAuthenticationCode; - external function fx_NG_NasCiphering(octetstring p_EncodedNasPdu, - B4_Type p_CipheringAlgorithm, - B128_Key_Type p_KNASenc, - NasCount_Type p_NasCount, - B5_Type p_BearerId) return octetstring; + external function fx_NG_NasCiphering(in octetstring p_EncodedNasPdu, + in B4_Type p_CipheringAlgorithm, + in B128_Key_Type p_KNASenc, + in NasCount_Type p_NasCount, + in B5_Type p_BearerId, + in MAC_Direction_Type p_Direction := 0) return octetstring; - external function fx_NG_NasDeciphering(octetstring p_CipheredNasMsg, - B4_Type p_CipheringAlgorithm, - B128_Key_Type p_KNASenc, - NasCount_Type p_NasCount, - B5_Type p_BearerId) return octetstring; + external function fx_NG_NasDeciphering(in octetstring p_CipheredNasMsg, + in B4_Type p_CipheringAlgorithm, + in B128_Key_Type p_KNASenc, + in NasCount_Type p_NasCount, + in B5_Type p_BearerId, + in MAC_Direction_Type p_Direction := 0) return octetstring; //---------------------------------------------------------------------------- } diff --git a/ttcn/Lib3GPP/NasEmulation/module.mk b/ttcn/Lib3GPP/NasEmulation/module.mk index 17a9b844061ce005fd9cdb5c8fdf22d6480b1958..28027c1d57c8d8cedbf0db27e720c6dece9891b3 100644 --- a/ttcn/Lib3GPP/NasEmulation/module.mk +++ b/ttcn/Lib3GPP/NasEmulation/module.mk @@ -1,6 +1,8 @@ sources:= \ NasEmu_Common4G5G.ttcn \ - NG_NasEmu_CtrlAspTypes.ttcn + NG_NasEmu_CtrlAspTypes.ttcn \ + NG_SecurityDefinitionsAndExternalFunctions.ttcn + #NasEmu5G_AspTypes_NR.ttcn \ #NasEmu5G_Component_NR_BASE.ttcn \ @@ -10,4 +12,3 @@ sources:= \ #NG_NasEmu_Common.ttcn \ #NG_NasEmu_CtrlAspTypes.ttcn \ #NG_NasEmu_CtrlFunctions.ttcn \ - #NG_SecurityDefinitionsAndExternalFunctions.ttcn diff --git a/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn b/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn index 6a044f39272fcea61c7d10a3cfb23863dbcd59b0..791cd4d3c91c75127c2a3e64326153aaf2385bb9 100644 --- a/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn +++ b/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn @@ -1,5 +1,5 @@ /** -* @author ETSI / TTF033 +* @author ETSI / TTF T033, T048 * @version $URL$ * $Id$ * @desc This module provides external function declarations. @@ -30,15 +30,18 @@ module LibNGAP_EncdecDeclarations { with {extension "prototype(convert) encode(LibNGAP_codec)"} external function fx_dec_NGAP_IEs (inout bitstring pdu, out NGAP_IEs p) return integer with {extension "prototype(sliding) decode(LibNGAP_codec)"}*/ - //external function dec_PDUSessionResourceSetupResponseTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceSetupResponseTransfer p) return integer - //with {extension "prototype(sliding) decode(LibNGAP_codec)"} + + external function fx_enc_PDUSessionResourceSetupResponseTransfer(NGAP_IEs.PDUSessionResourceSetupResponseTransfer p) return bitstring + with {extension "prototype(convert) encode(PER:ALIGNED)"} + external function fx_dec_PDUSessionResourceSetupResponseTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceSetupResponseTransfer p) return integer with {extension "prototype(sliding) decode(PER:ALIGNED)"} - //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceSetupRequestTransfer(NGAP_IEs.PDUSessionResourceSetupRequestTransfer p) return bitstring with {extension "prototype(convert) encode(PER:ALIGNED)"} + external function fx_dec_PDUSessionResourceSetupRequestTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceSetupRequestTransfer p) return integer + with {extension "prototype(sliding) decode(PER:ALIGNED)"} external function fx_dec_PDUSessionResourceSetupUnsuccessfulTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceSetupUnsuccessfulTransfer p) return integer with {extension "prototype(sliding) decode(PER:ALIGNED)"} diff --git a/ttcn/LibNGAP/lib/LibNGAP_Pics.ttcn b/ttcn/LibNGAP/lib/LibNGAP_Pics.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..e3a119ace4a2782d9dc998ef021e44a541e31438 --- /dev/null +++ b/ttcn/LibNGAP/lib/LibNGAP_Pics.ttcn @@ -0,0 +1,9 @@ +module LibNGAP_Pics { + + modulepar boolean PICS_OFFLINE_MODE := false; // If true, the test system runs in offline mode (no SUT connection) + + modulepar boolean PICS_USE_UERANSIMU := false; // If true, the test system uses UERANSIMU as SUT (instead of a real gNB) + + modulepar boolean PICS_USE_OPEN5GS := false; // If true, the test system starts Open5GS as 5GC for UERANSIMU + +} // End of module LibNGAP_Pics diff --git a/ttcn/LibNGAP/lib/LibNGAP_Pixits.ttcn b/ttcn/LibNGAP/lib/LibNGAP_Pixits.ttcn index 0b8285254948bd6423f5d515cbaee4b6da52ab5e..62009d9fbe910725aabfb997b1dc91fc4faa839f 100644 --- a/ttcn/LibNGAP/lib/LibNGAP_Pixits.ttcn +++ b/ttcn/LibNGAP/lib/LibNGAP_Pixits.ttcn @@ -1,5 +1,5 @@ /** -* @author ETSI / TTF033 +* @author ETSI / TTF T033, T048 * @version $URL$ * $Id$ * @desc This module provides PIXITS for NGAP protocol. @@ -14,6 +14,10 @@ module LibNGAP_Pixits { // LibCommon import from LibCommon_DataStrings all; + // Lib3GPP + import from CommonDefs all; + import from NAS_CommonTypeDefs all; + // LibNGAP import from NGAP_IEs language "ASN.1:1997" all; import from NGAP_CommonDataTypes language "ASN.1:1997" all; @@ -69,13 +73,13 @@ module LibNGAP_Pixits { * @desc This IE carries an identifier assigned by the RAN to the UE for the purposes of NGAP signaling * @see ETSI TS 138 413 V16.12.0 (2023-05) */ - modulepar RAN_UE_NGAP_ID PX_RAN_UE_NGAP_ID := 1; + modulepar RAN_UE_NGAP_ID PX_RAN_UE_NGAP_ID := 2; /** * @desc The identifier for the PDU session * @see ETSI TS 138 413 V16.12.0 (2023-05) */ - modulepar PDUSessionID PX_PDU_SESSION_ID := 0; + modulepar PDUSessionID PX_PDU_SESSION_ID := 1; /** * @desc Single Network Slice Selection Assistance Information @@ -93,25 +97,25 @@ module LibNGAP_Pixits { * @desc * @see ETSI TS 138 413 V16.12.0 (2023-05) */ - modulepar TransportLayerAddress PX_TRANSPORT_LAYER_ADDRESS := oct2bit('0a0000a2'O); // 10.0.0.162 + modulepar TransportLayerAddress PX_TRANSPORT_LAYER_ADDRESS := oct2bit('7f000001'O); // 127.0.0.1 /** * @desc * @see ETSI TS 138 413 V16.12.0 (2023-05) */ - modulepar TransportLayerAddress PX_SOURCE_TRANSPORT_LAYER_ADDRESS := oct2bit('0a0000a2'O); // 10.0.0.162 + modulepar TransportLayerAddress PX_SOURCE_TRANSPORT_LAYER_ADDRESS := oct2bit('7f000001'O); // 127.0.0.1 /** * @desc * @see ETSI TS 138 413 V16.12.0 (2023-05) */ - modulepar TransportLayerAddress PX_MC_TRANSPORT_LAYER_ADDRESS := oct2bit('0a0000a2'O); // 10.0.0.162 + modulepar TransportLayerAddress PX_MC_TRANSPORT_LAYER_ADDRESS := oct2bit('7f000001'O); // 127.0.0.1 /** * @desc GPRS Tunneling Protocol - Tunnel Endpoint Identifier * @see ETSI TS 138 413 V16.12.0 (2023-05) */ - modulepar GTP_TEID PX_GTP_TEID := '4f485cc3'O; + modulepar GTP_TEID PX_GTP_TEID := '00000001'O; /** * @desc To identify QoS flow @@ -131,16 +135,25 @@ module LibNGAP_Pixits { */ modulepar AlternativeQoSParaSetNotifyIndex PX_ALTERNATIVE_QOS_PARA_SET_NOTIFY_INDEX := 0; - /** - * @desc The Mobile Country Code (MCC) and Mobile Network Code (MNC) - * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.3.5 PLMN Identity - */ - modulepar PLMNIdentity PX_PLMN_IDENTITY := '00f110'O; // MCC: 1, MNC: 01 + /** + * @desc To indicates the relative processing capacity of an AMF with respect to the other AMFs in the AMF Set in order to load-balance AMFs within an AMF Set + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.32 Relative AMF Capacity + */ + modulepar RelativeAMFCapacity PX_M_RELATIVE_AMF_CAP := 255; - /** - * @desc The leftmost bits of the E-UTRA Cell Identity IE correspond to the ng-eNB ID - * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.9 E-UTRA CGI - */ + /** + * @desc The Mobile Country Code (MCC) and Mobile Network Code (MNC) + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.3.5 PLMN Identity + */ + modulepar NAS_Mcc PX_NAS_MCC := '001'H; // MCC: 1 + modulepar hexstring PX_NAS_MNC := '01'H; // MNC: 01 + + modulepar O1_Type PX_TIME_ZONE := '80'O; // 0x40 for GMT+1, 0x80 for GMT+2 + + /** + * @desc The leftmost bits of the E-UTRA Cell Identity IE correspond to the ng-eNB ID + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.9 E-UTRA CGI + */ modulepar EUTRACellIdentity PX_EUTRA_CELL_IDENTITY := hex2bit('1234501'H); modulepar NRCellIdentity PX_NR_CELL_IDENTITY := hex2bit('123450123'H); @@ -246,20 +259,12 @@ module LibNGAP_Pixits { */ modulepar CauseRadioNetwork PX_AMF_CONFIGURATION_UPDATE_FAILURE := unspecified; - - modulepar CauseTransport PX_xxx_1 := unspecified; - - modulepar CauseProtocol PX_xxx_2 := unspecified; - /** * @desc To indicate the reason for a particular event for the NGAP protocol * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.2 Cause */ modulepar CauseNas PX_CAUSE_NAS_NON_DELIVERY_INDICATION := unspecified; - modulepar CauseMisc PX_xxx_4 := unspecified; - - /** * @desc To indicate the RRC state of the UE * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.92 RRC State @@ -306,7 +311,7 @@ module LibNGAP_Pixits { * @desc To indicate the reason for RRC Connection Establishment/Resume * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.111 RRC Establishment Cause */ - modulepar RRCEstablishmentCause PX_RRC_ESTABLISHMENT_CAUSE := notAvailable; + modulepar RRCEstablishmentCause PX_RRC_ESTABLISHMENT_CAUSE := mo_Signalling; /** * @desc To indicate the reason for RRC Connection Establishment/Resume @@ -336,29 +341,37 @@ module LibNGAP_Pixits { * @desc Each position in the bitmap represents an encryption algorithm * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.86 UE Security Capabilities */ - modulepar NRencryptionAlgorithms PX_NR_ENCRYPTION_ALGORITHMS; + modulepar NRencryptionAlgorithms PX_NR_ENCRYPTION_ALGORITHMS := oct2bit('e000'O); /** * @desc Each position in the bitmap represents an encryption algorithm * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.86 UE Security Capabilities */ - modulepar NRintegrityProtectionAlgorithms PX_NR_INTEGRITY_PROTECTION_ALGORITHMS; + modulepar NRintegrityProtectionAlgorithms PX_NR_INTEGRITY_PROTECTION_ALGORITHMS := oct2bit('e000'O); /** * @desc Each position in the bitmap represents an encryption algorithm * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.86 UE Security Capabilities */ - modulepar EUTRAencryptionAlgorithms PX_EUTRA_ENCRYPTION_ALGORITHMS; + modulepar EUTRAencryptionAlgorithms PX_EUTRA_ENCRYPTION_ALGORITHMS := oct2bit('e000'O); /** * @desc Each position in the bitmap represents an encryption algorithm * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.86 UE Security Capabilities */ - modulepar EUTRAintegrityProtectionAlgorithms PX_EUTRA_INTEGRITY_PROTECTION_ALGORITHMS; + modulepar EUTRAintegrityProtectionAlgorithms PX_EUTRA_INTEGRITY_PROTECTION_ALGORITHMS := oct2bit('e000'O); - modulepar NextHopChainingCount PX_NEXT_HOP_CHAINING_COUNT; + /** + * @desc Serves as a counter that tracks how many NH key derivations have been performed from the initial root key + * @see ETSI TS 133 501 V16.12.0 (2023-05) Clause 7.2.2 E-UTRAN key identification + */ + modulepar NextHopChainingCount PX_NEXT_HOP_CHAINING_COUNT := 0; - modulepar SecurityKey PX_NEXT_HOP_NH; + /** + * @desc Intermediate key derived by the UE and Core Network (MME/AMF) to provide forward security + * @see ETSI TS 133 501 V16.12.0 (2023-05) + */ + modulepar SecurityKey PX_NEXT_HOP_NH := int2bit(0, 256); /** * @desc Contains the DRB ID @@ -408,39 +421,93 @@ module LibNGAP_Pixits { */ modulepar NumberOfBroadcastsRequested PX_NUMBER_OF_BROADCASTS_REQUESTED := 4; + /** + * @desc Transparent NAS container + */ modulepar octetstring PX_SOURCE_TO_TARGET_TRANSPARENT_CONTAINER; + /** + * @desc Uniquely and globally identify a tracking area within the Evolved Packet System + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.3.16 EPS TAC + */ modulepar EPS_TAC PX_EPS_TAC := '0000'O; + /** + * @desc Uniquely identify a Next Generation Evolved Node-B (ng-eNB) + * @see ETSI TS 133 501 V16.12.0 (2023-05) + */ modulepar Bit20 PX_MACRO_NGENB_ID; + /** + * @desc Uniquely identify a Next Generation Evolved Node-B (ng-eNB) + * @see ETSI TS 133 501 V16.12.0 (2023-05) + */ modulepar Bit18 PX_SHORT_MACRO_NGENB_ID; + /** + * @desc Uniquely identify a Next Generation Evolved Node-B (ng-eNB) + * @see ETSI TS 133 501 V16.12.0 (2023-05) + */ modulepar Bit21 PX_LONG_MACRO_NGENB_ID; + /** + * @desc Used by the NG-RAN node to calculate the Paging Frame for a specific User Equipment + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.3.23 UE Identity Index Value + */ modulepar Bit10 PX_UE_IDENTITY_INDEX_VALUE; + /** + * @desc Used within the 5G NG Application Protocol (NGAP) to assist the NG-RAN node in managing mobility for User Equipment (UE) in the RRC_INACTIVE state + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.3.24 Periodic Registration Update Timer + */ modulepar PeriodicRegistrationUpdateTimer PX_PERIODIC_REGISTRATION_UPDATE_TIMER; + /** + * @desc Used to uniquely identify a trace session for a specific User Equipment + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.10.1 Trace Start + */ modulepar NGRANTraceID PX_NGRAN_TRACE_ID; + /** + * @desc Used to specify which NG-RAN node interfaces should be monitored during a trace session + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.14 Trace Activation + */ modulepar InterfacesToTrace PX_INTERFACES_TO_TRACE; + /** + * @desc Serves as a compact identifier that represents a specific set of UE radio capabilities + * @see ETSI TS 124 301 V16.09.0 (2023-05) Clause 5.3.20 + */ modulepar UERadioCapabilityID PX_U_E_RADIO_CAPABILITY_ID; + /** + * @desc Used to indicate the minimum time the RAN should keep the User Equipment (UE) in the RRC_CONNECTED state + * @see ETSI TS 138 413 V16.12.0 (2023-05) + */ modulepar Extended_ConnectedTime PX_EXTENDED_CONNECTED_TIME; + /** + * @desc Used in the 5G NG Application Protocol (NGAP) to provide the radio access network with the aggregate maximum bit rate for a User Equipment's (UE) sidelink communication (V2X) + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.3.1.149 LTE UE Sidelink Aggregate Maximum Bit Rate + */ modulepar BitRate PX_UE_SIDELINK_AGGREGATE_MAXIMUM_BIT_RATE; + /** + * @desc Used in 5G systems to identify specific Quality of Service (QoS) characteristics to be provided for a QoS flow + * @see ETSI TS 124 501 V16.14.0 (2023-05) + */ modulepar FiveQI PX_FIVE_QI; + /** + * @desc gNodeB identifier + */ modulepar bitstring PX_GNB_ID := '10101010101010101010101010101010'B; /** * @desc To indicate IMEISV value with a mask, to identify a terminal model without identifying an individual Mobile Equipment. * @see 138 413 V16.12.0 (2023-05) Clause 9.3.1.54 Masked IMEISV */ - modulepar bitstring PX_MaskedIMEISV; + modulepar bitstring PX_MaskedIMEISV := oct2bit('4370816125ffff51'O); /** * @desc To indicate local configuration for RRM strategies such as camp priorities in Idle mode and control of inter-RAT/inter-frequency handover in Active mode @@ -655,5 +722,13 @@ module LibNGAP_Pixits { */ //modulepar Target_ToSource_TransparentContainer PX_TARGET_TO_SOURCE_TANSPARENT_CONTAINER := '12121212'O; + modulepar charstring PX_GNB_BINARY_FILE := "/home/yann/dev/UERANSIM/build/nr-gnb"; + modulepar charstring PX_GNB_CONFIG_FILE := "config/open5gs-gnb.yaml"; + modulepar charstring PX_UE_BINARY_FILE := "/home/yann/dev/UERANSIM/build/nr-ue"; + modulepar charstring PX_UE_CONFIG_FILE := "config/open5gs-ue.yaml"; + + modulepar charstring PX_OPEN5GS_BINARY_FILE := "/home/yann/dev/open5gs/build/tests/app/5gc"; + modulepar charstring PX_OPEN5GS_CONFIG_FILE := ""; + } // End of module LibNGAP_Pixits diff --git a/ttcn/LibNGAP/lib/LibNGAP_Templates.ttcn b/ttcn/LibNGAP/lib/LibNGAP_Templates.ttcn index ef2e9a92d21b92c3f2506b253b2a39f39ef11209..abae6c10d5cfbe47160e29521b392c7e6252699c 100644 --- a/ttcn/LibNGAP/lib/LibNGAP_Templates.ttcn +++ b/ttcn/LibNGAP/lib/LibNGAP_Templates.ttcn @@ -1,5 +1,5 @@ /** - * @author ETSI / TTF033 + * @author ETSI / TTF T033, T048 * @version $URL$ * $Id$ * @desc This module provides templates for NGAP protocol. @@ -17,8 +17,12 @@ module LibNGAP_Templates { // Lib3GPP/NAS import from NAS_CommonTypeDefs all; + import from NG_NAS_TypeDefs all; - // LibNGAP + // Lib_NG_NAS + import from Lib_NG_NAS_Security_Functions all; + + // LibNGAP import from NGAP_Constants language "ASN.1:2002" all; import from NGAP_CommonDataTypes language "ASN.1:2002" all; import from NGAP_IEs language "ASN.1:2002" all; @@ -136,7 +140,7 @@ module LibNGAP_Templates { }, { id := id_PDUSessionResourceSetupListSUReq, - criticality := ignore, + criticality := reject, value_ := { PDUSessionResourceSetupListSUReq := p_pDUSessionResourceSetupListSUReq } } } @@ -154,7 +158,8 @@ module LibNGAP_Templates { template (present) InitiatingMessage mw_n2_PDUSessionResourceSetupRequest( template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, - template (present) PDUSessionResourceSetupListSUReq p_pDUSessionResourceSetupListSUReq := ? + template (present) PDUSessionResourceSetupListSUReq p_pDUSessionResourceSetupListSUReq := ?, + template (present) UEAggregateMaximumBitRate p_uEAggregateMaximumBitRate := ? ) := { procedureCode := id_PDUSessionResourceSetup, criticality := reject, @@ -173,8 +178,13 @@ module LibNGAP_Templates { }, { id := id_PDUSessionResourceSetupListSUReq, - criticality := ignore, + criticality := reject, value_ := { PDUSessionResourceSetupListSUReq := p_pDUSessionResourceSetupListSUReq } + }, + { + id := id_UEAggregateMaximumBitRate, + criticality := ignore, + value_ := { UEAggregateMaximumBitRate := p_uEAggregateMaximumBitRate } } } } @@ -195,7 +205,8 @@ module LibNGAP_Templates { template (value) SuccessfulOutcome m_n2_PDUSessionResourceSetupResponse( in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, - in template (value) PDUSessionResourceSetupListSURes p_pDUSessionResourceSetupListSURes + in template (value) PDUSessionResourceSetupListSURes p_pDUSessionResourceSetupListSURes, + in template (value) UserLocationInformation p_userLocationInformation ) := { procedureCode := id_PDUSessionResourceSetup, criticality := reject, @@ -204,23 +215,28 @@ module LibNGAP_Templates { protocolIEs := { { id := id_AMF_UE_NGAP_ID, - criticality := reject, + criticality := ignore, value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } }, { id := id_RAN_UE_NGAP_ID, - criticality := reject, + criticality := ignore, value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } }, { id := id_PDUSessionResourceSetupListSURes, criticality := ignore, value_ := { PDUSessionResourceSetupListSURes := p_pDUSessionResourceSetupListSURes } + }, + { + id := id_UserLocationInformation, + criticality := ignore, + value_ := { UserLocationInformation := p_userLocationInformation } } } } } - } // End of template mw_n2_PDUSessionResourceSetupResponse + } // End of template m_n2_PDUSessionResourceSetupResponse } // End of group Send @@ -232,7 +248,8 @@ module LibNGAP_Templates { template (present) SuccessfulOutcome mw_n2_PDUSessionResourceSetupResponse( template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, - template (present) PDUSessionResourceSetupListSURes p_pDUSessionResourceSetupListSUReq := ? + template (present) PDUSessionResourceSetupListSURes p_pDUSessionResourceSetupListSUReq := ?, + template (present) UserLocationInformation p_userLocationInformation := ? ) := { procedureCode := id_PDUSessionResourceSetup, criticality := reject, @@ -253,6 +270,11 @@ module LibNGAP_Templates { id := id_PDUSessionResourceSetupListSURes, criticality := ignore, value_ := { PDUSessionResourceSetupListSURes := p_pDUSessionResourceSetupListSUReq} + }, + { + id := id_UserLocationInformation, + criticality := ignore, + value_ := { UserLocationInformation := p_userLocationInformation } } } } @@ -260,10 +282,10 @@ module LibNGAP_Templates { } // End of template mw_n2_PDUSessionResourceSetupResponse template (present) SuccessfulOutcome mw_n2_PDUSessionResourceSetupResponseFailed( - template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, - template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, - template (present) PDUSessionResourceFailedToSetupListSURes p_pDUSessionResourceFailedToSetupListSUReq := ? - ) := { + template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + template (present) PDUSessionResourceFailedToSetupListSURes p_pDUSessionResourceFailedToSetupListSUReq := ? + ) := { procedureCode := id_PDUSessionResourceSetup, criticality := reject, value_ := { @@ -305,7 +327,7 @@ module LibNGAP_Templates { in template (value) PDUSessionResourceToReleaseListRelCmd p_pDUSessionResourceToReleaseListRelCmd ) := { - procedureCode := id_PDUSessionResourceToReleaseListRelCmd, + procedureCode := id_PDUSessionResourceRelease, criticality := reject, value_ := { PDUSessionResourceReleaseCommand := { @@ -333,16 +355,37 @@ module LibNGAP_Templates { } // End of group Send group Receive { + /** * @see ETSI TS 138 413 V16.12.0 (2023-05) 9.2.1.3 PDU SESSION RESOURCE RELEASE COMMAND */ + template (present) InitiatingMessage mw_n2_PDUSessionResourceReleaseCommand_base_nas := { + + procedureCode := id_PDUSessionResourceRelease, + criticality := reject, + value_ := { + PDUSessionResourceReleaseCommand := { + protocolIEs := { + *, + { + id := id_NAS_PDU, + criticality := ignore, + value_ := { NAS_PDU := ? } + }, + * + } + } + } + } // End of template mw_n2_PDUSessionResourceReleaseCommand_base_nas + template (present) InitiatingMessage mw_n2_PDUSessionResourceReleaseCommand( template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + template (present) NAS_PDU p_nasPdu := ?, template (present) PDUSessionResourceToReleaseListRelCmd p_pDUSessionResourceToReleaseListRelCmd := ? ) := { - procedureCode := id_PDUSessionResourceToReleaseListRelCmd, + procedureCode := id_PDUSessionResourceRelease, criticality := reject, value_ := { PDUSessionResourceReleaseCommand := { @@ -357,6 +400,12 @@ module LibNGAP_Templates { criticality := reject, value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } }, + { + id := id_NAS_PDU, + criticality := ignore, + value_ := { NAS_PDU := p_nasPdu } + }, + { id := id_PDUSessionResourceToReleaseListRelCmd, criticality := reject, @@ -1010,7 +1059,7 @@ module LibNGAP_Templates { in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, in template (value) GUAMI p_gUAMI, in template (value) PDUSessionResourceSetupListCxtReq p_pDUSessionResourceSetupListCxtReq, - in template (value) AllowedNSSAI p_allowedNSSAI, + in template (value) NGAP_IEs.AllowedNSSAI p_allowedNSSAI, in template (value) UESecurityCapabilities p_uESecurityCapabilities, in template (value) SecurityKey p_nextHopNH := PX_NEXT_HOP_NH ) := { @@ -1018,13 +1067,6 @@ module LibNGAP_Templates { criticality := reject, value_ := { InitialContextSetupRequest := { - - - - - - - protocolIEs := { { id := id_AMF_UE_NGAP_ID, @@ -1047,13 +1089,15 @@ module LibNGAP_Templates { } // End of template m_n2_InitialContextSetupRequest template (value) InitiatingMessage m_n2_InitialContextSetupRequest_noPDUSessionResourceSetupListCxtReq( - in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, - in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, - in template (value) GUAMI p_gUAMI, - in template (value) AllowedNSSAI p_allowedNSSAI, - in template (value) UESecurityCapabilities p_uESecurityCapabilities, - in template (value) SecurityKey p_nextHopNH := PX_NEXT_HOP_NH - ) := { + in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, + in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, + in template (value) GUAMI p_gUAMI, + in template (value) NGAP_IEs.AllowedNSSAI p_allowedNSSAI, + in template (value) UESecurityCapabilities p_uESecurityCapabilities, + in template (value) SecurityKey p_nextHopNH := PX_NEXT_HOP_NH, + in template (value) MaskedIMEISV p_maskedIMEISV := PX_MaskedIMEISV, + in template (value) NG_NAS_Message p_nasPdu + ) := { procedureCode := id_InitialContextSetup, criticality := reject, value_ := { @@ -1070,24 +1114,34 @@ module LibNGAP_Templates { value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } }, { - id := id_GUAMI, + id := id_GUAMI, criticality := reject, value_ := { GUAMI := p_gUAMI } }, { - id := id_AllowedNSSAI, + id := id_AllowedNSSAI, criticality := reject, value_ := { AllowedNSSAI := p_allowedNSSAI } }, { - id := id_UESecurityCapabilities, + id := id_UESecurityCapabilities, criticality := reject, value_ := { UESecurityCapabilities := p_uESecurityCapabilities } }, { - id := id_SecurityKey, + id := id_SecurityKey, criticality := reject, value_ := { SecurityKey := p_nextHopNH } + }, + { + id := id_MaskedIMEISV, + criticality := ignore, + value_ := { MaskedIMEISV := p_maskedIMEISV } + }, + { + id := id_NAS_PDU, + criticality := ignore, + value_ := { NAS_PDU := p_nasPdu } } } } @@ -1102,7 +1156,7 @@ module LibNGAP_Templates { in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, in template (value) GUAMI p_gUAMI, in template (value) PDUSessionResourceSetupListCxtReq p_pDUSessionResourceSetupListCxtReq, - in template (value) AllowedNSSAI p_allowedNSSAI, + in template (value) NGAP_IEs.AllowedNSSAI p_allowedNSSAI, in template (value) UESecurityCapabilities p_uESecurityCapabilities, in template (value) SecurityKey p_nextHopNH := PX_NEXT_HOP_NH, in template (value) TraceActivation p_traceActivation @@ -1123,7 +1177,7 @@ module LibNGAP_Templates { value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } }, { - id := id_GUAMI, + id := id_GUAMI, criticality := reject, value_ := { GUAMI := p_gUAMI } }, @@ -1133,22 +1187,22 @@ module LibNGAP_Templates { value_ := { PDUSessionResourceSetupListCxtReq := p_pDUSessionResourceSetupListCxtReq } }, { - id := id_AllowedNSSAI, + id := id_AllowedNSSAI, criticality := reject, value_ := { AllowedNSSAI := p_allowedNSSAI } }, { - id := id_UESecurityCapabilities, + id := id_UESecurityCapabilities, criticality := reject, value_ := { UESecurityCapabilities := p_uESecurityCapabilities } }, { - id := id_SecurityKey, + id := id_SecurityKey, criticality := reject, value_ := { SecurityKey := p_nextHopNH } }, { - id := id_TraceActivation, + id := id_TraceActivation, criticality := ignore, value_ := { TraceActivation := p_traceActivation } } @@ -1165,7 +1219,7 @@ module LibNGAP_Templates { in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, in template (value) GUAMI p_gUAMI, in template (value) PDUSessionResourceSetupListCxtReq p_pDUSessionResourceSetupListCxtReq, - in template (value) AllowedNSSAI p_allowedNSSAI, + in template (value) NGAP_IEs.AllowedNSSAI p_allowedNSSAI, in template (value) UESecurityCapabilities p_uESecurityCapabilities, in template (value) SecurityKey p_nextHopNH := PX_NEXT_HOP_NH, in template (value) MobilityRestrictionList p_mobilityRestrictionList @@ -1186,7 +1240,7 @@ module LibNGAP_Templates { value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } }, { - id := id_GUAMI, + id := id_GUAMI, criticality := reject, value_ := { GUAMI := p_gUAMI } }, @@ -1196,22 +1250,22 @@ module LibNGAP_Templates { value_ := { PDUSessionResourceSetupListCxtReq := p_pDUSessionResourceSetupListCxtReq } }, { - id := id_AllowedNSSAI, + id := id_AllowedNSSAI, criticality := reject, value_ := { AllowedNSSAI := p_allowedNSSAI } }, { - id := id_UESecurityCapabilities, + id := id_UESecurityCapabilities, criticality := reject, value_ := { UESecurityCapabilities := p_uESecurityCapabilities } }, { - id := id_SecurityKey, + id := id_SecurityKey, criticality := reject, value_ := { SecurityKey := p_nextHopNH } }, { - id := id_TraceActivation, + id := id_TraceActivation, criticality := ignore, value_ := { MobilityRestrictionList := p_mobilityRestrictionList } } @@ -1220,7 +1274,7 @@ module LibNGAP_Templates { } } // End of template m_n2_InitialContextSetupRequest_optional_MobilityRestriction - /** + /** * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.2.1 INITIAL CONTEXT SETUP REQUEST */ template (value) InitiatingMessage m_n2_InitialContextSetupRequest_differentOptionals( @@ -1228,7 +1282,7 @@ module LibNGAP_Templates { in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, in template (value) GUAMI p_gUAMI, in template (value) PDUSessionResourceSetupListCxtReq p_pDUSessionResourceSetupListCxtReq, - in template (value) AllowedNSSAI p_allowedNSSAI, + in template (value) NGAP_IEs.AllowedNSSAI p_allowedNSSAI, in template (value) UESecurityCapabilities p_uESecurityCapabilities, in template (value) SecurityKey p_nextHopNH := PX_NEXT_HOP_NH, in template (value) UERadioCapability p_uERadioCapability, @@ -1264,7 +1318,7 @@ module LibNGAP_Templates { value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } }, { - id := id_GUAMI, + id := id_GUAMI, criticality := reject, value_ := { GUAMI := p_gUAMI } }, @@ -1274,97 +1328,97 @@ module LibNGAP_Templates { value_ := { PDUSessionResourceSetupListCxtReq := p_pDUSessionResourceSetupListCxtReq } }, { - id := id_AllowedNSSAI, + id := id_AllowedNSSAI, criticality := reject, value_ := { AllowedNSSAI := p_allowedNSSAI } }, { - id := id_UESecurityCapabilities, + id := id_UESecurityCapabilities, criticality := reject, value_ := { UESecurityCapabilities := p_uESecurityCapabilities } }, { - id := id_SecurityKey, + id := id_SecurityKey, criticality := reject, value_ := { SecurityKey := p_nextHopNH } }, { - id := id_UERadioCapability, + id := id_UERadioCapability, criticality := ignore, value_ := { UERadioCapability := p_uERadioCapability } }, { - id := id_IndexToRFSP, + id := id_IndexToRFSP, criticality := ignore, value_ := { IndexToRFSP := p_indexToRFSP } }, { - id := id_MaskedIMEISV, + id := id_MaskedIMEISV, criticality := ignore, value_ := { MaskedIMEISV := p_maskedIMEISV } }, { - id := id_NAS_PDU, + id := id_NAS_PDU, criticality := ignore, value_ := { NAS_PDU := p_nasPdu } }, { - id := id_EmergencyFallbackIndicator, + id := id_EmergencyFallbackIndicator, criticality := reject, value_ := { EmergencyFallbackIndicator := p_emergencyFallbackIndicator} }, { - id := id_RRCInactiveTransitionReportRequest, + id := id_RRCInactiveTransitionReportRequest, criticality := ignore, value_ := { RRCInactiveTransitionReportRequest := p_rRCInactiveTransitionReportRequest} }, { - id := id_RedirectionVoiceFallback, + id := id_RedirectionVoiceFallback, criticality := ignore, value_ := { RedirectionVoiceFallback := p_redirectionVoiceFallback } } , { - id := id_LocationReportingRequestType, + id := id_LocationReportingRequestType, criticality := ignore, value_ := { LocationReportingRequestType := p_locationReportingRequestType } }, { - id := id_SRVCCOperationPossible, + id := id_SRVCCOperationPossible, criticality := ignore, value_ := { SRVCCOperationPossible := p_sRVCCOperationPossible } }, { - id := id_IAB_Authorized, + id := id_IAB_Authorized, criticality := ignore, value_ := { IAB_Authorized := p_iAB_Authorized } }, { - id := id_Enhanced_CoverageRestriction, + id := id_Enhanced_CoverageRestriction, criticality := ignore, value_ := { Enhanced_CoverageRestriction := p_enhanced_CoverageRestriction } }, { - id := id_Extended_ConnectedTime, + id := id_Extended_ConnectedTime, criticality := ignore, value_ := { Extended_ConnectedTime := p_extended_ConnectedTime } }, { - id := id_UE_DifferentiationInfo, + id := id_UE_DifferentiationInfo, criticality := ignore, value_ := { UE_DifferentiationInfo := p_uE_DifferentiationInfo } }, - { - id := id_NRUESidelinkAggregateMaximumBitrate, + { + id := id_NRUESidelinkAggregateMaximumBitrate, criticality := ignore, value_ := { NRUESidelinkAggregateMaximumBitrate := p_nRUESidelinkAggregateMaximumBitrate } }, - { - id := id_LTEUESidelinkAggregateMaximumBitrate, + { + id := id_LTEUESidelinkAggregateMaximumBitrate, criticality := ignore, value_ := { LTEUESidelinkAggregateMaximumBitrate := p_lTEUESidelinkAggregateMaximumBitrate } }, { - id := id_UERadioCapabilityID, + id := id_UERadioCapabilityID, criticality := reject, value_ := { UERadioCapabilityID := p_uERadioCapabilityID } } @@ -1379,6 +1433,89 @@ module LibNGAP_Templates { group Receive { + template (present) InitiatingMessage mw_n2_InitialContextSetupRequest_base_nas := { + procedureCode := id_InitialContextSetup, + criticality := reject, + value_ := { + InitialContextSetupRequest := { + protocolIEs := { + *, + { + id := id_NAS_PDU, + criticality := ?, + value_ := { NAS_PDU := ? } + }, + * + } + + } + } + } // End of template mw_n2_InitialContextSetupRequest_base_nas + + /** + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.2.1 INITIAL CONTEXT SETUP REQUEST + */ + template (present) InitiatingMessage mw_n2_InitialContextSetupRequest( + template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + template (present) GUAMI p_gUAMI := ?, + template (present) PDUSessionResourceSetupListCxtReq p_pDUSessionResourceSetupListCxtReq := ?, + template (present) NGAP_IEs.AllowedNSSAI p_allowedNSSAI := ?, + template (present) UESecurityCapabilities p_uESecurityCapabilities := ?, + template (present) SecurityKey p_nextHopNH := ?, + template (present) MaskedIMEISV p_maskedIMEISV := ?, + template (present) NAS_PDU p_nasPdu := ? + ) := { + procedureCode := id_InitialContextSetup, + criticality := reject, + value_ := { + InitialContextSetupRequest := { + protocolIEs := { + { + id := id_AMF_UE_NGAP_ID, + criticality := reject, + value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } + }, + { + id := id_RAN_UE_NGAP_ID, + criticality := reject, + value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } + }, + { + id := id_GUAMI, + criticality := reject, + value_ := { GUAMI := p_gUAMI } + }, + { + id := id_AllowedNSSAI, + criticality := reject, + value_ := { AllowedNSSAI := p_allowedNSSAI } + }, + { + id := id_UESecurityCapabilities, + criticality := reject, + value_ := { UESecurityCapabilities := p_uESecurityCapabilities } + }, + { + id := id_SecurityKey, + criticality := reject, + value_ := { SecurityKey := p_nextHopNH } + }, + { + id := id_MaskedIMEISV, + criticality := ignore, + value_ := { MaskedIMEISV := p_maskedIMEISV } + }, + { + id := id_NAS_PDU, + criticality := ignore, + value_ := { NAS_PDU := p_nasPdu } + } + } + } + } + } // End of template mw_n2_InitialContextSetupRequest + /** * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.2.1 INITIAL CONTEXT SETUP REQUEST */ @@ -1387,7 +1524,7 @@ module LibNGAP_Templates { template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, template (present) GUAMI p_gUAMI := ?, template (present) PDUSessionResourceSetupListCxtReq p_pDUSessionResourceSetupListCxtReq := ?, - template (present) AllowedNSSAI p_allowedNSSAI := ?, + template (present) NGAP_IEs.AllowedNSSAI p_allowedNSSAI := ?, template (present) UESecurityCapabilities p_uESecurityCapabilities := ?, template (present) SecurityKey p_nextHopNH := ?, template (present) MaskedIMEISV p_maskedIMEISV := ?, @@ -1409,44 +1546,44 @@ module LibNGAP_Templates { value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } }, { - id := id_GUAMI, + id := id_GUAMI, criticality := reject, value_ := { GUAMI := p_gUAMI } }, { - id := id_PDUSessionResourceSetupListCxtReq, + id := id_AllowedNSSAI, criticality := reject, - value_ := { PDUSessionResourceSetupListCxtReq := p_pDUSessionResourceSetupListCxtReq } + value_ := { AllowedNSSAI := p_allowedNSSAI } }, { - id := id_AllowedNSSAI, + id := id_UESecurityCapabilities, criticality := reject, - value_ := { AllowedNSSAI := p_allowedNSSAI } + value_ := { UESecurityCapabilities := p_uESecurityCapabilities } }, { - id := id_UESecurityCapabilities, + id := id_PDUSessionResourceSetupListCxtReq, criticality := reject, - value_ := { UESecurityCapabilities := p_uESecurityCapabilities } + value_ := { PDUSessionResourceSetupListCxtReq := p_pDUSessionResourceSetupListCxtReq } }, { - id := id_SecurityKey, + id := id_SecurityKey, criticality := reject, value_ := { SecurityKey := p_nextHopNH } }, { - id := id_MaskedIMEISV, + id := id_MaskedIMEISV, criticality := ignore, value_ := { MaskedIMEISV := p_maskedIMEISV } }, { - id := id_NAS_PDU, + id := id_NAS_PDU, criticality := ignore, value_ := { NAS_PDU := p_nasPdu } } } } } - } // End of template mw_n2_InitialContextSetupRequest + } // End of template mw_n2_InitialContextSetupRequest_withPDUSessionList } // End of group Receive @@ -1461,31 +1598,25 @@ module LibNGAP_Templates { */ template (value) SuccessfulOutcome m_n2_InitialContextSetupResponse( in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, - in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, - in template (value) PDUSessionResourceSetupListSURes p_pDUSessionResourceSetupListSURes + in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID ) := { procedureCode := id_InitialContextSetup, criticality := reject, value_ := { - PDUSessionResourceSetupResponse := { - protocolIEs := { - { - id := id_AMF_UE_NGAP_ID, - criticality := ignore, - value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } - }, - { - id := id_RAN_UE_NGAP_ID, - criticality := ignore, - value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } - }, - { - id := id_PDUSessionResourceSetupListSURes, - criticality := ignore, - value_ := { PDUSessionResourceSetupListSURes := p_pDUSessionResourceSetupListSURes } - } + InitialContextSetupResponse := { + protocolIEs := { + { + id := id_AMF_UE_NGAP_ID, + criticality := ignore, + value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } + }, + { + id := id_RAN_UE_NGAP_ID, + criticality := ignore, + value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } } - } + } + } } } // End of template m_n2_InitialContextSetupResponse @@ -1496,7 +1627,7 @@ module LibNGAP_Templates { procedureCode := id_InitialContextSetup, criticality := reject, value_ := { - PDUSessionResourceSetupResponse := { + InitialContextSetupResponse := { protocolIEs := { { id := id_AMF_UE_NGAP_ID, @@ -1521,14 +1652,13 @@ module LibNGAP_Templates { * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.2.2 INITIAL CONTEXT SETUP RESPONSE */ template (present) SuccessfulOutcome mw_n2_InitialContextSetupResponse( - template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, - template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, - template (present) PDUSessionResourceSetupListSURes p_pDUSessionResourceSetupListSURes := ? + template (present) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, + template (present) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID ) := { procedureCode := id_InitialContextSetup, criticality := reject, value_ := { - PDUSessionResourceSetupResponse := { + InitialContextSetupResponse := { protocolIEs := { { id := id_AMF_UE_NGAP_ID, @@ -1539,11 +1669,6 @@ module LibNGAP_Templates { id := id_RAN_UE_NGAP_ID, criticality := ignore, value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } - }, - { - id := id_PDUSessionResourceSetupListSURes, - criticality := ignore, - value_ := { PDUSessionResourceSetupListSURes := p_pDUSessionResourceSetupListSURes } } } } @@ -1554,14 +1679,13 @@ module LibNGAP_Templates { * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.2.2 INITIAL CONTEXT SETUP RESPONSE */ template (present) SuccessfulOutcome mw_n2_InitialContextSetupResponse_Failed( - template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, - template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, - template (present) PDUSessionResourceFailedToSetupListSURes p_pDUSessionResourceFailedToSetupListURes := ? + template (present) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, + template (present) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID ) := { procedureCode := id_InitialContextSetup, criticality := reject, value_ := { - PDUSessionResourceSetupResponse := { + InitialContextSetupResponse := { protocolIEs := { { id := id_AMF_UE_NGAP_ID, @@ -1572,11 +1696,6 @@ module LibNGAP_Templates { id := id_RAN_UE_NGAP_ID, criticality := ignore, value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } - }, - { - id := id_PDUSessionResourceFailedToSetupListSURes, - criticality := ignore, - value_ := { PDUSessionResourceFailedToSetupListSURes := p_pDUSessionResourceFailedToSetupListURes } } } } @@ -1584,13 +1703,13 @@ module LibNGAP_Templates { } // End of template mw_n2_InitialContextSetupResponse_Failed template (present) SuccessfulOutcome mw_n2_InitialContextSetupResponse_noPDUSessionResourceSetupListSURes( - template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, - template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ? + template (present) AMF_UE_NGAP_ID p_amfUeNgapID := PX_RAN_UE_NGAP_ID, + template (present) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID ) := { procedureCode := id_InitialContextSetup, criticality := reject, value_ := { - PDUSessionResourceSetupResponse := { + InitialContextSetupResponse := { protocolIEs := { { id := id_AMF_UE_NGAP_ID, @@ -1654,6 +1773,39 @@ module LibNGAP_Templates { } } // End of template m_n2_InitialContextSetupFailure + /** + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.2.3 INITIAL CONTEXT SETUP FAILURE + */ + template (value) UnsuccessfulOutcome m_n2_InitialContextSetupFailure_noPDUSessionResourceFailedToSetupListCxtFail( + in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, + in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, + in template (value) Cause p_cause := m_cause_radioNetwork(PX_CAUSE_INITIAL_SETUP_FAILURE) + ) := { + procedureCode := id_InitialContextSetup, + criticality := reject, + value_ := { + InitialContextSetupFailure := { + protocolIEs := { + { + id := id_AMF_UE_NGAP_ID, + criticality := reject, + value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } + }, + { + id := id_RAN_UE_NGAP_ID, + criticality := reject, + value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } + }, + { + id := id_Cause, + criticality := ignore, + value_ := { Cause := p_cause } + } + } + } + } + } // End of template m_n2_InitialContextSetupFailure_noPDUSessionResourceFailedToSetupListCxtFail + } // End of group Send group Receive { @@ -1697,6 +1849,39 @@ module LibNGAP_Templates { } } // End of template mw_n2_PDUInitialContextSetupFailure + /** + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.2.3 INITIAL CONTEXT SETUP FAILURE + */ + template (present) UnsuccessfulOutcome mw_n2_InitialContextSetupFailure_noPDUSessionResourceFailedToSetupListCxtFail( + template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + template (present) Cause p_cause := ? + ) := { + procedureCode := id_InitialContextSetup, + criticality := reject, + value_ := { + InitialContextSetupFailure := { + protocolIEs := { + { + id := id_AMF_UE_NGAP_ID, + criticality := reject, + value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } + }, + { + id := id_RAN_UE_NGAP_ID, + criticality := reject, + value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } + }, + { + id := id_Cause, + criticality := ignore, + value_ := { Cause := p_cause } + } + } + } + } + } // End of template mw_n2_PDUInitialContextSetupFailure_noPDUSessionResourceFailedToSetupListCxtFail + } // End of group Receive } // End of group INITIAL_CONTEXT_SETUP_FAILURE @@ -1711,7 +1896,7 @@ module LibNGAP_Templates { template (value) InitiatingMessage m_n2_UEContextReleaseRequest( in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, - in template (value) PDUSessionResourceListCxtRelReq p_pDUSessionResourceListCxtRelReq + in template (value) Cause p_cause ) := { procedureCode := id_UEContextReleaseRequest, criticality := reject, @@ -1729,9 +1914,9 @@ module LibNGAP_Templates { value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } }, { - id := id_PDUSessionResourceListCxtRelReq, - criticality := reject, - value_ := { PDUSessionResourceListCxtRelReq := p_pDUSessionResourceListCxtRelReq } + id := id_Cause, + criticality := ignore, + value_ := { Cause := p_cause } } } } @@ -1854,13 +2039,39 @@ module LibNGAP_Templates { */ template (value) SuccessfulOutcome m_n2_UEContextReleaseComplete( in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, - in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, - in template (value) PDUSessionResourceSetupListSURes p_pDUSessionResourceSetupListSURes + in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID ) := { - procedureCode := id_InitialContextSetup, + procedureCode := id_UEContextRelease, criticality := reject, value_ := { - PDUSessionResourceSetupResponse := { + UEContextReleaseComplete := { + protocolIEs := { + { + id := id_AMF_UE_NGAP_ID, + criticality := reject, + value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } + }, + { + id := id_RAN_UE_NGAP_ID, + criticality := reject, + value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } + } + } + } + } + } // End of template m_n2_UEContextReleaseComplete + + /** + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.2.6 UE CONTEXT RELEASE COMPLETE + */ + template (value) SuccessfulOutcome m_n2_UEContextReleaseComplete_noPDUSessionResourceSetupListSURes( + in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, + in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID + ) := { + procedureCode := id_UEContextRelease, + criticality := reject, + value_ := { + UEContextReleaseComplete := { protocolIEs := { { id := id_AMF_UE_NGAP_ID, @@ -1871,16 +2082,11 @@ module LibNGAP_Templates { id := id_RAN_UE_NGAP_ID, criticality := reject, value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } - }, - { - id := id_PDUSessionResourceSetupListSURes, - criticality := reject, - value_ := { PDUSessionResourceSetupListSURes := p_pDUSessionResourceSetupListSURes } } } } } - } // End of template m_n2_UEContextReleaseComplete + } // End of template m_n2_UEContextReleaseComplete_noPDUSessionResourceSetupListSURes } // End of group Send @@ -1891,13 +2097,39 @@ module LibNGAP_Templates { */ template (present) SuccessfulOutcome mw_n2_UEContextReleaseComplete( template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, - template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, - template (present) PDUSessionResourceSetupListSURes p_pDUSessionResourceSetupListSURes := ? + template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ? ) := { - procedureCode := id_InitialContextSetup, + procedureCode := id_UEContextRelease, criticality := reject, value_ := { - PDUSessionResourceSetupResponse := { + UEContextReleaseComplete := { + protocolIEs := { + { + id := id_AMF_UE_NGAP_ID, + criticality := reject, + value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } + }, + { + id := id_RAN_UE_NGAP_ID, + criticality := reject, + value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } + } + } + } + } + } // End of template mw_n2_UEContextReleaseComplete + + /** + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.2.6 UE CONTEXT RELEASE COMPLETE + */ + template (present) SuccessfulOutcome mw_n2_UEContextReleaseComplete_noPDUSessionResourceSetupListSURes( + template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ? + ) := { + procedureCode := id_UEContextRelease, + criticality := reject, + value_ := { + UEContextReleaseComplete := { protocolIEs := { { id := id_AMF_UE_NGAP_ID, @@ -1908,16 +2140,11 @@ module LibNGAP_Templates { id := id_RAN_UE_NGAP_ID, criticality := reject, value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } - }, - { - id := id_PDUSessionResourceSetupListSURes, - criticality := reject, - value_ := { PDUSessionResourceSetupListSURes := p_pDUSessionResourceSetupListSURes } } } } } - } // End of template mw_n2_UEContextReleaseComplete + } // End of template mw_n2_UEContextReleaseComplete_noPDUSessionResourceSetupListSURes } // End of group Receive @@ -1980,14 +2207,14 @@ module LibNGAP_Templates { value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } }, { - id := id_SecurityKey, - criticality := reject, - value_ := { SecurityKey := p_nextHopNH } + id := id_SecurityKey, + criticality := reject, + value_ := { SecurityKey := p_nextHopNH } }, { - id := id_UESecurityCapabilities, - criticality := reject, - value_ := { UESecurityCapabilities := p_uESecurityCapabilities } + id := id_UESecurityCapabilities, + criticality := reject, + value_ := { UESecurityCapabilities := p_uESecurityCapabilities } } } } @@ -2002,14 +2229,14 @@ module LibNGAP_Templates { in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, in template (value) RANPagingPriority p_rANPagingPriority := 1, // RAN_Paging_Priority // TODO: do we need PIXIT here? in template (value) IndexToRFSP p_indexToRFSP := PX_Index_to_RAT_Frequency_Selection_Priority, - in template (value) UEAggregateMaximumBitRate p_uEAggregateMaximumBitRate, // UE_Aggregate_Maximum_Bit_Rate containing - in template (value) UESecurityCapabilities p_uESecurityCapabilities, // UE_Security_Capabilities containing - in template (value) EmergencyFallbackIndicator p_emergencyFallbackIndicator, // Emergency_Fallback_Indicator, - in template (value) GUAMI p_gUAMI, // New_GUAMI containing - in template (value) IAB_Authorized p_iAB_Authorized, // IAB_Authorized, - in template (value) PC5QoSParameters p_pC5QoSParameters, // PC5_QoS_Parameters containing - in template (value) UERadioCapabilityID p_uERadioCapabilityID := PX_U_E_RADIO_CAPABILITY_ID, // UE_Radio_Capability_ID, - in template (value) RGLevelWirelineAccessCharacteristics p_rGLevelWirelineAccessCharacteristics := '00'O // RG_Level_Wireline_Access_Characteristics // TODO: do we need a PIXIT here? + in template (value) UEAggregateMaximumBitRate p_uEAggregateMaximumBitRate, // UE_Aggregate_Maximum_Bit_Rate containing + in template (value) UESecurityCapabilities p_uESecurityCapabilities, // UE_Security_Capabilities containing + in template (value) EmergencyFallbackIndicator p_emergencyFallbackIndicator, // Emergency_Fallback_Indicator, + in template (value) GUAMI p_gUAMI, // New_GUAMI containing + in template (value) IAB_Authorized p_iAB_Authorized, // IAB_Authorized, + in template (value) PC5QoSParameters p_pC5QoSParameters, // PC5_QoS_Parameters containing + in template (value) UERadioCapabilityID p_uERadioCapabilityID := PX_U_E_RADIO_CAPABILITY_ID, // UE_Radio_Capability_ID, + in template (value) RGLevelWirelineAccessCharacteristics p_rGLevelWirelineAccessCharacteristics := '00'O // RG_Level_Wireline_Access_Characteristics // TODO: do we need a PIXIT here? ) := { procedureCode := id_UEContextModification, criticality := reject, @@ -2026,62 +2253,62 @@ module LibNGAP_Templates { criticality := reject, value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } }, - // in template (value) RANPagingPriority p_rANPagingPriority, // RAN_Paging_Priority - { + // in template (value) RANPagingPriority p_rANPagingPriority, // RAN_Paging_Priority + { id := id_RANPagingPriority, criticality := ignore, value_ := { RANPagingPriority := p_rANPagingPriority } }, // in template (value) IndexToRFSP p_indexToRFSP, // Index_to_RAT_Frequency_Selection_Priority, - { + { id := id_IndexToRFSP, criticality := ignore, value_ := { IndexToRFSP := p_indexToRFSP } }, - // in template (value) UEAggregateMaximumBitRate p_uEAggregateMaximumBitRate, // UE_Aggregate_Maximum_Bit_Rate containing - { + // in template (value) UEAggregateMaximumBitRate p_uEAggregateMaximumBitRate, // UE_Aggregate_Maximum_Bit_Rate containing + { id := id_UEAggregateMaximumBitRate, criticality := ignore, value_ := { UEAggregateMaximumBitRate := p_uEAggregateMaximumBitRate } }, - // in template (value) UESecurityCapabilities p_uESecurityCapabilities, // UE_Security_Capabilities containing - { + // in template (value) UESecurityCapabilities p_uESecurityCapabilities, // UE_Security_Capabilities containing + { id := id_UESecurityCapabilities, criticality := reject, value_ := { UESecurityCapabilities := p_uESecurityCapabilities } }, - // in template (value) EmergencyFallbackIndicator p_emergencyFallbackIndicator, // Emergency_Fallback_Indicator, - { + // in template (value) EmergencyFallbackIndicator p_emergencyFallbackIndicator, // Emergency_Fallback_Indicator, + { id := id_EmergencyFallbackIndicator, criticality := reject, value_ := { EmergencyFallbackIndicator := p_emergencyFallbackIndicator } }, - // in template (value) GUAMI p_gUAMI, // New_GUAMI containing - { + // in template (value) GUAMI p_gUAMI, // New_GUAMI containing + { id := id_GUAMI, criticality := reject, value_ := { GUAMI := p_gUAMI } }, - // in template (value) IAB_Authorized p_iAB_Authorized, // IAB_Authorized, - { + // in template (value) IAB_Authorized p_iAB_Authorized, // IAB_Authorized, + { id := id_IAB_Authorized, criticality := ignore, value_ := { IAB_Authorized := p_iAB_Authorized } }, - // in template (value) PC5QoSParameters p_pC5QoSParameters, // PC5_QoS_Parameters containing - { + // in template (value) PC5QoSParameters p_pC5QoSParameters, // PC5_QoS_Parameters containing + { id := id_PC5QoSParameters, criticality := ignore, value_ := { PC5QoSParameters := p_pC5QoSParameters } }, - // in template (value) UERadioCapabilityID p_uERadioCapabilityID := PX_U_E_RADIO_CAPABILITY_ID, // UE_Radio_Capability_ID, - { + // in template (value) UERadioCapabilityID p_uERadioCapabilityID := PX_U_E_RADIO_CAPABILITY_ID, // UE_Radio_Capability_ID, + { id := id_UERadioCapabilityID, criticality := reject, value_ := { UERadioCapabilityID := p_uERadioCapabilityID } }, - // in template (value) RGLevelWirelineAccessCharacteristics p_rGLevelWirelineAccessCharacteristics // RG_Level_Wireline_Access_Characteristics - { + // in template (value) RGLevelWirelineAccessCharacteristics p_rGLevelWirelineAccessCharacteristics // RG_Level_Wireline_Access_Characteristics + { id := id_RGLevelWirelineAccessCharacteristics, criticality := ignore, value_ := { RGLevelWirelineAccessCharacteristics := p_rGLevelWirelineAccessCharacteristics } @@ -3484,7 +3711,7 @@ module LibNGAP_Templates { in template (value) UESecurityCapabilities p_uESecurityCapabilities, in template (value) SecurityContext p_securityContext, in template (value) PDUSessionResourceSetupListHOReq p_pDUSessionResourceSetupListHOReq, - in template (value) AllowedNSSAI p_allowedNSSAI, + in template (value) NGAP_IEs.AllowedNSSAI p_allowedNSSAI, in template (value) SourceToTarget_TransparentContainer p_SourceToTarget_TransparentContainer, in template (value) GUAMI p_gUAMI ) := { @@ -3559,7 +3786,7 @@ module LibNGAP_Templates { in template (value) UESecurityCapabilities p_uESecurityCapabilities, in template (value) SecurityContext p_securityContext, in template (value) PDUSessionResourceSetupListHOReq p_pDUSessionResourceSetupListHOReq, - in template (value) AllowedNSSAI p_allowedNSSAI, + in template (value) NGAP_IEs.AllowedNSSAI p_allowedNSSAI, in template (value) SourceToTarget_TransparentContainer p_SourceToTarget_TransparentContainer, in template (value) GUAMI p_gUAMI, in template (value) CoreNetworkAssistanceInformationForInactive p_coreNetworkAssistanceInformationForInactive, @@ -3760,7 +3987,7 @@ module LibNGAP_Templates { template (present) UESecurityCapabilities p_uESecurityCapabilities := ?, template (present) SecurityContext p_securityContext := ?, template (present) PDUSessionResourceSetupListHOReq p_pDUSessionResourceSetupListHOReq := ?, - template (present) AllowedNSSAI p_allowedNSSAI := ?, + template (present) NGAP_IEs.AllowedNSSAI p_allowedNSSAI := ?, template (present) SourceToTarget_TransparentContainer p_SourceToTarget_TransparentContainer := ?, template (present) GUAMI p_gUAMI := ? ) := { @@ -3835,7 +4062,7 @@ module LibNGAP_Templates { template (present) UESecurityCapabilities p_uESecurityCapabilities := ?, template (present) SecurityContext p_securityContext := ?, template (present) PDUSessionResourceSetupListHOReq p_pDUSessionResourceSetupListHOReq := ?, - template (present) AllowedNSSAI p_allowedNSSAI := ?, + template (present) NGAP_IEs.AllowedNSSAI p_allowedNSSAI := ?, template (present) SourceToTarget_TransparentContainer p_SourceToTarget_TransparentContainer := ?, template (present) GUAMI p_gUAMI := ?, template (present) CoreNetworkAssistanceInformationForInactive p_coreNetworkAssistanceInformationForInactive := ?, @@ -5135,7 +5362,7 @@ module LibNGAP_Templates { in template (value) RRCEstablishmentCause p_rrcEstCause := PX_RRC_ESTABLISHMENT_CAUSE ) := { procedureCode := id_InitialUEMessage, - criticality := reject, + criticality := ignore, value_ := { InitialUEMessage := { protocolIEs := { @@ -5158,26 +5385,25 @@ module LibNGAP_Templates { id := id_RRCEstablishmentCause, criticality := ignore, value_ := { RRCEstablishmentCause := p_rrcEstCause } - }//, + }, /*{ id := NGAP_Constants.id_FiveG_S_TMSI, criticality := NGAP_CommonDataTypes.reject, Value := "NGAP_IEs.FiveG_S_TMSI", - presence := NGAP_CommonDataTypes.optional_ + UEContextRequest presence := NGAP_CommonDataTypes.optional_ }, { id := NGAP_Constants.id_AMFSetID, criticality := NGAP_CommonDataTypes.ignore, Value := "NGAP_IEs.AMFSetID", presence := NGAP_CommonDataTypes.optional_ - }, - { - id := NGAP_Constants.id_UEContextRequest, - criticality := NGAP_CommonDataTypes.ignore, - Value := "NGAP_IEs.UEContextRequest", - presence := NGAP_CommonDataTypes.optional_ - }, + },*/ { + id := NGAP_Constants.id_UEContextRequest, + criticality := ignore, + value_ := { UEContextRequest := requested} + }//, + /*{ id := NGAP_Constants.id_AllowedNSSAI, criticality := NGAP_CommonDataTypes.reject, Value := "NGAP_IEs.AllowedNSSAI", @@ -5252,7 +5478,7 @@ module LibNGAP_Templates { template (present) InitiatingMessage mw_n2_initialUeMessage_base_nas:= { procedureCode := id_InitialUEMessage, - criticality := ?, + criticality := ignore, value_ := { InitialUEMessage := { protocolIEs := {*, @@ -5271,13 +5497,14 @@ module LibNGAP_Templates { template (present) RAN_UE_NGAP_ID p_RANUeNgapID := ?, template (present) NAS_PDU p_nasPdu := ?, template (present) UserLocationInformation p_UeLocInf := ?, - template (present) RRCEstablishmentCause p_rrcEstCause := ? + template (present) RRCEstablishmentCause p_rrcEstCause := ?, + template (present) UEContextRequest p_uEContextRequest := ? ) := { procedureCode := id_InitialUEMessage, - criticality := reject, + criticality := ignore, value_ := { InitialUEMessage := { - protocolIEs := { + protocolIEs := {permutation( { id := id_RAN_UE_NGAP_ID, criticality := reject, @@ -5297,7 +5524,12 @@ module LibNGAP_Templates { id := id_RRCEstablishmentCause, criticality := ignore, value_ := { RRCEstablishmentCause := p_rrcEstCause } - } + }, + { + id := id_UEContextRequest, + criticality := ignore, + value_ := { UEContextRequest := p_uEContextRequest } + },*) } } } @@ -5356,14 +5588,14 @@ module LibNGAP_Templates { criticality := ?, value_ := { DownlinkNASTransport := { - protocolIEs := { + protocolIEs := {permutation( *, { id := id_NAS_PDU, criticality := ?, value_ := { NAS_PDU := ? } }, - * + *) } } } @@ -5378,7 +5610,7 @@ module LibNGAP_Templates { criticality := ignore, value_ := { DownlinkNASTransport := { - protocolIEs := { + protocolIEs := {permutation( { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -5393,7 +5625,7 @@ module LibNGAP_Templates { id := id_NAS_PDU, criticality := reject, value_ := { NAS_PDU := p_nasPdu } - } + }) } } } @@ -5739,11 +5971,11 @@ module LibNGAP_Templates { } // End of template m_n2_NGSetupRequest template (value) InitiatingMessage m_n2_NGSetupRequest_UERetentionInf( - in template (value) GlobalRANNodeID p_globalRANNodeID, - in template (value) SupportedTAList p_supportedTAs, - in template (value) PagingDRX p_pagingDRX := PX_PAGING_DRX, - in template (value) UERetentionInformation p_ueRetentionInf - ) := { + in template (value) GlobalRANNodeID p_globalRANNodeID, + in template (value) SupportedTAList p_supportedTAs, + in template (value) PagingDRX p_pagingDRX := PX_PAGING_DRX, + in template (value) UERetentionInformation p_ueRetentionInf + ) := { procedureCode := id_NGSetup, criticality := reject, value_ := { @@ -5774,13 +6006,53 @@ module LibNGAP_Templates { } } // End of template m_n2_NGSetupRequest_UERetentionInf - template (value) InitiatingMessage m_n2_NGSetupRequest_ExtRanNodeName( - in template (value) GlobalRANNodeID p_globalRANNodeID, - in template (value) SupportedTAList p_supportedTAs, - in template (value) PagingDRX p_pagingDRX := PX_PAGING_DRX, - in template (value) NB_IoT_DefaultPagingDRX p_nbIotDefPagDrx, - in template (value) Extended_RANNodeName p_extRanNodeName - ) := { + template (value) InitiatingMessage m_n2_NGSetupRequest_RanNodeName_ExtRanNodeName( + in template (value) GlobalRANNodeID p_globalRANNodeID, + in template (value) RANNodeName p_ranNodeName := PX_RAN_NODE_NAME, + in template (value) SupportedTAList p_supportedTAs, + in template (value) PagingDRX p_pagingDRX := PX_PAGING_DRX, + in template (value) Extended_RANNodeName p_extRanNodeName + ) := { + procedureCode := id_NGSetup, + criticality := reject, + value_ := { + NGSetupRequest := { + protocolIEs := { + { + id := id_GlobalRANNodeID, + criticality := reject, + value_ := { GlobalRANNodeID := p_globalRANNodeID } + }, + { + id := id_RANNodeName, + criticality := reject, + value_ := { RANNodeName := p_ranNodeName } + },{ + id := id_SupportedTAList, + criticality := reject, + value_ := { SupportedTAList := p_supportedTAs } + }, + { + id := id_DefaultPagingDRX, + criticality := ignore, + value_ := { PagingDRX := p_pagingDRX } + }, + { + id := id_Extended_RANNodeName, + criticality := ignore, + value_ := { Extended_RANNodeName := p_extRanNodeName } + } + } + } + } + } // End of template m_n2_NGSetupRequest_ExtRanNodeName + + template (value) InitiatingMessage m_n2_NGSetupRequest_RanNodeName( + in template (value) GlobalRANNodeID p_globalRANNodeID, + in template (value) RANNodeName p_ranNodeName := PX_RAN_NODE_NAME, + in template (value) SupportedTAList p_supportedTAs, + in template (value) PagingDRX p_pagingDRX := PX_PAGING_DRX + ) := { procedureCode := id_NGSetup, criticality := reject, value_ := { @@ -5792,6 +6064,10 @@ module LibNGAP_Templates { value_ := { GlobalRANNodeID := p_globalRANNodeID } }, { + id := id_RANNodeName, + criticality := reject, + value_ := { RANNodeName := p_ranNodeName } + },{ id := id_SupportedTAList, criticality := reject, value_ := { SupportedTAList := p_supportedTAs } @@ -5800,11 +6076,37 @@ module LibNGAP_Templates { id := id_DefaultPagingDRX, criticality := ignore, value_ := { PagingDRX := p_pagingDRX } + } + } + } + } + } // End of template m_n2_NGSetupRequest_RanNodeName + + template (value) InitiatingMessage m_n2_NGSetupRequest_ExtRanNodeName( + in template (value) GlobalRANNodeID p_globalRANNodeID, + in template (value) SupportedTAList p_supportedTAs, + in template (value) PagingDRX p_pagingDRX := PX_PAGING_DRX, + in template (value) Extended_RANNodeName p_extRanNodeName + ) := { + procedureCode := id_NGSetup, + criticality := reject, + value_ := { + NGSetupRequest := { + protocolIEs := { + { + id := id_GlobalRANNodeID, + criticality := reject, + value_ := { GlobalRANNodeID := p_globalRANNodeID } + }, + { + id := id_SupportedTAList, + criticality := reject, + value_ := { SupportedTAList := p_supportedTAs } }, { - id := id_NB_IoT_DefaultPagingDRX, + id := id_DefaultPagingDRX, criticality := ignore, - value_ := { NB_IoT_DefaultPagingDRX := p_nbIotDefPagDrx } + value_ := { PagingDRX := p_pagingDRX } }, { id := id_Extended_RANNodeName, @@ -5829,6 +6131,7 @@ module LibNGAP_Templates { template (present) InitiatingMessage mw_n2_NGSetupRequest( template (present) GlobalRANNodeID p_globalRANNodeID := ?, + template (present) RANNodeName p_rANNodeName := ?, template (present) SupportedTAList p_supportedTAs := ?, template (present) PagingDRX p_pagingDRX := ? ) := { @@ -5842,6 +6145,11 @@ module LibNGAP_Templates { criticality := reject, value_ := { GlobalRANNodeID := p_globalRANNodeID } }, + { + id := id_RANNodeName, + criticality := ignore, + value_ := { RANNodeName := p_rANNodeName } + }, { id := id_SupportedTAList, criticality := reject, @@ -5857,6 +6165,37 @@ module LibNGAP_Templates { } } // End of template mw_n2_NGSetupRequest + template (present) InitiatingMessage mw_n2_NGSetupRequest_noRANNodeName( + template (present) GlobalRANNodeID p_globalRANNodeID := ?, + template (present) SupportedTAList p_supportedTAs := ?, + template (present) PagingDRX p_pagingDRX := ? + ) := { + procedureCode := id_NGSetup, + criticality := reject, + value_ := { + NGSetupRequest := { + protocolIEs := {permutation( + { + id := id_GlobalRANNodeID, + criticality := reject, + value_ := { GlobalRANNodeID := p_globalRANNodeID } + }, + { + id := id_SupportedTAList, + criticality := reject, + value_ := { SupportedTAList := p_supportedTAs } + }, + { + id := id_DefaultPagingDRX, + criticality := ignore, + value_ := { PagingDRX := p_pagingDRX } + }, + *) + } + } + } + } // End of template mw_n2_NGSetupRequest + } // End of group Receive } // End of group NG_SETUP_REQUEST @@ -5950,12 +6289,12 @@ module LibNGAP_Templates { } // End of template mw_n2_NGSetupResponse template (present) SuccessfulOutcome mw_n2_NGSetupResponse_UERetentionInf( - template (present) AMFName p_amfName := ?, - template (present) ServedGUAMIList p_servedGUAMIList := ?, - template (present) RelativeAMFCapacity p_relativeAmfCap:= ?, - template (present) PLMNSupportList p_plmnSuppList := ?, - template (present) UERetentionInformation p_ueRetentionInf :=? - ) := { + template (present) AMFName p_amfName := ?, + template (present) ServedGUAMIList p_servedGUAMIList := ?, + template (present) RelativeAMFCapacity p_relativeAmfCap:= ?, + template (present) PLMNSupportList p_plmnSuppList := ?, + template (present) UERetentionInformation p_ueRetentionInf :=? + ) := { procedureCode := id_NGSetup, criticality := reject, value_ := { @@ -5992,12 +6331,12 @@ module LibNGAP_Templates { } // End of template mw_n2_NGSetupResponse_UERetentionInfo template (present) SuccessfulOutcome mw_n2_NGSetupResponse_ExtAmfName( - template (present) AMFName p_amfName := ?, - template (present) ServedGUAMIList p_servedGUAMIList := ?, - template (present) RelativeAMFCapacity p_relativeAmfCap:= ?, - template (present) PLMNSupportList p_plmnSuppList := ?, - template (present) Extended_AMFName p_extAmfName :=? - ) := { + template (present) AMFName p_amfName := ?, + template (present) ServedGUAMIList p_servedGUAMIList := ?, + template (present) RelativeAMFCapacity p_relativeAmfCap:= ?, + template (present) PLMNSupportList p_plmnSuppList := ?, + template (present) Extended_AMFName p_extAmfName :=? + ) := { procedureCode := id_NGSetup, criticality := reject, value_ := { @@ -6024,14 +6363,61 @@ module LibNGAP_Templates { value_ := { PLMNSupportList := p_plmnSuppList } }, { - id := id_Extended_AMFName, - criticality := ignore, - value_ := { Extended_AMFName := p_extAmfName } - } + id := id_Extended_AMFName, + criticality := ignore, + value_ := { Extended_AMFName := p_extAmfName } + } + } + } + } + } // End of template mw_n2_NGSetupResponse_ExtAmfName + + /** + * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.6.2 NG SETUP RESPONSE + */ + template (present) SuccessfulOutcome mw_n2_NGSetupResponse_iab( + template (present) AMFName p_amfName := ?, + template (present) ServedGUAMIList p_servedGUAMIList := ?, + template (present) RelativeAMFCapacity p_relativeAmfCap:= ?, + template (present) PLMNSupportList p_plmnSuppList := ?, + template (present) IAB_Supported p_iab_s:= ? + ) := { + procedureCode := id_NGSetup, + criticality := reject, + value_ := { + NGSetupResponse := { + protocolIEs := { + *, + { + id := id_AMFName, + criticality := reject, + value_ := { AMFName := p_amfName } + }, + { + id := id_ServedGUAMIList, + criticality := reject, + value_ := { ServedGUAMIList := (p_servedGUAMIList,*) } + }, + { + id := id_RelativeAMFCapacity, + criticality := ignore, + value_ := { RelativeAMFCapacity := p_relativeAmfCap } + }, + { + id := id_PLMNSupportList, + criticality := reject, + value_ := { PLMNSupportList := p_plmnSuppList } + }, + { + id := id_IAB_Supported, + criticality := reject, + value_ := { IAB_Supported := p_iab_s } + }, + * } } } - } // End of template mw_n2_NGSetupResponse_ExtAmfName + } // End of template mw_n2_NGSetupResponse_iab } // End of group Receive @@ -6088,7 +6474,7 @@ module LibNGAP_Templates { } } // End of template mw_n2_NGSetupFailure - } // End of group Receive + } // End of group Receive } // End of group NG_SETUP_FAILURE @@ -6266,11 +6652,13 @@ module LibNGAP_Templates { value_ := { RANConfigurationUpdateFailure := { protocolIEs := { + *, { id := id_Cause, criticality := ignore, value_ := { Cause := p_cause } - } + }, + * } } } @@ -6306,14 +6694,14 @@ module LibNGAP_Templates { } // End of template m_n2_AMFConfigurationUpdate template (value) InitiatingMessage m_n2_AMFConfigurationUpdate_tnl( - //in template (value) AMFName p_AMFName, - in template (value) ServedGUAMIList p_servedGUAMIList, - //in template (value) RelativeAMFCapacity p_relativeAMFCapacity, - in template (value) PLMNSupportList p_pLMNSupportList, - in template (value) AMF_TNLAssociationToAddList p_aMF_TNLAssociationToAddList, - //in template (value) AMF_TNLAssociationToRemoveList p_aMF_TNLAssociationToRemoveList, - in template (value) AMF_TNLAssociationToUpdateList p_aMF_TNLAssociationToUpdateList//, - //in template (value) Extended_AMFName p_extended_AMFName + //in template (value) AMFName p_AMFName, + in template (value) ServedGUAMIList p_servedGUAMIList, + //in template (value) RelativeAMFCapacity p_relativeAMFCapacity, + in template (value) PLMNSupportList p_pLMNSupportList, + in template (value) AMF_TNLAssociationToAddList p_aMF_TNLAssociationToAddList, + //in template (value) AMF_TNLAssociationToRemoveList p_aMF_TNLAssociationToRemoveList, + in template (value) AMF_TNLAssociationToUpdateList p_aMF_TNLAssociationToUpdateList//, + //in template (value) Extended_AMFName p_extended_AMFName ):={ procedureCode := id_AMFConfigurationUpdate, criticality := reject, @@ -6347,17 +6735,17 @@ module LibNGAP_Templates { //{ // id := id_AMF_TNLAssociationToRemoveList, // criticality := ignore, - // value_ := { AMF_TNLAssociationToRemoveList := p_aMF_TNLAssociationToRemoveList} + // value_ := { AMF_TNLAssociationToRemoveList := p_aMF_TNLAssociationToRemoveList} //}, { id := id_AMF_TNLAssociationToUpdateList, criticality := ignore, - value_ := { AMF_TNLAssociationToUpdateList := p_aMF_TNLAssociationToUpdateList} + value_ := { AMF_TNLAssociationToUpdateList := p_aMF_TNLAssociationToUpdateList} }//, //{ // id := id_Extended_AMFName, // criticality := ignore, - // value_ := { Extended_AMFName := p_extended_AMFName} + // value_ := { Extended_AMFName := p_extended_AMFName} //} } } @@ -6718,12 +7106,20 @@ module LibNGAP_Templates { /** * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.6.13 ERROR INDICATION */ - template (value) InitiatingMessage m_n2_ErrorIndication := { + template (value) InitiatingMessage m_n2_ErrorIndication( + in template (value) Cause p_cause + ) := { procedureCode := id_ErrorIndication, - criticality := reject, + criticality := ignore, value_ := { ErrorIndication := { - protocolIEs := { } + protocolIEs := { + { + id := id_Cause, + criticality := ignore, + value_ := { Cause := p_cause } + } + } } } } // End of template m_n2_ErrorIndication @@ -6737,7 +7133,7 @@ module LibNGAP_Templates { in template (value) Cause p_cause ) := { procedureCode := id_ErrorIndication, - criticality := reject, + criticality := ignore, value_ := { ErrorIndication := { protocolIEs := { @@ -6768,12 +7164,20 @@ module LibNGAP_Templates { /** * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.6.13 ERROR INDICATION */ - template (present) InitiatingMessage mw_n2_ErrorIndication := { + template (present) InitiatingMessage mw_n2_ErrorIndication( + template (present) Cause p_cause := ? + ) := { procedureCode := id_ErrorIndication, - criticality := reject, + criticality := ignore, value_ := { ErrorIndication := { - protocolIEs := { } + protocolIEs := { + { + id := id_Cause, + criticality := ignore, + value_ := { Cause := p_cause } + } + } } } } // End of template mw_n2_ErrorIndication @@ -6787,7 +7191,7 @@ module LibNGAP_Templates { template (present) Cause p_cause := ? ) := { procedureCode := id_ErrorIndication, - criticality := reject, + criticality := ignore, value_ := { ErrorIndication := { protocolIEs := { @@ -8232,8 +8636,8 @@ module LibNGAP_Templates { procedureCode := id_LocationReportingControl, criticality := ignore, value_ := { - LocationReportingControl := { - protocolIEs := { + LocationReportingControl := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8268,8 +8672,8 @@ module LibNGAP_Templates { procedureCode := id_LocationReportingControl, criticality := ignore, value_ := { - LocationReportingControl := { - protocolIEs := { + LocationReportingControl := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8307,8 +8711,8 @@ module LibNGAP_Templates { procedureCode := id_LocationReportingFailureIndication, criticality := ignore, value_ := { - LocationReportingFailureIndication := { - protocolIEs := { + LocationReportingFailureIndication := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8343,8 +8747,8 @@ module LibNGAP_Templates { procedureCode := id_LocationReportingFailureIndication, criticality := ignore, value_ := { - LocationReportingFailureIndication := { - protocolIEs := { + LocationReportingFailureIndication := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8383,8 +8787,8 @@ module LibNGAP_Templates { procedureCode := id_LocationReport, criticality := ignore, value_ := { - LocationReport := { - protocolIEs := { + LocationReport := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8423,8 +8827,8 @@ module LibNGAP_Templates { procedureCode := id_LocationReport, criticality := ignore, value_ := { - LocationReport := { - protocolIEs := { + LocationReport := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8470,8 +8874,8 @@ module LibNGAP_Templates { procedureCode := id_LocationReport, criticality := ignore, value_ := { - LocationReport := { - protocolIEs := { + LocationReport := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8510,8 +8914,8 @@ module LibNGAP_Templates { procedureCode := id_LocationReport, criticality := ignore, value_ := { - LocationReport := { - protocolIEs := { + LocationReport := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8562,8 +8966,8 @@ module LibNGAP_Templates { procedureCode := id_UETNLABindingRelease, criticality := ignore, value_ := { - UETNLABindingReleaseRequest := { - protocolIEs := { + UETNLABindingReleaseRequest := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8592,8 +8996,8 @@ module LibNGAP_Templates { procedureCode := id_UETNLABindingRelease, criticality := ignore, value_ := { - UETNLABindingReleaseRequest := { - protocolIEs := { + UETNLABindingReleaseRequest := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8631,8 +9035,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityInfoIndication, criticality := ignore, value_ := { - UERadioCapabilityInfoIndication := { - protocolIEs := { + UERadioCapabilityInfoIndication := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8666,8 +9070,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityInfoIndication, criticality := ignore, value_ := { - UERadioCapabilityInfoIndication := { - protocolIEs := { + UERadioCapabilityInfoIndication := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8712,8 +9116,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityInfoIndication, criticality := ignore, value_ := { - UERadioCapabilityInfoIndication := { - protocolIEs := { + UERadioCapabilityInfoIndication := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8747,8 +9151,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityInfoIndication, criticality := ignore, value_ := { - UERadioCapabilityInfoIndication := { - protocolIEs := { + UERadioCapabilityInfoIndication := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8795,8 +9199,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityCheck, criticality := ignore, value_ := { - UERadioCapabilityCheckRequest := { - protocolIEs := { + UERadioCapabilityCheckRequest := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8824,8 +9228,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityCheck, criticality := ignore, value_ := { - UERadioCapabilityCheckRequest := { - protocolIEs := { + UERadioCapabilityCheckRequest := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8864,8 +9268,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityCheck, criticality := ignore, value_ := { - UERadioCapabilityCheckRequest := { - protocolIEs := { + UERadioCapabilityCheckRequest := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8893,8 +9297,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityCheck, criticality := ignore, value_ := { - UERadioCapabilityCheckRequest := { - protocolIEs := { + UERadioCapabilityCheckRequest := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8937,8 +9341,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityCheck, criticality := ignore, value_ := { - UERadioCapabilityCheckResponse := { - protocolIEs := { + UERadioCapabilityCheckResponse := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -8971,8 +9375,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityCheck, criticality := ignore, value_ := { - UERadioCapabilityCheckResponse := { - protocolIEs := { + UERadioCapabilityCheckResponse := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -9012,8 +9416,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityCheck, criticality := ignore, value_ := { - UERadioCapabilityCheckResponse := { - protocolIEs := { + UERadioCapabilityCheckResponse := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -9046,8 +9450,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityCheck, criticality := ignore, value_ := { - UERadioCapabilityCheckResponse := { - protocolIEs := { + UERadioCapabilityCheckResponse := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := reject, @@ -9088,8 +9492,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityIDMapping, criticality := ignore, value_ := { - UERadioCapabilityIDMappingRequest := { - protocolIEs := { + UERadioCapabilityIDMappingRequest := { + protocolIEs := { { id := id_UERadioCapabilityID, criticality := reject, @@ -9112,8 +9516,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityIDMapping, criticality := ignore, value_ := { - UERadioCapabilityIDMappingRequest := { - protocolIEs := { + UERadioCapabilityIDMappingRequest := { + protocolIEs := { { id := id_UERadioCapabilityID, criticality := reject, @@ -9140,8 +9544,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityIDMapping, criticality := ignore, value_ := { - UERadioCapabilityIDMappingResponse := { - protocolIEs := { + UERadioCapabilityIDMappingResponse := { + protocolIEs := { { id := id_UERadioCapabilityID, criticality := reject, @@ -9168,8 +9572,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityIDMapping, criticality := ignore, value_ := { - UERadioCapabilityIDMappingResponse := { - protocolIEs := { + UERadioCapabilityIDMappingResponse := { + protocolIEs := { { id := id_UERadioCapabilityID, criticality := reject, @@ -9203,8 +9607,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityIDMapping, criticality := ignore, value_ := { - UERadioCapabilityIDMappingResponse := { - protocolIEs := { + UERadioCapabilityIDMappingResponse := { + protocolIEs := { { id := id_UERadioCapabilityID, criticality := reject, @@ -9231,8 +9635,8 @@ module LibNGAP_Templates { procedureCode := id_UERadioCapabilityIDMapping, criticality := ignore, value_ := { - UERadioCapabilityIDMappingResponse := { - protocolIEs := { + UERadioCapabilityIDMappingResponse := { + protocolIEs := { { id := id_UERadioCapabilityID, criticality := reject, @@ -9274,8 +9678,8 @@ module LibNGAP_Templates { procedureCode := id_SecondaryRATDataUsageReport, criticality := ignore, value_ := { - SecondaryRATDataUsageReport := { - protocolIEs := { + SecondaryRATDataUsageReport := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := ignore, @@ -9309,8 +9713,8 @@ module LibNGAP_Templates { procedureCode := id_SecondaryRATDataUsageReport, criticality := ignore, value_ := { - SecondaryRATDataUsageReport := { - protocolIEs := { + SecondaryRATDataUsageReport := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := ignore, @@ -9355,8 +9759,8 @@ module LibNGAP_Templates { procedureCode := id_SecondaryRATDataUsageReport, criticality := ignore, value_ := { - SecondaryRATDataUsageReport := { - protocolIEs := { + SecondaryRATDataUsageReport := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := ignore, @@ -9390,8 +9794,8 @@ module LibNGAP_Templates { procedureCode := id_SecondaryRATDataUsageReport, criticality := ignore, value_ := { - SecondaryRATDataUsageReport := { - protocolIEs := { + SecondaryRATDataUsageReport := { + protocolIEs := { { id := id_AMF_UE_NGAP_ID, criticality := ignore, @@ -9441,8 +9845,8 @@ module LibNGAP_Templates { procedureCode := id_UplinkRIMInformationTransfer, criticality := ignore, value_ := { - UplinkRIMInformationTransfer := { - protocolIEs := { + UplinkRIMInformationTransfer := { + protocolIEs := { { id := id_RIMInformationTransfer, criticality := ignore, @@ -9465,8 +9869,8 @@ module LibNGAP_Templates { procedureCode := id_UplinkRIMInformationTransfer, criticality := ignore, value_ := { - UplinkRIMInformationTransfer := { - protocolIEs := { + UplinkRIMInformationTransfer := { + protocolIEs := { { id := id_RIMInformationTransfer, criticality := ignore, @@ -9492,8 +9896,8 @@ module LibNGAP_Templates { procedureCode := id_DownlinkRIMInformationTransfer, criticality := ignore, value_ := { - DownlinkRIMInformationTransfer := { - protocolIEs := { + DownlinkRIMInformationTransfer := { + protocolIEs := { { id := id_RIMInformationTransfer, criticality := ignore, @@ -9516,8 +9920,8 @@ module LibNGAP_Templates { procedureCode := id_DownlinkRIMInformationTransfer, criticality := ignore, value_ := { - DownlinkRIMInformationTransfer := { - protocolIEs := { + DownlinkRIMInformationTransfer := { + protocolIEs := { { id := id_RIMInformationTransfer, criticality := ignore, @@ -9578,7 +9982,7 @@ module LibNGAP_Templates { in template (value) S_NSSAI p_s_NSSAI, in template (omit) AllowedNSSAI_Item.iE_Extensions p_iE_Extensions := omit ) := { - s_NSSAI := p_s_NSSAI, + s_NSSAI := p_s_NSSAI, iE_Extensions := p_iE_Extensions } // End of template m_allowedNSSAI_Item @@ -10039,7 +10443,7 @@ module LibNGAP_Templates { ) := p_list; template (omit) BroadcastPLMNItem m_ie_broadcastPLMNItem( - in template (value) PLMNIdentity p_plmnId := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_plmnId := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) SliceSupportList p_ssl, in template (omit) BroadcastPLMNItem.iE_Extensions p_iE_Extensions := omit ) := { @@ -10083,7 +10487,7 @@ module LibNGAP_Templates { } // End of template m_cancelledCellsInEAI_EUTRA_Item template (omit) CancelledCellsInEAI_NR_Item m_cancelledCellsInEAI_NR_Item( - in template (value) NR_CGI p_nR_CGI, + in template (value) NGAP_IEs.NR_CGI p_nR_CGI, in template (value) NumberOfBroadcasts p_numberOfBroadcasts, in template (omit) CancelledCellsInEAI_NR_Item.iE_Extensions p_iE_Extensions := omit ) := { @@ -10103,7 +10507,7 @@ module LibNGAP_Templates { } // End of template m_cancelledCellsInTAI_EUTRA_Item template (omit) CancelledCellsInTAI_NR_Item m_CancelledCellsInTAI_NR_Item( - in template (value) NR_CGI p_nR_CGI, + in template (value) NGAP_IEs.NR_CGI p_nR_CGI, in template (value) NumberOfBroadcasts p_numberOfBroadcasts, in template (omit) CancelledCellsInTAI_NR_Item.iE_Extensions p_iE_Extensions := omit ) := { @@ -10139,7 +10543,7 @@ module LibNGAP_Templates { } // End of template m_candidateCell_ext template (omit) CandidateCellID m_candidateCellID( - in template (value) NR_CGI p_candidateCellID, + in template (value) NGAP_IEs.NR_CGI p_candidateCellID, in template (omit) CandidateCellID.iE_Extensions p_iE_Extensions := omit ) := { candidateCellID := p_candidateCellID, @@ -10163,14 +10567,14 @@ module LibNGAP_Templates { } // End of template m_cause_radioNetwork template (value) Cause m_cause_transport( - in template (value) CauseTransport p_transport - ) := { + in template (value) CauseTransport p_transport + ) := { transport := p_transport } // End of template m_cause_transport template (value) Cause m_cause_nas( - in template (value) CauseNas p_nas - ) := { + in template (value) CauseNas p_nas + ) := { nas := p_nas } // End of template m_cause_nas @@ -10217,7 +10621,7 @@ module LibNGAP_Templates { } // End of template m_cellIDBroadcastEUTRA_Item template (omit) CellIDBroadcastNR_Item m_cellIDBroadcastNR_Item( - in template (value) NR_CGI p_nR_CGI, + in template (value) NGAP_IEs.NR_CGI p_nR_CGI, in template (omit) CellIDBroadcastNR_Item.iE_Extensions p_iE_Extensions := omit ) := { nR_CGI := p_nR_CGI, @@ -10235,7 +10639,7 @@ module LibNGAP_Templates { } // End of template m_cellIDCancelledEUTRA_Item template (omit) CellIDCancelledNR_Item m_cellIDCancelledNR_Item( - in template (value) NR_CGI p_nR_CGI, + in template (value) NGAP_IEs.NR_CGI p_nR_CGI, in template (value) NumberOfBroadcasts p_numberOfBroadcasts, in template (omit) CellIDCancelledNR_Item.iE_Extensions p_iE_Extensions := omit ) := { @@ -10304,7 +10708,7 @@ module LibNGAP_Templates { } // End of template m_completedCellsInEAI_EUTRA_Item template (omit) CompletedCellsInEAI_NR_Item m_completedCellsInEAI_NR_Item( - in template (value) NR_CGI p_nR_CGI, + in template (value) NGAP_IEs.NR_CGI p_nR_CGI, in template (omit) CompletedCellsInEAI_NR_Item.iE_Extensions p_iE_Extensions := omit ) := { nR_CGI := p_nR_CGI, @@ -10320,7 +10724,7 @@ module LibNGAP_Templates { } // End of template m_completedCellsInTAI_EUTRA_Item template (omit) CompletedCellsInTAI_NR_Item m_completedCellsInTAI_NR_Item( - in template (value) NR_CGI p_nR_CGI, + in template (value) NGAP_IEs.NR_CGI p_nR_CGI, in template (omit) CompletedCellsInTAI_NR_Item.iE_Extensions p_iE_Extensions := omit ) := { nR_CGI := p_nR_CGI, @@ -10844,7 +11248,7 @@ module LibNGAP_Templates { template (value) EndIndication m_endIndication(in EndIndication p_value := no_further_data) := p_value; template (omit) EPS_TAI m_ePS_TAI( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) EPS_TAC p_ePS_TAC := PX_EPS_TAC, in template (omit) EPS_TAI.iE_Extensions p_iE_Extensions := omit ) := { @@ -10900,7 +11304,7 @@ module LibNGAP_Templates { } // End of template m_e_RABInformationItem_full template (omit) EUTRA_CGI m_uUTRA_CGI( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) EUTRACellIdentity p_eUTRACellIdentity := PX_EUTRA_CELL_IDENTITY, in template (omit) EUTRA_CGI.iE_Extensions p_iE_Extensions := omit ) := { @@ -11134,7 +11538,7 @@ module LibNGAP_Templates { } // End of template m_fiveG_S_TMSI template (omit) ForbiddenAreaInformation_Item m_forbiddenAreaInformation_Item( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) ForbiddenTACs p_forbiddenTACs, in template (omit) ForbiddenAreaInformation_Item.iE_Extensions p_iE_Extensions := omit ) := { @@ -11204,7 +11608,7 @@ module LibNGAP_Templates { } // End of template m_globalCable_ID_new template (omit) GlobalGNB_ID m_ie_globalGnbId( - in template (value) PLMNIdentity p_plmnId := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_plmnId := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) bitstring p_gnbId := PX_GNB_ID, in template (omit) GlobalGNB_ID.iE_Extensions p_iE_Extensions := omit ) := { @@ -11214,7 +11618,7 @@ module LibNGAP_Templates { } // End of template m_ie_globalGnbId template (omit) GlobalN3IWF_ID m_globalN3IWF_ID( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) N3IWF_ID p_n3IWF_ID, in template (omit) GlobalN3IWF_ID.iE_Extensions p_iE_Extensions := omit ) := { @@ -11242,7 +11646,7 @@ module LibNGAP_Templates { } // End of template m_globalLine_ID_id_TAI template (omit) GlobalNgENB_ID m_globalNgENB_ID( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) NgENB_ID p_ngENB_ID, in template (omit) GlobalNgENB_ID.iE_Extensions p_iE_Extensions := omit ) := { @@ -11322,7 +11726,7 @@ module LibNGAP_Templates { // } // End of template m_globalRANNodeID_all template (omit) GlobalTNGF_ID m_globalTNGF_ID( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) TNGF_ID p_tNGF_ID, in template (omit) GlobalTNGF_ID.iE_Extensions p_iE_Extensions := omit ) := { @@ -11332,7 +11736,7 @@ module LibNGAP_Templates { } // End of template m_globalTNGF_ID template (omit) GlobalTWIF_ID m_globalTWIF_ID( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) TWIF_ID p_tWIF_ID, in template (omit) GlobalTWIF_ID.iE_Extensions p_iE_Extensions := omit ) := { @@ -11342,7 +11746,7 @@ module LibNGAP_Templates { } // End of template m_globalTWIF_ID template (omit) GlobalW_AGF_ID m_GlobalW_AGF_ID( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) W_AGF_ID p_w_AGF_ID, in template (omit) GlobalW_AGF_ID.iE_Extensions p_iE_Extensions := omit ) := { @@ -11374,7 +11778,7 @@ module LibNGAP_Templates { } // End of template m_gTPTunnel template (omit) GUAMI m_gUAMI( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) AMFRegionID p_aMFRegionID := PX_AMF_REGION_ID, in template (value) AMFSetID p_aMFSetID := PX_AMF_SET_ID, in template (value) AMFPointer p_aMFPointer := PX_AMF_POINTER, @@ -12348,36 +12752,36 @@ module LibNGAP_Templates { } // End of template m_mRB_ProgressInformation_pDCP_SN_Length18 template (value) MRB_ProgressInformation m_mRB_ProgressInformation_choice_Extensions( - in template (value) MRB_ProgressInformation.choice_Extensions p_choice_Extensions - ) := { + in template (value) MRB_ProgressInformation.choice_Extensions p_choice_Extensions + ) := { choice_Extensions := p_choice_Extensions } // End of template m_mRB_ProgressInformation_choice_Extensions template (omit) MBS_QoSFlowsToBeSetupItem m_mBS_QoSFlowsToBeSetupItem( - in template (value)QosFlowIdentifier p_mBSqosFlowIdentifier, - in template (value)QosFlowLevelQosParameters p_mBSqosFlowLevelQosParameters, - in template (omit) MBS_QoSFlowsToBeSetupItem.iE_Extensions p_iE_Extensions := omit - ) := { + in template (value)QosFlowIdentifier p_mBSqosFlowIdentifier, + in template (value)QosFlowLevelQosParameters p_mBSqosFlowLevelQosParameters, + in template (omit) MBS_QoSFlowsToBeSetupItem.iE_Extensions p_iE_Extensions := omit + ) := { mBSqosFlowIdentifier := p_mBSqosFlowIdentifier, mBSqosFlowLevelQosParameters := p_mBSqosFlowLevelQosParameters, iE_Extensions := p_iE_Extensions } // End of template m_mBS_QoSFlowsToBeSetupItem - template (value) MBS_ServiceArea m_mBS_ServiceArea_locationindependent( - in template (value) MBS_ServiceAreaInformation p_locationindependent - ) := { + template (value) NGAP_IEs.MBS_ServiceArea m_mBS_ServiceArea_locationindependent( + in template (value) MBS_ServiceAreaInformation p_locationindependent + ) := { locationindependent := p_locationindependent } // End of template m_mBS_ServiceArea_locationindependent - template (value) MBS_ServiceArea m_mBS_ServiceArea_locationdependent( - in template (value) MBS_ServiceAreaInformationList p_locationdependent - ) := { + template (value) NGAP_IEs.MBS_ServiceArea m_mBS_ServiceArea_locationdependent( + in template (value) MBS_ServiceAreaInformationList p_locationdependent + ) := { locationdependent := p_locationdependent } // End of template m_mBS_ServiceArea_locationdependent - template (value) MBS_ServiceArea m_mBS_ServiceArea_choice_Extensions( - in template (value) MBS_ServiceArea.choice_Extensions p_choice_Extensions - ) := { + template (value) NGAP_IEs.MBS_ServiceArea m_mBS_ServiceArea_choice_Extensions( + in template (value) NGAP_IEs.MBS_ServiceArea.choice_Extensions p_choice_Extensions + ) := { choice_Extensions := p_choice_Extensions } // End of template m_mBS_ServiceArea_choice_Extensions @@ -12402,10 +12806,10 @@ module LibNGAP_Templates { } // End of template m_mBS_ServiceAreaInformation template (omit) MBS_SessionID m_mBS_SessionID( - in template (value) TMGI p_tMGI, - in template (omit) NID p_nID := omit, - in template (omit) MBS_SessionID.iE_Extensions p_iE_Extensions := omit - ) := { + in template (value) TMGI p_tMGI, + in template (omit) NGAP_IEs.NID p_nID := omit, + in template (omit) MBS_SessionID.iE_Extensions p_iE_Extensions := omit + ) := { tMGI := p_tMGI, nID := p_nID, iE_Extensions := p_iE_Extensions @@ -12427,7 +12831,7 @@ module LibNGAP_Templates { in template (value) MBS_SessionID p_mBS_SessionID, in template (value) MBS_QoSFlowsToBeSetupList p_mBS_QoSFlowsToBeSetupList, in template (omit) MBS_AreaSessionID p_mBS_AreaSessionID := omit, - in template (omit) MBS_ServiceArea p_mBS_ServiceArea := omit, + in template (omit) NGAP_IEs.MBS_ServiceArea p_mBS_ServiceArea := omit, in template (omit) MBS_MappingandDataForwardingRequestList p_mBS_MappingandDataForwardingRequestList := omit, in template (omit) MBS_ActiveSessionInformation_SourcetoTargetItem.iE_Extensions p_iE_Extensions := omit ):= { @@ -12605,7 +13009,7 @@ module LibNGAP_Templates { in template (value) MBSSessionStatus p_mBSSessionStatus, in template (omit) MBS_AreaSessionID p_mBS_AreaSessionID := omit, in template (omit) MBS_SessionTNLInfo5GCItem p_sharedNGU_MulticastTNLInformation := omit, - in template (omit) MBS_ServiceArea p_mBS_ServiceArea := omit, + in template (omit) NGAP_IEs.MBS_ServiceArea p_mBS_ServiceArea := omit, in template (omit) MBS_DistributionSetupResponseTransfer.iE_Extensions p_iE_Extensions := omit ) := { mBS_SessionID := p_mBS_SessionID, @@ -12832,7 +13236,7 @@ module LibNGAP_Templates { } // End of template m_multicastSessionUpdateRequestTransfer_id_MBS_SessionID template (value) MulticastSessionUpdateRequestTransfer.protocolIEs m_multicastSessionUpdateRequestTransfer_id_MBS_ServiceArea( - in template (value) MBS_ServiceArea p_mBS_ServiceArea + in template (value) NGAP_IEs.MBS_ServiceArea p_mBS_ServiceArea ) := { { id := id_MBS_ServiceArea, @@ -13182,7 +13586,7 @@ module LibNGAP_Templates { template (value) NotifySourceNGRANNode m_notifySourceNGRANNode(in NotifySourceNGRANNode p_value := notifySource) := p_value; template (value) NGRAN_CGI m_ngENB_ID_nR_CGI( - in template (value) NR_CGI p_nR_CGI + in template (value) NGAP_IEs.NR_CGI p_nR_CGI ) := { nR_CGI := p_nR_CGI } // End of template m_ngENB_ID_nR_CGI @@ -13289,8 +13693,8 @@ module LibNGAP_Templates { choice_Extensions := p_choice_Extensions } // End of template m_nPN_PagingAssistanceInformation_choice_Extensions - template (value) NPN_Support m_nPN_Support_sNPN( - in template (value) NID p_sNPN + template (value) NPN_Support m_nPN_Support_sNPN( + in template (value) NGAP_IEs.NID p_sNPN ) := { sNPN := p_sNPN } // End of template m_nPN_Support_sNPN @@ -13301,11 +13705,11 @@ module LibNGAP_Templates { choice_Extensions := p_choice_Extensions } // End of template m_nPN_Support_choice_Extensions - template (omit) NR_CGI m_nR_CGI( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, - in template (value) NRCellIdentity p_nRCellIdentity := PX_NR_CELL_IDENTITY, - in template (omit) NR_CGI.iE_Extensions p_iE_Extensions := omit - ) := { + template (omit) NGAP_IEs.NR_CGI m_nR_CGI( + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + in template (value) NRCellIdentity p_nRCellIdentity := PX_NR_CELL_IDENTITY, + in template (omit) NGAP_IEs.NR_CGI.iE_Extensions p_iE_Extensions := omit + ) := { pLMNIdentity := p_pLMNIdentity, nRCellIdentity := p_nRCellIdentity, iE_Extensions := p_iE_Extensions @@ -14588,8 +14992,8 @@ module LibNGAP_Templates { } // End of template m_pDUSessionResourceSetupRequestTransfer_id_RedundantPDUSessionInformation template (value) PDUSessionResourceSetupRequestTransfer.protocolIEs m_pDUSessionResourceSetupRequestTransfer_id_MBSSessionSetupRequestList( - in template (value) MBSSessionSetupRequestList p_mBSSessionSetupRequestList - ) := { + in template (value) MBSSessionSetupRequestList p_mBSSessionSetupRequestList + ) := { { id := id_MBSSessionSetupRequestList, criticality := ignore, @@ -14598,12 +15002,12 @@ module LibNGAP_Templates { } // End of template m_pDUSessionResourceSetupRequestTransfer_id_MBSSessionSetupRequestList template (omit) PDUSessionResourceSetupResponseTransfer m_pDUSessionResourceSetupResponseTransfer( - in template (value) QosFlowPerTNLInformation p_dLQosFlowPerTNLInformation, - in template (omit) QosFlowPerTNLInformationList p_additionalDLQosFlowPerTNLInformation := omit, - in template (omit) SecurityResult p_securityResult := omit, - in template (omit) QosFlowListWithCause p_qosFlowFailedToSetupList := omit, - in template (omit) PDUSessionResourceSetupResponseTransfer.iE_Extensions p_iE_Extensions := omit - ) := { + in template (value) QosFlowPerTNLInformation p_dLQosFlowPerTNLInformation, + in template (omit) QosFlowPerTNLInformationList p_additionalDLQosFlowPerTNLInformation := omit, + in template (omit) SecurityResult p_securityResult := omit, + in template (omit) QosFlowListWithCause p_qosFlowFailedToSetupList := omit, + in template (omit) PDUSessionResourceSetupResponseTransfer.iE_Extensions p_iE_Extensions := omit + ) := { dLQosFlowPerTNLInformation := p_dLQosFlowPerTNLInformation, additionalDLQosFlowPerTNLInformation := p_additionalDLQosFlowPerTNLInformation, securityResult := p_securityResult, @@ -14780,7 +15184,7 @@ module LibNGAP_Templates { } // End of template m_pLMNAreaBasedQMC template (omit) PLMNSupportItem m_pLMNSupportItem( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) SliceSupportList p_sliceSupportList, in template (omit) PLMNSupportItem.iE_Extensions p_iE_Extensions := omit ) := { @@ -14866,8 +15270,8 @@ module LibNGAP_Templates { } // End of template m_qMCDeactivation template (value) QosCharacteristics m_qosCharacteristics_nonDynamic5QI( - in template (value) NonDynamic5QIDescriptor p_nonDynamic5QI - ) := { + in template (value) NonDynamic5QIDescriptor p_nonDynamic5QI + ) := { nonDynamic5QI := p_nonDynamic5QI } // End of template m_qosCharacteristics_nonDynamic5QI @@ -14878,8 +15282,8 @@ module LibNGAP_Templates { } // End of template m_qosCharacteristics_dynamic5QI template (value) QosCharacteristics m_qosCharacteristics_choice_Extensions( - in template (value) QosCharacteristics.choice_Extensions p_choice_Extensions - ) := { + in template (value) QosCharacteristics.choice_Extensions p_choice_Extensions + ) := { choice_Extensions := p_choice_Extensions } // End of template m_qosCharacteristics_choice_Extensions @@ -15272,7 +15676,7 @@ module LibNGAP_Templates { template (value) RAT_Information m_rAT_Information(in RAT_Information p_value := unlicensed) := p_value; template (omit) RATRestrictions_Item m_rATRestrictions_Item( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) RATRestrictionInformation p_rATRestrictionInformation, in template (omit) RATRestrictions_Item.iE_Extensions p_iE_Extensions := omit ) := { @@ -15330,7 +15734,7 @@ module LibNGAP_Templates { template (value) RedirectionVoiceFallback m_redirectionVoiceFallback(in RedirectionVoiceFallback p_value := possible) := p_value; template (omit) RedundantPDUSessionInformation m_redundantPDUSessionInformation( - in template (value) RSN p_rSN, + in template (value) NGAP_IEs.RSN p_rSN, in template (omit) RedundantPDUSessionInformation.iE_Extensions p_iE_Extensions := omit ) := { rSN := p_rSN, @@ -15338,8 +15742,8 @@ module LibNGAP_Templates { } // End of template m_redundantPDUSessionInformation template (value) RedundantPDUSessionInformation.iE_Extensions m_redundantPDUSessionInformation_id_PDUSessionPairID( - in template (value) PDUSessionPairID p_pDUSessionPairID - ) := { + in template (value) PDUSessionPairID p_pDUSessionPairID + ) := { { id := id_PDUSessionPairID, criticality := ignore, @@ -15368,8 +15772,8 @@ module LibNGAP_Templates { } // End of template m_resetType_nG_Interface template (value) ResetType m_resetType_partOfNG_Interface( - in template (value) UE_associatedLogicalNG_connectionList p_partOfNG_Interface - ) := { + in template (value) UE_associatedLogicalNG_connectionList p_partOfNG_Interface + ) := { partOfNG_Interface := p_partOfNG_Interface } // End of template m_resetType_partOfNG_Interface @@ -15385,7 +15789,7 @@ module LibNGAP_Templates { template (value) RRCState m_rRCState(in RRCState p_value := inactive) := p_value; - template (value) RSN m_rSN(in RSN p_value := v1) := p_value; + template (value) NGAP_IEs.RSN m_rSN(in NGAP_IEs.RSN p_value := v1) := p_value; template (omit) RIMInformationTransfer m_rIMInformationTransfer( in template (value) TargetRANNodeID_RIM p_targetRANNodeID_RIM, @@ -15432,18 +15836,18 @@ module LibNGAP_Templates { } // End of template m_secondaryRATUsageInformation template (omit) SecondaryRATDataUsageReportTransfer m_secondaryRATDataUsageReportTransfer( - in template (omit) SecondaryRATUsageInformation p_secondaryRATUsageInformation := omit, - in template (omit) SecondaryRATDataUsageReportTransfer.iE_Extensions p_iE_Extensions := omit - ) := { + in template (omit) SecondaryRATUsageInformation p_secondaryRATUsageInformation := omit, + in template (omit) SecondaryRATDataUsageReportTransfer.iE_Extensions p_iE_Extensions := omit + ) := { secondaryRATUsageInformation := p_secondaryRATUsageInformation, iE_Extensions := p_iE_Extensions } // End of template m_secondaryRATDataUsageReportTransfer template (omit) SecurityContext m_securityContext( - in template (value) NextHopChainingCount p_nextHopChainingCount := PX_NEXT_HOP_CHAINING_COUNT, - in template (value) SecurityKey p_nextHopNH := PX_NEXT_HOP_NH, - in template (omit) SecurityContext.iE_Extensions p_iE_Extensions := omit - ) := { + in template (value) NextHopChainingCount p_nextHopChainingCount := PX_NEXT_HOP_CHAINING_COUNT, + in template (value) SecurityKey p_nextHopNH := PX_NEXT_HOP_NH, + in template (omit) SecurityContext.iE_Extensions p_iE_Extensions := omit + ) := { nextHopChainingCount := p_nextHopChainingCount, nextHopNH := p_nextHopNH, iE_Extensions := p_iE_Extensions @@ -15547,7 +15951,7 @@ module LibNGAP_Templates { } // End of template m_servedGUAMIItem_id_GUAMIType template (omit) ServiceAreaInformation_Item m_serviceAreaInformation_Item( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (omit) AllowedTACs p_allowedTACs := omit, in template (omit) NotAllowedTACs p_notAllowedTACs := omit, in template (omit) ServiceAreaInformation_Item.iE_Extensions p_iE_Extensions := omit @@ -15597,7 +16001,7 @@ module LibNGAP_Templates { } // End of template m_sliceSupportQMC_Item template (omit) SNPN_MobilityInformation m_sNPN_MobilityInformation( - in template (value) NID p_serving_NID, + in template (value) NGAP_IEs.NID p_serving_NID, in template (omit) SNPN_MobilityInformation.iE_Extensions p_iE_Extensions := omit ) := { serving_NID := p_serving_NID, @@ -15884,7 +16288,7 @@ module LibNGAP_Templates { template (value) Suspend_Response_Indication m_suspend_Response_Indication(in Suspend_Response_Indication p_value := suspend_indicated) := p_value; template (omit) TAI m_tAI( - in template (value) PLMNIdentity p_pLMNIdentity := PX_PLMN_IDENTITY, + in template (value) PLMNIdentity p_pLMNIdentity := fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), in template (value) TAC p_tAC := PX_TACode, in template (omit) TAI.iE_Extensions p_iE_Extensions := omit ) := { @@ -16130,7 +16534,7 @@ module LibNGAP_Templates { } // End of template m_targetRANNodeID_SON template (value) TargetRANNodeID_SON.iE_Extensions m_targetRANNodeID_SON_id_NR_CGI( - in template (value) NR_CGI p_nR_CGI + in template (value) NGAP_IEs.NR_CGI p_nR_CGI ) := { { id := id_NR_CGI, @@ -16217,8 +16621,8 @@ module LibNGAP_Templates { } // End of template m_traceActivation template (value) TraceActivation.iE_Extensions m_traceActivation_id_MDTConfiguration( - in template (value) MDT_Configuration p_mDT_Configuration - ) := { + in template (value) MDT_Configuration p_mDT_Configuration + ) := { { id := id_MDTConfiguration, criticality := ignore, @@ -16227,8 +16631,8 @@ module LibNGAP_Templates { } // End of template m_traceActivation_id_MDTConfiguration template (value) TraceActivation.iE_Extensions m_traceActivation_id_TraceCollectionEntityURI( - in template (value) URI_address p_uRI_address - ) := { + in template (value) URI_address p_uRI_address + ) := { { id := id_TraceCollectionEntityURI, criticality := ignore, @@ -16377,10 +16781,10 @@ module LibNGAP_Templates { } // End of template m_uEAppLayerMeasConfigInfo template (omit) UE_associatedLogicalNG_connectionItem m_uE_associatedLogicalNG_connectionItem( - in template (omit) AMF_UE_NGAP_ID p_aMF_UE_NGAP_ID := omit, - in template (omit) RAN_UE_NGAP_ID p_rAN_UE_NGAP_ID := omit, - in template (omit) UE_associatedLogicalNG_connectionItem.iE_Extensions p_iE_Extensions := omit - ) := { + in template (omit) AMF_UE_NGAP_ID p_aMF_UE_NGAP_ID := PX_AMF_UE_NGAP_ID, + in template (omit) RAN_UE_NGAP_ID p_rAN_UE_NGAP_ID := PX_RAN_UE_NGAP_ID, + in template (omit) UE_associatedLogicalNG_connectionItem.iE_Extensions p_iE_Extensions := omit + ) := { aMF_UE_NGAP_ID := p_aMF_UE_NGAP_ID, rAN_UE_NGAP_ID := p_rAN_UE_NGAP_ID, iE_Extensions := p_iE_Extensions @@ -16445,40 +16849,40 @@ module LibNGAP_Templates { } // End of template m_uEHistoryInformationFromTheUE_choice_Extensions template (value) UEIdentityIndexValue m_uEIdentityIndexValue_indexLength10( - in template (value) UEIdentityIndexValue.indexLength10 p_indexLength10 - ) := { + in template (value) UEIdentityIndexValue.indexLength10 p_indexLength10 + ) := { indexLength10 := p_indexLength10 } // End of template m_uEIdentityIndexValue_indexLength10 template (value) UEIdentityIndexValue m_uEIdentityIndexValue_choice_Extensions( - in template (value) UEIdentityIndexValue.choice_Extensions p_choice_Extensions - ) := { + in template (value) UEIdentityIndexValue.choice_Extensions p_choice_Extensions + ) := { choice_Extensions := p_choice_Extensions } // End of template m_uEIdentityIndexValue_choice_Extensions template (value) UE_NGAP_IDs m_uE_NGAP_IDs_uE_NGAP_ID_pair( - in template (value) UE_NGAP_ID_pair p_uE_NGAP_ID_pair - ) := { + in template (value) UE_NGAP_ID_pair p_uE_NGAP_ID_pair + ) := { uE_NGAP_ID_pair := p_uE_NGAP_ID_pair } // End of template m_uE_NGAP_IDs_uE_NGAP_ID_pair template (value) UE_NGAP_IDs m_uE_NGAP_IDs_aMF_UE_NGAP_ID( - in template (value) AMF_UE_NGAP_ID p_aMF_UE_NGAP_ID := PX_AMF_UE_NGAP_ID - ) := { + in template (value) AMF_UE_NGAP_ID p_aMF_UE_NGAP_ID := PX_AMF_UE_NGAP_ID + ) := { aMF_UE_NGAP_ID := p_aMF_UE_NGAP_ID } // End of template m_uE_NGAP_IDs_aMF_UE_NGAP_ID template (value) UE_NGAP_IDs m_uE_NGAP_IDs_choice_Extensions( - in template (value) UE_NGAP_IDs.choice_Extensions p_choice_Extensions - ) := { + in template (value) UE_NGAP_IDs.choice_Extensions p_choice_Extensions + ) := { choice_Extensions := p_choice_Extensions } // End of template m_uE_NGAP_IDs_choice_Extensions template (omit) UE_NGAP_ID_pair m_uE_NGAP_ID_pair( - in template (value) AMF_UE_NGAP_ID p_aMF_UE_NGAP_ID := PX_AMF_UE_NGAP_ID, - in template (value) RAN_UE_NGAP_ID p_rAN_UE_NGAP_ID := PX_RAN_UE_NGAP_ID, - in template (omit) UE_NGAP_ID_pair.iE_Extensions p_iE_Extensions := omit - ) := { + in template (value) AMF_UE_NGAP_ID p_aMF_UE_NGAP_ID := PX_AMF_UE_NGAP_ID, + in template (value) RAN_UE_NGAP_ID p_rAN_UE_NGAP_ID := PX_RAN_UE_NGAP_ID, + in template (omit) UE_NGAP_ID_pair.iE_Extensions p_iE_Extensions := omit + ) := { aMF_UE_NGAP_ID := p_aMF_UE_NGAP_ID, rAN_UE_NGAP_ID := p_rAN_UE_NGAP_ID, iE_Extensions := p_iE_Extensions @@ -16647,21 +17051,21 @@ module LibNGAP_Templates { template (value) ULForwarding m_uLForwarding(in ULForwarding p_value := ul_forwarding_proposed) := p_value; template (value) UPTransportLayerInformation m_uPTransportLayerInformation_gTPTunnel( - in template (value) GTPTunnel p_gTPTunnel - ) := { + in template (value) GTPTunnel p_gTPTunnel + ) := { gTPTunnel := p_gTPTunnel } // End of template m_uPTransportLayerInformation_gTPTunnel template (value) UPTransportLayerInformation m_uPTransportLayerInformation_choice_Extensions( - in template (value) UPTransportLayerInformation.choice_Extensions p_choice_Extensions - ) := { + in template (value) UPTransportLayerInformation.choice_Extensions p_choice_Extensions + ) := { choice_Extensions := p_choice_Extensions } // End of template m_uPTransportLayerInformation_choice_Extensions template (omit) UPTransportLayerInformationItem m_uPTransportLayerInformationItem( - in template (value) UPTransportLayerInformation p_nGU_UP_TNLInformation, - in template (omit) UPTransportLayerInformationItem.iE_Extensions p_iE_Extensions := omit - ) := { + in template (value) UPTransportLayerInformation p_nGU_UP_TNLInformation, + in template (omit) UPTransportLayerInformationItem.iE_Extensions p_iE_Extensions := omit + ) := { nGU_UP_TNLInformation := p_nGU_UP_TNLInformation, iE_Extensions := p_iE_Extensions } // End of template m_uPTransportLayerInformationItem @@ -16865,7 +17269,7 @@ module LibNGAP_Templates { template (omit) UserLocationInformationNR m_userLocationInformationNR( - in template (value) NR_CGI p_nR_CGI, + in template (value) NGAP_IEs.NR_CGI p_nR_CGI, in template (value) TAI p_tAI, in template (omit) TimeStamp p_timeStamp := omit, in template (omit) UserLocationInformationNR.iE_Extensions p_iE_Extensions := omit @@ -16887,7 +17291,7 @@ module LibNGAP_Templates { } // End of template m_userLocationInformationNR_id_PSCellInformation template (value) UserLocationInformationNR.iE_Extensions m_userLocationInformationNR_id_NID( - in template (value) NID p_nID + in template (value) NGAP_IEs.NID p_nID ) := { { id := id_NID, @@ -17078,7 +17482,7 @@ module LibNGAP_Templates { template (present) S_NSSAI p_s_NSSAI := ?, template AllowedNSSAI_Item.iE_Extensions p_iE_Extensions := * ) := { - s_NSSAI := p_s_NSSAI, + s_NSSAI := p_s_NSSAI, iE_Extensions := p_iE_Extensions } // End of template mw_allowedNSSAI_Item @@ -17579,7 +17983,7 @@ module LibNGAP_Templates { } // End of template mw_cancelledCellsInEAI_EUTRA_Item template (present) CancelledCellsInEAI_NR_Item mw_cancelledCellsInEAI_NR_Item( - template (present) NR_CGI p_nR_CGI := ?, + template (present) NGAP_IEs.NR_CGI p_nR_CGI := ?, template (present) NumberOfBroadcasts p_numberOfBroadcasts := ?, template CancelledCellsInEAI_NR_Item.iE_Extensions p_iE_Extensions := * ) := { @@ -17599,7 +18003,7 @@ module LibNGAP_Templates { } // End of template mw_cancelledCellsInTAI_EUTRA_Item template (present) CancelledCellsInTAI_NR_Item mw_CancelledCellsInTAI_NR_Item( - template (present) NR_CGI p_nR_CGI := ?, + template (present) NGAP_IEs.NR_CGI p_nR_CGI := ?, template (present) NumberOfBroadcasts p_numberOfBroadcasts := ?, template CancelledCellsInTAI_NR_Item.iE_Extensions p_iE_Extensions := * ) := { @@ -17686,7 +18090,7 @@ module LibNGAP_Templates { template (present) CauseProtocol mw_causeProtocol(template (present) CauseProtocol p_value := ?) := p_value; - template (present) CauseRadioNetwork mww_causeRadioNetwork(template (present) CauseRadioNetwork p_value := ?) := p_value; + template (present) CauseRadioNetwork mw_causeRadioNetwork(template (present) CauseRadioNetwork p_value := ?) := p_value; template (present) CauseTransport mw_causeTransport(template (present) CauseTransport p_value := ?) := p_value; @@ -17709,7 +18113,7 @@ module LibNGAP_Templates { } // End of template mw_cellIDBroadcastEUTRA_Item template (present) CellIDBroadcastNR_Item mw_cellIDBroadcastNR_Item( - template (present) NR_CGI p_nR_CGI := ?, + template (present) NGAP_IEs.NR_CGI p_nR_CGI := ?, template CellIDBroadcastNR_Item.iE_Extensions p_iE_Extensions := * ) := { nR_CGI := p_nR_CGI, @@ -17727,7 +18131,7 @@ module LibNGAP_Templates { } // End of template mw_cellIDCancelledEUTRA_Item template (present) CellIDCancelledNR_Item mw_cellIDCancelledNR_Item( - template (present) NR_CGI p_nR_CGI := ?, + template (present) NGAP_IEs.NR_CGI p_nR_CGI := ?, template (present) NumberOfBroadcasts p_numberOfBroadcasts := ?, template CellIDCancelledNR_Item.iE_Extensions p_iE_Extensions := * ) := { @@ -17797,7 +18201,7 @@ module LibNGAP_Templates { } // End of template mw_completedCellsInEAI_EUTRA_Item template (present) CompletedCellsInEAI_NR_Item mw_completedCellsInEAI_NR_Item( - template (present) NR_CGI p_nR_CGI := ?, + template (present) NGAP_IEs.NR_CGI p_nR_CGI := ?, template CompletedCellsInEAI_NR_Item.iE_Extensions p_iE_Extensions := * ) := { nR_CGI := p_nR_CGI, @@ -17813,7 +18217,7 @@ module LibNGAP_Templates { } // End of template mw_completedCellsInTAI_EUTRA_Item template (present) CompletedCellsInTAI_NR_Item mw_completedCellsInTAI_NR_Item( - template (present) NR_CGI p_nR_CGI := ?, + template (present) NGAP_IEs.NR_CGI p_nR_CGI := ?, template CompletedCellsInTAI_NR_Item.iE_Extensions p_iE_Extensions := * ) := { nR_CGI := p_nR_CGI, @@ -18474,30 +18878,30 @@ module LibNGAP_Templates { } // End of template mw_expectedUEMovingTrajectoryItem template Extended_AMFName mw_extended_AMFName( - template AMFNameVisibleString p_aMFNameVisibleString := *, - template AMFNameUTF8String p_aMFNameUTF8String := *, - template Extended_AMFName.iE_Extensions p_iE_Extensions := * - ) := { + template AMFNameVisibleString p_aMFNameVisibleString := *, + template AMFNameUTF8String p_aMFNameUTF8String := *, + template Extended_AMFName.iE_Extensions p_iE_Extensions := * + ) := { aMFNameVisibleString := p_aMFNameVisibleString, aMFNameUTF8String := p_aMFNameUTF8String, iE_Extensions := p_iE_Extensions } // End of template mw_extended_AMFName template Extended_RANNodeName mw_extended_RANNodeName( - template RANNodeNameVisibleString p_rANNodeNameVisibleString := *, - template RANNodeNameUTF8String p_rANNodeNameUTF8String := *, - template Extended_RANNodeName.iE_Extensions p_iE_Extensions := * - ) := { + template RANNodeNameVisibleString p_rANNodeNameVisibleString := *, + template RANNodeNameUTF8String p_rANNodeNameUTF8String := *, + template Extended_RANNodeName.iE_Extensions p_iE_Extensions := * + ) := { rANNodeNameVisibleString := p_rANNodeNameVisibleString, rANNodeNameUTF8String := p_rANNodeNameUTF8String, iE_Extensions := p_iE_Extensions } // End of template mw_extended_RANNodeName template (present) ExtendedRATRestrictionInformation mw_extendedRATRestrictionInformation( - template (present) ExtendedRATRestrictionInformation.primaryRATRestriction p_primaryRATRestriction := ?, - template (present) ExtendedRATRestrictionInformation.secondaryRATRestriction p_secondaryRATRestriction := ?, - template ExtendedRATRestrictionInformation.iE_Extensions p_iE_Extensions := * - ) := { + template (present) ExtendedRATRestrictionInformation.primaryRATRestriction p_primaryRATRestriction := ?, + template (present) ExtendedRATRestrictionInformation.secondaryRATRestriction p_secondaryRATRestriction := ?, + template ExtendedRATRestrictionInformation.iE_Extensions p_iE_Extensions := * + ) := { primaryRATRestriction := p_primaryRATRestriction, secondaryRATRestriction := p_secondaryRATRestriction, iE_Extensions := p_iE_Extensions @@ -19825,21 +20229,21 @@ module LibNGAP_Templates { iE_Extensions := p_iE_Extensions } // End of template mw_mBS_QoSFlowsToBeSetupItem - template (present) MBS_ServiceArea mw_mBS_ServiceArea_locationindependent( - template (present) MBS_ServiceAreaInformation p_locationindependent := ? - ) := { + template (present) NGAP_IEs.MBS_ServiceArea mw_mBS_ServiceArea_locationindependent( + template (present) NGAP_IEs.MBS_ServiceAreaInformation p_locationindependent := ? + ) := { locationindependent := p_locationindependent } // End of template mw_mBS_ServiceArea_locationindependent - template (present) MBS_ServiceArea mw_mBS_ServiceArea_locationdependent( - template (present) MBS_ServiceAreaInformationList p_locationdependent := ? - ) := { + template (present) NGAP_IEs.MBS_ServiceArea mw_mBS_ServiceArea_locationdependent( + template (present) NGAP_IEs.MBS_ServiceAreaInformationList p_locationdependent := ? + ) := { locationdependent := p_locationdependent } // End of template mw_mBS_ServiceArea_locationdependent - template (present) MBS_ServiceArea mw_mBS_ServiceArea_choice_Extensions( - template (present) MBS_ServiceArea.choice_Extensions p_choice_Extensions := ? - ) := { + template (present) NGAP_IEs.MBS_ServiceArea mw_mBS_ServiceArea_choice_Extensions( + template (present) NGAP_IEs.MBS_ServiceArea.choice_Extensions p_choice_Extensions := ? + ) := { choice_Extensions := p_choice_Extensions } // End of template mw_mBS_ServiceArea_choice_Extensions @@ -19865,7 +20269,7 @@ module LibNGAP_Templates { template (present) MBS_SessionID mw_mBS_SessionID( template (present) TMGI p_tMGI := ?, - template NID p_nID := *, + template NGAP_IEs.NID p_nID := *, template MBS_SessionID.iE_Extensions p_iE_Extensions := * ) := { tMGI := p_tMGI, @@ -19889,7 +20293,7 @@ module LibNGAP_Templates { template (present) MBS_SessionID p_mBS_SessionID := ?, template (present) MBS_QoSFlowsToBeSetupList p_mBS_QoSFlowsToBeSetupList := ?, template MBS_AreaSessionID p_mBS_AreaSessionID := *, - template MBS_ServiceArea p_mBS_ServiceArea := *, + template NGAP_IEs.MBS_ServiceArea p_mBS_ServiceArea := *, template MBS_MappingandDataForwardingRequestList p_mBS_MappingandDataForwardingRequestList := *, template MBS_ActiveSessionInformation_SourcetoTargetItem.iE_Extensions p_iE_Extensions := * ):= { @@ -20068,7 +20472,7 @@ module LibNGAP_Templates { template (present) MBSSessionStatus p_mBSSessionStatus := ?, template MBS_AreaSessionID p_mBS_AreaSessionID := *, template MBS_SessionTNLInfo5GCItem p_sharedNGU_MulticastTNLInformation := *, - template MBS_ServiceArea p_mBS_ServiceArea := *, + template NGAP_IEs.MBS_ServiceArea p_mBS_ServiceArea := *, template MBS_DistributionSetupResponseTransfer.iE_Extensions p_iE_Extensions := * ) := { mBS_SessionID := p_mBS_SessionID, @@ -20295,7 +20699,7 @@ module LibNGAP_Templates { } // End of template mw_multicastSessionUpdateRequestTransfer_id_MBS_SessionID template (present) MulticastSessionUpdateRequestTransfer.protocolIEs mw_multicastSessionUpdateRequestTransfer_id_MBS_ServiceArea( - template (present) MBS_ServiceArea p_mBS_ServiceArea := ? + template (present) NGAP_IEs.MBS_ServiceArea p_mBS_ServiceArea := ? ) := { { id := id_MBS_ServiceArea, @@ -20645,7 +21049,7 @@ module LibNGAP_Templates { template (present) NotifySourceNGRANNode mw_notifySourceNGRANNode(template (present) NotifySourceNGRANNode p_value := ?) := p_value; template (present) NGRAN_CGI mw_ngENB_ID_nR_CGI( - template (present) NR_CGI p_nR_CGI + template (present) NGAP_IEs.NR_CGI p_nR_CGI ) := { nR_CGI := p_nR_CGI } // End of template mw_ngENB_ID_nR_CGI @@ -20753,7 +21157,7 @@ module LibNGAP_Templates { } // End of template mw_nPN_PagingAssistanceInformation_choice_Extensions template (present) NPN_Support mw_nPN_Support_sNPN( - template (present) NID p_sNPN := ? + template (present) NGAP_IEs.NID p_sNPN := ? ) := { sNPN := p_sNPN } // End of template mw_nPN_Support_sNPN @@ -20764,11 +21168,11 @@ module LibNGAP_Templates { choice_Extensions := p_choice_Extensions } // End of template mw_nPN_Support_choice_Extensions - template (present) NR_CGI mw_nR_CGI( - template (present) PLMNIdentity p_pLMNIdentity := ?, - template (present) NRCellIdentity p_nRCellIdentity := ?, - template NR_CGI.iE_Extensions p_iE_Extensions := * - ) := { + template (present) NGAP_IEs.NR_CGI mw_nR_CGI( + template (present) PLMNIdentity p_pLMNIdentity := ?, + template (present) NRCellIdentity p_nRCellIdentity := ?, + template NGAP_IEs.NR_CGI.iE_Extensions p_iE_Extensions := * + ) := { pLMNIdentity := p_pLMNIdentity, nRCellIdentity := p_nRCellIdentity, iE_Extensions := p_iE_Extensions @@ -21807,8 +22211,8 @@ module LibNGAP_Templates { } // End of template mw_pDUSessionResourceSetupItemSUReq template (present) PDUSessionResourceSetupItemSUReq.iE_Extensions mw_pDUSessionResourceSetupItemSUReq_id_PduSessionExpectedUEActivityBehaviour( - template (present) ExpectedUEActivityBehaviour p_expectedUEActivityBehaviour := ? - ) := { + template (present) ExpectedUEActivityBehaviour p_expectedUEActivityBehaviour := ? + ) := { { id := id_PduSessionExpectedUEActivityBehaviour, criticality := ignore, @@ -21833,10 +22237,21 @@ module LibNGAP_Templates { } // End of template mw_pDUSessionResourceSetupRequestTransfer template (present) PDUSessionResourceSetupRequestTransfer.protocolIEs mw_pDUSessionResourceSetupRequestTransfer_mandatories( + template (present) PDUSessionAggregateMaximumBitRate p_pDUSessionAggregateMaximumBitRate := ?, template (present) PDUSessionType p_pDUSessionType := ?, template (present) QosFlowSetupRequestList p_qosFlowSetupRequestList := ?, template (present) UPTransportLayerInformation p_uPTransportLayerInformation := ? ) := { + { + id := id_PDUSessionAggregateMaximumBitRate, + criticality := reject, + value_ := { PDUSessionAggregateMaximumBitRate := p_pDUSessionAggregateMaximumBitRate } + }, + { + id := id_UL_NGU_UP_TNLInformation, + criticality := reject, + value_ := { UPTransportLayerInformation := p_uPTransportLayerInformation } + }, { id := id_PDUSessionType, criticality := reject, @@ -21846,11 +22261,6 @@ module LibNGAP_Templates { id := id_QosFlowSetupRequestList, criticality := reject, value_ := { QosFlowSetupRequestList := p_qosFlowSetupRequestList } - }, - { - id := id_UL_NGU_UP_TNLInformation, - criticality := reject, - value_ := { UPTransportLayerInformation := p_uPTransportLayerInformation } } } // End of template mw_pDUSessionResourceSetupRequestTransfer_mandatories @@ -22604,11 +23014,11 @@ module LibNGAP_Templates { } // End of template mw_qosFlowPerTNLInformationItem template (present) QosFlowSetupRequestItem mw_qosFlowSetupRequestItem( - template (present) QosFlowIdentifier p_qosFlowIdentifier := ?, - template (present) QosFlowLevelQosParameters p_qosFlowLevelQosParameters := ?, - template E_RAB_ID p_e_RAB_ID := *, - template QosFlowSetupRequestItem.iE_Extensions p_iE_Extensions := * - ) := { + template (present) QosFlowIdentifier p_qosFlowIdentifier := ?, + template (present) QosFlowLevelQosParameters p_qosFlowLevelQosParameters := ?, + template E_RAB_ID p_e_RAB_ID := *, + template QosFlowSetupRequestItem.iE_Extensions p_iE_Extensions := * + ) := { qosFlowIdentifier := p_qosFlowIdentifier, qosFlowLevelQosParameters := p_qosFlowLevelQosParameters, e_RAB_ID := p_e_RAB_ID, @@ -22616,8 +23026,8 @@ module LibNGAP_Templates { } // End of template mw_qosFlowSetupRequestItem template (present) QosFlowSetupRequestItem.iE_Extensions mw_qosFlowSetupRequestItemw_id_TSCTrafficCharacteristics( - template (present) TSCTrafficCharacteristics p_tSCTrafficCharacteristics := ? - ) := { + template (present) TSCTrafficCharacteristics p_tSCTrafficCharacteristics := ? + ) := { { id := id_TSCTrafficCharacteristics, criticality := ignore, @@ -22763,7 +23173,7 @@ module LibNGAP_Templates { template (present) RedirectionVoiceFallback mw_redirectionVoiceFallback(template (present) RedirectionVoiceFallback p_value := ?) := p_value; template (present) RedundantPDUSessionInformation mw_redundantPDUSessionInformation( - template (present) RSN p_rSN := ?, + template (present) NGAP_IEs.RSN p_rSN := ?, template RedundantPDUSessionInformation.iE_Extensions p_iE_Extensions := * ) := { rSN := p_rSN, @@ -22818,7 +23228,7 @@ module LibNGAP_Templates { template (present) RRCState mw_rRCState(template (present) RRCState p_value := ?) := p_value; - template (present) RSN mw_rSN(template (present) RSN p_value := ?) := p_value; + template (present) NGAP_IEs.RSN mw_rSN(template (present) NGAP_IEs.RSN p_value := ?) := p_value; template (present) RIMInformationTransfer mw_rIMInformationTransfer( template (present) TargetRANNodeID_RIM p_targetRANNodeID_RIM := ?, @@ -23030,7 +23440,7 @@ module LibNGAP_Templates { } // End of template mw_sliceSupportQMC_Item template (present) SNPN_MobilityInformation mw_sNPN_MobilityInformation( - template (present) NID p_serving_NID := ?, + template (present) NGAP_IEs.NID p_serving_NID := ?, template SNPN_MobilityInformation.iE_Extensions p_iE_Extensions := * ) := { serving_NID := p_serving_NID, @@ -23563,7 +23973,7 @@ module LibNGAP_Templates { } // End of template mw_targetRANNodeID_SON template (present) TargetRANNodeID_SON.iE_Extensions mw_targetRANNodeID_SON_id_NR_CGI( - template (present) NR_CGI p_nR_CGI := ? + template (present) NGAP_IEs.NR_CGI p_nR_CGI := ? ) := { { id := id_NR_CGI, @@ -24279,7 +24689,7 @@ module LibNGAP_Templates { } // End of template mw_userLocationInformationW_AGF_id_GlobalCable_ID_new template (present) UserLocationInformationNR mw_userLocationInformationNR( - template (present) NR_CGI p_nR_CGI := ?, + template (present) NGAP_IEs.NR_CGI p_nR_CGI := ?, template (present) TAI p_tAI := ?, template TimeStamp p_timeStamp := *, template UserLocationInformationNR.iE_Extensions p_iE_Extensions := * @@ -24301,8 +24711,8 @@ module LibNGAP_Templates { } // End of template mw_userLocationInformationNR_id_PSCellInformation template (present) UserLocationInformationNR.iE_Extensions mw_userLocationInformationNR_id_NID( - template (present) NID p_nID := ? - ) := { + template (present) NGAP_IEs.NID p_nID := ? + ) := { { id := id_NID, criticality := reject, @@ -24311,8 +24721,8 @@ module LibNGAP_Templates { } // End of template mw_userLocationInformationNR_id_NID template (present) UserLocationInformationNR.iE_Extensions mw_userLocationInformationNR_id_NRNTNTAIInformation( - template (present) NRNTNTAIInformation p_nRNTNTAIInformation := ? - ) := { + template (present) NRNTNTAIInformation p_nRNTNTAIInformation := ? + ) := { { id := id_NRNTNTAIInformation, criticality := ignore, @@ -24465,6 +24875,1033 @@ module LibNGAP_Templates { } // End of group g_NGAP group Functions_For_Templates{ + + function f_m_n2_InitialContextSetupRequest( + in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, + in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, + in template (omit) AMFName p_amfName := omit, + in template (omit) UEAggregateMaximumBitRate p_uEAggregateMaximumBitRate := omit, + in template (omit) CoreNetworkAssistanceInformationForInactive p_coreNetworkAssistanceInformationForInactive := omit, + in template (value) GUAMI p_gUAMI, + in template (omit) PDUSessionResourceSetupListCxtReq p_pDUSessionResourceSetupListCxtReq := omit, + in template (value) NGAP_IEs.AllowedNSSAI p_allowedNSSAI, + in template (value) UESecurityCapabilities p_uESecurityCapabilities, + in template (value) SecurityKey p_nextHopNH := PX_NEXT_HOP_NH, + in template (omit) TraceActivation p_traceActivation := omit, + in template (omit) MobilityRestrictionList p_mobilityRestrictionList := omit, + in template (omit) UERadioCapability p_uERadioCapability := omit, + in template (omit) IndexToRFSP p_indexToRFSP := PX_Index_to_RAT_Frequency_Selection_Priority, + in template (omit) MaskedIMEISV p_maskedIMEISV := PX_MaskedIMEISV, + in template (omit) NAS_PDU p_nAS_PDU := omit, + in template (omit) EmergencyFallbackIndicator p_emergencyFallbackIndicator := omit, + in template (omit) RRCInactiveTransitionReportRequest p_rRCInactiveTransitionReportRequest := omit, + in template (omit) RedirectionVoiceFallback p_redirectionVoiceFallback := omit, + in template (omit) LocationReportingRequestType p_locationReportingRequestType := omit, + in template (omit) SRVCCOperationPossible p_sRVCCOperationPossible := omit, + in template (omit) IAB_Authorized p_iAB_Authorized := omit, + in template (omit) Enhanced_CoverageRestriction p_enhanced_CoverageRestriction := omit, + in template (omit) Extended_ConnectedTime p_extended_ConnectedTime := PX_EXTENDED_CONNECTED_TIME, + in template (omit) UE_DifferentiationInfo p_uE_DifferentiationInfo := omit, + in template (omit) NRUESidelinkAggregateMaximumBitrate p_nRUESidelinkAggregateMaximumBitrate := omit, + in template (omit) LTEUESidelinkAggregateMaximumBitrate p_lTEUESidelinkAggregateMaximumBitrate := omit, + in template (omit) UERadioCapabilityID p_uERadioCapabilityID := omit + ) return template (value) InitiatingMessage { + var template (value) InitiatingMessage pdu := { + procedureCode := id_InitialContextSetup, + criticality := reject, + value_ := { + InitialContextSetupRequest := { + protocolIEs := { + { + id := id_AMF_UE_NGAP_ID, + criticality := reject, + value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } + }, + { + id := id_RAN_UE_NGAP_ID, + criticality := reject, + value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } + } + } + } + } + }; + log("f_m_n2_InitialContextSetupRequest pdu (0): ", pdu); + return pdu; + var integer idx := lengthof(pdu.value_.InitialContextSetupRequest.protocolIEs); + + /* Old AMF */ + if (isvalue(p_amfName)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_AMFName, + criticality := reject, + value_ := { AMFName := p_amfName } + }; + idx := idx + 1; + } + log("f_m_n2_InitialContextSetupRequest pdu (1): ", pdu); + + /* UE Aggregate Maximum Bit Rate */ + if (isvalue(p_uEAggregateMaximumBitRate)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_UEAggregateMaximumBitRate, + criticality := reject, + value_ := { UEAggregateMaximumBitRate := p_uEAggregateMaximumBitRate } + }; + idx := idx + 1; + } + log("f_m_n2_InitialContextSetupRequest pdu (2): ", pdu); + + /* Core Network Assistance Information for RRC INACTIVE */ + if (isvalue(p_coreNetworkAssistanceInformationForInactive)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_CoreNetworkAssistanceInformationForInactive, + criticality := ignore, + value_ := { CoreNetworkAssistanceInformationForInactive := p_coreNetworkAssistanceInformationForInactive } + }; + idx := idx + 1; + } + log("f_m_n2_InitialContextSetupRequest pdu (3): ", pdu); + + /* GUAMI */ + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_GUAMI, + criticality := reject, + value_ := { GUAMI := p_gUAMI } + }; + idx := idx + 1; + + /* PDU Session Resource Setup Request List */ + if (isvalue(p_pDUSessionResourceSetupListCxtReq)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_PDUSessionResourceSetupListCxtReq, + criticality := reject, + value_ := { PDUSessionResourceSetupListCxtReq := p_pDUSessionResourceSetupListCxtReq } + }; + idx := idx + 1; + } + + /* Allowed NSSAI */ + if (isvalue(p_allowedNSSAI)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_AllowedNSSAI, + criticality := reject, + value_ := { AllowedNSSAI := p_allowedNSSAI } + }; + idx := idx + 1; + } + + /* UE Security Capabilities */ + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_UESecurityCapabilities, + criticality := reject, + value_ := { UESecurityCapabilities := p_uESecurityCapabilities } + }; + idx := idx + 1; + + log("f_m_n2_InitialContextSetupRequest pdu (4): ", pdu); + /* Security Key */ + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_SecurityKey, + criticality := reject, + value_ := { SecurityKey := p_nextHopNH } + }; + idx := idx + 1; + + /* Trace Activation */ + if (isvalue(p_traceActivation)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_TraceActivation, + criticality := ignore, + value_ := { TraceActivation := p_traceActivation } + }; + idx := idx + 1; + } + + log("f_m_n2_InitialContextSetupRequest pdu (5): ", pdu); + /* Mobility Restriction List */ + if (isvalue(p_mobilityRestrictionList)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_MobilityRestrictionList, + criticality := ignore, + value_ := { MobilityRestrictionList := p_mobilityRestrictionList } + }; + idx := idx + 1; + } + + /* UE Radio Capability */ + if (isvalue(p_uERadioCapability)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_UERadioCapability, + criticality := ignore, + value_ := { UERadioCapability := p_uERadioCapability } + }; + idx := idx + 1; + } + + /* Index to RAT/Frequency Selection Priority */ + if (isvalue(p_indexToRFSP)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_IndexToRFSP, + criticality := ignore, + value_ := { IndexToRFSP := p_indexToRFSP } + }; + idx := idx + 1; + } + + /* Masked IMEISV */ + if (isvalue(p_maskedIMEISV)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_MaskedIMEISV, + criticality := ignore, + value_ := { MaskedIMEISV := p_maskedIMEISV } + }; + idx := idx + 1; + } + + /* NAS-PDU */ + if (isvalue(p_nAS_PDU)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_NAS_PDU, + criticality := ignore, + value_ := { nAS_PDU := p_nAS_PDU } + }; + idx := idx + 1; + } + log("f_m_n2_InitialContextSetupRequest pdu (6): ", pdu); + + /* Emergency Fallback Indicator*/ + if (isvalue(p_emergencyFallbackIndicator)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_EmergencyFallbackIndicator, + criticality := reject, + value_ := { EmergencyFallbackIndicator := p_emergencyFallbackIndicator} + }; + idx := idx + 1; + } + + /* RRC Inactive Transition Report Request */ + if (isvalue(p_rRCInactiveTransitionReportRequest)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_RRCInactiveTransitionReportRequest, + criticality := ignore, + value_ := { RRCInactiveTransitionReportRequest := p_rRCInactiveTransitionReportRequest} + }; + idx := idx + 1; + } + + /* TODO: UE Radio Capability for Paging */ + + /* Redirection for Voice EPS Fallback */ + if (isvalue(p_redirectionVoiceFallback)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_RedirectionVoiceFallback, + criticality := ignore, + value_ := { RedirectionVoiceFallback := p_redirectionVoiceFallback } + }; + idx := idx + 1; + } + + /* Location Reporting Request Type */ + if (isvalue(p_locationReportingRequestType)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_LocationReportingRequestType, + criticality := ignore, + value_ := { LocationReportingRequestType := p_locationReportingRequestType } + }; + idx := idx + 1; + } + + /* SRVCC Operation Possible */ + if (isvalue(p_sRVCCOperationPossible)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_SRVCCOperationPossible, + criticality := ignore, + value_ := { SRVCCOperationPossible := p_sRVCCOperationPossible } + }; + idx := idx + 1; + } + + /* IAB Authorized */ + if (isvalue(p_iAB_Authorized)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_IAB_Authorized, + criticality := ignore, + value_ := { IAB_Authorized := p_iAB_Authorized } + }; + idx := idx + 1; + } + + + /* Enhanced Coverage Restriction */ + if (isvalue(p_enhanced_CoverageRestriction)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_Enhanced_CoverageRestriction, + criticality := ignore, + value_ := { Enhanced_CoverageRestriction := p_enhanced_CoverageRestriction } + }; + idx := idx + 1; + } + + /* Extended Connected Time */ + if (isvalue(p_extended_ConnectedTime)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_Extended_ConnectedTime, + criticality := ignore, + value_ := { Extended_ConnectedTime := p_extended_ConnectedTime } + }; + idx := idx + 1; + } + + /* UE Differentiation Information */ + if (isvalue(p_uE_DifferentiationInfo)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_UE_DifferentiationInfo, + criticality := ignore, + value_ := { UE_DifferentiationInfo := p_uE_DifferentiationInfo } + }; + idx := idx + 1; + } + + /* TODO: NR V2X Services Authorized */ + /* TODO: LTE V2X Services Authorized */ + + /* NR UE Sidelink Aggregate Maximum Bit Rate */ + if (isvalue(p_nRUESidelinkAggregateMaximumBitrate)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_NRUESidelinkAggregateMaximumBitrate, + criticality := ignore, + value_ := { NRUESidelinkAggregateMaximumBitrate := p_nRUESidelinkAggregateMaximumBitrate } + }; + idx := idx + 1; + } + + /* LTE UE Sidelink Aggregate Maximum Bit Rate */ + if (isvalue(p_lTEUESidelinkAggregateMaximumBitrate)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_LTEUESidelinkAggregateMaximumBitrate, + criticality := ignore, + value_ := { LTEUESidelinkAggregateMaximumBitrate := p_lTEUESidelinkAggregateMaximumBitrate } + }; + idx := idx + 1; + } + + /* ... TODO: lots other optional IEs ... */ + + /* UE Radio Capability ID */ + if (isvalue(p_uERadioCapabilityID)) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_UERadioCapabilityID, + criticality := reject, + value_ := { UERadioCapabilityID := p_uERadioCapabilityID } + }; + idx := idx + 1; + } + + /* ... TODO: lots other optional IEs ... */ + + log("<<< f_m_n2_InitialContextSetupRequest pdu: ", pdu); + return pdu; + } // End of function f_m_n2_InitialContextSetupRequest + + function f_mw_n2_InitialContextSetupRequest( + template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + template AMFName p_amfName := omit, + template UEAggregateMaximumBitRate p_uEAggregateMaximumBitRate := omit, + template CoreNetworkAssistanceInformationForInactive p_coreNetworkAssistanceInformationForInactive := omit, + template (present) GUAMI p_gUAMI := ?, + template PDUSessionResourceSetupListCxtReq p_pDUSessionResourceSetupListCxtReq := omit, + template (present) NGAP_IEs.AllowedNSSAI p_allowedNSSAI := ?, + template (present) UESecurityCapabilities p_uESecurityCapabilities := ?, + template (present) SecurityKey p_nextHopNH := ?, + template TraceActivation p_traceActivation := omit, + template MobilityRestrictionList p_mobilityRestrictionList := omit, + template UERadioCapability p_uERadioCapability := omit, + template IndexToRFSP p_indexToRFSP := omit, + template MaskedIMEISV p_maskedIMEISV := ?, + template NAS_PDU p_nAS_PDU := ?, + template EmergencyFallbackIndicator p_emergencyFallbackIndicator := omit, + template RRCInactiveTransitionReportRequest p_rRCInactiveTransitionReportRequest := omit, + template RedirectionVoiceFallback p_redirectionVoiceFallback := omit, + template LocationReportingRequestType p_locationReportingRequestType := omit, + template SRVCCOperationPossible p_sRVCCOperationPossible := omit, + template IAB_Authorized p_iAB_Authorized := omit, + template Enhanced_CoverageRestriction p_enhanced_CoverageRestriction := omit, + template Extended_ConnectedTime p_extended_ConnectedTime := omit, + template UE_DifferentiationInfo p_uE_DifferentiationInfo := omit, + template NRUESidelinkAggregateMaximumBitrate p_nRUESidelinkAggregateMaximumBitrate := omit, + template LTEUESidelinkAggregateMaximumBitrate p_lTEUESidelinkAggregateMaximumBitrate := omit, + template UERadioCapabilityID p_uERadioCapabilityID := omit + ) return template (present) InitiatingMessage { + var template (present) InitiatingMessage pdu := { + procedureCode := id_InitialContextSetup, + criticality := reject, + value_ := { + InitialContextSetupRequest := { + protocolIEs := { + { + id := id_AMF_UE_NGAP_ID, + criticality := reject, + value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } + }, + { + id := id_RAN_UE_NGAP_ID, + criticality := reject, + value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } + } + } + } + } + }; + var integer idx := lengthof(pdu.value_.InitialContextSetupRequest.protocolIEs); + + /* Old AMF */ + if (not istemplatekind(p_amfName, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_AMFName, + criticality := reject, + value_ := { AMFName := p_amfName } + }; + idx := idx + 1; + } + + /* UE Aggregate Maximum Bit Rate */ + if (not istemplatekind(p_uEAggregateMaximumBitRate, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_UEAggregateMaximumBitRate, + criticality := reject, + value_ := { UEAggregateMaximumBitRate := p_uEAggregateMaximumBitRate } + }; + idx := idx + 1; + } + + /* Core Network Assistance Information for RRC INACTIVE */ + if (not istemplatekind(p_coreNetworkAssistanceInformationForInactive, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_CoreNetworkAssistanceInformationForInactive, + criticality := ignore, + value_ := { CoreNetworkAssistanceInformationForInactive := p_coreNetworkAssistanceInformationForInactive } + }; + idx := idx + 1; + } + + /* GUAMI */ + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_GUAMI, + criticality := reject, + value_ := { GUAMI := p_gUAMI } + }; + idx := idx + 1; + + /* PDU Session Resource Setup Request List */ + if (not istemplatekind(p_pDUSessionResourceSetupListCxtReq, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_PDUSessionResourceSetupListCxtReq, + criticality := reject, + value_ := { PDUSessionResourceSetupListCxtReq := p_pDUSessionResourceSetupListCxtReq } + }; + idx := idx + 1; + } + + /* Allowed NSSAI */ + if (not istemplatekind(p_allowedNSSAI, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_AllowedNSSAI, + criticality := reject, + value_ := { AllowedNSSAI := p_allowedNSSAI } + }; + idx := idx + 1; + } + + /* UE Security Capabilities */ + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_UESecurityCapabilities, + criticality := reject, + value_ := { UESecurityCapabilities := p_uESecurityCapabilities } + }; + idx := idx + 1; + + /* Security Key */ + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_SecurityKey, + criticality := reject, + value_ := { SecurityKey := p_nextHopNH } + }; + idx := idx + 1; + + /* Trace Activation */ + if (not istemplatekind(p_traceActivation, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_TraceActivation, + criticality := ignore, + value_ := { TraceActivation := p_traceActivation } + }; + idx := idx + 1; + } + + /* Mobility Restriction List */ + if (not istemplatekind(p_mobilityRestrictionList, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_MobilityRestrictionList, + criticality := ignore, + value_ := { MobilityRestrictionList := p_mobilityRestrictionList } + }; + idx := idx + 1; + } + + /* UE Radio Capability */ + if (not istemplatekind(p_uERadioCapability, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_UERadioCapability, + criticality := ignore, + value_ := { UERadioCapability := p_uERadioCapability } + }; + idx := idx + 1; + } + + /* Index to RAT/Frequency Selection Priority */ + if (not istemplatekind(p_indexToRFSP, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_IndexToRFSP, + criticality := ignore, + value_ := { IndexToRFSP := p_indexToRFSP } + }; + idx := idx + 1; + } + + /* Masked IMEISV */ + if (not istemplatekind(p_maskedIMEISV, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_MaskedIMEISV, + criticality := ignore, + value_ := { MaskedIMEISV := p_maskedIMEISV } + }; + idx := idx + 1; + } + + /* NAS-PDU */ + if (not istemplatekind(p_nAS_PDU, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_NAS_PDU, + criticality := ignore, + value_ := { nAS_PDU := p_nAS_PDU } + }; + idx := idx + 1; + } + + /* Emergency Fallback Indicator*/ + if (not istemplatekind(p_emergencyFallbackIndicator, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_EmergencyFallbackIndicator, + criticality := reject, + value_ := { EmergencyFallbackIndicator := p_emergencyFallbackIndicator} + }; + idx := idx + 1; + } + + /* RRC Inactive Transition Report Request */ + if (not istemplatekind(p_rRCInactiveTransitionReportRequest, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_RRCInactiveTransitionReportRequest, + criticality := ignore, + value_ := { RRCInactiveTransitionReportRequest := p_rRCInactiveTransitionReportRequest} + }; + idx := idx + 1; + } + + /* TODO: UE Radio Capability for Paging */ + + /* Redirection for Voice EPS Fallback */ + if (not istemplatekind(p_redirectionVoiceFallback, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_RedirectionVoiceFallback, + criticality := ignore, + value_ := { RedirectionVoiceFallback := p_redirectionVoiceFallback } + }; + idx := idx + 1; + } + + /* Location Reporting Request Type */ + if (not istemplatekind(p_locationReportingRequestType, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_LocationReportingRequestType, + criticality := ignore, + value_ := { LocationReportingRequestType := p_locationReportingRequestType } + }; + idx := idx + 1; + } + + /* SRVCC Operation Possible */ + if (not istemplatekind(p_sRVCCOperationPossible, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_SRVCCOperationPossible, + criticality := ignore, + value_ := { SRVCCOperationPossible := p_sRVCCOperationPossible } + }; + idx := idx + 1; + } + + /* IAB Authorized */ + if (not istemplatekind(p_iAB_Authorized, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_IAB_Authorized, + criticality := ignore, + value_ := { IAB_Authorized := p_iAB_Authorized } + }; + idx := idx + 1; + } + + + /* Enhanced Coverage Restriction */ + if (not istemplatekind(p_enhanced_CoverageRestriction, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_Enhanced_CoverageRestriction, + criticality := ignore, + value_ := { Enhanced_CoverageRestriction := p_enhanced_CoverageRestriction } + }; + idx := idx + 1; + } + + /* Extended Connected Time */ + if (not istemplatekind(p_extended_ConnectedTime, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_Extended_ConnectedTime, + criticality := ignore, + value_ := { Extended_ConnectedTime := p_extended_ConnectedTime } + }; + idx := idx + 1; + } + + /* UE Differentiation Information */ + if (not istemplatekind(p_uE_DifferentiationInfo, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_UE_DifferentiationInfo, + criticality := ignore, + value_ := { UE_DifferentiationInfo := p_uE_DifferentiationInfo } + }; + idx := idx + 1; + } + + /* TODO: NR V2X Services Authorized */ + /* TODO: LTE V2X Services Authorized */ + + /* NR UE Sidelink Aggregate Maximum Bit Rate */ + if (not istemplatekind(p_nRUESidelinkAggregateMaximumBitrate, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_NRUESidelinkAggregateMaximumBitrate, + criticality := ignore, + value_ := { NRUESidelinkAggregateMaximumBitrate := p_nRUESidelinkAggregateMaximumBitrate } + }; + idx := idx + 1; + } + + /* LTE UE Sidelink Aggregate Maximum Bit Rate */ + if (not istemplatekind(p_lTEUESidelinkAggregateMaximumBitrate, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_LTEUESidelinkAggregateMaximumBitrate, + criticality := ignore, + value_ := { LTEUESidelinkAggregateMaximumBitrate := p_lTEUESidelinkAggregateMaximumBitrate } + }; + idx := idx + 1; + } + + /* ... TODO: lots other optional IEs ... */ + + /* UE Radio Capability ID */ + if (not istemplatekind(p_uERadioCapabilityID, "omit")) { + pdu.value_.InitialContextSetupRequest.protocolIEs[idx] := + { + id := id_UERadioCapabilityID, + criticality := reject, + value_ := { UERadioCapabilityID := p_uERadioCapabilityID } + }; + idx := idx + 1; + } + + /* ... TODO: lots other optional IEs ... */ + + return pdu; + } // End of function f_mw_n2_InitialContextSetupRequest + + function f_m_n2_PDUSessionResourceSetupRequest( + in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, + in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID + ) return template (value) InitiatingMessage { + var template (value) InitiatingMessage pdu := { + procedureCode := id_PDUSessionResourceSetup, + criticality := reject, + value_ := { + PDUSessionResourceSetupRequest := { + protocolIEs := { + { + id := id_AMF_UE_NGAP_ID, + criticality := reject, + value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } + }, + { + id := id_RAN_UE_NGAP_ID, + criticality := reject, + value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } + } + } + } + } + }; + var integer idx := lengthof(pdu.value_.PDUSessionResourceSetupRequest.protocolIEs); + + // TODO FSCOM To be done + return pdu; + } // End of function f_m_n2_PDUSessionResourceSetupRequest + + function f_mw_n2_PDUSessionResourceSetupRequest( + template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?, + template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?, + template RANPagingPriority p_rANPagingPriority := omit, + template NAS_PDU p_nAS_PDU := omit, + template (present) PDUSessionResourceSetupListSUReq p_pDUSessionResourceSetupListSUReq := ?, + template UEAggregateMaximumBitRate p_uEAggregateMaximumBitRate := omit, + template UESliceMaximumBitRateList p_uESliceMaximumBitRateList := omit + ) return template (present) InitiatingMessage { + + var template (present) InitiatingMessage pdu := { + procedureCode := id_PDUSessionResourceSetup, + criticality := reject, + value_ := { + PDUSessionResourceSetupRequest := { + protocolIEs := { + { + id := id_AMF_UE_NGAP_ID, + criticality := reject, + value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } + }, + { + id := id_RAN_UE_NGAP_ID, + criticality := reject, + value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } + } + } + } + } + }; + var integer idx := lengthof(pdu.value_.PDUSessionResourceSetupRequest.protocolIEs); + + /* RAN Paging Priority */ + if (not istemplatekind(p_rANPagingPriority, "omit")) { + pdu.value_.PDUSessionResourceSetupRequest.protocolIEs[idx] := { + id := id_RANPagingPriority, + criticality := ignore, + value_ := { RANPagingPriority := p_rANPagingPriority } + }; + idx := idx + 1; + } + + /* NAS-PDU */ + if (not istemplatekind(p_nAS_PDU, "omit")) { + pdu.value_.PDUSessionResourceSetupRequest.protocolIEs[idx] := { + id := id_NAS_PDU, + criticality := reject, + value_ := { NAS_PDU := p_nAS_PDU } + }; + idx := idx + 1; + } + + /* PDU Session Resource Setup Request List */ + pdu.value_.PDUSessionResourceSetupRequest.protocolIEs[idx] := { + id := id_PDUSessionResourceSetupListSUReq, + criticality := reject, + value_ := { PDUSessionResourceSetupListSUReq := p_pDUSessionResourceSetupListSUReq } + }; + idx := idx + 1; + + /* UE Aggregate Maximum Bit Rate */ + if (not istemplatekind(p_uEAggregateMaximumBitRate, "omit")) { + pdu.value_.PDUSessionResourceSetupRequest.protocolIEs[idx] := { + id := id_UEAggregateMaximumBitRate, + criticality := ignore, + value_ := { UEAggregateMaximumBitRate := p_uEAggregateMaximumBitRate } + }; + idx := idx + 1; + } + + /* UE Slice Maximum Bit Rate List */ + if (not istemplatekind(p_uESliceMaximumBitRateList, "omit")) { + pdu.value_.PDUSessionResourceSetupRequest.protocolIEs[idx] := { + id := id_UESliceMaximumBitRateList, + criticality := ignore, + value_ := { UESliceMaximumBitRateList := p_uESliceMaximumBitRateList } + }; + idx := idx + 1; + } + return pdu; + } // End of function f_mw_n2_PDUSessionResourceSetupRequest + + function f_m_n2_PDUSessionResourceReleaseCommand( + in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, + in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, + in template (omit) NAS_PDU p_nAS_PDU, + in template (value) PDUSessionResourceToReleaseListRelCmd p_pDUSessionResourceToReleaseListRelCmd + ) return template (value) InitiatingMessage { + var template (value) InitiatingMessage pdu := { + procedureCode := id_PDUSessionResourceRelease, + criticality := reject, + value_ := { + PDUSessionResourceReleaseCommand := { + protocolIEs := { + { + id := id_AMF_UE_NGAP_ID, + criticality := reject, + value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID } + }, + { + id := id_RAN_UE_NGAP_ID, + criticality := reject, + value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID } + } + } + } + } + }; + var integer idx := lengthof(pdu.value_.PDUSessionResourceReleaseCommand.protocolIEs); + + if (isvalue(p_nAS_PDU)) { + pdu.value_.PDUSessionResourceReleaseCommand.protocolIEs[idx] := + { + id := id_NAS_PDU, + criticality := ignore, + value_ := { nAS_PDU := p_nAS_PDU } + }; + idx := idx + 1; + } + + pdu.value_.PDUSessionResourceReleaseCommand.protocolIEs[idx] := + { id := id_PDUSessionResourceToReleaseListRelCmd, + criticality := reject, + value_ := { PDUSessionResourceToReleaseListRelCmd := p_pDUSessionResourceToReleaseListRelCmd } + }; + return pdu; + } // End of function f_n2_PDUSessionResourceReleaseCommand + + function f_m_n2_UEContextReleaseComplete( + in template (value) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, + in template (value) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, + in template (omit) UserLocationInformation p_userLocationInformation := omit, + in template (omit) InfoOnRecommendedCellsAndRANNodesForPaging p_infoOnRecommendedCellsAndRANNodesForPaging := omit, + in template (omit) PDUSessionResourceListCxtRelCpl p_pDUSessionResourceListCxtRelCpl := omit, + in template (omit) CriticalityDiagnostics p_criticalityDiagnostics := omit, + in template (omit) PagingAssisDataforCEcapabUE p_pagingAssisDataforCEcapabUE := omit + ) return template (value) SuccessfulOutcome { + + var template (value) SuccessfulOutcome pdu := m_n2_UEContextReleaseComplete(p_amfUeNgapID, p_ranUeNgapID); + var integer idx := lengthof(pdu.value_.UEContextReleaseComplete.protocolIEs); + + if (isvalue(p_userLocationInformation)) { + pdu.value_.UEContextReleaseComplete.protocolIEs[idx] := { + id := id_UserLocationInformation, + criticality := ignore, + value_ := { UserLocationInformation := p_userLocationInformation } + }; + idx := idx + 1; + } + + if (isvalue(p_infoOnRecommendedCellsAndRANNodesForPaging)) { + pdu.value_.UEContextReleaseComplete.protocolIEs[idx] := { + id := id_InfoOnRecommendedCellsAndRANNodesForPaging, + criticality := reject, + value_ := { InfoOnRecommendedCellsAndRANNodesForPaging := p_infoOnRecommendedCellsAndRANNodesForPaging } + }; + idx := idx + 1; + } + + if (isvalue(p_pDUSessionResourceListCxtRelCpl)) { + pdu.value_.UEContextReleaseComplete.protocolIEs[idx] := { + id := id_PDUSessionResourceListCxtRelCpl, + criticality := reject, + value_ := { PDUSessionResourceListCxtRelCpl := p_pDUSessionResourceListCxtRelCpl } + }; + idx := idx + 1; + } + + if (isvalue(p_criticalityDiagnostics)) { + pdu.value_.UEContextReleaseComplete.protocolIEs[idx] := { + id := id_CriticalityDiagnostics, + criticality := ignore, + value_ := { CriticalityDiagnostics := p_criticalityDiagnostics } + }; + idx := idx + 1; + } + + if (isvalue(p_pagingAssisDataforCEcapabUE)) { + pdu.value_.UEContextReleaseComplete.protocolIEs[idx] := { + id := id_PagingAssisDataforCEcapabUE, + criticality := ignore, + value_ := { PagingAssisDataforCEcapabUE := p_pagingAssisDataforCEcapabUE } + } + idx := idx + 1; + } + return pdu; + } // End of function f_m_n2_UEContextReleaseComplete + + function f_mw_n2_UEContextReleaseComplete( + template (present) AMF_UE_NGAP_ID p_amfUeNgapID := PX_AMF_UE_NGAP_ID, + template (present) RAN_UE_NGAP_ID p_ranUeNgapID := PX_RAN_UE_NGAP_ID, + template UserLocationInformation p_userLocationInformation := omit, + template InfoOnRecommendedCellsAndRANNodesForPaging p_infoOnRecommendedCellsAndRANNodesForPaging := omit, + template PDUSessionResourceListCxtRelCpl p_pDUSessionResourceListCxtRelCpl := omit, + template CriticalityDiagnostics p_criticalityDiagnostics := omit, + template PagingAssisDataforCEcapabUE p_pagingAssisDataforCEcapabUE := omit + ) return template (present) SuccessfulOutcome { + + var template (present) SuccessfulOutcome pdu := m_n2_UEContextReleaseComplete(p_amfUeNgapID, p_ranUeNgapID); + var integer idx := lengthof(pdu.value_.UEContextReleaseComplete.protocolIEs); + + if (not istemplatekind(p_userLocationInformation, "omit")) { + pdu.value_.UEContextReleaseComplete.protocolIEs[idx] := { + id := id_UserLocationInformation, + criticality := ignore, + value_ := { UserLocationInformation := p_userLocationInformation } + }; + idx := idx + 1; + } + + if (not istemplatekind(p_infoOnRecommendedCellsAndRANNodesForPaging, "omit")) { + pdu.value_.UEContextReleaseComplete.protocolIEs[idx] := { + id := id_InfoOnRecommendedCellsAndRANNodesForPaging, + criticality := reject, + value_ := { InfoOnRecommendedCellsAndRANNodesForPaging := p_infoOnRecommendedCellsAndRANNodesForPaging } + }; + idx := idx + 1; + } + + if (not istemplatekind(p_pDUSessionResourceListCxtRelCpl, "omit")) { + pdu.value_.UEContextReleaseComplete.protocolIEs[idx] := { + id := id_PDUSessionResourceListCxtRelCpl, + criticality := reject, + value_ := { PDUSessionResourceListCxtRelCpl := p_pDUSessionResourceListCxtRelCpl } + }; + idx := idx + 1; + } + + if (not istemplatekind(p_criticalityDiagnostics, "omit")) { + pdu.value_.UEContextReleaseComplete.protocolIEs[idx] := { + id := id_CriticalityDiagnostics, + criticality := ignore, + value_ := { CriticalityDiagnostics := p_criticalityDiagnostics } + }; + idx := idx + 1; + } + + if (not istemplatekind(p_pagingAssisDataforCEcapabUE, "omit")) { + pdu.value_.UEContextReleaseComplete.protocolIEs[idx] := { + id := id_PagingAssisDataforCEcapabUE, + criticality := ignore, + value_ := { PagingAssisDataforCEcapabUE := p_pagingAssisDataforCEcapabUE } + } + idx := idx + 1; + } + return pdu; + } // End of function f_mw_n2_UEContextReleaseComplete + + function f_mw_n2_NGSetupFailure( + template (present) Cause p_cause := ?, + template TimeToWait p_timeToWait := omit, + template CriticalityDiagnostics p_criticalityDiagnostics := omit + ) return template (present) UnsuccessfulOutcome { + + var template (present) UnsuccessfulOutcome pdu := mw_n2_NGSetupFailure(p_cause); + var integer idx := 1; + + /* Time to Wait */ + if (not istemplatekind(p_timeToWait, "omit")) { + pdu.value_.NGSetupFailure.protocolIEs[idx] := { + id := id_TimeToWait, + criticality := ignore, + value_ := { TimeToWait := p_timeToWait } + }; + idx := idx + 1; + } + + /* Criticality Diagnostics */ + if (not istemplatekind(p_criticalityDiagnostics, "omit")) { + pdu.value_.NGSetupFailure.protocolIEs[idx] := { + id := id_CriticalityDiagnostics, + criticality := ignore, + value_ := { CriticalityDiagnostics := p_criticalityDiagnostics } + }; + idx := idx + 1; + } + return pdu; + } // End of function f_mw_n2_NGSetupFailure + + // function f_mw_CoreNetworkAssistanceInformationForInactive_ExtIEs( + // template NGAP_IEs.CN_MT_CommunicationHandling p_cN_MT_CommunicationHandling := omit + // ) return template (present) CoreNetworkAssistanceInformationForInactive.iE_Extensions { + // var template (present) CoreNetworkAssistanceInformationForInactive.iE_Extensions ies ; + // var integer idx := 0; + + // if (not istemplatekind(p_cN_MT_CommunicationHandling, "omit")) { + // ies[idx] := { + // id := id_CN_MT_CommunicationHandling, + // criticality := ignore, + // extensionValue := { CN_MT_CommunicationHandling := p_cN_MT_CommunicationHandling } + // }; + // idx := idx + 1; + // } + + // return ies; + // } // End of function f_mw_CoreNetworkAssistanceInformationForInactive_ExtIEs + } // End of group functionsForTemplates } // End of module LibNGAP_Templates diff --git a/ttcn/LibNGAP/lib_system/LibNGAP_Functions.ttcn b/ttcn/LibNGAP/lib_system/LibNGAP_Functions.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..61dbd29c21dbe732240df812e5f8a4caf06b190c --- /dev/null +++ b/ttcn/LibNGAP/lib_system/LibNGAP_Functions.ttcn @@ -0,0 +1,2503 @@ +module LibNGAP_Functions { + + // Lib3GPP + import from CommonDefs all; + import from Parameters all; + import from NAS_CommonTypeDefs all; + import from NAS_CommonTemplates all; + import from NAS_AuthenticationCommon all; + import from NAS_AuxiliaryDefsAndFunctions all; + import from NG_NAS_Common all; + import from NG_NAS_MsgContainers all; + import from NG_NAS_Templates all; + import from NG_NAS_SecurityFunctions all; + import from NG_NAS_TypeDefs all; + import from NG_SecurityDefinitionsAndExternalFunctions all; + + // Lib_NGAP + import from NGAP_IEs language "ASN.1:2002" all; + import from NGAP_Constants language "ASN.1:2002" all; + import from NGAP_PDU_Descriptions language "ASN.1:2002" all; + import from LibNGAP_Templates all; + import from LibNGAP_Interface all; + import from LibNGAP_Steps all; + import from LibNGAP_Pixits all; + + // Lib_NG_NAS_Templates + import from Lib_NG_NAS_Templates all; + import from Lib_NG_NAS_Security_Functions all; + import from Lib_NG_NAS_Pixits all; + + /** + * @desc Function to send NGSetupRequest message and await for NGSetupResponse message + */ + function f_await_NGSetupRequest_send_NGSetupRespone() runs on NGNASComponent { + log(">>> f_await_NGSetupRequest_send_NGSetupRespone"); + + // Await NGSetupRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_NGSetupRequest( + mw_globalRANNodeID_globalGNB_ID( + mw_ie_globalGnbId + ), + PX_RAN_NODE_NAME, + { + *, + mw_supportedTAItem, + * + }, + PX_PAGING_DRX + ))); + + // Send NGSetupResponse + f_send_NGAP_PDU( + m_ngap_succMsg( + m_n2_NGSetupResponse( + m_aMFName(PX_AMF_NAME), + { + m_servedGUAMIItem( + m_gUAMI + ) + }, + PX_M_RELATIVE_AMF_CAP, + { + m_pLMNSupportItem( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + { + m_sliceSupportItem( + m_s_NSSAI( + PX_SST, + PX_SD + )) + } + ) + } + ))); + } + + /** + * @desc Function to send NGSetupRequest message and await for NGSetupResponse message + */ + function f_send_NGSetupRequest_await_NGSetupResponse() runs on NGNASComponent { + // Send NGSetupRequest + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_NGSetupRequest( + m_globalRANNodeID_globalGNB_ID( + m_ie_globalGnbId( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_GNB_ID + )), + { + m_supportedTAItem( + PX_TACode, + { + m_ie_broadcastPLMNItem( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + { + m_sliceSupportItem( + m_s_NSSAI( + PX_SST/*, + PX_SD*/ + )) + } + ) + } + ) + }, + PX_PAGING_DRX + ))); + + // Await NGSetupResponse + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGSetupResponse( + mw_aMFName(PX_AMF_NAME), + { + *, + mw_servedGUAMIItem( + mw_gUAMI( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) + )), + * + } + ))); + } + + /** + * @desc Function to send NGSetupRequest message and await for NGSetupResponse message + */ + function f_send_NGSetupRequest_await_NGSetupResponse2() runs on NGNASComponent { + // Await NGSetupRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_NGSetupRequest( + mw_globalRANNodeID_globalGNB_ID( + mw_ie_globalGnbId( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_GNB_ID + )), + -, + { + *, + mw_supportedTAItem( + PX_TACode, + { + *, + mw_ie_broadcastPLMNItem( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC),//m_ie_pLMNIdentity('00f110'O), + { + *, + mw_sliceSupportItem( + mw_s_NSSAI( + PX_SST/*, + PX_SD*/ + )), + * + } + ), + * + } + ), + * + }, + PX_PAGING_DRX + ))); + + // Await NGSetupResponse + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGSetupResponse( + mw_aMFName(PX_AMF_NAME), + { + *, + mw_servedGUAMIItem( + mw_gUAMI( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) + )), + * + } + ))); + } + + /** + * @desc Function to await NGSetupRequest message and await for NGSetupResponse message + */ + function f_await_NGSetupRequest_await_NGSetupResponse() runs on NGNASComponent { + // Send NGSetupRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_NGSetupRequest_noRANNodeName( + mw_globalRANNodeID_globalGNB_ID( + mw_ie_globalGnbId( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_GNB_ID,//'0000000000000000000000'B,//in template (value) bitstring p_gnbId, + -//in template (omit) GlobalGNB_ID.iE_Extensions p_iE_Extensions := omit + )), + { + mw_supportedTAItem( + PX_TACode, + { + mw_ie_broadcastPLMNItem( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC),//m_ie_pLMNIdentity('00f110'O), + { + mw_sliceSupportItem( + mw_s_NSSAI( + PX_SST/*, + PX_SD, + -*/ + ), + -//in template (omit) SliceSupportItem.iE_Extensions p_iE_Extensions := omit + ) + } + ), + * + },//in template (value) BroadcastPLMNList p_broadcastPLMNList, + -//in template (omit) SupportedTAItem.iE_Extensions p_iE_Extensions := omit + ) + }, + PX_PAGING_DRX + ))); + + // Await NGSetupResponse + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_NGSetupResponse( + mw_aMFName(PX_AMF_NAME), + { + *, + mw_servedGUAMIItem( + mw_gUAMI( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) + )), + * + } + ))); + } + + /** + * @desc Function to send NAS RegistrationRequest message + */ + function f_send_registration_request() runs on NGNASComponent { + log(">>> f_send_registration_request"); + + // Send REGISTRATION_REQUEST + var octetstring v_other_digits := // ETSI TS 124 501 Figure 9.11.3.4.3: 5GS mobile identity information element for type of identity "SUCI" and SUPI format "IMSI" + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) & + '0000'O & // Routing Indicator + '00'O & // Protection scheme + '00'O & // Home network public key identifier + PX_MSIN; + log("f_send_registration_request: v_other_digits: ", v_other_digits); + log("f_send_registration_request: m_NG_MobileIdentitySUCI: ", m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID)); + var NG_NAS_UL_Message_Type v_nas_message := valueof( + m_NG_REGISTRATION_REQUEST( + cs_RegistrationType(tsc_NG_RegistrationInitial, '1'B), + tsc_NasKsi_NoKey, + '0'B, // TSC, + m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID), // 24.501 cl. 9.11.3.4 + -, + -, + m_ng_ue_security_capability + )); + // Save message in global variable for later use + vc_registration_request := v_nas_message.registration_Request; + // Send it + log("f_send_registration_request: v_nas_message: ", v_nas_message); + log(bit2oct(encvalue(valueof(v_nas_message)))) + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_initialUeMessage( + -, + bit2oct(encvalue(valueof(v_nas_message))), + m_uPTransportLayerInformation_userLocationInformationNR( + m_userLocationInformationNR( + m_nR_CGI, + m_tAI + )) + ))); + } + + /** + * @desc Function to await NAS RegistrationRequest message + */ + function f_await_registration_request() runs on NGNASComponent { + log(">>> f_await_registration_request"); + + // REGISTRATION_REQUEST + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_initialUeMessage + )); + f_NASPDU_Get(vc_recvNGAP_PDU); + if (match(vc_recvNgNasUl_Msg, mw_NG_REGISTRATION_REQUEST)) { + log("Received NG_REGISTRATION_REQUEST NAS message"); + + // Extract RAN_UE_NGAP_ID + vc_RAN_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.initialUEMessage.protocolIEs[0].value_.rAN_UE_NGAP_ID; + log("vc_RAN_UE_ID: ", vc_RAN_UE_ID); + + // Save message in global variable for later use + vc_registration_request := vc_recvNgNasUl_Msg.registration_Request; + } else { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NAS message"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NAS message"); + } + } + + /** + * @desc Function to await NAS AuthenticationRequest message and send for AuthenticationResponse message + */ + function f_await_authentication_request_send_authentication_response() runs on NGNASComponent { + log(">>> f_await_authentication_request_send_authentication_response"); + + // Await request for DOWNLINK_NAS_TRANSPORT + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + ?, + vc_RAN_UE_ID, + ? // AuthorizationRequest + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_REQUEST( + ?,//'100'B, + -, + mw_GMM_AuthRAND, + mw_GSM_AUTN + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST"); + } + log("v_message: ", v_message); + if (not(isbound(v_message))) { + setverdict(fail); + return; + } + vc_ngKSI := v_message.authentication_Request.ngNasKeySetId.nasKeySetId; + log("vc_ngKSI: ", vc_ngKSI); + + // Extract AMF_UE_NGAP_ID + vc_AMF_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[0].value_.aMF_UE_NGAP_ID; + log("vc_AMF_UE_ID: ", vc_AMF_UE_ID); + // Extract RAN_UE_NGAP_ID + vc_RAN_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[1].value_.rAN_UE_NGAP_ID; + log("vc_RAN_UE_ID: ", vc_RAN_UE_ID); + + // Compute RES/XRES + if (f_5g_aka_compute_res_xres(-, v_message.authentication_Request.rand.randValue, v_message.authentication_Request.autn.aUTN, v_message.authentication_Request.abba, fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), -/*oct2hex(PX_SUPI_DIGITS)*/, px_IMSI_Def, vc_ng_nas_security_params_type) == false) { + setverdict(fail); + return; + } + + // Send response for AUTHENTICATION_RESPONSE + vt_NgNasUl_Msg := m_NG_AUTHENTICATION_RESPONSE( + { iei := '2d'O, iel := '10'O, res := vc_ng_nas_security_params_type.AuthParams.XRES } + ); + vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + vc_sendNAS_PDU, + m_uPTransportLayerInformation_userLocationInformationNR( + m_userLocationInformationNR( + m_nR_CGI, + m_tAI + ))))); + + setverdict(pass); + } + + /** + * @desc Function to await NAS AuthenticationRequest message and send for AuthenticationResponse message + */ + function f_await_authentication_request_send_authentication_response_with_invalid_response() runs on NGNASComponent { + log(">>> f_await_authentication_request_send_authentication_response_with_invalid_response"); + + // Await request for DOWNLINK_NAS_TRANSPORT + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + ?, + vc_RAN_UE_ID, + ? // AuthorizationRequest + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_REQUEST( + ?,//'100'B, + -, + mw_GMM_AuthRAND, + mw_GSM_AUTN + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST"); + } + log("v_message: ", v_message); + if (not(isbound(v_message))) { + setverdict(fail); + return; + } + vc_ngKSI := v_message.authentication_Request.ngNasKeySetId.nasKeySetId; + log("vc_ngKSI: ", vc_ngKSI); + + // Extract AMF_UE_NGAP_ID + vc_AMF_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[0].value_.aMF_UE_NGAP_ID; + log("vc_AMF_UE_ID: ", vc_AMF_UE_ID); + // Extract RAN_UE_NGAP_ID + vc_RAN_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[1].value_.rAN_UE_NGAP_ID; + log("vc_RAN_UE_ID: ", vc_RAN_UE_ID); + + // Compute RES/XRES + if (f_5g_aka_compute_res_xres(-, v_message.authentication_Request.rand.randValue, v_message.authentication_Request.autn.aUTN, v_message.authentication_Request.abba, fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), -/*oct2hex(PX_SUPI_DIGITS)*/, px_IMSI_Def, vc_ng_nas_security_params_type) == false) { + setverdict(fail); + return; + } + + // Send invalid response for AUTHENTICATION_RESPONSE + vc_ng_nas_security_params_type.AuthParams.XRES := vc_ng_nas_security_params_type.AuthParams.XRES xor4b vc_ng_nas_security_params_type.AuthParams.XRES; // Invalidate the authentication response value by flipping all bits with the value of the 7th byte of XRES + log("Invalidated XRES values: ", bit2oct(vc_ng_nas_security_params_type.AuthParams.XRES)); + vt_NgNasUl_Msg := m_NG_AUTHENTICATION_RESPONSE( + { iei := '2d'O, iel := '10'O, res := vc_ng_nas_security_params_type.AuthParams.XRES } + ); + vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + vc_sendNAS_PDU, + m_uPTransportLayerInformation_userLocationInformationNR( + m_userLocationInformationNR( + m_nR_CGI, + m_tAI + ))))); + + setverdict(pass); + } + + function f_await_authentication_request_await_authentication_reject() runs on NGNASComponent { + log(">>> f_await_authentication_request_await_authentication_reject"); + + // Await request for DOWNLINK_NAS_TRANSPORT + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + ?, + vc_RAN_UE_ID, + ? // AuthorizationRequest + ))); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_REQUEST( + ?,//'100'B, + -, + mw_GMM_AuthRAND, + mw_GSM_AUTN + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST"); + } + log("v_message: ", v_message); + if (not(isbound(v_message))) { + setverdict(fail); + return; + } + vc_ngKSI := v_message.authentication_Request.ngNasKeySetId.nasKeySetId; + log("vc_ngKSI: ", vc_ngKSI); + + // Extract AMF_UE_NGAP_ID + vc_AMF_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[0].value_.aMF_UE_NGAP_ID; + log("vc_AMF_UE_ID: ", vc_AMF_UE_ID); + // Extract RAN_UE_NGAP_ID + vc_RAN_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[1].value_.rAN_UE_NGAP_ID; + log("vc_RAN_UE_ID: ", vc_RAN_UE_ID); + + // Await response for AUTHENTICATION_REJECT + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + if (f_Check_5GAKA_NAS_UL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_REJECT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_ul, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REJECT"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REJECT"); + } + + setverdict(pass); + } + + /** + * @desc Function to await NAS AuthenticationRequest message and await for AuthenticationResponse message + */ + function f_await_authentication_request_await_authentication_response() runs on NGNASComponent { + log(">>> f_await_authentication_request_await_authentication_response"); + + // Await request for DOWNLINK_NAS_TRANSPORT + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + ?, + vc_RAN_UE_ID, + ? // AuthorizationRequest + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_dl_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_REQUEST( + -, + -, + mw_GMM_AuthRAND, + mw_GSM_AUTN + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_dl_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST"); + } + log("v_dl_message: ", v_dl_message); + + // Extract AMF_UE_NGAP_ID + vc_AMF_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[0].value_.aMF_UE_NGAP_ID; + log("vc_AMF_UE_ID: ", vc_AMF_UE_ID); + // Extract + vc_RAN_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[1].value_.rAN_UE_NGAP_ID; + log("vc_RAN_UE_ID: ", vc_RAN_UE_ID); + + // Compute RES/XRES + if (f_5g_aka_compute_res_xres(-, v_dl_message.authentication_Request.rand.randValue, v_dl_message.authentication_Request.autn.aUTN, v_dl_message.authentication_Request.abba, fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), -/*oct2hex(PX_SUPI_DIGITS)*/, px_IMSI_Def, vc_ng_nas_security_params_type) == false) { + setverdict(fail); + return; + } + + // Await response for AUTHENTICATION_REQUEST + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + if (f_Check_5GAKA_NAS_UL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_RESPONSE( + { iei := '2d'O, iel := '10'O, res := vc_ng_nas_security_params_type.AuthParams.XRES } + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_ul, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_RESPONSE"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_RESPONSE"); + } + + setverdict(pass); + } + + /** + * @desc Function to send NAS AuthenticationRequest message and await for AuthenticationResponse message + */ + function f_send_authentication_request_await_authentication_response() runs on NGNASComponent { + log(">>> f_send_authentication_request_await_authentication_response"); + + // Compute security context + // Set OP + if (PX_FORCE_USING_OPERATOR_SECRET_KEY == false) { + f_set_op(PX_OPERATOR_KEY); + } else { + f_force_opc(PX_OPERATOR_SECRET_KEY); + } + // Compute MAC_A + var B48_Type v_sqn := PX_SQN; + var B16_Type v_amf := PX_AMF; // AMF: Authentication Management Field + vc_ng_nas_security_params_type.AuthParams.RandValue := PX_RAND_VALUE; + var B64_Type v_mac_a; + var integer v_result := f_f1(PX_SUBSCRIPTION_KEY, vc_ng_nas_security_params_type.AuthParams.RandValue, v_sqn, v_amf, v_mac_a); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'fx_f1' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } + log("v_sqn: ", bit2oct(v_sqn)); + log("v_mac_a: ", bit2oct(v_mac_a)); + var B48_Type v_ak; + // Compute RES, CK, IK and AK + v_result := f_f2345(PX_SUBSCRIPTION_KEY, vc_ng_nas_security_params_type.AuthParams.RandValue, vc_ng_nas_security_params_type.AuthParams.XRES, vc_ng_nas_security_params_type.AuthParams.CK, vc_ng_nas_security_params_type.AuthParams.IK, v_ak); + if (v_result != 0) { + log("*** " & __SCOPE__ & ": ERROR: 'f_f2345' returned an error code: " & int2str(v_result) & ". ***"); + setverdict(fail); + } + log("v_ak: ", bit2oct(v_ak)); + vc_ng_nas_security_params_type.AuthParams.XRESLength := lengthof(vc_ng_nas_security_params_type.AuthParams.XRES); + // Build AUTN, the Authentication Token: AUTN = SQN ⊕ AK || AMF || MAC + vc_ng_nas_security_params_type.AuthParams.AUTN := (v_sqn xor4b v_ak) & v_amf & v_mac_a; + log("v_sqn xor4b v_ak: ", bit2oct(v_sqn xor4b v_ak)); + log("vc_ng_nas_security_params_type.AuthParams.AUTN: ", bit2oct(vc_ng_nas_security_params_type.AuthParams.AUTN)); + // RE-compute RES/XRES and finalyze security context + if (f_5g_aka_compute_res_xres(-, vc_ng_nas_security_params_type.AuthParams.RandValue, vc_ng_nas_security_params_type.AuthParams.AUTN, valueof(cs_ABBA('0000'O, omit)), fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), -/*oct2hex(PX_SUPI_DIGITS)*/, px_IMSI_Def, vc_ng_nas_security_params_type) == false) { + setverdict(fail); + return; + } + // Build the NAS message for AuthenticationRequest + var NG_NAS_DL_Message_Type v_dl_message := valueof( + m_NG_AUTHENTICATION_REQUEST( + '000'B, + cs_ABBA('0000'O, omit), + cs_GMM_AuthRAND(vc_ng_nas_security_params_type.AuthParams.RandValue), + cs_GSM_AUTN(vc_ng_nas_security_params_type.AuthParams.AUTN) + )); + log("v_dl_message: ", v_dl_message); + log(bit2oct(encvalue(valueof(v_dl_message)))); + // Send request for DOWNLINK_NAS_TRANSPORT + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_DownlinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + bit2oct(encvalue(valueof(v_dl_message))) // AuthorizationRequest + ))); + + // Await response for AUTHENTICATION_REQUEST + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + if (f_Check_5GAKA_NAS_UL_Message( + vc_recvNAS_PDU, + mw_NG_AUTHENTICATION_RESPONSE( + { iei := '2d'O, iel := '10'O, res := vc_ng_nas_security_params_type.AuthParams.XRES } + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_ul, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_RESPONSE"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_RESPONSE"); + } + + setverdict(pass); + } + + /** + * @desc Function to await NAS AuthenticationRequest message and await for ErrorIndication message + */ + function f_await_authentication_request_await_authentication_response_failure() runs on NGNASComponent { + log(">>> f_await_authentication_request_await_authentication_response_failure"); + + // Await request for DOWNLINK_NAS_TRANSPORT + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + ?, + vc_RAN_UE_ID, + ? // AuthorizationRequest + ))); + + // Extract AMF_UE_NGAP_ID + vc_AMF_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[0].value_.aMF_UE_NGAP_ID; + log("vc_AMF_UE_ID: ", vc_AMF_UE_ID); + // Extract RAN_UE_NGAP_ID + vc_RAN_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[1].value_.rAN_UE_NGAP_ID; + log("vc_RAN_UE_ID: ", vc_RAN_UE_ID); + + // Await response for AUTHENTICATION_RESPONSE failure + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_ErrorIndication_ids( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + + setverdict(pass); + } + + /** + * @desc Function to await NAS AuthenticationRequest message and send for ErrorIndication message + */ + function f_await_authentication_request_send_authentication_response_failure() runs on NGNASComponent { + log(">>> f_await_authentication_request_send_authentication_response_failure"); + + // Await request for DOWNLINK_NAS_TRANSPORT + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + ?, + vc_RAN_UE_ID, + ? // AuthorizationRequest + ))); + + // Extract AMF_UE_NGAP_ID + vc_AMF_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[0].value_.aMF_UE_NGAP_ID; + log("vc_AMF_UE_ID: ", vc_AMF_UE_ID); + // Extract RAN_UE_NGAP_ID + vc_RAN_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[1].value_.rAN_UE_NGAP_ID; + log("vc_RAN_UE_ID: ", vc_RAN_UE_ID); + + // Await response for AUTHENTICATION_RESPONSE failure + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_ErrorIndication_ids( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + m_cause_nas(authentication_failure) + ))); + + setverdict(pass); + } + + /** + * @desc Function to send NAS SecurityModeCommand message and await for SecurityModeComplete message + */ + function f_send_security_mode_command_await_security_mode_complete() runs on NGNASComponent { + // Send request for SECURITY_MODE_COMMAND + // 1. Build the NAS message for SECURITY_MODE_COMMAND request + var NG_NAS_DL_Message_Type v_nas_message := valueof( + m_NG_SECURITY_MODE_COMMAND( + cs_NG_NAS_SecurityAlgorithms( + tsc_SHT_NoSecurityProtection, // No cyphering for SecurityModeCommand as per 24.501 cl + tsc_SHT_IntegrityProtected_Ciphered // Integrity protection only for SecurityModeCommand as per 24.501 cl. + ), + '000'B, + valueof( + m_ng_ue_security_capability( + omit, + vc_registration_request.ueSecurityCapability.iel, + vc_registration_request.ueSecurityCapability.ngeaCap, + vc_registration_request.ueSecurityCapability.ngiaCap, + vc_registration_request.ueSecurityCapability.eeaCap, + vc_registration_request.ueSecurityCapability.eiaCap, + vc_registration_request.ueSecurityCapability.spare + )), + cds_NG_IMEISV_Request, + omit, + m_additional_security_info('36'O) + )); + log("v_nas_message: ", v_nas_message); + var octetstring v_msg := bit2oct(encvalue(valueof(v_nas_message))); + // 2. Set security algorithm + f_5g_security_context(v_nas_message.security_Mode_Command, vc_ng_nas_security_params_type); + log("vc_ng_nas_security_params_type: ", vc_ng_nas_security_params_type); + // New context + vc_previous_nas_count_dl := f_NasCountInit(); + // 3. Add security if any + var NG_SECURITY_PROTECTED_NAS_MESSAGE v_security_Protected_Nas_Message; + vc_sendNAS_PDU := f_EncodeAndCipher_NG_NasPdu_v( + tsc_SHT_IntegrityProtected_NewSecurityContext, + v_msg, + tsc_DirectionDL, + PX_BEARER_ID, + vc_previous_nas_count_dl, + vc_ng_nas_security_params_type, + v_security_Protected_Nas_Message + ); + log("vc_previous_nas_count_dl: ", vc_previous_nas_count_dl); + vt_NgNasDl_Msg.security_Protected_Nas_Message := v_security_Protected_Nas_Message; + log("vc_sendNAS_PDU: ", vc_sendNAS_PDU); + // 4. Send request for DOWNLINK_NAS_TRANSPORT + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_DownlinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + vc_sendNAS_PDU + ))); + + // Await response for SECURITY_MODE_COMPLETE + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + ?, + mw_uPTransportLayerInformation_userLocationInformationNR( + mw_userLocationInformationNR( + mw_nR_CGI, + mw_tAI + ))))); + f_NASPDU_Get(vc_recvNGAP_PDU); + if (f_Check_5GAKA_NAS_UL_Message( + vc_recvNAS_PDU, + mw_NG_SECURITY_MODE_COMPLETE_no_nonIMEISV_PEI( + -, //mw_NG_MobileIdentitySUCI(PX_TYPE_OF_ID, PX_SUPI_DIGITS), //in template (value) NG_MobileIdentity p_IMEISV, + - //{ iei := omit, iel := int2oct(0, 2), replayedNASMsgContainerValue := ''O } /* 24.301 cl. 9.9.3.51 @sic R5s170597 Baseline Moving sic@ */, //in template (value) ReplayedNASMessageContainer p_NASMsg, + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_ul, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_SECURITY_MODE_COMPLETE"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NG_SECURITY_MODE_COMPLETE"); + } + + // TODO Check plainNASMessage content + + setverdict(pass); + } + + /** + * @desc Function to await NAS SecurityModeCommand message and send for SecurityModeComplete message + */ + function f_await_security_mode_command_send_security_mode_complete() runs on NGNASComponent { + log(">>> f_await_security_mode_command_send_security_mode_complete"); + + // Await request for SECURITY_MODE_COMMAND + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + ? // SecurityModeCommand + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_SECURITY_MODE_COMMAND, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: NG_SECURITY_MODE_COMMAND mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_SECURITY_MODE_COMMAND"); + setverdict(pass); + } + log("v_message: ", v_message); + + // Setup security context based on received SECURITY_MODE_COMMAND + f_5g_security_context(v_message.security_Mode_Command, vc_ng_nas_security_params_type); + vc_previous_nas_count_ul := f_NasCountInit(); + vc_previous_nas_count_dl := f_NasCountInit(); + log("f_await_security_mode_command_send_security_mode_complete: vc_previous_nas_count_ul: ", vc_previous_nas_count_ul); + log("f_await_security_mode_command_send_security_mode_complete: vc_previous_nas_count_dl: ", vc_previous_nas_count_dl); + + // Prepare response for SECURITY_MODE_COMPLETE + // 1. Registration Request message with no + var octetstring v_other_digits := // ETSI TS 124 501 Figure 9.11.3.4.3: 5GS mobile identity information element for type of identity "SUCI" and SUPI format "IMSI" + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) & + '0000'O & // Routing Indicator + '00'O & // Protection scheme + '00'O & // Home network public key identifier + PX_MSIN; + var NG_NAS_UL_Message_Type ng_registration_Request := valueof( + m_NG_REGISTRATION_REQUEST( + cs_RegistrationType(tsc_NG_RegistrationInitial, '1'B), + tsc_NasKsi_NoKey, + '0'B, // TSC, + m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID), + -, + m_ng_gmm_cap, + m_ng_ue_security_capability('04'O, -, -, 'f0'O, 'f0'O), + cs_NSSAI_SST1eMBB('2f'O), + -, -, -, -, -, -, -, -, + -, //m_ue_usagesetting, + -, -, -, -, -, -, + m_ng_update_type + )); + // 2. Add security if any + // TODO + log("ng_registration_Request: ", ng_registration_Request); + var octetstring v_msg := bit2oct(encvalue(ng_registration_Request.registration_Request)); + log("bit2oct(encvalue(ng_registration_Request.registration_Request))", v_msg); + + // 3. NAS 5GS message + log("px_IMEISV_Def: ", px_IMEISV_Def); + log("f_NG_Imeisv2MobileIdentity_v(px_IMEISV_Def): ", f_NG_Imeisv2MobileIdentity_v(px_IMEISV_Def)); + var NG_NAS_UL_Message_Type ng_security_mode_complete := valueof( + m_NG_SECURITY_MODE_COMPLETE_no_NonIMEISV_PEI( + f_NG_Imeisv2MobileIdentity_v(px_IMEISV_Def), //in template (value) NG_MobileIdentity p_IMEISV, + { iei := '71'O, iel := int2oct(lengthof(v_msg), 2), replayedNASMsgContainerValue := v_msg } + )); + ng_security_mode_complete.security_Mode_Complete.nasMsg := { iei := '71'O, iel := int2oct(lengthof(v_msg), 2), replayedNASMsgContainerValue := v_msg }; + log("ng_security_mode_complete: ", ng_security_mode_complete); + + // 4. Add security if any + v_msg := bit2oct(encvalue(ng_security_mode_complete.security_Mode_Complete)); + log("bit2oct(encvalue(ng_security_mode_complete.security_Mode_Complete))", v_msg); + var NG_SECURITY_PROTECTED_NAS_MESSAGE v_security_Protected_Nas_Message; + vc_sendNAS_PDU := f_EncodeAndCipher_NG_NasPdu_v( + tsc_SHT_IntegrityProtected_Ciphered_NewSecurityContext, + v_msg, + tsc_DirectionUL, + PX_BEARER_ID, + vc_previous_nas_count_ul, + vc_ng_nas_security_params_type, + v_security_Protected_Nas_Message + ); + log("vc_previous_nas_count_ul: ", vc_previous_nas_count_ul); + vt_NgNasUl_Msg.security_Protected_Nas_Message := v_security_Protected_Nas_Message; + log("vc_sendNAS_PDU: ", vc_sendNAS_PDU); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + vc_sendNAS_PDU, + m_uPTransportLayerInformation_userLocationInformationNR( + m_userLocationInformationNR( + m_nR_CGI, + m_tAI + ))))); + + setverdict(pass); + } + + /** + * @desc Function to await NAS SecurityModeCommand message and await for SecurityModeComplete message + */ + function f_await_security_mode_command_await_security_mode_complete() runs on NGNASComponent { + log(">>> f_await_security_mode_command_await_security_mode_complete"); + + // Await request for SECURITY_MODE_COMMAND + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + ? // SecurityModeCommand + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_SECURITY_MODE_COMMAND, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: NG_SECURITY_MODE_COMMAND mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_SECURITY_MODE_COMMAND"); + setverdict(pass); + } + log("v_message: ", v_message); + + // Await response for SECURITY_MODE_COMPLETE + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + ?, + mw_uPTransportLayerInformation_userLocationInformationNR( + mw_userLocationInformationNR( + mw_nR_CGI, + mw_tAI + ))))); + f_NASPDU_Get(vc_recvNGAP_PDU); + if (f_Check_5GAKA_NAS_UL_Message( + vc_recvNAS_PDU, + mw_NG_SECURITY_MODE_COMPLETE_no_nonIMEISV_PEI( + -, //mw_NG_MobileIdentitySUCI(PX_TYPE_OF_ID, PX_SUPI_DIGITS), //in template (value) NG_MobileIdentity p_IMEISV, + - //{ iei := omit, iel := int2oct(0, 2), replayedNASMsgContainerValue := ''O } /* 24.301 cl. 9.9.3.51 @sic R5s170597 Baseline Moving sic@ */, //in template (value) ReplayedNASMessageContainer p_NASMsg, + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_ul, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_SECURITY_MODE_COMPLETE"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NG_SECURITY_MODE_COMPLETE"); + } + + // TODO Check plainNASMessage content + + setverdict(pass); + } + + /** + * @desc Function to await NAS InitialContextSetupRequest message and await for InitialContextSetupResonse message + */ + function f_await_initial_context_setup_request_await_initial_context_setup_resonse() runs on NGNASComponent { + log(">>> f_await_initial_context_setup_request_await_initial_context_setup_resonse"); + + // Await InitialContextSetupRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + f_mw_n2_InitialContextSetupRequest( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + -, -, -, + mw_gUAMI + ( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_AMF_REGION_ID, + PX_AMF_SET_ID, + PX_AMF_POINTER + )))); + vc_initialContextSetupRequest := vc_recvNGAP_PDU.initiatingMessage.value_.InitialContextSetupRequest; + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_REGISTRATION_ACCEPT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_ACCEPT mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_REGISTRATION_ACCEPT"); + setverdict(pass); + } + log("v_message: ", v_message); + + // Await InitialContextSetupResponse + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_InitialContextSetupResponse_noPDUSessionResourceSetupListSURes( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + + setverdict(pass); + + log("<<< f_await_initial_context_setup_request_await_initial_context_setup_resonse"); + } + + /** + * @desc Function to await NAS InitialContextSetupRequest message and send for InitialContextSetupResonse message + */ + function f_await_initial_context_setup_request_send_initial_context_setup_resonse() runs on NGNASComponent { + log(">>> f_await_initial_context_setup_request_send_initial_context_setup_resonse"); + + // Await InitialContextSetupRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + f_mw_n2_InitialContextSetupRequest( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + -, -, -, + mw_gUAMI + ( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_AMF_REGION_ID, + PX_AMF_SET_ID, + PX_AMF_POINTER + )))); + vc_initialContextSetupRequest := vc_recvNGAP_PDU.initiatingMessage.value_.InitialContextSetupRequest; + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_REGISTRATION_ACCEPT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_ACCEPT mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_REGISTRATION_ACCEPT"); + setverdict(pass); + } + log("v_message: ", v_message); + + // Send InitialContextSetupResponse + f_send_NGAP_PDU( + m_ngap_succMsg( + m_n2_InitialContextSetupResponse_noPDUSessionResourceSetupListSURes( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + + setverdict(pass); + + } + + /** + * @desc Function to send NAS InitialContextSetupRequest message and await for InitialContextSetupResonse message + */ + function f_send_initial_context_setup_request_await_initial_context_setup_resonse() runs on NGNASComponent { + log(">>> f_send_initial_context_setup_request_await_initial_context_setup_resonse"); + + // Send InitialContextSetupRequest + // 1. Build the NAS message for Registration Accept + var NG_NAS_DL_Message_Type v_nas_message := valueof( + m_NG_REGISTRATION_ACCEPT( + cs_RegistrationResult( + '001'B, + '0'B, + '0'B, + '0'B, + '0'B + ), + f_NG_Imeisv2MobileIdentity_v(px_IMEISV_Def), + -, + m_NG_TrackingAreaIdList( + -, + m_NG_TrackingAreaIdList_LV( + '07'O, + { + m_NG_ListOfPartialTaiList( + -, -, + '00001'B, + valueof( + m_NG_PartialTaiType_type3( + m_NG_Type3Element( + fl_NasNN_MCC2PlmnId( + PX_NAS_MCC, + PX_NAS_MNC + ))))) + } + )), + cs_NSSAI_SST1eMBB('15'O), + -, -, + cs_NG_NetworkFeatureSupport_Def, + -, -, -, -, -, -, -, + cs_GprsTimer3( + -, + '100'B, + '10010'B + ))); + log("v_nas_message: ", v_nas_message); + var octetstring v_msg := bit2oct(encvalue(valueof(v_nas_message))); + // 2. Add security if any + var NG_SECURITY_PROTECTED_NAS_MESSAGE v_security_Protected_Nas_Message; + vc_sendNAS_PDU := f_EncodeAndCipher_NG_NasPdu_v( + tsc_SHT_IntegrityProtected_NewSecurityContext, + v_msg, + tsc_DirectionDL, + PX_BEARER_ID, + vc_previous_nas_count_dl, + vc_ng_nas_security_params_type, + v_security_Protected_Nas_Message + ); + log("vc_previous_nas_count_dl: ", vc_previous_nas_count_dl); + vt_NgNasDl_Msg.security_Protected_Nas_Message := v_security_Protected_Nas_Message; + log("vc_sendNAS_PDU: ", vc_sendNAS_PDU); + // 3. Calculate the SecretKey for gNB based on the security context established with AMF + var B256_Type v_k_gnb := f_NG_Authentication_A9(vc_previous_nas_count_dl, + vc_ng_nas_security_params_type.KAMF, + Access_3GPP, + tsc_KDF_HMAC_SHA_256 + ); + log("v_k_gnb: ", bit2oct(v_k_gnb)); + // 4. Send InitialContextSetupRequest + // FIXME Issue with function: Dynamic test case error: Creating a template from an unbound integer value + // var InitiatingMessage v_initialContextSetupRequest := valueof( + // f_m_n2_InitialContextSetupRequest( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID, + // -, -, -, + // m_gUAMI( + // fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + // PX_AMF_REGION_ID, + // PX_AMF_SET_ID, + // PX_AMF_POINTER + // ), + // -, + // { + // m_allowedNSSAI_Item( + // m_s_NSSAI('00'O, '000000'O) + // ) + // }, + // m_uESecurityCapabilities, + // v_k_gnb, + // -, -, -, -, -, + // vc_sendNAS_PDU + // )); + var InitiatingMessage v_initialContextSetupRequest := valueof( + m_n2_InitialContextSetupRequest_noPDUSessionResourceSetupListCxtReq( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + m_gUAMI( + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + PX_AMF_REGION_ID, + PX_AMF_SET_ID, + PX_AMF_POINTER + ), + { + m_allowedNSSAI_Item( + m_s_NSSAI('00'O, '000000'O) + ) + }, + m_uESecurityCapabilities, + v_k_gnb, + -, + vc_sendNAS_PDU + )); + vc_initialContextSetupRequest := v_initialContextSetupRequest.value_.InitialContextSetupRequest; + log("vc_initialContextSetupRequest: ", vc_initialContextSetupRequest); + f_send_NGAP_PDU( + m_ngap_initMsg( + v_initialContextSetupRequest + )); + + // Await InitialContextSetupResponse + // FIXME FSCOM To be continued + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_InitialContextSetupResponse_noPDUSessionResourceSetupListSURes( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + log("<<< f_send_initial_context_setup_request_await_initial_context_setup_resonse"); + } + + function f_await_retrieve_ue_information_await_ue_information_transfer() runs on NGNASComponent { + log(">>> f_await_retrieve_ue_information_await_ue_information_transfer"); + + // Await RetrieveUEInformation + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_RetrieveUEInformation( + mw_fiveG_S_TMSI( // FiveG_S_TMSI + PX_AMF_SET_ID, + PX_AMF_POINTER, + '00000001'O + )))); + // Await UEInformationTransfer + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEInformationTransfer( + mw_fiveG_S_TMSI( + PX_AMF_SET_ID, + PX_AMF_POINTER, + ? + )))); + } + + function f_send_retrieve_ue_information_await_ue_information_transfer() runs on NGNASComponent { + log(">>> f_send_retrieve_ue_information_await_ue_information_transfer"); + + // Send RetrieveUEInformation + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_RetrieveUEInformation( + m_fiveG_S_TMSI( // FiveG_S_TMSI + PX_AMF_SET_ID, + PX_AMF_POINTER, + '00000001'O, + omit + )))); + // Await UEInformationTransfer + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEInformationTransfer( + mw_fiveG_S_TMSI( + PX_AMF_SET_ID, + PX_AMF_POINTER, + ? + )))); + } + + /** + * @desc Function to send NAS RegistrationComplete message + */ + function f_send_registration_complete() runs on NGNASComponent { + log(">>> f_send_registration_complete"); + + // Send request for REGISTRATION_COMPLETE + // Compute NAS message + var NG_NAS_UL_Message_Type v_nas_message := valueof( + m_NG_REGISTRATION_COMPLETE_noSOR + ); + // 2. Add security if any + log("f_send_registration_complete: ", v_nas_message); + var octetstring v_msg := bit2oct(encvalue(v_nas_message)); + log("bit2oct(encvalue(f_send_registration_complete))", v_msg); + + // 3. Add security if any + var NG_SECURITY_PROTECTED_NAS_MESSAGE v_security_Protected_Nas_Message; + vc_sendNAS_PDU := f_EncodeAndCipher_NG_NasPdu_v( + tsc_SHT_IntegrityProtected_Ciphered, + v_msg, + tsc_DirectionUL, + PX_BEARER_ID, + vc_previous_nas_count_ul, + vc_ng_nas_security_params_type, + v_security_Protected_Nas_Message + ); + log("vc_previous_nas_count_ul: ", vc_previous_nas_count_ul); + vt_NgNasUl_Msg.security_Protected_Nas_Message := v_security_Protected_Nas_Message; + log("vc_sendNAS_PDU: ", vc_sendNAS_PDU); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + vc_sendNAS_PDU, + m_uPTransportLayerInformation_userLocationInformationNR( + m_userLocationInformationNR( + m_nR_CGI, + m_tAI + ))))); + + setverdict(pass); + } + + /** + * @desc Function to await NAS RegistrationComplete message + */ + function f_await_registration_complete() runs on NGNASComponent { + log(">>> f_await_registration_complete"); + + // Await request for UERadiCapability - OPTIONAL? + // TODO FSCOM: Move it into a function + alt { + [] N2_gNBaMF_P.check( // Check if received message is UERadioCapabilityInfoIndication, if yes consume it and continue to wait for REGISTRATION_COMPLETE + receive( + mw_ngap_initMsg( + mw_n2_UERadioCapabilityInfoIndication( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + ? + )))) { + f_recv_NGAP_PDU( // Consume the message + mw_ngap_initMsg( + mw_n2_UERadioCapabilityInfoIndication( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + ? + ))); + } + [] N2_gNBaMF_P.check(receive(NGAP_PDU: ?)) { + // continue + } + } + + // Await request for REGISTRATION_COMPLETE + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU) + if (f_Check_5GAKA_NAS_UL_Message( + vc_recvNAS_PDU, + mw_NG_REGISTRATION_COMPLETE_noSOR, + vc_ng_nas_security_params_type, + vc_previous_nas_count_ul, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_COMPLETE mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_REGISTRATION_COMPLETE"); + setverdict(pass); + } + + log("<<< f_await_registration_complete"); + } + + function f_send_pdu_session_establishment_request() runs on NGNASComponent { + log(">>> f_send_pdu_session_establishment_request"); + + // 1. Prepare PDUSessionEstablishmentRequest message + var NG_NAS_UL_Message_Type v_ng_pdu_session_establishment_request := valueof( + m_NG_PDU_SESSION_ESTABLISHMENT_REQUEST( + cs_NG_PDU_SessionId(int2oct(PX_PDU_SESSION_ID, 1), omit), + tsc_PTI_1, + m_PDU_SessionType_iei('001'B), + crs_SSC_Mode('9'H, '001'B), + m_ng_ue_sm_cap, + -, + m_integrity_prot_max_data_rate, + -, -, + f_NAS_ExtdProtocolConfigOptionsTX( + { + cs_ProtocolContainer_Common('000a'O), + cs_ProtocolContainer_Common('000d'O) + } + + ))); + v_ng_pdu_session_establishment_request.pdu_Session_Establishment_Request.protocolDiscriminator := tsc_EPD_GSM; + // 2. Prepare UL NAS Transport message + log("v_ng_pdu_session_establishment_request: ", v_ng_pdu_session_establishment_request); + var octetstring v_msg := bit2oct(encvalue(v_ng_pdu_session_establishment_request)); + log("bit2oct(encvalue(v_ng_pdu_session_establishment_request))", v_msg); + var NG_NAS_UL_Message_Type v_ng_ul_nas_transport := valueof( + m_NG_UL_NAS_TRANSPORT( + { iei := omit, container := '0001'B }, // N1 SM information (1) + m_PayloadContainer( + -, + int2oct(lengthof(v_msg), 2), + v_msg + ), + cr_NG_PDU_SessionId ('12'O, int2oct(PX_PDU_SESSION_ID, 1)), + -, + cr_NG_Request_Type('001'B), + cs_S_NSSAI_WithIEI('22'O, cs_S_NSSAI('01'O, PX_SST, omit)), + cs_DNN(-, '08696e7465726e6574'O) // internet + )); + + // 3. Add security if any + log("v_ng_ul_nas_transport: ", v_ng_ul_nas_transport); + v_msg := bit2oct(encvalue(v_ng_ul_nas_transport)); + log("bit2oct(encvalue(v_ng_ul_nas_transport))", v_msg); + + // 4. Add security if any + var NG_SECURITY_PROTECTED_NAS_MESSAGE v_security_Protected_Nas_Message; + vc_sendNAS_PDU := f_EncodeAndCipher_NG_NasPdu_v( + tsc_SHT_IntegrityProtected_Ciphered, + v_msg, + tsc_DirectionUL, + PX_BEARER_ID, + vc_previous_nas_count_ul, + vc_ng_nas_security_params_type, + v_security_Protected_Nas_Message + ); + log("vc_previous_nas_count_ul: ", vc_previous_nas_count_ul); + vt_NgNasUl_Msg.security_Protected_Nas_Message := v_security_Protected_Nas_Message; + log("vc_sendNAS_PDU: ", vc_sendNAS_PDU); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + vc_sendNAS_PDU, + m_uPTransportLayerInformation_userLocationInformationNR( + m_userLocationInformationNR( + m_nR_CGI, + m_tAI + ))))); + + setverdict(pass); + + log("<<< f_send_pdu_session_establishment_request"); + } + + function f_await_pdu_session_establishment_request() runs on NGNASComponent { + log(">>> f_await_pdu_session_establishment_request"); + + // Await PDUSessionEstablishmentRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + if (f_Check_5GAKA_NAS_UL_Message( + vc_recvNAS_PDU, + mw_NG_PDU_SESSION_ESTABLISHMENT_REQUEST, + vc_ng_nas_security_params_type, + vc_previous_nas_count_ul, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: PDU_SESSION_ESTABLISHMENT_REQUEST mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected PDU_SESSION_ESTABLISHMENT_REQUEST"); + setverdict(pass); + } + } + + function f_send_session_establishment_accept() runs on NGNASComponent { + log(">>> f_send_session_establishment_accept"); + + // Send PDUSessionEstablishmentRequest + // vt_NgNasUl_Msg := m_NG_SECURITY_MODE_COMPLETE( + // m_NG_MobileIdentitySUCI(PX_TYPE_OF_ID, PX_SUPI_DIGITS), //in template (value) NG_MobileIdentity p_IMEISV, + // { iei := omit, iel := int2oct(0, 2), replayedNASMsgContainerValue := ''O } /* 24.301 cl. 9.9.3.51 @sic R5s170597 Baseline Moving sic@ */, //in template (value) ReplayedNASMessageContainer p_NASMsg, + // m_NG_MobileIdentitySUCI(PX_TYPE_OF_ID,PX_SUPI_DIGITS) //in template (value) NG_MobileIdentity p_NonIMEISV_PEI + // ); + // var octetstring os := ''O; // TODO + // // var octetstring os := bit2oct( + // // encvalue( + // // valueof( + // // m_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT( + // // cs_NG_PDU_SessionId, + // // tsc_PTI_1 + // // )))); + // vt_NgNasUl_Msg.security_Protected_Nas_Message := m_NG_SECURITY_PROTECTED_NAS_MESSAGE( + // tsc_EPD_GMM, + // tsc_SpareHalfOctet, + // tsc_SHT_IntegrityProtected_Ciphered, + // '00000000'O, // FIXME How to calculate MessageAuthenticationCode? + // '00'O, + // os // Cyphered NAS message + // ); + + // vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); + // f_send_NGAP_PDU( + // m_ngap_initMsg( + // m_n2_UplinkNASTransport( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID, + // vc_sendNAS_PDU, + // m_uPTransportLayerInformation_userLocationInformationNR( + // m_userLocationInformationNR( + // m_nR_CGI, + // m_tAI + // ))))); + + } + + function f_await_session_establishment_accept() runs on NGNASComponent { + log(">>> f_await_session_establishment_accept"); + + // Await PDUSessionEstablishmentRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + ? // SecurityModeCommand + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_ul, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: PDU_SESSION_ESTABLISHMENT_ACCEPT mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected PDU_SESSION_ESTABLISHMENT_ACCEPT"); + setverdict(pass); + } + } + + function f_send_pdu_session_resource_setup_request() runs on NGNASComponent { + log(">>> f_send_pdu_session_resource_setup_request"); + + // Send PDUSessionResourceSetupRequest + // TODO FSCOM Set vc_pdu_session_resource_setup_list_su_req + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_PDUSessionResourceSetupRequest( + -, + -, + { + m_pDUSessionResourceSetupItemSUReq( + -, + m_s_NSSAI('00'O, '000000'O), + bit2oct( + encvalue( + m_pDUSessionResourceSetupRequestTransfer( + m_pDUSessionResourceSetupRequestTransfer_mandatories( + m_pDUSessionType(ipv4), + { + m_qosFlowSetupRequestItem( + PX_QOS_FLOW_IDENTIFIER, + m_qosFlowLevelQosParameters( + m_qosCharacteristics_dynamic5QI( + m_dynamic5QIDescriptor( + 1,//in template (value) PriorityLevelQos p_priorityLevelQos, + 0,//in template (value) PacketDelayBudget p_packetDelayBudget, + m_PacketErrorRate( + 0,//in template (value) PacketErrorRate.pERScalar p_pERScalar, + 0//in template (value) PacketErrorRate.pERExponent p_pERExponent + ))), + m_allocationAndRetentionPriority( + 1,//in template (value) PriorityLevelARP p_priorityLevelARP, + shall_not_trigger_pre_emption,//in template (value) Pre_emptionCapability p_pre_emptionCapability, + not_pre_emptable//in template (value) Pre_emptionVulnerability p_pre_emptionVulnerability, + ))) + }, + m_uPTransportLayerInformation_gTPTunnel( + m_gTPTunnel + )))))) + } + ))); + } + + function f_await_pdu_session_resource_setup_request() runs on NGNASComponent { + log(">>> f_await_pdu_session_resource_setup_request"); + + // Await PDUSessionEstablishmentRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + f_mw_n2_PDUSessionResourceSetupRequest( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + -, + -, + { + mw_pDUSessionResourceSetupItemSUReq( + PX_PDU_SESSION_ID, + mw_s_NSSAI( + PX_SST/*, + PX_SD, + -*/ + ), + ?,//decmatch(mw_pDUSessionResourceSetupRequestTransfer(?)),//OCTETSTRING + -,//in template (omit) NAS_PDU p_pDUSessionNAS_PDU := omit, + -//in template (omit) PDUSessionResourceSetupItemSUReq.iE_Extensions p_iE_Extensions := omit + ) + }, + ? + ))); + + var integer numOfIEs := lengthof(vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs) + log("*** " & __SCOPE__ & ": DBG: numOfIEs: ", numOfIEs, ""); + for (var integer i :=0 ; i < numOfIEs; i := i + 1) { // Loop over the protocolIEs found + if ((vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs[i].id) == 74 /*id_NAS_PDU*/) { + var integer numOfItems := lengthof(vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs[i].value_.pDUSessionResourceSetupListSUReq) + log("*** " & __SCOPE__ & ": DBG: Number of items in pDUSessionResourceSetupListSUReq: ", numOfItems); + if (numOfItems > 0) { + vc_pdu_session_resource_setup_list_su_req := vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs[i].value_.pDUSessionResourceSetupListSUReq; + for (var integer j :=0; j < numOfItems; j := j + 1) { // Loop over the PDUSessionResourceSetupListSUReq items + log("*** " & __SCOPE__ & ": DBG: pDUSessionNAS_PDU of item ", j, ": ", vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs[i].value_.pDUSessionResourceSetupListSUReq[j].pDUSessionNAS_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNGAP_PDU.initiatingMessage.value_.pDUSessionResourceSetupRequest.protocolIEs[i].value_.pDUSessionResourceSetupListSUReq[j].pDUSessionNAS_PDU, + mw_NG_DL_NAS_TRANSPORT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: NG_PDU_SESSION_ESTABLISHMENT_ACCEPT mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": DBG: v_message.dl_Nas_Transport ", v_message.dl_Nas_Transport); + var bitstring v_bs := oct2bit(v_message.dl_Nas_Transport.payload.payload); + var NG_PDU_SESSION_ESTABLISHMENT_ACCEPT v_ng_pdu_session_establishment_accept; + if (decvalue(v_bs, v_ng_pdu_session_establishment_accept) != 0) { + log("*** " & __SCOPE__ & ": INCONC: Failed to decode dl_Nas_Transport payload"); + setverdict(inconc); + } else { + log("*** " & __SCOPE__ & ": DBG: v_ng_pdu_session_establishment_accept: ", v_ng_pdu_session_establishment_accept); + var NG_NAS_DL_Message_Type v_expected_message; + v_expected_message.pdu_Session_Establishment_Accept := v_ng_pdu_session_establishment_accept; + if (not(match(v_expected_message, mw_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT_noPTI))) { + log(match(v_expected_message, mw_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT_noPTI)); // Log mismatch + log("*** " & __SCOPE__ & ": FAIL: NG_PDU_SESSION_ESTABLISHMENT_ACCEPT mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_PDU_SESSION_ESTABLISHMENT_ACCEPT"); + setverdict(pass); + } + } + } + } // End of 'for' statement + } else { + log("*** " & __SCOPE__ & ": FAIL: No items in pDUSessionResourceSetupListSUReq."); + setverdict(fail); + } + break; // Break the loop as the relevant IE has been processed + } + } // End of 'for' statement + } + + function f_send_pdu_session_resource_setup_response() runs on NGNASComponent { + log(">>> f_send_pdu_session_resource_setup_response"); + + // Send PDUSessionEstablishmentResponse + var NGAP_IEs.PDUSessionResourceSetupResponseTransfer v_pDUSessionResourceSetupResponseTransfer := { + dLQosFlowPerTNLInformation := { + uPTransportLayerInformation := { + gTPTunnel := { + transportLayerAddress := PX_TRANSPORT_LAYER_ADDRESS, + gTP_TEID := PX_GTP_TEID, + iE_Extensions := omit + } + }, + associatedQosFlowList := { + { + qosFlowIdentifier := 1, + qosFlowMappingIndication := omit, + iE_Extensions := omit + } + }, + iE_Extensions := omit + }, + additionalDLQosFlowPerTNLInformation := omit, + securityResult := omit, + qosFlowFailedToSetupList := omit, + iE_Extensions := omit + }; + log( + "f_send_pdu_session_resource_setup_response:v_pDUSessionResourceSetupResponseTransfer: ", + v_pDUSessionResourceSetupResponseTransfer + ); + // FIXME TITAN issue workaround bit2oct(encvalue(v_pDUSessionResourceSetupResponseTransfer, "PER:ALIGNED", "PER:ALIGNED")); + // I cannot reproduce the issue with a simpler structure, but it seems that encoding v_pDUSessionResourceSetupResponseTransfer with PER aligned is not working in TITAN. The workaround is to directly use the expected encoded value (which is also the one generated by asn1c and Wireshark) instead of encoding the structure in TTCN3. + var octetstring v_os := bit2oct(encvalue(v_pDUSessionResourceSetupResponseTransfer)); + log( + "f_send_pdu_session_resource_setup_response:encvalue v_pDUSessionResourceSetupResponseTransfer: ", + v_os + ); + //v_os := '0003E07F000001000000010001'O; // So, force with the correct encoded value + v_os := '0003E0'O & bit2oct(PX_TRANSPORT_LAYER_ADDRESS) & '000000010001'O; // So, force with the correct encoded value + vc_pdu_session_resource_setup_list_su_res := { + valueof( + m_pDUSessionResourceSetupItemSURes( + vc_pdu_session_resource_setup_list_su_req[0].pDUSessionID, // Reuse the same PDU Session ID as in the request + v_os + )) + }; + log("f_send_pdu_session_resource_setup_response: vc_pdu_session_resource_setup_list_su_res: ", vc_pdu_session_resource_setup_list_su_res); + f_send_NGAP_PDU( + m_ngap_succMsg( + m_n2_PDUSessionResourceSetupResponse( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + vc_pdu_session_resource_setup_list_su_res, + m_uPTransportLayerInformation_userLocationInformationNR( + m_userLocationInformationNR( + m_nR_CGI, + m_tAI + ))))); + } + + function f_await_pdu_session_resource_setup_response() runs on NGNASComponent { + log(">>> f_await_pdu_session_resource_setup_response"); + + // Await PDUSessionResourceSetupResponse + f_recv_NGAP_PDU( + mw_ngap_succMsg( + mw_n2_PDUSessionResourceSetupResponse( + vc_AMF_UE_ID, + -, + { + ( + mw_pDUSessionResourceSetupItemSURes( + ?,//template (present) PDUSessionID p_pDUSessionID, + decmatch ( + mw_pDUSessionResourceSetupResponseTransfer( + ?,//template (present) QosFlowPerTNLInformation p_dLQosFlowPerTNLInformation := ?, + *,//template QosFlowPerTNLInformationList p_additionalDLQosFlowPerTNLInformation := *, + *,//template SecurityResult p_securityResult := *, + *,//template QosFlowListWithCause p_qosFlowFailedToSetupList := *, + *//template PDUSessionResourceSetupResponseTransfer.iE_Extensions p_iE_Extensions := * + )),// Decode&Match - In ASN1 it is OCTET STRING - PDUSessionResourceSetupResponseTransfer + *//template PDUSessionResourceSetupItemSURes.iE_Extensions p_iE_Extensions := * + )) + }, + mw_uPTransportLayerInformation_userLocationInformationNR( + mw_userLocationInformationNR( + mw_nR_CGI, + mw_tAI + ))))); + vc_pdu_session_resource_setup_list_su_res := valueof(vc_recvNGAP_PDU.successfulOutcome.value_.PDUSessionResourceSetupResponse.protocolIEs[2].value_.PDUSessionResourceSetupListSURes); + log("f_await_pdu_session_resource_setup_response: vc_pdu_session_resource_setup_list_su_res: ", vc_pdu_session_resource_setup_list_su_res); + } + + function f_await_pdu_session_resource_release_request() runs on NGNASComponent { + log(">>> f_await_pdu_session_resource_release_request"); + + // Await NG_PDU_SESSION_RELEASE_REQUEST + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU) + if (f_Check_5GAKA_NAS_UL_Message( + vc_recvNAS_PDU, + mw_NG_PDU_SESSION_RELEASE_REQUEST, + vc_ng_nas_security_params_type, + vc_previous_nas_count_ul, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: NG_PDU_SESSION_RELEASE_REQUEST mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected NG_PDU_SESSION_RELEASE_REQUEST"); + setverdict(pass); + } + } + + function f_send_pdu_session_resource_release_request() runs on NGNASComponent { + log(">>> f_send_pdu_session_resource_release_request"); + + // Send request for NG_PDU_SESSION_RELEASE_REQUEST + var NG_NAS_UL_Message_Type v_ng_pdu_session_release_request := valueof( + m_NG_PDU_SESSION_RELEASE_REQUEST( + cs_NG_PDU_SessionId(int2oct(vc_pdu_session_resource_setup_list_su_req[0].pDUSessionID, 1), omit), + tsc_PTI_1, + cs_GMM_GSM_Cause ('59'O, '00100100'B) + )); + v_ng_pdu_session_release_request.pdu_Session_Release_Request.protocolDiscriminator := tsc_EPD_GSM; + // 2. Prepare UL NAS Transport message + log("v_ng_pdu_session_release_request: ", v_ng_pdu_session_release_request); + var octetstring v_msg := bit2oct(encvalue(v_ng_pdu_session_release_request)); + log("bit2oct(encvalue(v_ng_pdu_session_release_request))", v_msg); + var NG_NAS_UL_Message_Type v_ng_ul_nas_transport := valueof( + m_NG_UL_NAS_TRANSPORT( + { iei := omit, container := '0001'B }, // N1 SM information (1) + m_PayloadContainer( + -, + int2oct(lengthof(v_msg), 2), + v_msg + ), + cr_NG_PDU_SessionId('12'O, int2oct(vc_pdu_session_resource_setup_list_su_req[0].pDUSessionID, 1)) + )); + + // 3. Add security if any + log("f_send_pdu_session_resource_release_request: ", v_ng_ul_nas_transport); + v_msg := bit2oct(encvalue(v_ng_ul_nas_transport)); + log("bit2oct(encvalue(f_send_pdu_session_resource_release_request))", v_msg); + + // 4. Add security if any + var NG_SECURITY_PROTECTED_NAS_MESSAGE v_security_Protected_Nas_Message; + vc_sendNAS_PDU := f_EncodeAndCipher_NG_NasPdu_v( + tsc_SHT_IntegrityProtected_Ciphered, + v_msg, + tsc_DirectionUL, + PX_BEARER_ID, + vc_previous_nas_count_ul, + vc_ng_nas_security_params_type, + v_security_Protected_Nas_Message + ); + log("vc_previous_nas_count_ul: ", vc_previous_nas_count_ul); + vt_NgNasUl_Msg.security_Protected_Nas_Message := v_security_Protected_Nas_Message; + log("vc_sendNAS_PDU: ", vc_sendNAS_PDU); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + vc_sendNAS_PDU, + m_uPTransportLayerInformation_userLocationInformationNR( + m_userLocationInformationNR( + m_nR_CGI, + m_tAI + ))))); + + setverdict(pass); + } + + function f_await_pdu_session_resource_release_command() runs on NGNASComponent { + log(">>> f_await_pdu_session_resource_release_command"); + + // Await NG_PDU_SESSION_RELEASE_COMMAND + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_PDUSessionResourceReleaseCommand( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_DL_NAS_TRANSPORT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("f_await_pdu_session_resource_release_command: Unexpected NG_PDU_SESSION_RELEASE_COMMAND"); + setverdict(fail); + } else { + log("f_await_pdu_session_resource_release_command: v_message.dl_Nas_Transport ", v_message.dl_Nas_Transport); + var bitstring v_bs := oct2bit(v_message.dl_Nas_Transport.payload.payload); + var NG_PDU_SESSION_RELEASE_COMMAND v_ng_pdu_session_release_command; + if (decvalue(v_bs, v_ng_pdu_session_release_command) != 0) { + log("f_await_pdu_session_resource_release_command: Failed to decode dl_Nas_Transport payload"); + setverdict(inconc); + } else { + log("f_await_pdu_session_resource_release_command: v_ng_pdu_session_release_command: ", v_ng_pdu_session_release_command); + var NG_NAS_DL_Message_Type v_expected_message; + v_expected_message.pdu_Session_Release_Command := v_ng_pdu_session_release_command; + if (not(match(v_expected_message, mw_NG_PDU_SESSION_RELEASE_COMMAND(cs_NG_PDU_SessionId(int2oct(vc_pdu_session_resource_setup_list_su_req[0].pDUSessionID, 1), omit))))) { + log(match(v_expected_message, mw_NG_PDU_SESSION_RELEASE_COMMAND(cs_NG_PDU_SessionId(int2oct(vc_pdu_session_resource_setup_list_su_req[0].pDUSessionID, 1), omit)))); // Log mismatch + log("f_await_pdu_session_resource_release_command: FAIL: NG_PDU_SESSION_RELEASE_COMMAND mismatch."); + setverdict(fail); + } else { + log("f_await_pdu_session_resource_release_command: PASS: Expected NG_PDU_SESSION_RELEASE_COMMAND"); + setverdict(pass); + } + } + } + } + + function f_await_pdu_session_resource_release_request_await_pdu_session_resource_release_command() runs on NGNASComponent { + // Await NG_PDU_SESSION_RELEASE_REQUEST + f_await_pdu_session_resource_release_request(); + // Await NG_PDU_SESSION_RELEASE_COMMAND + f_await_pdu_session_resource_release_command(); + } + + function f_send_pdu_session_resource_release_request_await_pdu_session_resource_release_command() runs on NGNASComponent { + // Send NG_PDU_SESSION_RELEASE_REQUEST + f_send_pdu_session_resource_release_request(); + // Await NG_PDU_SESSION_RELEASE_COMMAND + f_await_pdu_session_resource_release_command(); + } + + // function f_await_pdu_session_resource_setup_request_await_session_resource_setup_response() runs on NGNASComponent { + // log(">>> f_await_pdu_session_resource_setup_request_await_session_resource_setup_response"); + + // // Await PDUSessionEstablishmentRequest + // f_recv_NGAP_PDU( + // mw_ngap_initMsg( + // mw_n2_PDUSessionResourceSetupRequest( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID, + // { + // mw_pDUSessionResourceSetupItemSUReq( + // PX_PDU_SESSION_ID, + // mw_s_NSSAI( + // PX_SST, + // PX_SD,//in template (omit) SD p_sD := omit, + // -//in template (omit) S_NSSAI.iE_Extensions p_iE_Extensions := omit + // ), + // ?,//decmatch(mw_pDUSessionResourceSetupRequestTransfer(?)),//OCTETSTRING + // -,//in template (omit) NAS_PDU p_pDUSessionNAS_PDU := omit, + // -//in template (omit) PDUSessionResourceSetupItemSUReq.iE_Extensions p_iE_Extensions := omit + // ) + // }//in template (value) PDUSessionResourceSetupListSUReq p_pDUSessionResourceSetupListSUReq + // ))); + + + // // Await PDUSessionEstablishmentResponse + // f_recv_NGAP_PDU( + // mw_ngap_succMsg( + // mw_n2_PDUSessionResourceSetupResponse( + // vc_AMF_UE_ID, + // -, + // { + // ( + // mw_pDUSessionResourceSetupItemSURes( + // ?,//template (present) PDUSessionID p_pDUSessionID, + // decmatch ( + // mw_pDUSessionResourceSetupResponseTransfer( + // ?,//template (present) QosFlowPerTNLInformation p_dLQosFlowPerTNLInformation := ?, + // *,//template QosFlowPerTNLInformationList p_additionalDLQosFlowPerTNLInformation := *, + // *,//template SecurityResult p_securityResult := *, + // *,//template QosFlowListWithCause p_qosFlowFailedToSetupList := *, + // *//template PDUSessionResourceSetupResponseTransfer.iE_Extensions p_iE_Extensions := * + // )),// Decode&Match - In ASN1 it is OCTET STRING - PDUSessionResourceSetupResponseTransfer + // *//template PDUSessionResourceSetupItemSURes.iE_Extensions p_iE_Extensions := * + // )) + // } + // ))); + // } + + function f_await_configuration_update_command() runs on NGNASComponent { + log(">>> f_await_configuration_update_command"); + + // Await ConfigurationUpdateCommand + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_CONFIGURATION_UPDATE_COMMAND( + -, -, -, -, -, + mw_network_name( + -, -, -, -, -, + -//unichar2oct(oct2unichar(char2oct(PX_NETWORK_NAME))) + ), + -, + cs_TimeZone(PX_TIME_ZONE), + ?, // TimeZoneAndTime + ? // DaylightSavingTime + ), + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("f_await_configuration_update_command: NG_CONFIGURATION_UPDATE_COMMAND mismatch."); + setverdict(fail); + } else { + log("f_await_configuration_update_command: PASS: Expected NG_CONFIGURATION_UPDATE_COMMAND"); + setverdict(pass); + } + log("v_message: ", v_message); + + log("<<< f_await_configuration_update_command"); + } + + function f_await_initial_context_setup_failure() runs on NGNASComponent { + log(">>> f_send_initial_context_setup_failure"); + + // Await InitialContextSetupFailure + f_recv_NGAP_PDU( + mw_ngap_unsuccMsg( + mw_n2_InitialContextSetupFailure_noPDUSessionResourceFailedToSetupListCxtFail( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + } + + function f_send_initial_context_setup_failure() runs on NGNASComponent { + log(">>> f_send_initial_context_setup_failure"); + + // Send InitialContextSetupFailure + f_send_NGAP_PDU( + m_ngap_unsuccMsg( + m_n2_InitialContextSetupFailure_noPDUSessionResourceFailedToSetupListCxtFail( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + m_cause_radioNetwork(unspecified) + ))); + } + + function f_await_ue_context_release_command_await_ue_context_release_complete() runs on NGNASComponent { + log(">>> f_await_ue_context_release_command_await_ue_context_release_complete"); + + // Await UEContextRealeaseCommand + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextReleaseCommand + )); + + // Await UEContextReleaseComplete + f_recv_NGAP_PDU( + mw_ngap_succMsg( + f_mw_n2_UEContextReleaseComplete( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + } + + function f_await_ue_context_release_command_send_ue_context_release_complete() runs on NGNASComponent { + log(">>> f_await_ue_context_release_command_send_ue_context_release_complete"); + + // Await UEContextRealeaseCommand + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextReleaseCommand + )); + + // Send UEContextReleaseComplete + f_send_NGAP_PDU( + m_ngap_succMsg( + f_m_n2_UEContextReleaseComplete( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + // f_send_NGAP_PDU( + // m_ngap_succMsg( + // m_n2_UEContextReleaseComplete_noPDUSessionResourceSetupListSURes( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID + // ))); + } + + function f_await_ue_context_release_request() runs on NGNASComponent { + log(">>> f_await_ue_context_release_request"); + + // Await UEContextReleaseRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextReleaseRequest( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + m_cause_radioNetwork(unspecified) + ))); + } + + function f_send_ue_context_release_request() runs on NGNASComponent { + log(">>> f_send_ue_context_release_request"); + + // Send UEContextReleaseRequest + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UEContextReleaseRequest( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + m_cause_radioNetwork(unspecified) + ))); + } + + function f_await_ue_context_release_complete() runs on NGNASComponent { + log(">>> f_await_ue_context_release_complete"); + + // Await UEContextReleaseComplete + f_recv_NGAP_PDU( + mw_ngap_succMsg( + f_mw_n2_UEContextReleaseComplete( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + } + + function f_send_ue_context_release_complete() runs on NGNASComponent { + log(">>> f_send_ue_context_release_complete"); + + // Send UEContextReleaseComplete + f_send_NGAP_PDU( + m_ngap_succMsg( + f_m_n2_UEContextReleaseComplete( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + // f_send_NGAP_PDU( + // m_ngap_succMsg( + // m_n2_UEContextReleaseComplete_noPDUSessionResourceSetupListSURes( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID + // ))); + } + + function f_send_ue_context_release_request_await_ue_context_release_response( + in template (value) Cause p_Cause + ) runs on NGNASComponent { + log(">>> f_send_ue_context_release_request_await_ue_context_release_response"); + + // Send UEContextReleaseRequest + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UEContextReleaseRequest( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + p_Cause + ))); + // Await UEContextReleaseCommand + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextReleaseCommand( + -, + p_Cause + ))); + // Send UEContextReleaseComplete + f_send_NGAP_PDU( + m_ngap_succMsg( + f_m_n2_UEContextReleaseComplete( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + // f_send_NGAP_PDU( + // m_ngap_succMsg( + // m_n2_UEContextReleaseComplete( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID + // ))); + } + + function f_await_ue_context_release_request_await_ue_context_release_response( + in template (value) Cause p_Cause + ) runs on NGNASComponent { + log(">>> f_await_ue_context_release_request_await_ue_context_release_response"); + + // Send UEContextReleaseRequest + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextReleaseRequest( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + p_Cause + ))); + // Await UEContextReleaseCommand + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UEContextReleaseCommand( + -, + p_Cause + ))); + // await UEContextReleaseComplete + f_recv_NGAP_PDU( + mw_ngap_succMsg( + f_mw_n2_UEContextReleaseComplete( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + } + + /** + * @desc Function to send NAS DeregistrationRequest message + */ + function f_send_deregistration_request() runs on NGNASComponent { + log(">>> f_send_deregistration_request"); + + // Send request for DEREGISTRATION_REQUEST + var octetstring v_other_digits := // ETSI TS 124 501 Figure 9.11.3.4.3: 5GS mobile identity information element for type of identity "SUCI" and SUPI format "IMSI" + fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) & + '0000'O & // Routing Indicator + '00'O & // Protection scheme + '00'O & // Home network public key identifier + PX_MSIN; + log("f_send_deregistration_request: v_other_digits: ", v_other_digits); + log("f_send_deregistration_request: m_NG_MobileIdentitySUCI: ", m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID)); + + var NG_NAS_UL_Message_Type v_nas_message := valueof( + m_NG_DEREGISTRATION_REQUEST_MO( + crs_DeregisterType ('0'B, '0'B, '01'B), + cs_NAS_KeySetIdentifier_lv('100'B,'0'B), + m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID) + )); + // 2. Add security if any + log("f_send_deregistration_request: ", v_nas_message); + var octetstring v_msg := bit2oct(encvalue(v_nas_message)); + log("bit2oct(encvalue(f_send_deregistration_request))", v_msg); + + // 3. Add security if any + var NG_SECURITY_PROTECTED_NAS_MESSAGE v_security_Protected_Nas_Message; + vc_sendNAS_PDU := f_EncodeAndCipher_NG_NasPdu_v( + tsc_SHT_IntegrityProtected_Ciphered, + v_msg, + tsc_DirectionUL, + PX_BEARER_ID, + vc_previous_nas_count_ul, + vc_ng_nas_security_params_type, + v_security_Protected_Nas_Message + ); + log("vc_previous_nas_count_ul: ", vc_previous_nas_count_ul); + vt_NgNasUl_Msg.security_Protected_Nas_Message := v_security_Protected_Nas_Message; + log("vc_sendNAS_PDU: ", vc_sendNAS_PDU); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + vc_sendNAS_PDU, + m_uPTransportLayerInformation_userLocationInformationNR( + m_userLocationInformationNR( + m_nR_CGI, + m_tAI + ))))); + + setverdict(pass); + } + + function f_await_deregistration_request() runs on NGNASComponent { + log(">>> f_await_deregistration_request"); + + // Await request for DEREGISTRATION_COMPLETE + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU) + if (match(vc_recvNgNasUl_Msg, mw_NG_DEREGISTRATION_REQUEST_MO)) { + log("Received NG_DEREGISTRATION_REQUEST_MO NAS message"); + } else { + log("*** " & __SCOPE__ & ": FAIL: Unexpected NAS message"); + setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NAS message"); + } + } + + function f_await_deregistration_request_await_deregistration_accept() runs on NGNASComponent { + log(">>> f_await_deregistration_request_await_deregistration_accept"); + + // Await request for DEREGISTRATION_REQUEST + f_await_deregistration_request(); + // Await request for DEREGISTRATION_ACCEPT + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_DEREGISTRATION_ACCEPT_MO, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: mw_NG_DEREGISTRATION_ACCEPT_MO mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected mw_NG_DEREGISTRATION_ACCEPT_MO"); + setverdict(pass); + } + log("v_message: ", v_message); + } + + function f_send_deregistration_request_await_deregistration_accept() runs on NGNASComponent { + log(">>> f_send_deregistration_request_await_deregistration_accept"); + + // Send request for DEREGISTRATION_REQUEST + f_send_deregistration_request(); + // Await request for DEREGISTRATION_ACCEPT + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_DEREGISTRATION_ACCEPT_MO, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + log("*** " & __SCOPE__ & ": FAIL: mw_NG_DEREGISTRATION_ACCEPT_MO mismatch."); + setverdict(fail); + } else { + log("*** " & __SCOPE__ & ": PASS: Expected mw_NG_DEREGISTRATION_ACCEPT_MO"); + setverdict(pass); + } + log("v_message: ", v_message); + + } + + function f_await_error_indication( + in template (value) Cause p_cause := m_cause_misc(unknown_PLMN_or_SNPN) + ) runs on NGNASComponent { + log(">>> f_await_error_indication"); + + // Await ErrorIndication + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_ErrorIndication( + p_cause + ))); + } + + function f_await_error_indication_ids( + in template (value) Cause p_cause := m_cause_misc(unknown_PLMN_or_SNPN) + ) runs on NGNASComponent { + log(">>> f_await_error_indication_ids"); + + // Await ErrorIndication + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_ErrorIndication_ids( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + p_cause + ))); + } + + function f_send_error_indication( + in template (value) Cause p_cause := m_cause_misc(unknown_PLMN_or_SNPN) + ) runs on NGNASComponent { + log(">>> f_send_error_indication"); + + // Await ErrorIndication + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_ErrorIndication( + p_cause + ))); + } + + function f_send_error_indication_ids( + in template (value) Cause p_cause := m_cause_misc(unknown_PLMN_or_SNPN) + ) runs on NGNASComponent { + log(">>> f_send_error_indication_ids"); + + // Send ErrorIndication + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_ErrorIndication_ids( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + p_cause + ))); + } + + function f_NASPDU_Get(inout NGAP_PDU p_PDU) runs on NGNASComponent { + + vc_recvNGAP_PDU := p_PDU; + vc_recvNAS_PDU := ''O; + + if (ischosen(p_PDU.initiatingMessage)) { + // Nothing to do + if (match(vc_recvNGAP_PDU.initiatingMessage, mw_n2_NGSetupRequest_base)) { + var integer numOfIEs := lengthof(vc_recvNGAP_PDU.initiatingMessage.value_.NGSetupRequest.protocolIEs) + //log("Number of IEs:",numOfIEs); + for (var integer i:=0;i>> f_recv_NGAP_PDU", p_PDU); + log(">>> f_recv_NGAP_PDU: Awaiting message: ", p_PDU); tc_wait.start; alt { [] N2_gNBaMF_P.receive(p_PDU) -> value v_PDU { @@ -92,7 +95,7 @@ module LibNGAP_Steps { */ function f_recv_NGAP_initiatingMessage( template (present) InitiatingMessage p_initiatingMessage := ? - ) runs on NGAPComponent { + ) runs on NGNASComponent { f_recv_NGAP_PDU( { initiatingMessage := p_initiatingMessage }) } // End of function f_recv_NGAP_initiatingMessage @@ -102,7 +105,7 @@ module LibNGAP_Steps { */ function f_recv_NGAP_successfulOutcome( template (present) SuccessfulOutcome p_successfulOutcome := ? - ) runs on NGAPComponent { + ) runs on NGNASComponent { f_recv_NGAP_PDU( {successfulOutcome := p_successfulOutcome}) } // End of f_recv_NGAP_successfulOutcome @@ -112,7 +115,7 @@ module LibNGAP_Steps { */ function f_recv_NGAP_unsuccessfulOutcome( template (present) UnsuccessfulOutcome p_unsuccessfulOutcome := ? - ) runs on NGAPComponent { + ) runs on NGNASComponent { f_recv_NGAP_PDU( {unsuccessfulOutcome := p_unsuccessfulOutcome}) } // End of function f_recv_NGAP_unsuccessfulOutcome @@ -130,7 +133,7 @@ module LibNGAP_Steps { */ function f_NGAPPDU_Set( inout template (value) NGAP_PDU p_PDU - ) runs on NGAPComponent { + ) runs on NGNASComponent { if (ischosen(p_PDU.initiatingMessage)) { vc_sendNGAP_PDU:=valueof(p_PDU); @@ -150,11 +153,34 @@ module LibNGAP_Steps { */ function f_send_NGAP_PDU( in template (value) NGAP_PDU p_PDU - ) runs on NGAPComponent { + ) runs on NGNASComponent { log(">>> f_send_NGAP_PDU: ", p_PDU) f_NGAPPDU_Set(p_PDU); - log("f_send_NGAP_PDU: vc_sendNGAP_PDU: ", vc_sendNGAP_PDU) + log("f_send_NGAP_PDU: vc_sendNGAP_PDU: ", vc_sendNGAP_PDU); N2_gNBaMF_P.send(p_PDU); + // tc_noac.start(3.0); + // alt { + // [] N2_gNBaMF_P.check( + // receive( + // mw_ngap_initMsg( + // mw_n2_ErrorIndication_ids( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID + // )))) { + // // Let's the test case proceed with the error indication, but log it as inconclusive + // setverdict(inconc,"*** " & __SCOPE__ & ": INCONC: Error indication received. ***"); + // } + // [] N2_gNBaMF_P.check( + // receive( + // NGAP_PDU:? + // )) { + // tc_noac.stop; + // } + // [] tc_noac.timeout { + // // No message received, let's consider the message was accepted and proceed with the test case execution + // log("f_send_NGAP_PDU: Message accepted"); + // } + // } } // End of function f_send_NGAPPDU /** @@ -164,7 +190,7 @@ module LibNGAP_Steps { function f_send_NGAP_initiatingMessage( in template (value) InitiatingMessage p_initiatingMessage, in template (value) Criticality p_criticality := reject - ) runs on NGAPComponent { + ) runs on NGNASComponent { f_send_NGAP_PDU( {initiatingMessage := p_initiatingMessage}) } // End of function f_send_NGAP_initiatingMessage @@ -174,7 +200,7 @@ module LibNGAP_Steps { */ function f_send_NGAP_successfulOutcome( in template (value) SuccessfulOutcome p_successfulOutcome - ) runs on NGAPComponent { + ) runs on NGNASComponent { f_send_NGAP_PDU( {successfulOutcome := p_successfulOutcome}) } // End of function f_send_NGAP_successfulOutcome @@ -184,7 +210,7 @@ module LibNGAP_Steps { */ function f_send_NGAP_unsuccessfulOutcome( in template (value) UnsuccessfulOutcome p_unsuccessfulOutcome - ) runs on NGAPComponent { + ) runs on NGNASComponent { f_send_NGAP_PDU( {unsuccessfulOutcome := p_unsuccessfulOutcome}) } // End of function f_send_NGAP_unsuccessfulOutcome @@ -209,7 +235,7 @@ module LibNGAP_Steps { * @verdict */ function f_preambleNGAP_MME() - runs on NGAPComponent { + runs on NGNASComponent { // Nothing to do } // End of function f_preambleNGAP_MME @@ -218,7 +244,7 @@ module LibNGAP_Steps { * @verdict */ function f_preambleNGAP_eNB() - runs on NGAPComponent { + runs on NGNASComponent { // Nothing to do } // End of function f_preambleNGAP_eNB @@ -234,18 +260,26 @@ module LibNGAP_Steps { * @desc * @verdict */ - function f_postambleNGAP_gNB() - runs on NGAPComponent { - // Nothing to do + function f_postambleNGAP_gNB( + in template (value) Cause p_Cause + ) runs on gNBNGAPComponent { + f_send_ue_context_release_request_await_ue_context_release_response(p_Cause); } // End of function f_postambleNGAP_gNB /** * @desc * @verdict */ - function f_postambleNGAP_AMF() - runs on NGAPComponent { - // Nothing to do + function f_postambleNGAP_AMF( + in template (value) Cause p_Cause + ) runs on aMFNGAPComponent { + if (isbound(vc_initialContextSetupRequest)) { + if (PICS_OFFLINE_MODE) { + f_await_ue_context_release_request_await_ue_context_release_response(p_Cause); + } else { + f_send_ue_context_release_request_await_ue_context_release_response(p_Cause); + } + } } // End of function f_postambleNGAP_AMF } // End of group postamble_NGAP @@ -261,7 +295,7 @@ module LibNGAP_Steps { * @desc This is a test step that init NGAP component */ function f_NGAP_Init_Component() - runs on NGAPComponent { + runs on NGNASComponent { // Nothing to do } // End of function f_NGAP_Init_Component @@ -269,7 +303,7 @@ module LibNGAP_Steps { * @desc Component termination */ function f_NGAP_terminate_component() - runs on NGAPComponent { + runs on NGNASComponent { log("component terminated - forced!"); deactivate; @@ -280,7 +314,7 @@ module LibNGAP_Steps { * @desc Component termination */ function f_componentStop() - runs on NGAPComponent { + runs on NGNASComponent { syncPort.send(m_syncClientStop); N2_gNBaMF_P.clear; @@ -312,7 +346,7 @@ module LibNGAP_Steps { * @verdict */ altstep a_defaultNGAP() - runs on NGAPComponent { + runs on NGNASComponent { [] any timer.timeout { all timer.stop; if (vc_serverStop==false) { @@ -322,6 +356,23 @@ module LibNGAP_Steps { stop; } } + [] N2_gNBaMF_P.receive( + mw_ngap_initMsg( + mw_n2_ErrorIndication_ids( + vc_AMF_UE_ID, + vc_RAN_UE_ID + ))) { + // Let's the test case proceed with the error indication, but log it as inconclusive + setverdict(inconc,"*** " & __SCOPE__ & ": INCONC: Error indication received. ***"); + all timer.stop; + if (vc_serverStop==false) { + f_selfOrClientSyncAndVerdict("error", e_timeout); + } + else { + //stop; + testcase.stop("*** " & __SCOPE__ & ": INCONC: Error indication received. ***"); + } + } [] N2_gNBaMF_P.receive (NGAP_PDU:{initiatingMessage := ?}) -> value vc_recvNGAP_PDUDefault { repeat; } @@ -336,7 +387,8 @@ module LibNGAP_Steps { f_selfOrClientSyncAndVerdict("error", e_error); } else { - stop; + //stop; + testcase.stop("*** " & __SCOPE__ & ": INCONC: Unexpected NGAP message received. ***"); } } [] N2_gNBaMF_P.receive { @@ -344,7 +396,8 @@ module LibNGAP_Steps { f_selfOrClientSyncAndVerdict("error", e_error); } else { - stop; + //stop; + testcase.stop("*** " & __SCOPE__ & ": INCONC: Unexpected message received. ***"); } } [] a_shutdown() { @@ -356,7 +409,7 @@ module LibNGAP_Steps { } // End of altstep a_defaultNGAP altstep a_defaultNGAP_MME() - runs on NGAPComponent { + runs on NGNASComponent { [] any timer.timeout { all timer.stop; if (vc_serverStop==false) { @@ -370,7 +423,7 @@ module LibNGAP_Steps { } // End of altstep a_defaultNGAP_MME altstep a_defaultNGAP_eNB() - runs on NGAPComponent { + runs on NGNASComponent { [] any timer.timeout { all timer.stop; if (vc_serverStop==false) { diff --git a/ttcn/LibNGAP/module.mk b/ttcn/LibNGAP/module.mk index beb3f85c476705b9f066668623465ed374a2304b..eb3759523d298c8a8025d452cc09c6391e3692c8 100644 --- a/ttcn/LibNGAP/module.mk +++ b/ttcn/LibNGAP/module.mk @@ -1,8 +1,10 @@ sources := \ lib/LibNGAP_TypesAndValues.ttcn \ lib/LibNGAP_Pixits.ttcn \ + lib/LibNGAP_Pics.ttcn \ lib/LibNGAP_Templates.ttcn \ lib/LibNGAP_EncdecDeclarations.ttcn \ + lib_system/LibNGAP_Functions.ttcn \ lib_system/LibNGAP_Interface.ttcn \ lib_system/LibNGAP_Steps.ttcn diff --git a/ttcn/Lib_NG_NAS/LIB_NG_NAS_Functions.ttcn b/ttcn/Lib_NG_NAS/LIB_NG_NAS_Functions.ttcn deleted file mode 100644 index 581b0fa292ba564da022fa41810f10ecff3a0181..0000000000000000000000000000000000000000 --- a/ttcn/Lib_NG_NAS/LIB_NG_NAS_Functions.ttcn +++ /dev/null @@ -1,665 +0,0 @@ -module LIB_NG_NAS_Functions { - - // Lib_NG_NAS - import from Lib_NG_NAS_Interface all; - import from Lib_NG_NAS_Templates all; - import from Lib_NG_NAS_Pixits all; - - // NG_NAS - import from NG_NAS_TypeDefs all; - import from NG_NAS_TestSystem all; - - // Lib3GPP - import from CommonDefs all; - import from NG_NAS_MsgContainers all; - import from NAS_CommonTypeDefs all; - import from NAS_CommonTemplates all; - import from NG_NAS_Common all; - import from NAS_AuthenticationCommon all; - import from NG_NAS_SecurityFunctions all; - - // Lib_NGAP - import from NGAP_IEs language "ASN.1:2002" all; - import from NGAP_Constants language "ASN.1:2002" all; - import from NGAP_PDU_Descriptions language "ASN.1:2002" all; - import from LibNGAP_Pixits all; - import from LibNGAP_Templates all; - import from LibNGAP_Interface all; - import from LibNGAP_Steps all; - - /** - * @desc Function to send NGSetupRequest message and await for NGSetupResponse message - */ - function f_send_NGSetupRequest_await_NGSetupRespone() runs on NGNASComponent { - f_send_NGAP_PDU( - m_ngap_initMsg( - m_n2_NGSetupRequest( - m_globalRANNodeID_globalGNB_ID( - m_ie_globalGnbId( - PX_PLMN_IDENTITY, - PX_GNB_ID,//'0000000000000000000000'B,//in template (value) bitstring p_gnbId, - -//in template (omit) GlobalGNB_ID.iE_Extensions p_iE_Extensions := omit - )), - { - m_supportedTAItem( - PX_TACode, - { - m_ie_broadcastPLMNItem( - PX_PLMN_IDENTITY,//m_ie_pLMNIdentity('00f110'O), - { - m_sliceSupportItem( - m_s_NSSAI( - PX_SST, - -,// in template (omit) SD p_sD := omit, - -// in template (omit) S_NSSAI.iE_Extensions p_iE_Extensions := omit - ), - -//in template (omit) SliceSupportItem.iE_Extensions p_iE_Extensions := omit - ) - } - ) - },//in template (value) BroadcastPLMNList p_broadcastPLMNList, - -//in template (omit) SupportedTAItem.iE_Extensions p_iE_Extensions := omit - ) - }, - PX_PAGING_DRX - ))); - f_recv_NGAP_PDU( - mw_ngap_succMsg( - mw_n2_NGSetupResponse( - mw_aMFName(PX_AMF_NAME), - { - *, - mw_servedGUAMIItem( - mw_gUAMI( - PX_PLMN_IDENTITY - )), - * - } - ))); - } - - /** - * @desc Function to send NAS RegistrationRequest message - * @see NG_NASTemplateFunctions.f_Check_NG_RegistrationReqMsg - */ - function f_send_NasRegistrationRequest() runs on NGNASComponent { - vt_NgNasUl_Msg := m_NG_REGISTRATION_REQUEST( - {'0'B,'001'B}, - '111'B, - '0'B, - m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT,PX_SUPI_DIGITS) // TODO Use PIXIT here? - ); - vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); - f_send_NGAP_PDU( - m_ngap_initMsg( - m_n2_UplinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, - vc_sendNAS_PDU, - m_uPTransportLayerInformation_userLocationInformationNR( - m_userLocationInformationNR( - m_nR_CGI, - m_tAI - ))))); - } - - /** - * @desc Function to await NAS NGSetupResponse message - */ - function f_await_registration_accept() runs on NGNASComponent { - // Await request for REGISTRATION_ACCEPT - f_recv_NGAP_PDU( - mw_ngap_initMsg( - mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, - ? // AuthorizationRequest - ))); - f_NASPDU_Get(vc_recvNGAP_PDU); - var NG_NAS_DL_Message_Type v_message; - if (f_Check_5GAKA_NAS_DL_Message( - vc_recvNAS_PDU, - mw_NG_REGISTRATION_ACCEPT( - -, - ?, - mw_PLMN_List( - -, -, - { - *, - PX_PLMN_IDENTITY, - * - } - ), - -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, - ? - ), - v_message) == false) { - setverdict(fail); - return; - } - } - - /** - * @desc Function to await NAS AuthorizationRequest message and send AuthorizationResponse message with security computation for future encryption - */ - function f_await_NasAuthorizationRequest_send_NasAuthorizationResponse() runs on NGNASComponent { - // Await request for authorization - f_recv_NGAP_PDU( - mw_ngap_initMsg( - mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, - ? // AuthorizationRequest - ))); - f_NASPDU_Get(vc_recvNGAP_PDU); - var NG_NAS_DL_Message_Type v_message; - if (f_Check_5GAKA_NAS_DL_Message( - vc_recvNAS_PDU, - mw_NG_AUTHENTICATION_REQUEST( - '100'B, - -, - mw_GMM_AuthRAND, - mw_GSM_AUTN - ), - v_message - ) == false) { - setverdict(fail); - return; - } - // Compute RES/XRES - f_5g_aka_compute_res_xres(v_message.authentication_Request.rand.randValue, v_message.authentication_Request.autn.aUTN, v_message.authentication_Request.abba, PX_PLMN_IDENTITY, oct2hex(PX_SUPI_DIGITS), vc_ng_nas_security_params_type); - // Send response - vt_NgNasUl_Msg := m_NG_AUTHENTICATION_RESPONSE( - { iei := '2d'O, iel := '10'O, res := vc_ng_nas_security_params_type.AuthParams.XRES } - ); - vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); - f_send_NGAP_PDU( - m_ngap_initMsg( - m_n2_UplinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, - vc_sendNAS_PDU, - m_uPTransportLayerInformation_userLocationInformationNR( - m_userLocationInformationNR( - m_nR_CGI, - m_tAI - ))))); - } - - /******************************************************************************** - * - * FIXME Use or enhance check functions from 3GPP library such as NG_NASTemplateFunctions.f_Check_NG_SecurityModeCompleteMsg - * - ********************************************************************************/ - - function f_await_NasSecurityModeCommand() runs on NGNASComponent { - // Await SecurityModeCommand - f_recv_NGAP_PDU( - mw_ngap_initMsg( - mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, - ? // Security mode command - ))); - f_NASPDU_Get(vc_recvNGAP_PDU); - var NG_NAS_DL_Message_Type v_message; - if (f_Check_5GAKA_NAS_DL_Message( - vc_recvNAS_PDU, - mw_NG_SECURITY_MODE_COMMAND, - v_message - ) == false) { - setverdict(fail); - return; - } - } - - function f_await_NasSecurityModeCommand_send_NasSecurityModeComplete() runs on NGNASComponent { - // Await SecurityModeCommand - f_recv_NGAP_PDU( - mw_ngap_initMsg( - mw_n2_DownlinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, - ? // Security mode command - ))); - f_NASPDU_Get(vc_recvNGAP_PDU); - var NG_NAS_DL_Message_Type v_message; - if (f_Check_5GAKA_NAS_DL_Message( - vc_recvNAS_PDU, - mw_NG_SECURITY_MODE_COMMAND, - v_message - ) == false) { - setverdict(fail); - return; - } - // Send SecurityModeComplete - vt_NgNasUl_Msg := m_NG_SECURITY_MODE_COMPLETE( - m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, PX_SUPI_DIGITS), //in template (value) NG_MobileIdentity p_IMEISV, - { iei := omit, iel := int2oct(0, 2), replayedNASMsgContainerValue := ''O } /* 24.301 cl. 9.9.3.51 @sic R5s170597 Baseline Moving sic@ */, //in template (value) ReplayedNASMessageContainer p_NASMsg, - m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT,PX_SUPI_DIGITS) //in template (value) NG_MobileIdentity p_NonIMEISV_PEI - ); - var octetstring os := ''O; // FIXME f_EncodeAndCipher_NG_NasPdu(vt_NgNasUl_Msg, ); How to calculate NG_NAS_MSG_Request_Type - vt_NgNasUl_Msg.security_Protected_Nas_Message := m_NG_SECURITY_PROTECTED_NAS_MESSAGE( - tsc_EPD_GMM, - tsc_SpareHalfOctet, - tsc_SHT_IntegrityProtected_Ciphered, - '00000000'O, // FIXME How to calculate MessageAuthenticationCode? - '00'O, - os // Cyphered NAS message - ) - vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); - f_send_NGAP_PDU( - m_ngap_initMsg( - m_n2_UplinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, - vc_sendNAS_PDU, - m_uPTransportLayerInformation_userLocationInformationNR( - m_userLocationInformationNR( - m_nR_CGI, - m_tAI - ))))); - } - - function f_terminate_NasRegistrationRequest_with_reject() runs on NGNASComponent { - // Send error message - vt_NgNasUl_Msg := m_NG_AUTHENTICATION_FAILURE( - m_GMM_GSM_Cause( - -, - tsc_EmmCause_IllegalMe // '00000110'B; - )); - vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); - f_send_NGAP_PDU( - m_ngap_initMsg( - m_n2_UplinkNASTransport( - PX_AMF_UE_NGAP_ID, - PX_RAN_UE_NGAP_ID, - vc_sendNAS_PDU, - m_uPTransportLayerInformation_userLocationInformationNR( - m_userLocationInformationNR( - m_nR_CGI, - m_tAI - ))))); - } - - function f_send_NGUERadioCApabilityInfoIndication() runs on NGNASComponent { - f_send_NGAP_PDU( - m_ngap_initMsg( - m_n2_UERadioCapabilityInfoIndication( - -, -, - ''O // FIXME FSCOM How to deal with UERadioCapability - ))); - } - - function f_await_NGInitialContextSetupRequest_send_NGInitialContextSetupRespone() runs on NGNASComponent { - f_recv_NGAP_PDU( - mw_ngap_initMsg( - mw_n2_InitialContextSetupRequest_withPDUSessionList( // FIXME FSCOM How to deal with it? - - ))); - f_send_NGAP_PDU( - m_ngap_succMsg( - m_n2_InitialContextSetupResponse_noPDUSessionResourceSetupListSURes - )); - } - - function f_NASPDU_Get(inout NGAP_PDU p_PDU) runs on NGNASComponent { - - vc_recvNGAP_PDU := p_PDU; - - if (ischosen(p_PDU.initiatingMessage)) { - // Nothing to do - if (match(vc_recvNGAP_PDU.initiatingMessage,mw_n2_NGSetupRequest_base)){ - var integer numOfIEs := lengthof(vc_recvNGAP_PDU.initiatingMessage.value_.NGSetupRequest.protocolIEs) - //log("Number of IEs:",numOfIEs); - for (var integer i:=0;i>> f_decode_5G_NAS_DL_Message: ", p_nas_pdu); - - var bitstring v_bs := oct2bit(p_nas_pdu); - var NG_NAS_DL_Message_Type v_message; - if (decvalue(v_bs, v_message) != 0) { - log("f_decode_5G_NAS_DL_Message: decvalue failure"); - return false; - } - log("f_decode_5G_NAS_DL_Message: v_message: ", v_message); - if (ischosen(v_message.security_Protected_Nas_Message)) { - if (v_message.security_Protected_Nas_Message.securityHeaderType == '0100'B) { - // TODO Cyphered message - log("f_decode_5G_NAS_DL_Message: TODO Cyphered message"); - setverdict(inconc); - return false; - } else { - v_bs := oct2bit(v_message.security_Protected_Nas_Message.plainNASMessage); - if (decvalue(v_bs, v_message) != 0) { - log("f_decode_5G_NAS_DL_Message: decvalue failure"); - return false; - } - log("f_decode_5G_NAS_DL_Message: v_message: ", v_message); - if (not(match(v_message, p_NG_NAS_DL_Message_Type))) { - log(match(v_message, p_NG_NAS_DL_Message_Type)); - return false; - } - } - } - log("f_decode_5G_NAS_DL_Message: matching"); - - return true; - } // End of function f_decode_5G_NAS_DL_Message - - function f_Check_5GAKA_NAS_DL_Message( - in NAS_PDU p_nas_pdu, - in template NG_NAS_DL_Message_Type p_NG_NAS_DL_Message_Type, - out NG_NAS_DL_Message_Type p_message - ) return boolean { - log(">>> f_Check_5GAKA_NAS_DL_Message: ", p_nas_pdu); - - var bitstring v_bs := oct2bit(p_nas_pdu); - var NG_NAS_DL_Message_Type v_message; - if (decvalue(v_bs, v_message) != 0) { - log("f_Check_5GAKA_NAS_DL_Message: decvalue failure"); - return false; - } - log("f_Check_5GAKA_NAS_DL_Message: v_message: ", v_message); - if (ischosen(v_message.security_Protected_Nas_Message)) { - if (v_message.security_Protected_Nas_Message.securityHeaderType == '0010'B) { - // TODO Cyphered message - // Decipher NAS container - // v_NonCleartextString := fx_NG_NasDeciphering(v_NonCleartextString, - // p_NasSecurityByRef.Ciphering.Algorithm, - // p_NasSecurityByRef.Ciphering.K_NAS, - // p_NasCount, - // p_NasSecurityByRef.BearerId); - //v_message.security_Protected_Nas_Message.plainNASMessage := v_NonCleartextString; - log("f_Check_5GAKA_NAS_DL_Message: TODO Cyphered message"); - setverdict(inconc); - return false; - } - // Message was decrypted properly - v_bs := oct2bit(v_message.security_Protected_Nas_Message.plainNASMessage); - if (decvalue(v_bs, v_message) != 0) { - log("f_Check_5GAKA_NAS_DL_Message: decvalue failure"); - return false; - } - log("f_Check_5GAKA_NAS_DL_Message: v_message: ", v_message); - } - if (not(match(v_message, p_NG_NAS_DL_Message_Type))) { - log(match(v_message, p_NG_NAS_DL_Message_Type)); - return false; - } - p_message := v_message; - log("f_Check_5GAKA_NAS_DL_Message: matching: p_message: ", p_message); - - return true; - } // End of function f_Check_5GAKA_NAS_DL_Message - - function f_Check_5GAKA_NAS_UL_Message( - in NAS_PDU p_nas_pdu, - in template NG_NAS_UL_Message_Type p_NG_NAS_UL_Message_Type - ) return boolean { - log(">>> f_Check_5GAKA_NAS_UL_Message: ", p_nas_pdu); - - var bitstring v_bs := oct2bit(p_nas_pdu); - var NG_NAS_UL_Message_Type v_message; - if (decvalue(v_bs, v_message) != 0) { - log("f_Check_5GAKA_NAS_UL_Message: decvalue failure"); - return false; - } - log("f_Check_5GAKA_NAS_UL_Message: v_message: ", v_message); - if (ischosen(v_message.security_Protected_Nas_Message)) { - // TODO Decyphered message - log("f_Check_5GAKA_NAS_UL_Message: TODO Decyphered message"); - setverdict(inconc); - return false; - } else { - v_bs := oct2bit(v_message.security_Protected_Nas_Message.plainNASMessage); - if (decvalue(v_bs, v_message) != 0) { - log("f_Check_5GAKA_NAS_UL_Message: decvalue failure"); - return false; - } - log("f_Check_5GAKA_NAS_UL_Message: v_message: ", v_message); - if (not(match(v_message, p_NG_NAS_UL_Message_Type))) { - log(match(v_message, p_NG_NAS_UL_Message_Type)); - return false; - } - } - log("f_Check_5GAKA_NAS_UL_Message: matching"); - - return true; - } // End of function f_Check_5GAKA_NAS_UL_Message - - function f_Check_5GAKA_NAS_DL_Message_is_encrypted(in NAS_PDU p_nas_pdu) return boolean { - log(">>> f_Check_5GAKA_NAS_DL_Message_is_encrypted: ", p_nas_pdu); - - var bitstring v_bs := oct2bit(p_nas_pdu); - var NG_NAS_DL_Message_Type v_message; - if (decvalue(v_bs, v_message) != 0) { - log("f_Check_5GAKA_NAS_DL_Message_is_encrypted: decvalue failure"); - return false; - } - log("f_Check_5GAKA_NAS_DL_Message_is_encrypted: v_message: ", v_message); - if (not ischosen(v_message.security_Protected_Nas_Message)) { - return false - } - - return true; - } // End of function f_Check_5GAKA_NAS_DL_Message_is_encrypted - - function f_Check_5GAKA_NAS_UL_Message_is_encrypted(in NAS_PDU p_nas_pdu) return boolean { - log(">>> f_Check_5GAKA_NAS_UL_Message_is_encrypted: ", p_nas_pdu); - - var bitstring v_bs := oct2bit(p_nas_pdu); - var NG_NAS_UL_Message_Type v_message; - if (decvalue(v_bs, v_message) != 0) { - log("f_Check_5GAKA_NAS_UL_Message_is_encrypted: decvalue failure"); - return false; - } - log("f_Check_5GAKA_NAS_UL_Message_is_encrypted: v_message: ", v_message); - if (not ischosen(v_message.security_Protected_Nas_Message)) { - return false - } - - return true; - } // End of function f_Check_5GAKA_NAS_UL_Message_is_encrypted - - group fiveg_aka_security_network { // FIXME FSCOM To be re-organize later to create a security library - - /** - * @desc Compute RES and XRES values based on rAND & AUTN received in the NG_AUTHENTICATION_REQUEST - * @param [in] p_rand - * @param [in] p_autn - * @param [in] KeySeq - * @param [in,out] p_ng_nas_security_params_type Built security parameters - */ - function f_5g_aka_compute_res_xres( - in B128_Type p_rand, - in B128_Type p_autn, - in ABBA p_abba, - in NAS_PlmnId p_PLMN, - in hexstring p_NID, - inout NG_NAS_SecurityParams_Type p_ng_nas_security_params_type - ) return boolean { - log(">>> f_5g_aka_compute_res_xres: ", p_ng_nas_security_params_type); - - p_ng_nas_security_params_type := valueof(cs_NG_NAS_SecurityParamsInit); - log("f_5g_aka_compute_res_xres: KDF=", p_ng_nas_security_params_type.KDF); - p_ng_nas_security_params_type.ABBA := p_abba.abbaValue; - p_ng_nas_security_params_type.AuthParams.RandValue := p_rand; - p_ng_nas_security_params_type.AuthParams.AUTN := p_autn; - - log("f_5g_aka_compute_res_xres: PX_USIM_SECRET_KEY=", PX_USIM_SECRET_KEY); - - // Extract SQN from v_sqn_ak and XOR it with calculated MAC - var B48_Type v_sqn_ak := substr(p_autn, 0, 48); - var B16_Type v_amf := substr(p_autn, 48, 16); - var B64_Type v_mac := substr(p_autn, 64, 64); - log("f_5g_aka_compute_res_xres: v_sqn_ak=", v_sqn_ak); - log("f_5g_aka_compute_res_xres: v_amf=", v_amf); - log("f_5g_aka_compute_res_xres: v_mac=", v_mac); - - // Set OP - f_set_op(PX_USIM_OPERATOR_VARIANT_ALGORITHM_CONFIGURATION); - // Calculate RES, CK, IK and AK in one step - var B128_Type v_ck; - var B128_Type v_ik; - var B48_Type v_ak; - var B64_Type v_res; - if (f_f2345(PX_USIM_SECRET_KEY, p_rand, v_res, v_ck, v_ik, v_ak) == -1) { - return false; - } - p_ng_nas_security_params_type.AuthParams.CK := v_ck; - log("f_5g_aka_compute_res_xres: CK=", p_ng_nas_security_params_type.AuthParams.CK); - p_ng_nas_security_params_type.AuthParams.IK := v_ik; - log("f_5g_aka_compute_res_xres: IK=", p_ng_nas_security_params_type.AuthParams.IK); - p_ng_nas_security_params_type.Ks := p_ng_nas_security_params_type.AuthParams.CK & p_ng_nas_security_params_type.AuthParams.IK; - log("f_5g_aka_compute_res_xres: Ks=", p_ng_nas_security_params_type.Ks); - var B48_Type v_sqn := v_sqn_ak xor4b v_ak; - log("f_5g_aka_compute_res_xres: v_sqn=", v_sqn); - - // Verify that MAC was accepted - var B64_Type v_mac_p; - if (f_f1(PX_USIM_SECRET_KEY, p_rand, v_sqn, v_amf, v_mac_p) == -1) { - return false; - } - log("f_5g_aka_compute_res_xres: v_mac_p=", v_mac_p); - if (v_mac != v_mac_p) { - return false; - } - - // Compute XRES - p_ng_nas_security_params_type.AuthParams.XRES := f_NG_Authentication_A4(p_PLMN, - p_ng_nas_security_params_type.AuthParams, - p_ng_nas_security_params_type.KDF, - p_ng_nas_security_params_type.Ks, - p_NID); - p_ng_nas_security_params_type.AuthParams.XRESLength := lengthof(bit2oct(p_ng_nas_security_params_type.AuthParams.XRES)); - log("f_5g_aka_compute_res_xres: XRES=", p_ng_nas_security_params_type.AuthParams.XRES); - log("f_5g_aka_compute_res_xres: XRESLength=", p_ng_nas_security_params_type.AuthParams.XRESLength); - - // Generate KAUSF - p_ng_nas_security_params_type.KAUSF := f_NG_Authentication_A2(p_ng_nas_security_params_type.AuthParams, - p_ng_nas_security_params_type.KDF, - p_ng_nas_security_params_type.Ks, - p_PLMN, - p_NID); - log("f_5g_aka_compute_res_xres: KAUSF=", p_ng_nas_security_params_type.KAUSF); - - // Generate KSEAF - p_ng_nas_security_params_type.KSEAF := f_NG_Authentication_A6(p_PLMN, - p_ng_nas_security_params_type.KAUSF, - p_ng_nas_security_params_type.KDF, - p_NID - ); - log("f_5g_aka_compute_res_xres: KSEAF=", p_ng_nas_security_params_type.KSEAF); - - // TODO Generate KMAF - // p_ng_nas_security_params_type.KAMF := f_NG_Authentication_A7(p_Identity, - // p_ng_nas_security_params_type.KSEAF, - // p_ng_nas_security_params_type.ABBA, - // p_ng_nas_security_params_type.KDF - // ); - //log("f_5g_aka_compute_res_xres: KAMF=", p_ng_nas_security_params_type.KAMF); - - // TODO Generate KMAF - - - log("<<< f_5g_aka_compute_res_xres: ", p_ng_nas_security_params_type); - return true; - } // End of function f_5g_aka_compute_res_xres - - function f_set_op(in O16_Type p_op) { - fx_set_op(p_op); - } - - function f_f1(in B128_Type p_authK, in B128_Type p_rand, in B48_Type v_sqn, in B16_Type v_amf, out B64_Type v_mac_a) return integer { - return fx_f1(p_authK, p_rand, v_sqn, v_amf, v_mac_a); - } - - function f_f1star(in B128_Type p_authK, in B128_Type p_rand, in B48_Type v_sqn, in B16_Type v_amf, out B64_Type v_mac_s) return integer { - return fx_f1star(p_authK, p_rand, v_sqn, v_amf, v_mac_s); - } - - function f_f2345(in B128_Type p_authK, in B128_Type p_rand, out B64_Type v_res, out B128_Type v_ck, out B128_Type v_ik, out B48_Type v_ak) return integer { - return fx_f2345(p_authK, p_rand, v_res, v_ik, v_ck, v_ak); - } - - function f_f5star(in B128_Type p_authK, in B128_Type p_rand, out B48_Type p_ak) return integer { - return fx_f5star(p_authK, p_rand, p_ak); - } - - external function fx_set_op(in O16_Type p_op); - external function fx_f1(in B128_Type p_authK, in B128_Type p_rand, in B48_Type v_sqn, in B16_Type v_amf, out B64_Type v_mac_a) return integer; - external function fx_f1star(in B128_Type p_authK, in B128_Type p_rand, in B48_Type v_sqn, in B16_Type v_amf, out B64_Type v_mac_s) return integer; - external function fx_f2345(in B128_Type p_authK, in B128_Type p_rand, out B64_Type v_res, out B128_Type v_ck, out B128_Type v_ik, out B48_Type v_ak) return integer; - external function fx_f5star(in B128_Type p_authK, in B128_Type p_rand, out B48_Type p_ak) return integer; - - } // End of function fiveg_aka_security_network - -} // End of module LIB_NG_NAS_Functions \ No newline at end of file diff --git a/ttcn/Lib_NG_NAS/Lib_NG_NAS_Interface.ttcn b/ttcn/Lib_NG_NAS/Lib_NG_NAS_Interface.ttcn deleted file mode 100644 index d2b0d8fbae9db58f9623e198ee50dea3e453e3c0..0000000000000000000000000000000000000000 --- a/ttcn/Lib_NG_NAS/Lib_NG_NAS_Interface.ttcn +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @author ETSI / STF - * @version $URL:$ - * $Id:$ - * @desc This module provides the types used by the test component for NGAP tests. - * @copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * @see ETSI TS / 3GPP TS - */ -module Lib_NG_NAS_Interface { - - // LibCommon - import from LibCommon_Sync all; - - //Lib3GPP - import from NG_NAS_MsgContainers all; - import from NG_NAS_SecurityFunctions all; - - // LibNGAP - //import from NGAP_IEs language "ASN.1:1997" all; - //import from NGAP_PDU_Descriptions language "ASN.1:1997" all; - //import from LibNGAP_Pixits all; - import from LibNGAP_Interface all; - - group portDefinitions { - } // End of group portDefinitions - - group interfacePorts { - type component NGNASComponent extends NGAPComponent {//extends SelfSyncComp { - // Port - //port NGAPPort N2_gNBaMF_P; - - // Global variables - var template NG_NAS_UL_Message_Type vt_NgNasUl_Msg := omit; - var template NG_NAS_DL_Message_Type vt_NgNasDl_Msg := omit; - var octetstring vc_sendNAS_PDU :=''O; - var octetstring vc_recvNAS_PDU :=''O; - var octetstring vc_recvNAS_PDUDefault:=''O; - var NG_NAS_UL_Message_Type vc_recvNgNasUl_Msg; - var NG_NAS_DL_Message_Type vc_recvNgNasDl_Msg; - var NG_NAS_SecurityParams_Type vc_ng_nas_security_params_type := {}; - - // Init of values at component started - - // General timers - //timer tc_wait := PX_NGAP_TWAIT; - //timer tc_delay := 0.3; // delay next Request - - // Variables for storing default references - var default vc_default_nas; - var default vc_def_catchSyncStop_nas; - - } // End of type component NASComponent - - } // End of group interfacePorts - -} // End of module Lib_NG_NAS_Interface - diff --git a/ttcn/Lib_NG_NAS/Lib_NG_NAS_Pixits.ttcn b/ttcn/Lib_NG_NAS/Lib_NG_NAS_Pixits.ttcn deleted file mode 100755 index 59ccfc4eab4e1870b484a17bee26a2e9c1e36920..0000000000000000000000000000000000000000 --- a/ttcn/Lib_NG_NAS/Lib_NG_NAS_Pixits.ttcn +++ /dev/null @@ -1,27 +0,0 @@ -/** -* @author ETSI / TTF041 -* @version $URL$ -* $Id$ -* @desc This module provides PICS for NGAP tests. -* @copyright ETSI Copyright Notification -* No part may be reproduced except as authorized by written permission. -* The copyright and the foregoing restriction extend to reproduction in all media. -* All rights reserved. -* @see ETSI TS -*/ -module Lib_NG_NAS_Pixits { - - import from CommonDefs all; - import from NAS_CommonTypeDefs all; - - modulepar B4_Type PX_SUPI_FORMAT := '0000'B; - - modulepar octetstring PX_SUPI_DIGITS := '00f110214300014444330302'O; - - modulepar O16_Type PX_USIM_OPERATOR_VARIANT_ALGORITHM_CONFIGURATION := '00000000000000000000000000000000'O; - - modulepar B128_Type PX_USIM_SECRET_KEY := oct2bit('00000000000000000000000000000000'O); - - modulepar NAS_PlmnId PX_PLMN := '000000'O; - -} // End of module Lib_NG_NAS_Pixits \ No newline at end of file diff --git a/ttcn/Lib_NG_NAS/NG_NAS_EncdecDeclarations b/ttcn/Lib_NG_NAS/NG_NAS_EncdecDeclarations deleted file mode 100644 index 7f65093940e261c773bbd481df1fe094e041262c..0000000000000000000000000000000000000000 --- a/ttcn/Lib_NG_NAS/NG_NAS_EncdecDeclarations +++ /dev/null @@ -1,50 +0,0 @@ -module NG_NAS_EncdecDeclarations { - - import from NG_NAS_MsgContainers all; - import from NG_NAS_TypeDefs all; - import from EAP_TypeDefs all; - - - external function fx_enc_NG_NAS_UL_Message_Type (NG_NAS_UL_Message_Type p) return bitstring - //with {extension "prototype(convert) encode(NAS Types)"} - - external function fx_dec_NG_NAS_UL_Message_Type (inout bitstring pdu, out NG_NAS_UL_Message_Type p) return integer - //with {extension "prototype(sliding) decode(NAS Types)"} - - - external function fx_enc_NG_NAS_DL_Message_Type (NG_NAS_DL_Message_Type p) return bitstring - //with {extension "prototype(convert) encode(NAS Types)"} - - external function fx_dec_NG_NAS_DL_Message_Type (inout bitstring pdu, out NG_NAS_DL_Message_Type p) return integer - //with {extension "prototype(sliding) decode(NAS Types)"} - //external function fx_dec_NG_NAS_DL_Message_Type (in octetstring pdu) return NG_NAS_DL_Message_Type - //with {extension "prototype(convert) decode(RAW)"} - - external function fx_enc_NG_SECURITY_PROTECTED_NAS_MESSAGE(NG_SECURITY_PROTECTED_NAS_MESSAGE p) return bitstring - //with {extension "prototype(convert) encode(NAS Types)"} - - external function fx_dec_NG_SECURITY_PROTECTED_NAS_MESSAGE(in octetstring pdu) return NG_SECURITY_PROTECTED_NAS_MESSAGE - //with {extension "prototype(sliding) decode(NAS Types)"} - - external function fx_enc_IntraN1TransparentContainer (IntraN1TransparentContainer p) return bitstring - //with {extension "prototype(convert) encode(NAS Types)"} - - external function fx_dec_IntraN1TransparentContainer (inout bitstring pdu, out IntraN1TransparentContainer p) return integer - //with {extension "prototype(sliding) decode(NAS Types)"} - - - external function fx_enc_CIoTSmallDataContainer (CIoTSmallDataContainer p) return bitstring - //with {extension "prototype(convert) encode(NAS Types)"} - - external function fx_dec_CIoTSmallDataContainer (inout bitstring pdu, out CIoTSmallDataContainer p) return integer - //with {extension "prototype(sliding) decode(NAS Types)"} - - - - external function fx_enc_EAP_Message_Type (EAP_Message_Type p) return bitstring - with {extension "prototype(convert) encode(EAP Types)"} - - external function fx_dec_EAP_Message_Type (inout bitstring pdu, out EAP_Message_Type p) return integer - with {extension "prototype(sliding) decode(EAP Types)"} - -} // End of module module NG_NAS_EncdecDeclarations diff --git a/ttcn/Lib_NG_NAS/lib/Lib_NG_NAS_Pixits.ttcn b/ttcn/Lib_NG_NAS/lib/Lib_NG_NAS_Pixits.ttcn new file mode 100755 index 0000000000000000000000000000000000000000..4365ff37246a80e50047fd19896d493d0d611aa0 --- /dev/null +++ b/ttcn/Lib_NG_NAS/lib/Lib_NG_NAS_Pixits.ttcn @@ -0,0 +1,93 @@ +/** +* @author ETSI / TTF T041, T048 +* @version $URL$ +* $Id$ +* @desc This module provides PICS for NGAP tests. +* @copyright ETSI Copyright Notification +* No part may be reproduced except as authorized by written permission. +* The copyright and the foregoing restriction extend to reproduction in all media. +* All rights reserved. +* @see ETSI TS +*/ +module Lib_NG_NAS_Pixits { + + import from CommonDefs all; + import from NAS_CommonTypeDefs all; + + /** + * @desc Set to true to activate security checks + */ + modulepar boolean PX_CHECK_SECURITY := true; + + /** + * @desc Specify the type of identity being transmitted + */ + modulepar B4_Type PX_SUPI_FORMAT := '0000'B; + + /** + * @desc Identify the specific nature of a User Equipment (UE) identifier + */ + modulepar NAS_IdType PX_TYPE_OF_ID := '001'B; + + /** + * @desc SUPI digits + */ + modulepar octetstring PX_SUPI_DIGITS := '00f110214300014444330302'O; + + /** + * @desc MSIN digits + */ + modulepar octetstring PX_MSIN := '0000000010'O; + + /** + * @desc SUCI digits + */ + modulepar octetstring PX_SUCI_DIGITS := '0000000010'O; + + /** + * @desc Operator Key (OP) + */ + modulepar O16_Type PX_OPERATOR_KEY := '00000000000000000000000000000000'O; + + /** + * @desc OPc is derived from OP and K + * OPc is used in 3GPP AKA algorithm + */ + modulepar O16_Type PX_OPERATOR_SECRET_KEY := '00000000000000000000000000000000'O; + + /** + * @desc Set to true if OPc is provided instead of OP + */ + modulepar boolean PX_FORCE_USING_OPERATOR_SECRET_KEY := false + + /** + * @desc Sequence Number (SQN) + */ + modulepar B48_Type PX_SQN := oct2bit('000000000000'O); + + /** + * @desc Authentication Management Field + */ + modulepar B16_Type PX_AMF := oct2bit('8000'O); // AMF: Authentication Management Field + + /** + * @desc Random challenge + */ + modulepar B128_Type PX_RAND_VALUE := oct2bit('23553cbe9637a89d218ae64dae47bf35'O); + /** + * @desc Subscription key (K) + */ + modulepar B128_Type PX_SUBSCRIPTION_KEY := oct2bit('00000000000000000000000000000000'O); + + /** + * @desc Bearer identifier + */ + modulepar B5_Type PX_BEARER_ID := '11010'B; + + /** + * @desc Network Name + */ + modulepar charstring PX_NETWORK_NAME := ""; + + +} // End of module Lib_NG_NAS_Pixits \ No newline at end of file diff --git a/ttcn/Lib_NG_NAS/lib/Lib_NG_NAS_Security_Functions.ttcn b/ttcn/Lib_NG_NAS/lib/Lib_NG_NAS_Security_Functions.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..7836f0ecfc0846733f72e19df2db478566e327b9 --- /dev/null +++ b/ttcn/Lib_NG_NAS/lib/Lib_NG_NAS_Security_Functions.ttcn @@ -0,0 +1,879 @@ +module Lib_NG_NAS_Security_Functions { + + // Lib_NG_NAS + import from Lib_NG_NAS_Templates all; + import from Lib_NG_NAS_Pixits all; + + // NG_NAS + import from NG_NAS_TypeDefs all; + + // Lib3GPP + import from CommonDefs all; + import from Parameters all; + import from NG_NAS_MsgContainers all; + import from NAS_CommonTypeDefs all; + import from NAS_CommonTemplates all; + import from NG_NAS_Common all; + import from NAS_AuthenticationCommon all; + import from NAS_AuxiliaryDefsAndFunctions all; + import from NG_NAS_SecurityFunctions all; + import from NG_SecurityDefinitionsAndExternalFunctions all; + import from EUTRA_NR_SecurityFunctions all; + + // Lib_NGAP + import from NGAP_IEs language "ASN.1:2002" all; + import from NGAP_Constants language "ASN.1:2002" all; + import from NGAP_PDU_Descriptions language "ASN.1:2002" all; + import from LibNGAP_Pixits all; + import from LibNGAP_Templates all; + import from LibNGAP_Steps all; + + function f_decode_5G_NAS_DL_Message( + in NAS_PDU p_nas_pdu, + out NG_NAS_DL_Message_Type p_NG_NAS_DL_Message_Type + ) return boolean { + log(">>> f_decode_5G_NAS_DL_Message: ", p_nas_pdu); + + var bitstring v_bs := oct2bit(p_nas_pdu); + var NG_NAS_DL_Message_Type v_message; + if (decvalue(v_bs, v_message) != 0) { + log("f_decode_5G_NAS_DL_Message: decvalue failure"); + return false; + } + log("f_decode_5G_NAS_DL_Message: v_message: ", v_message); + if (ischosen(v_message.security_Protected_Nas_Message)) { + if (v_message.security_Protected_Nas_Message.securityHeaderType == '0100'B) { + // TODO Cyphered message + log("f_decode_5G_NAS_DL_Message: TODO Cyphered message"); + setverdict(inconc); + return false; + } else { + v_bs := oct2bit(v_message.security_Protected_Nas_Message.plainNASMessage); + if (decvalue(v_bs, v_message) != 0) { + log("f_decode_5G_NAS_DL_Message: decvalue failure"); + return false; + } + log("f_decode_5G_NAS_DL_Message: v_message: ", v_message); + if (not(match(v_message, p_NG_NAS_DL_Message_Type))) { + log(match(v_message, p_NG_NAS_DL_Message_Type)); + return false; + } + } + } + log("f_decode_5G_NAS_DL_Message: matching"); + + return true; + } // End of function f_decode_5G_NAS_DL_Message + + function f_Check_5GAKA_NAS_DL_Message( + in NAS_PDU p_nas_pdu, + in template NG_NAS_DL_Message_Type p_NG_NAS_DL_Message_Type, + inout NG_NAS_SecurityParams_Type p_NasSecurityByRef, + inout NasCount_Type p_previous_nas_count_dl, + out NG_NAS_DL_Message_Type p_message, + out octetstring p_inner_message + ) return boolean { + log(">>> f_Check_5GAKA_NAS_DL_Message: p_nas_pdu: ", p_nas_pdu); + log(">>> f_Check_5GAKA_NAS_DL_Message: p_NasSecurityByRef: ", p_NasSecurityByRef); + log(">>> f_Check_5GAKA_NAS_DL_Message: p_previous_nas_count_dl: ", p_previous_nas_count_dl); + + var bitstring v_bs := oct2bit(p_nas_pdu); + var NG_NAS_DL_Message_Type v_message; + if (decvalue(v_bs, v_message) != 0) { + log("f_Check_5GAKA_NAS_DL_Message: decvalue failure"); + return false; + } + log("f_Check_5GAKA_NAS_DL_Message: Raw v_message: ", v_message); + + log("f_Check_5GAKA_NAS_DL_Message: v_message: ", v_message); + if (ischosen(v_message.security_Protected_Nas_Message)) { + log("f_Check_5GAKA_NAS_DL_Message: v_message.security_Protected_Nas_Message: ", v_message.security_Protected_Nas_Message); + if (v_message.security_Protected_Nas_Message.securityHeaderType == tsc_SHT_NoSecurityProtection) { + // Nothing to do + } else if (v_message.security_Protected_Nas_Message.securityHeaderType == tsc_SHT_IntegrityProtected_NewSecurityContext) { // Integrity & new context + var NG_SECURITY_MODE_COMMAND v_ng_security_mode_command; + var bitstring v_bs1 := oct2bit(v_message.security_Protected_Nas_Message.plainNASMessage); + log(v_message.security_Protected_Nas_Message.plainNASMessage); + if (decvalue(v_bs1, v_ng_security_mode_command) != 0) { + log("f_Check_5GAKA_NAS_DL_Message: decvalue failure for NG_SECURITY_MODE_COMMAND"); + return false; + } + + // Set security algorithm + f_5g_security_context(v_ng_security_mode_command, p_NasSecurityByRef); + log(">>> f_Check_5GAKA_NAS_DL_Message: p_NasSecurityByRef: ", p_NasSecurityByRef); + // New context + p_previous_nas_count_dl := f_NasCountInit(); + + // Check integrity + log("f_Check_5GAKA_NAS_DL_Message: v_SequenceNumber: ", v_message.security_Protected_Nas_Message.sequenceNumber); + var octetstring v_calculated_mac := fx_NG_NasIntegrityAlgorithm(v_message.security_Protected_Nas_Message.sequenceNumber & v_message.security_Protected_Nas_Message.plainNASMessage, + p_NasSecurityByRef.NAS_Integrity.Algorithm, + p_NasSecurityByRef.NAS_Integrity.K_NAS, + f_NG_NasSecurity_EstimateCOUNT(p_previous_nas_count_dl, oct2int(v_message.security_Protected_Nas_Message.sequenceNumber)), + PX_BEARER_ID, + tsc_DirectionDL); + log("f_Check_5GAKA_NAS_DL_Message: v_calculated_mac: ", v_calculated_mac); + if (v_calculated_mac != v_message.security_Protected_Nas_Message.messageAuthenticationCode) { + //ORG log("f_Check_5GAKA_NAS_DL_Message: Integrity check failed"); + log("f_Check_5GAKA_NAS_DL_Message: Integrity check failed - mac: ", v_message.security_Protected_Nas_Message.messageAuthenticationCode); + return false; + } + var integer v := oct2int(p_previous_nas_count_dl); + v := v + 1; + p_previous_nas_count_dl := int2oct(v, 4); + p_previous_nas_count_dl := bit2oct(oct2bit(p_previous_nas_count_dl) and4b oct2bit('00FFFFFF'O)); // Use 24bits only + } else if (v_message.security_Protected_Nas_Message.securityHeaderType == tsc_SHT_IntegrityProtected_Ciphered) { + // Check integrity + log("f_Check_5GAKA_NAS_DL_Message: v_SequenceNumber: ", v_message.security_Protected_Nas_Message.sequenceNumber); + var octetstring v_calculated_mac := fx_NG_NasIntegrityAlgorithm(v_message.security_Protected_Nas_Message.sequenceNumber & v_message.security_Protected_Nas_Message.plainNASMessage, + p_NasSecurityByRef.NAS_Integrity.Algorithm, + p_NasSecurityByRef.NAS_Integrity.K_NAS, + f_NG_NasSecurity_EstimateCOUNT(p_previous_nas_count_dl, oct2int(v_message.security_Protected_Nas_Message.sequenceNumber)), + PX_BEARER_ID, + tsc_DirectionDL); + log("f_Check_5GAKA_NAS_DL_Message: v_calculated_mac: ", v_calculated_mac); + if (v_calculated_mac != v_message.security_Protected_Nas_Message.messageAuthenticationCode) { + log("f_Check_5GAKA_NAS_DL_Message: Integrity check failed"); + return false; + } + var integer v := oct2int(p_previous_nas_count_dl); + v := v + 1; + p_previous_nas_count_dl := int2oct(v, 4); + p_previous_nas_count_dl := bit2oct(oct2bit(p_previous_nas_count_dl) and4b oct2bit('00FFFFFF'O)); // Use 24bits only + // Decyphering + var octetstring v_cleartextString; + v_cleartextString := fx_NG_NasDeciphering(v_message.security_Protected_Nas_Message.plainNASMessage, + p_NasSecurityByRef.NAS_Ciphering.Algorithm, + p_NasSecurityByRef.NAS_Ciphering.K_NAS, + v_message.security_Protected_Nas_Message.messageAuthenticationCode, + PX_BEARER_ID, + tsc_DirectionDL + ); + if (lengthof(v_cleartextString) == 0) { + log("f_Check_5GAKA_NAS_DL_Message: Deciphering failed"); + return false; + } + v_message.security_Protected_Nas_Message.plainNASMessage := v_cleartextString; + log("f_Check_5GAKA_NAS_DL_Message: v_message.security_Protected_Nas_Message.plainNASMessage: ", v_message.security_Protected_Nas_Message.plainNASMessage); + } else { + log("f_Check_5GAKA_NAS_DL_Message: Unsupported securityHeaderType: ", v_message.security_Protected_Nas_Message.securityHeaderType); + return false; + } + // Message was decrypted properly + v_bs := oct2bit(v_message.security_Protected_Nas_Message.plainNASMessage); + if (decvalue(v_bs, v_message) != 0) { + log("f_Check_5GAKA_NAS_DL_Message: decvalue failure"); + return false; + } + log("f_Check_5GAKA_NAS_DL_Message: Deciphered v_message: ", v_message); + } else { + log("f_Check_5GAKA_NAS_DL_Message: Message is not security protected"); + } + log("f_Check_5GAKA_NAS_DL_Message: v_message: ", v_message); + log("f_Check_5GAKA_NAS_DL_Message: p_NG_NAS_DL_Message_Type: ", p_NG_NAS_DL_Message_Type); + if (not(match(v_message, p_NG_NAS_DL_Message_Type))) { + log(match(v_message, p_NG_NAS_DL_Message_Type)); + return false; + } + p_message := v_message; + log("f_Check_5GAKA_NAS_DL_Message: matching: p_message: ", p_message); + + // Extract inner message if any + p_inner_message := ''O; + // if (ischosen(v_message.security_Mode_Complete)) { + // if (ispresent(v_message.security_Mode_Complete.nasMsg)) { + // log("f_Check_5GAKA_NAS_DL_Message: v_message.security_Mode_Complete.nasMsgContainer: ", v_message.security_Mode_Complete.nasMsg); + // p_inner_message := v_message.security_Mode_Complete.nasMsg.replayedNASMsgContainerValue; + // } + // } else { + // p_inner_message := ''O; + // } + + log("<<< f_Check_5GAKA_NAS_DL_Message: p_previous_nas_count_dl: ", p_previous_nas_count_dl); + return true; + } // End of function f_Check_5GAKA_NAS_DL_Message + + function f_Check_5GAKA_NAS_UL_Message( + in NAS_PDU p_nas_pdu, + in template NG_NAS_UL_Message_Type p_NG_NAS_UL_Message_Type, + in NG_NAS_SecurityParams_Type p_NasSecurityByRef, + inout NasCount_Type p_previous_nas_count_ul, + out octetstring p_inner_message + ) return boolean { + log(">>> f_Check_5GAKA_NAS_UL_Message: p_nas_pdu: ", p_nas_pdu); + log(">>> f_Check_5GAKA_NAS_UL_Message: p_NasSecurityByRef: ", p_NasSecurityByRef); + log(">>> f_Check_5GAKA_NAS_UL_Message: p_previous_nas_count_ul: ", p_previous_nas_count_ul); + + var bitstring v_bs := oct2bit(p_nas_pdu); + var NG_NAS_UL_Message_Type v_message; + if (decvalue(v_bs, v_message) != 0) { + log("f_Check_5GAKA_NAS_UL_Message: decvalue failure"); + return false; + } + log("f_Check_5GAKA_NAS_DL_Message: Raw v_message: ", v_message); + + if (ischosen(v_message.security_Protected_Nas_Message)) { + log("f_Check_5GAKA_NAS_UL_Message: v_message.security_Protected_Nas_Message: ", v_message.security_Protected_Nas_Message); + log("f_Check_5GAKA_NAS_UL_Message: v_message.security_Protected_Nas_Message.securityHeaderType: ", v_message.security_Protected_Nas_Message.securityHeaderType); + if (v_message.security_Protected_Nas_Message.securityHeaderType == tsc_SHT_NoSecurityProtection) { + // Nothing to do + } else if (v_message.security_Protected_Nas_Message.securityHeaderType == tsc_SHT_IntegrityProtected_NewSecurityContext) { // Integrity & new context + // New context + p_previous_nas_count_ul := f_NasCountInit(); + + // Check integrity + log("f_Check_5GAKA_NAS_UL_Message: v_SequenceNumber: ", v_message.security_Protected_Nas_Message.sequenceNumber); + var octetstring v_calculated_mac := fx_NG_NasIntegrityAlgorithm(v_message.security_Protected_Nas_Message.sequenceNumber & v_message.security_Protected_Nas_Message.plainNASMessage, + p_NasSecurityByRef.NAS_Integrity.Algorithm, + p_NasSecurityByRef.NAS_Integrity.K_NAS, + f_NG_NasSecurity_EstimateCOUNT(p_previous_nas_count_ul, oct2int(v_message.security_Protected_Nas_Message.sequenceNumber)), + PX_BEARER_ID, + tsc_DirectionDL); + log("f_Check_5GAKA_NAS_UL_Message: v_calculated_mac: ", v_calculated_mac); + if (v_calculated_mac != v_message.security_Protected_Nas_Message.messageAuthenticationCode) { + log("f_Check_5GAKA_NAS_UL_Message: Integrity check failed"); + return false; + } + var integer v := oct2int(p_previous_nas_count_ul); + v := v + 1; + p_previous_nas_count_ul := int2oct(v, 4); + p_previous_nas_count_ul := bit2oct(oct2bit(p_previous_nas_count_ul) and4b oct2bit('00FFFFFF'O)); // Use 24bits only + } else if (v_message.security_Protected_Nas_Message.securityHeaderType == tsc_SHT_IntegrityProtected) { + // TODO Check integrity + } else if (v_message.security_Protected_Nas_Message.securityHeaderType == tsc_SHT_IntegrityProtected_Ciphered_NewSecurityContext) { + // New context + p_previous_nas_count_ul := f_NasCountInit(); + + // Check integrity + log("f_Check_5GAKA_NAS_UL_Message: v_SequenceNumber: ", v_message.security_Protected_Nas_Message.sequenceNumber); + var octetstring v_calculated_mac := fx_NG_NasIntegrityAlgorithm(v_message.security_Protected_Nas_Message.sequenceNumber & v_message.security_Protected_Nas_Message.plainNASMessage, + p_NasSecurityByRef.NAS_Integrity.Algorithm, + p_NasSecurityByRef.NAS_Integrity.K_NAS, + f_NG_NasSecurity_EstimateCOUNT(p_previous_nas_count_ul, oct2int(v_message.security_Protected_Nas_Message.sequenceNumber)), + PX_BEARER_ID, + tsc_DirectionUL); + log("f_Check_5GAKA_NAS_UL_Message: v_calculated_mac: ", v_calculated_mac); + if (v_calculated_mac != v_message.security_Protected_Nas_Message.messageAuthenticationCode) { + log("f_Check_5GAKA_NAS_UL_Message: Integrity check failed"); + return false; + } + var integer v := oct2int(p_previous_nas_count_ul); + v := v + 1; + p_previous_nas_count_ul := int2oct(v, 4); + p_previous_nas_count_ul := bit2oct(oct2bit(p_previous_nas_count_ul) and4b oct2bit('00FFFFFF'O)); // Use 24bits only + } else if (v_message.security_Protected_Nas_Message.securityHeaderType == tsc_SHT_IntegrityProtected_Ciphered) { + // TODO Check integrity + var octetstring v_cleartextString; + if (ischosen(v_message.security_Protected_Nas_Message)) { + v_cleartextString := fx_NG_NasDeciphering(v_message.security_Protected_Nas_Message.plainNASMessage, + p_NasSecurityByRef.NAS_Ciphering.Algorithm, + p_NasSecurityByRef.NAS_Ciphering.K_NAS, + v_message.security_Protected_Nas_Message.messageAuthenticationCode, + PX_BEARER_ID, + tsc_DirectionUL + ); + } else { + log("f_Check_5GAKA_NAS_UL_Message: Unsupported variant of NAS UL Message"); + return false; + } + if (lengthof(v_cleartextString) == 0) { + log("f_Check_5GAKA_NAS_UL_Message: Deciphering failed"); + return false; + } + v_message.security_Protected_Nas_Message.plainNASMessage := v_cleartextString; + log("f_Check_5GAKA_NAS_UL_Message: v_message.security_Protected_Nas_Message.plainNASMessage: ", v_message.security_Protected_Nas_Message.plainNASMessage); + } else { + log("f_Check_5GAKA_NAS_UL_Message: Unsupported securityHeaderType: ", v_message.security_Protected_Nas_Message.securityHeaderType); + return false; + } + // Message was decrypted/verified properly + v_bs := oct2bit(v_message.security_Protected_Nas_Message.plainNASMessage); + if (decvalue(v_bs, v_message) != 0) { + log("f_Check_5GAKA_NAS_UL_Message: decvalue failure"); + return false; + } + + } + + if(ischosen(v_message.ul_Nas_Transport)){ + v_bs:=oct2bit(v_message.ul_Nas_Transport.payload.payload); + log(v_bs); + if(decvalue(v_bs, v_message) != 0){} + } + log("f_Check_5GAKA_NAS_UL_Message: v_message: ", v_message); + log("f_Check_5GAKA_NAS_UL_Message: p_NG_NAS_UL_Message_Type: ", p_NG_NAS_UL_Message_Type); + if (not(match(v_message, p_NG_NAS_UL_Message_Type))) { + log(match(v_message, p_NG_NAS_UL_Message_Type)); + return false; + } + log("f_Check_5GAKA_NAS_UL_Message: matching"); + + // Extract inner message if any + if (ischosen(v_message.security_Mode_Complete)) { + if (ispresent(v_message.security_Mode_Complete.nasMsg)) { + log("f_Check_5GAKA_NAS_UL_Message: v_message.security_Mode_Complete.nasMsgContainer: ", v_message.security_Mode_Complete.nasMsg); + p_inner_message := v_message.security_Mode_Complete.nasMsg.replayedNASMsgContainerValue; + } + } else { + p_inner_message := ''O; + } + + log("<<< f_Check_5GAKA_NAS_UL_Message: p_previous_nas_count_ul: ", p_previous_nas_count_ul); + return true; + } // End of function f_Check_5GAKA_NAS_UL_Message + + function f_Check_5GAKA_NAS_DL_Message_is_encrypted(in NAS_PDU p_nas_pdu) return boolean { + log(">>> f_Check_5GAKA_NAS_DL_Message_is_encrypted: ", p_nas_pdu); + + var bitstring v_bs := oct2bit(p_nas_pdu); + var NG_NAS_DL_Message_Type v_message; + if (decvalue(v_bs, v_message) != 0) { + log("f_Check_5GAKA_NAS_DL_Message_is_encrypted: decvalue failure"); + return false; + } + log("f_Check_5GAKA_NAS_DL_Message_is_encrypted: v_message: ", v_message); + if (not ischosen(v_message.security_Protected_Nas_Message)) { + return false + } + + return true; + } // End of function f_Check_5GAKA_NAS_DL_Message_is_encrypted + + function f_Check_5GAKA_NAS_UL_Message_is_encrypted(in NAS_PDU p_nas_pdu) return boolean { + log(">>> f_Check_5GAKA_NAS_UL_Message_is_encrypted: ", p_nas_pdu); + + var bitstring v_bs := oct2bit(p_nas_pdu); + var NG_NAS_UL_Message_Type v_message; + if (decvalue(v_bs, v_message) != 0) { + log("f_Check_5GAKA_NAS_UL_Message_is_encrypted: decvalue failure"); + return false; + } + log("f_Check_5GAKA_NAS_UL_Message_is_encrypted: v_message: ", v_message); + if (not ischosen(v_message.security_Protected_Nas_Message)) { + return false + } + + return true; + } // End of function f_Check_5GAKA_NAS_UL_Message_is_encrypted + + function f_NasCountInit() return NasCount_Type { + var integer v_CountValue := (65536 * 256) - 1; + log("f_NasCountInit: p_PrevCount: ", int2oct(v_CountValue, 4)); + return int2oct(v_CountValue, 4); + } + + function f_NG_NasSecurity_EstimateCOUNT(in NasCount_Type p_PrevCount, + in integer p_SequenceNumber + ) return NasCount_Type { + log(">>> f_NG_NasSecurity_EstimateCOUNT: p_PrevCount: ", p_PrevCount); + log(">>> f_NG_NasSecurity_EstimateCOUNT: p_SequenceNumber: ", p_SequenceNumber); + + var integer v_PrevCountValue := oct2int(p_PrevCount); + var integer v_CountValue; + var integer v_MaxSnPlus1; + var integer v_PrevSnValue; + var integer v_ReceivedSnValue; + var integer v_OverflowCounter; /* Note: for normal (long) SN this is the overflow counter as described in 24.301; + for 5 bit SN it includes the 3 most significant bits of the least significant octet (what normally is the SN) */ + v_ReceivedSnValue := p_SequenceNumber; + v_MaxSnPlus1 := 256; + v_OverflowCounter := v_PrevCountValue / v_MaxSnPlus1; + v_PrevSnValue := v_PrevCountValue mod v_MaxSnPlus1; + + if (v_ReceivedSnValue < v_PrevSnValue) { // => overflow + v_OverflowCounter := (v_OverflowCounter + 1) mod 65536; + } + v_CountValue := (v_OverflowCounter * v_MaxSnPlus1) + v_ReceivedSnValue; + + log("<<< f_NG_NasSecurity_EstimateCOUNT: ", int2oct(v_CountValue, 4)); + return int2oct(v_CountValue, 4); + }; + + function f_NasSecurity_ExtractSNfromCOUNT( + in NasCount_Type p_Count + ) return NAS_SequenceNumber { + return int2oct(oct2int(p_Count) mod 256, 1); + }; + + function f_NasSecurity_IncrementCOUNT( + in NasCount_Type p_Count + ) return NasCount_Type { + var integer v_CountValue := oct2int(p_Count); + v_CountValue := (v_CountValue + 1) mod (65536 * 256); // the 8 most significant bits are 0 (24.301 cl. 4.4.3.1) + return int2oct(v_CountValue, 4); + }; + + function f_NG_Imeisv2MobileIdentity_v( + in hexstring p_IMEISV + ) return NG_MobileIdentity { + var integer v_ImeiLength := lengthof(p_IMEISV); + var integer v_Odd := (v_ImeiLength rem 2); + var octetstring v_Other := f_ImsiImei2Octetstring (p_IMEISV); + var B4_Type v_FirstDigit := hex2bit(p_IMEISV[0]); + var B1_Type v_OddEvenInd := int2bit(v_Odd, 1); + + return valueof({ + iei := '77'O, + iel := int2oct(1+v_ImeiLength, 2), + idDigit1 := v_FirstDigit, + oddEvenInd := v_OddEvenInd, + typeOfId := tsc_IdType_NG_IMEISV, + otherDigits := v_Other + }); + } + + // TODO To be moved in Lib_NG_NAS_Security_Functions.ttcn + // See NG_NasEmu_Common.f_EncodeAndCipher_NG_NasPdu + // This function needs to be reworked for ciphering + function f_EncodeAndCipher_NG_NasPdu_v( // TODO To be renamed + in SecurityHeaderType p_security_header_type, + in octetstring p_nAS_PDU, + in MAC_Direction_Type p_direction, + in B5_Type p_bearerId, + inout NasCount_Type p_nas_count, + inout NG_NAS_SecurityParams_Type p_ng_nas_security_params_type, + out NG_SECURITY_PROTECTED_NAS_MESSAGE p_ng_security_protected_nas_message + ) return octetstring { + log(">>> f_EncodeAndCipher_NG_NasPdu_v: p_nAS_PDU: ", p_nAS_PDU); + log(">>> f_EncodeAndCipher_NG_NasPdu_v: p_direction: ", p_direction); + log(">>> f_EncodeAndCipher_NG_NasPdu_v: p_bearerId: ", p_bearerId); + log(">>> f_EncodeAndCipher_NG_NasPdu_v: p_nas_count: ", p_nas_count); + log(">>> f_EncodeAndCipher_NG_NasPdu_v: p_ng_nas_security_params_type: ", p_ng_nas_security_params_type); + + //v_EncodedNasPdu := f_NG_NasEmu_EncodePiggybacked(p_NAS_MSG_Request.Pdu); + + if (p_ng_nas_security_params_type.NAS_Integrity.Algorithm == tsc_SHT_NoSecurityProtection) { + log("f_EncodeAndCipher_NG_NasPdu_v: No security applied"); + return p_nAS_PDU; + } + + // Increment NAS count + p_nas_count := f_NasSecurity_IncrementCOUNT(p_nas_count); + + // Apply ciphering if necessary + var octetstring v_EncodedNasPdu := p_nAS_PDU; + if ( + (p_ng_nas_security_params_type.NAS_Ciphering.Algorithm == tsc_SHT_IntegrityProtected_Ciphered) or + (p_ng_nas_security_params_type.NAS_Ciphering.Algorithm == tsc_SHT_IntegrityProtected_Ciphered_NewSecurityContext) + ) { + log("f_EncodeAndCipher_NG_NasPdu_v: Apply ciphering"); + v_EncodedNasPdu := fx_NG_NasCiphering(p_nAS_PDU, + p_ng_nas_security_params_type.NAS_Ciphering.Algorithm, + p_ng_nas_security_params_type.NAS_Ciphering.K_NAS, + p_nas_count, + p_bearerId); + } + if ( + (p_ng_nas_security_params_type.NAS_Ciphering.Algorithm == tsc_SHT_IntegrityProtected_Ciphered) or + (p_ng_nas_security_params_type.NAS_Ciphering.Algorithm == tsc_SHT_IntegrityProtected_Ciphered_NewSecurityContext) + ) { + log("f_EncodeAndCipher_NG_NasPdu_v: Apply ciphering"); + v_EncodedNasPdu := fx_NG_NasCiphering(p_nAS_PDU, + p_ng_nas_security_params_type.NAS_Ciphering.Algorithm, + p_ng_nas_security_params_type.NAS_Ciphering.K_NAS, + p_nas_count, + p_bearerId); + } + + // Apply integrity protection + log("f_EncodeAndCipher_NG_NasPdu_v: Apply integrity protection"); + var NAS_SequenceNumber v_SequenceNumber := f_NasSecurity_ExtractSNfromCOUNT(p_nas_count); + log("f_EncodeAndCipher_NG_NasPdu_v: v_SequenceNumber: ", v_SequenceNumber); + var octetstring v_Octet7toN := v_SequenceNumber & v_EncodedNasPdu; + log("f_EncodeAndCipher_NG_NasPdu_v: v_Octet7toN: ", v_Octet7toN); + var octetstring v_calculated_mac := fx_NG_NasIntegrityAlgorithm(v_Octet7toN, + p_ng_nas_security_params_type.NAS_Integrity.Algorithm, + p_ng_nas_security_params_type.NAS_Integrity.K_NAS, + p_nas_count, + p_bearerId, + p_direction); + log("f_EncodeAndCipher_NG_NasPdu_v: v_calculated_mac: ", v_calculated_mac); + + // Security protected NAS message + var NG_NAS_DL_Message_Type v := valueof( + m_NG_SecurityProtected_NasMsg( + p_security_header_type, + v_calculated_mac, + v_SequenceNumber, + v_EncodedNasPdu + )); + p_ng_security_protected_nas_message := v.security_Protected_Nas_Message; + v_EncodedNasPdu := bit2oct(encvalue(p_ng_security_protected_nas_message)); + + log("<<< f_EncodeAndCipher_NG_NasPdu_v: p_ng_security_protected_nas_message: ", p_ng_security_protected_nas_message); + log("<<< f_EncodeAndCipher_NG_NasPdu_v: ", v_EncodedNasPdu); + return v_EncodedNasPdu; + } + + function fl_NasNN_MCC2PlmnId( + in NAS_Mcc p_nas_mcc, + in hexstring p_nas_mnc + ) return NAS_PlmnId { + log(">>> fl_NasNN_MCC2PlmnId: p_nas_mcc=", p_nas_mcc); + log(">>> fl_NasNN_MCC2PlmnId: p_nas_mnc=", p_nas_mnc); + + // log("fl_NasNN_MCC2PlmnId: p_nas_mcc[0]=", p_nas_mcc[0]); + // log("fl_NasNN_MCC2PlmnId: p_nas_mcc[1]=", p_nas_mcc[1]); + // log("fl_NasNN_MCC2PlmnId: p_nas_mcc[2]=", p_nas_mcc[2]); + // log("fl_NasNN_MCC2PlmnId: p_nas_mnc[0]=", p_nas_mnc[0]); + // log("fl_NasNN_MCC2PlmnId: p_nas_mnc[1]=", p_nas_mnc[1]); + + var hexstring v_plmn_hexstring; + if (lengthof(p_nas_mnc) == 2) { + v_plmn_hexstring := p_nas_mcc[1] & p_nas_mcc[0] & 'f'H & p_nas_mcc[2] & p_nas_mnc[1] & p_nas_mnc[0]; + } else { + v_plmn_hexstring := p_nas_mcc[1] & p_nas_mcc[0] & p_nas_mnc[2] & p_nas_mcc[2] & p_nas_mnc[1] & p_nas_mnc[0]; + } + + log("<<< fl_NasNN_MCC2PlmnId`: v_plmn_hexstring=", hex2oct(v_plmn_hexstring)); + return hex2oct(v_plmn_hexstring); + } + + /** + * @see https://www.ericsson.com/en/blog/2021/9/authentication-and-key-agreements + */ + group fiveg_aka_security_network { + + /** + * @desc Compute RES and XRES values based on rAND & AUTN received in the NG_AUTHENTICATION_REQUEST + * @param [in] p_rand + * @param [in] p_autn + * @param [in] KeySeq + * @param [in,out] p_ng_nas_security_params_type Built security parameters + */ + function f_5g_aka_compute_res_xres( + in B128_Type p_subscription_key := PX_SUBSCRIPTION_KEY, + in B128_Type p_rand, + in B128_Type p_autn, + in ABBA p_abba, + in NAS_PlmnId p_PLMN, + in template (omit) hexstring p_NID := omit, + in hexstring p_Identity := px_IMSI_Def, + inout NG_NAS_SecurityParams_Type p_ng_nas_security_params_type + ) return boolean { + log(">>> f_5g_aka_compute_res_xres: p_ng_nas_security_params_type: ", p_ng_nas_security_params_type); + log(">>> f_5g_aka_compute_res_xres: p_Identity: ", p_Identity); + + p_ng_nas_security_params_type := valueof(cs_NG_NAS_SecurityParamsInit); + log("f_5g_aka_compute_res_xres: KDF=", p_ng_nas_security_params_type.KDF); + p_ng_nas_security_params_type.ABBA := p_abba.abbaValue; + p_ng_nas_security_params_type.AuthParams.RandValue := p_rand; + p_ng_nas_security_params_type.AuthParams.AUTN := p_autn; + + log("f_5g_aka_compute_res_xres: PX_SUBSCRIPTION_KEY=", PX_SUBSCRIPTION_KEY); + + // Extract SQN from v_sqn_ak and XOR it with calculated MAC + var B48_Type v_sqn_ak := f_extract_sqn_ak_from_autn(p_autn); + var B16_Type v_amf := f_extract_amf_from_autn(p_autn); + var B64_Type v_mac := f_extract_mac_from_autn(p_autn); + log("f_5g_aka_compute_res_xres: v_sqn_ak=", bit2oct(v_sqn_ak)); + log("f_5g_aka_compute_res_xres: v_amf=", bit2oct(v_amf)); + log("f_5g_aka_compute_res_xres: v_mac=", bit2oct(v_mac)); + + // Set OP + if (PX_FORCE_USING_OPERATOR_SECRET_KEY == false) { + f_set_op(PX_OPERATOR_KEY); + } else { + f_force_opc(PX_OPERATOR_SECRET_KEY); + } + // Calculate RES, CK, IK and AK in one step + var B128_Type v_ck; + var B128_Type v_ik; + var B48_Type v_ak; + var B64_Type v_xres; + if (f_f2345(PX_SUBSCRIPTION_KEY, p_rand, v_xres, v_ck, v_ik, v_ak) == -1) { + log("f_f2345 failed"); + return false; + } + log("f_5g_aka_compute_res_xres: v_xres=", bit2oct(v_xres)); + log("f_5g_aka_compute_res_xres: v_xres lenght=", lengthof(bit2oct(v_xres))); + p_ng_nas_security_params_type.AuthParams.XRES := v_xres; + p_ng_nas_security_params_type.AuthParams.XRESLength := lengthof(bit2oct(v_xres)); + p_ng_nas_security_params_type.AuthParams.CK := v_ck; + log("f_5g_aka_compute_res_xres: CK=", bit2oct(p_ng_nas_security_params_type.AuthParams.CK)); + p_ng_nas_security_params_type.AuthParams.IK := v_ik; + log("f_5g_aka_compute_res_xres: IK=", bit2oct(p_ng_nas_security_params_type.AuthParams.IK)); + p_ng_nas_security_params_type.Ks := p_ng_nas_security_params_type.AuthParams.CK & p_ng_nas_security_params_type.AuthParams.IK; + log("f_5g_aka_compute_res_xres: Ks=", bit2oct(p_ng_nas_security_params_type.Ks)); + var B48_Type v_sqn := v_sqn_ak xor4b v_ak; + log("f_5g_aka_compute_res_xres: v_sqn=", bit2oct(v_sqn)); + + // Verify that MAC-A was accepted + var B64_Type v_mac_a; + if (f_f1(PX_SUBSCRIPTION_KEY, p_rand, v_sqn, v_amf, v_mac_a) == -1) { + log("f_f1 failed: "); + return false; + } + log("f_5g_aka_compute_res_xres: v_mac_a=", bit2oct(v_mac_a)); + if (PX_CHECK_SECURITY and (v_mac != v_mac_a)) { + log("v_mac != v_mac_a"); + return false; + } + + // Compute XRES + p_ng_nas_security_params_type.AuthParams.XRES := f_NG_Authentication_A4(p_PLMN, + p_ng_nas_security_params_type.AuthParams, + p_ng_nas_security_params_type.KDF, + p_ng_nas_security_params_type.Ks, + p_NID); + p_ng_nas_security_params_type.AuthParams.XRESLength := lengthof(bit2oct(p_ng_nas_security_params_type.AuthParams.XRES)); + log("f_5g_aka_compute_res_xres: XRESstar=", bit2oct(p_ng_nas_security_params_type.AuthParams.XRES)); + log("f_5g_aka_compute_res_xres: XRESstarLength=", p_ng_nas_security_params_type.AuthParams.XRESLength); + + // Generate KAUSF + p_ng_nas_security_params_type.KAUSF := f_NG_Authentication_A2(p_ng_nas_security_params_type.AuthParams, + p_ng_nas_security_params_type.KDF, + p_ng_nas_security_params_type.Ks, + p_PLMN, + p_NID); + log("f_5g_aka_compute_res_xres: KAUSF=", bit2oct(p_ng_nas_security_params_type.KAUSF)); + + // Generate KSEAF + p_ng_nas_security_params_type.KSEAF := f_NG_Authentication_A6(p_PLMN, + p_ng_nas_security_params_type.KAUSF, + p_ng_nas_security_params_type.KDF, + p_NID + ); + log("f_5g_aka_compute_res_xres: KSEAF=", bit2oct(p_ng_nas_security_params_type.KSEAF)); + + // Generate KMAF + p_ng_nas_security_params_type.KAMF := f_NG_Authentication_A7(oct2char(hex2oct(p_Identity)), + p_ng_nas_security_params_type.KSEAF, + p_ng_nas_security_params_type.ABBA, + p_ng_nas_security_params_type.KDF + ); + log("f_5g_aka_compute_res_xres: KAMF=", bit2oct(p_ng_nas_security_params_type.KAMF)); + + log("<<< f_5g_aka_compute_res_xres: ", p_ng_nas_security_params_type); + return true; + } // End of function f_5g_aka_compute_res_xres + + function f_5g_security_context( + in template (value) NG_SECURITY_MODE_COMMAND p_ng_security_mode_command, + inout NG_NAS_SecurityParams_Type p_ng_nas_security_params_type + ) return boolean { + log(">>> f_5g_security_context: ", p_ng_security_mode_command); + + // Set security parameters + p_ng_nas_security_params_type.NAS_Integrity.Algorithm := valueof(p_ng_security_mode_command.nasSecurityAlgorithms.integrityType); + p_ng_nas_security_params_type.NAS_Ciphering.Algorithm := valueof(p_ng_security_mode_command.nasSecurityAlgorithms.cipheringType); + + // Derive KNASenc key + p_ng_nas_security_params_type.NAS_Ciphering.K_NAS := f_NG_Authentication_A8(tsc_NAS_Enc_Alg, + valueof(p_ng_security_mode_command.nasSecurityAlgorithms.cipheringType), + valueof(p_ng_nas_security_params_type.KAMF), + valueof(p_ng_nas_security_params_type.KDF) + ); + // Derive KNASint key + p_ng_nas_security_params_type.NAS_Integrity.K_NAS := f_NG_Authentication_A8(tsc_NAS_Int_Alg, + valueof(p_ng_security_mode_command.nasSecurityAlgorithms.integrityType), + valueof(p_ng_nas_security_params_type.KAMF), + valueof(p_ng_nas_security_params_type.KDF) + ); + + log("<<< f_5g_security_context: ", p_ng_nas_security_params_type); + return true; + } // End of function f_5g_security_context + + //-------------------------------------------------------------------------- + /* + * @desc HRES* and HXRES* derivation function + * As per annex A.5 of 33.501 + * @param p_AuthParams + * @param p_KAUSF + * @param p_KDF_Type + * @param p_NID (default value: omit) + * @return B256_Type + */ + function f_NG_Authentication_A5( + in B128_Type p_RAND, + in B64_Type p_XRESstar, + KDF_Type p_KDF_Type, + B256_Type p_Key + ) return B128_Type + { + const octetstring const_S6C_FC :='6C'O; + var octetstring v_S; + var octetstring v_P0; + var octetstring v_P1; + + log(">>> f_NG_Authentication_A5: p_RAND=", bit2oct(p_RAND)); + log(">>> f_NG_Authentication_A5: p_XRESstar=", bit2oct(p_XRESstar)); + log(">>> f_NG_Authentication_A5: p_KDF=", p_KDF_Type); + log(">>> f_NG_Authentication_A5: p_Key=", bit2oct(p_Key)); + + v_S := bit2oct(p_RAND) & bit2oct(p_XRESstar); + log("f_NG_Authentication_A5: v_S=", v_S); + + //return substr(fx_KeyDerivationFunction(p_KDF_Type, p_Key, v_S), 128, 128); + return substr(fx_sha256(v_S), 128, 128); + }; + + /* + * @desc KgNB key derivation functions (S69) + * As per annex A.9 of 33.501/ A.19 of 33.401 + * @param p_uplink_nas_count + * @param p_Key + * @param p_RegAccType + * @param p_KDF_Type + * @return B256_Type + */ + function f_NG_Authentication_A9( + in NasCount_Type p_uplink_nas_count, + in B256_Type p_Key, + in RegistrationAccessType p_RegAccType := Access_3GPP, + in KDF_Type p_KDF_Type := tsc_KDF_HMAC_SHA_256 + ) return B256_Type { + const octetstring const_S6E_FC :='6E'O; + var octetstring v_S; + // Generation of String + v_S := const_S6E_FC; + log("f_NG_Authentication_A9 (1): v_S=", v_S); + //FC = 0x6E + v_S := ( v_S & p_uplink_nas_count ); + log("f_NG_Authentication_A9 (2): v_S=", v_S); + //P0 = Uplink NAS COUNT + v_S := ( v_S & int2oct ( 4, 2 ) ); + log("f_NG_Authentication_A9 (3): v_S=", v_S); + //L0 = length of uplink NAS COUNT + if (p_RegAccType == Access_3GPP) { + v_S := ( v_S & '01'O ); + } else { + v_S := ( v_S & '02'O ); + } + log("f_NG_Authentication_A9 (4): v_S=", v_S); + //P1 = Access type distinguisher + v_S := ( v_S & '0001'O ); + log("f_NG_Authentication_A9 (5): v_S=", v_S); + //L1 = length of Access type distiguisher (i.e. 0x00 0x01) + + return fx_KeyDerivationFunction(p_KDF_Type, p_Key, v_S); + } + + /* + * @desc KnhGnb key derivation functions (S69) + * As per annex A.9 of 33.501/ A.19 of 33.401 + * @param p_sync_input + * @param p_Key + * @param p_KDF_Type + * @return B256_Type + */ + function f_NG_Authentication_A10( + in B256_Type p_sync_input, // This is the Kgnb key in 33.401 but it can be any input as per 33.501 + in B256_Type p_Key, + in KDF_Type p_KDF_Type := tsc_KDF_HMAC_SHA_256 + ) return B256_Type { + const octetstring const_S6F_FC :='6F'O; + var octetstring v_S; + // Generation of String + v_S := const_S6F_FC; + log("f_NG_Authentication_A10 (1): v_S=", v_S); + //FC = 0x6F + v_S := ( v_S & bit2oct(p_sync_input) ); + log("f_NG_Authentication_A10 (2): v_S=", v_S); + //P0 = SYNC INPUT + v_S := ( v_S & int2oct ( 4, 2 ) ); + log("f_NG_Authentication_A10 (3): v_S=", v_S); + //L0 = length of SYNC INPUT + + return fx_KeyDerivationFunction(p_KDF_Type, p_Key, v_S); + } + + + + + + + + + + + + + + + + function f_extract_sqn_ak_from_autn(in B128_Type p_autn) return B48_Type { + return substr(p_autn, 0, 48); + } + + function f_extract_amf_from_autn(in B128_Type p_autn) return B16_Type { + return substr(p_autn, 48, 16); + } + + function f_extract_mac_from_autn(in B128_Type p_autn) return B64_Type { + return substr(p_autn, 64, 64); + } + + /** + * @desc Set operator variant algorithm configuration + * @param [in] p_op Operator variant algorithm configuration + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 2 + */ + function f_set_op(in O16_Type p_op) { + fx_set_op(p_op); + } + /** + * @desc Get operator variant algorithm configuration + * @param [out] p_op Operator variant algorithm configuration + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 2 + */ + function f_get_op(out O16_Type p_op) { + fx_get_op(p_op); + } + /** + * @desc Derived OP from from OP and K (subscriber key) + * @param [in] p_authK The subscriber key + * @param [out] p_opc The derived OP from from OP and K + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 2 + */ + function f_compute_opc(in O16_Type p_authK, out O16_Type p_opc) return integer { + return fx_compute_opc(p_authK, p_opc); + } + /** + * @desc Force the value of OPc. In this case, OP is ignored. + * @param [in] p_opc The derived OP from from OP and K + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 2 + */ + function f_force_opc(in O16_Type p_opc) { + fx_force_opc(p_opc); + } + + /** + * @desc Encryption according to the cryptographic kernel function Rijndael. + * @see ETSI TS 135 207 V16.0.0 (2020-08) Clause 3 + */ + external function fx_rijndael_encrypt(in octetstring p_key, in octetstring p_plain_text, out octetstring p_cypherer_text) return integer; + function f_rijndael_encrypt(in octetstring p_key, in octetstring p_plain_text, out octetstring p_cypherer_text) return integer { + return fx_rijndael_encrypt(p_key, p_plain_text, p_cypherer_text); + } + + function f_f1(in B128_Type p_authK, in B128_Type p_rand, in B48_Type v_sqn, in B16_Type v_amf, out B64_Type v_mac_a) return integer { + return fx_f1(p_authK, p_rand, v_sqn, v_amf, v_mac_a); + } + + function f_f1star(in B128_Type p_authK, in B128_Type p_rand, in B48_Type v_sqn, in B16_Type v_amf, out B64_Type v_mac_s) return integer { + return fx_f1star(p_authK, p_rand, v_sqn, v_amf, v_mac_s); + } + + function f_f2345(in B128_Type p_authK, in B128_Type p_rand, out B64_Type v_res, out B128_Type v_ck, out B128_Type v_ik, out B48_Type v_ak) return integer { + return fx_f2345(p_authK, p_rand, v_res, v_ck, v_ik, v_ak); + } + + function f_f5star(in B128_Type p_authK, in B128_Type p_rand, out B48_Type p_ak) return integer { + return fx_f5star(p_authK, p_rand, p_ak); + } + + external function fx_set_op(in O16_Type p_op); + external function fx_get_op(out O16_Type p_op); + external function fx_force_opc(in O16_Type p_op); + external function fx_compute_opc(in O16_Type p_authK, out O16_Type p_opc) return integer; + external function fx_f1(in B128_Type p_authK, in B128_Type p_rand, in B48_Type v_sqn, in B16_Type v_amf, out B64_Type v_mac_a) return integer; + external function fx_f1star(in B128_Type p_authK, in B128_Type p_rand, in B48_Type v_sqn, in B16_Type v_amf, out B64_Type v_mac_s) return integer; + external function fx_f2345(in B128_Type p_authK, in B128_Type p_rand, out B64_Type v_res, out B128_Type v_ck, out B128_Type v_ik, out B48_Type v_ak) return integer; + external function fx_f5star(in B128_Type p_authK, in B128_Type p_rand, out B48_Type p_ak) return integer; + + } // End of function fiveg_aka_security_network + +} // End of module Lib_NG_NAS_Security_Functions \ No newline at end of file diff --git a/ttcn/Lib_NG_NAS/Lib_NG_NAS_Templates.ttcn b/ttcn/Lib_NG_NAS/lib/Lib_NG_NAS_Templates.ttcn similarity index 86% rename from ttcn/Lib_NG_NAS/Lib_NG_NAS_Templates.ttcn rename to ttcn/Lib_NG_NAS/lib/Lib_NG_NAS_Templates.ttcn index 627d9962f855771399ac3263d2e9b3d8e64a0229..28e246d0e0f657d4556738a6a49cb5aea5188b37 100644 --- a/ttcn/Lib_NG_NAS/Lib_NG_NAS_Templates.ttcn +++ b/ttcn/Lib_NG_NAS/lib/Lib_NG_NAS_Templates.ttcn @@ -70,11 +70,11 @@ module Lib_NG_NAS_Templates { authentication_Response := {} } // End of template mw_NG_AUTHENTICATION_RESPONSE - template (value) NG_NAS_DL_Message_Type m_NG_AUTHENTICATION_RESULT( - in NAS_KsiValue p_KeySetId, - in template (omit) EAP_Message p_EAP, - in template (omit) ABBA p_ABBA - ) modifies cs_NG_AUTHENTICATION_RESULT := { /* @status APPROVED (NR5GC) */ + template (omit) NG_NAS_DL_Message_Type m_NG_AUTHENTICATION_RESULT( + in NAS_KsiValue p_KeySetId, + in template (omit) EAP_Message p_EAP, + in template (omit) ABBA p_ABBA + ) modifies cs_NG_AUTHENTICATION_RESULT := { /* @status APPROVED (NR5GC) */ /* 24.501 cl. 8.2.3 */ authentication_Result := { } @@ -334,59 +334,59 @@ module Lib_NG_NAS_Templates { smsRequested := p_SmsRequested } // End of template mw_NG_Update - template (value) NG_NAS_DL_Message_Type m_NG_REGISTRATION_ACCEPT( - in template (value) RegistrationResult p_RegistrationResult, - in template (omit) NG_MobileIdentity p_GUTI := omit, - in template (omit) PLMN_List p_EPLMNs := omit, - in template (omit) NG_TrackingAreaIdList p_TAIList := omit, - in template (omit) NSSAI p_AllowedNSSAI := omit, - in template (omit) RejectedNSSAI p_RejectedNSSAI := omit, - in template (omit) NSSAI p_ConfiguredNSSAI := omit, - in template (omit) NG_NetworkFeatureSupport p_NwkFeatureSupport := omit, - in template (omit) PDU_SessionStatus p_PDU_SessionStatus := omit, - in template (omit) PDU_SessionReactivationResult p_PDU_SessionReactResult := omit, - in template (omit) PDU_SessionReactivationError p_PDU_SessionReactError := omit, - in template (omit) LADN_Info p_LADN_Info := omit, - in template (omit) MICO_Ind p_MICO_Ind := omit, - in template (omit) NetworkSlicingInd p_NetworkSlicingInd := omit, - in template (omit) ServiceAreaIdList p_SAIList := omit, - in template (omit) GPRS_Timer3 p_T3512 := omit, - in template (omit) GPRS_Timer2 p_Non3GPPDereg := omit, - in template (omit) GPRS_Timer2 p_T3502 := omit, - in template (omit) EmergNumList p_EmergNumList := omit, - in template (omit) ExtdEmergNumList p_ExtdEmergNumList := omit, - in template (omit) SORTransparentContainer p_SOR := omit, - in template (omit) EAP_Message p_EAP := omit, - in template (omit) InclusionModeNSSAI p_InclusionModeNSSAI := omit, - in template (omit) OperatorAccessCatDefinitions p_AccessCatDefinition := omit, - in template (omit) NG_DRXparameter p_NG_DRXparameter := omit, - in template (omit) Non3GPP_NW_ProvidedPolicies p_Non3GPP_NW_ProvidedPolicies := omit, - in template (omit) EPS_BearerContextStatus p_EPS_BearerContextStatus := omit, - in template (omit) ExtdDRXParams p_NegotiatedExtdDRXParams := omit, - in template (omit) GPRS_Timer3 p_T3447 := omit, - in template (omit) GPRS_Timer3 p_T3448 := omit, - in template (omit) GPRS_Timer3 p_T3324 := omit, - in template (omit) UERadioCapId p_UERadioCapId := omit, - in template (omit) UERadioCapIdDeletion p_UERadioCapIdDeletion := omit, - in template (omit) NSSAI p_PendingNSSAI := omit, - in template (omit) NG_CipheringKeyData p_CipheringKeyData := omit, - in template (omit) CAGInfoList p_CAGInfoList := omit, - in template (omit) TruncatedS_TMSIConfig p_TruncatedS_TMSIConfig := omit, - in template (omit) WUSAssistInfo p_WUSAssistInfo := omit, - in template (omit) NB_N1ModeDRXParams p_NB_N1ModeDRXParams := omit, - in template (omit) ExtdRejectedNSSAI p_ExtdRejectedNSSAI := omit, - in template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit, - in template (omit) PEIPS_AssistInfo p_NegotiatedPEIPS_AssistInfo := omit, - in template (omit) NG_AddReqResult p_AddRequestResult := omit, - in template (omit) NSSRG_Info p_NssrgInfo := omit, - in template (omit) RegistrationWaitRange p_DisasterRoamingWaitRange := omit, - in template (omit) RegistrationWaitRange p_DisasterReturnWaitRange := omit, - in template (omit) DisasterPLMNList p_DisasterPLMNList := omit, - in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_Roaming := omit, - in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := omit, - in template (omit) ExtdCAGInfoList p_ExtdCAGInfoList := omit, - in template (omit) NSAG_Info p_NsagInfo := omit - ) modifies cs_NG_REGISTRATION_ACCEPT := { /* 24.501 cl. 8.2.7 */ + template (omit) NG_NAS_DL_Message_Type m_NG_REGISTRATION_ACCEPT( + in template (value) RegistrationResult p_RegistrationResult, + in template (omit) NG_MobileIdentity p_GUTI := omit, + in template (omit) PLMN_List p_EPLMNs := omit, + in template (omit) NG_TrackingAreaIdList p_TAIList := omit, + in template (omit) NSSAI p_AllowedNSSAI := omit, + in template (omit) RejectedNSSAI p_RejectedNSSAI := omit, + in template (omit) NSSAI p_ConfiguredNSSAI := omit, + in template (omit) NG_NetworkFeatureSupport p_NwkFeatureSupport := omit, + in template (omit) PDU_SessionStatus p_PDU_SessionStatus := omit, + in template (omit) PDU_SessionReactivationResult p_PDU_SessionReactResult := omit, + in template (omit) PDU_SessionReactivationError p_PDU_SessionReactError := omit, + in template (omit) LADN_Info p_LADN_Info := omit, + in template (omit) MICO_Ind p_MICO_Ind := omit, + in template (omit) NetworkSlicingInd p_NetworkSlicingInd := omit, + in template (omit) ServiceAreaIdList p_SAIList := omit, + in template (omit) GPRS_Timer3 p_T3512 := omit, + in template (omit) GPRS_Timer2 p_Non3GPPDereg := omit, + in template (omit) GPRS_Timer2 p_T3502 := omit, + in template (omit) EmergNumList p_EmergNumList := omit, + in template (omit) ExtdEmergNumList p_ExtdEmergNumList := omit, + in template (omit) SORTransparentContainer p_SOR := omit, + in template (omit) EAP_Message p_EAP := omit, + in template (omit) InclusionModeNSSAI p_InclusionModeNSSAI := omit, + in template (omit) OperatorAccessCatDefinitions p_AccessCatDefinition := omit, + in template (omit) NG_DRXparameter p_NG_DRXparameter := omit, + in template (omit) Non3GPP_NW_ProvidedPolicies p_Non3GPP_NW_ProvidedPolicies := omit, + in template (omit) EPS_BearerContextStatus p_EPS_BearerContextStatus := omit, + in template (omit) ExtdDRXParams p_NegotiatedExtdDRXParams := omit, + in template (omit) GPRS_Timer3 p_T3447 := omit, + in template (omit) GPRS_Timer3 p_T3448 := omit, + in template (omit) GPRS_Timer3 p_T3324 := omit, + in template (omit) UERadioCapId p_UERadioCapId := omit, + in template (omit) UERadioCapIdDeletion p_UERadioCapIdDeletion := omit, + in template (omit) NSSAI p_PendingNSSAI := omit, + in template (omit) NG_CipheringKeyData p_CipheringKeyData := omit, + in template (omit) CAGInfoList p_CAGInfoList := omit, + in template (omit) TruncatedS_TMSIConfig p_TruncatedS_TMSIConfig := omit, + in template (omit) WUSAssistInfo p_WUSAssistInfo := omit, + in template (omit) NB_N1ModeDRXParams p_NB_N1ModeDRXParams := omit, + in template (omit) ExtdRejectedNSSAI p_ExtdRejectedNSSAI := omit, + in template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit, + in template (omit) PEIPS_AssistInfo p_NegotiatedPEIPS_AssistInfo := omit, + in template (omit) NG_AddReqResult p_AddRequestResult := omit, + in template (omit) NSSRG_Info p_NssrgInfo := omit, + in template (omit) RegistrationWaitRange p_DisasterRoamingWaitRange := omit, + in template (omit) RegistrationWaitRange p_DisasterReturnWaitRange := omit, + in template (omit) DisasterPLMNList p_DisasterPLMNList := omit, + in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_Roaming := omit, + in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := omit, + in template (omit) ExtdCAGInfoList p_ExtdCAGInfoList := omit, + in template (omit) NSAG_Info p_NsagInfo := omit + ) modifies cs_NG_REGISTRATION_ACCEPT := { /* 24.501 cl. 8.2.7 */ /* @status APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */ registration_Accept := { } @@ -443,7 +443,7 @@ module Lib_NG_NAS_Templates { template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *, template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := *, template ExtdCAGInfoList p_ExtdCAGInfoList := *, - template NSAG_Info p_NsagInfo + template NSAG_Info p_NsagInfo := * ) := { /* 24.501 cl. 8.2.7 */ /* @status APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */ registration_Accept := { @@ -518,8 +518,19 @@ module Lib_NG_NAS_Templates { } } // End of template m_NG_REGISTRATION_COMPLETE + template (value) NG_NAS_UL_Message_Type m_NG_REGISTRATION_COMPLETE_noSOR := { /* 24.501 cl. 8.2.8 */ + /* @status APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */ + registration_Complete := { + protocolDiscriminator := tsc_EPD_GMM, /* cl. 9.2 M V 1 */ + spareHalfOctet := tsc_SpareHalfOctet, /* cl. 9.3 M V 1/2 */ + securityHeaderType := tsc_SHT_NoSecurityProtection, + messageType := tsc_MT_NG_RegistrationComplete, /* cl. 9.7 M V 1 */ + sorTransparentContainer := omit + } + } // End of template m_NG_REGISTRATION_COMPLETE + template (present) NG_NAS_UL_Message_Type mw_NG_REGISTRATION_COMPLETE( - template SORTransparentContainer p_SOR := ? + template (present) SORTransparentContainer p_SOR := ? ) modifies cr_NG_REGISTRATION_COMPLETE := { /* 24.501 cl. 8.2.8 */ /* @status APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */ registration_Complete := { @@ -531,20 +542,34 @@ module Lib_NG_NAS_Templates { } } // End of template mw_NG_REGISTRATION_COMPLETE - template (value) NG_NAS_DL_Message_Type m_NG_REGISTRATION_REJECT( - in template (value) GMM_GSM_Cause p_Cause, - in template (omit) GPRS_Timer2 p_T3346 := omit, - in template (omit) GPRS_Timer2 p_T3502 := omit, - in template (omit) EAP_Message p_EAP := omit, - in template (omit) RejectedNSSAI p_RejectedNSSAI := omit, - in template (omit) CAGInfoList p_CAGInfoList := omit, - in template (omit) ExtdRejectedNSSAI p_ExtdRejectedNSSAI := omit, - in template (omit) RegistrationWaitRange p_DisasterReturnWaitRange := omit, - in template (omit) ExtdCAGInfoList p_ExtdCAGInfoList := omit, - in template (omit) GPRS_Timer3 p_LowerBoundTimerValue := omit, - in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_Roaming := omit, - in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := omit - ) modifies cs_NG_REGISTRATION_REJECT := { /* @status APPROVED (NR5GC, NR5GC_IRAT) */ + template (present) NG_NAS_UL_Message_Type mw_NG_REGISTRATION_COMPLETE_noSOR( + template SORTransparentContainer p_SOR := omit + ) modifies cr_NG_REGISTRATION_COMPLETE := { /* 24.501 cl. 8.2.8 */ + /* @status APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */ + registration_Complete := { + protocolDiscriminator := tsc_EPD_GMM, /* cl. 9.2 M V 1 */ + spareHalfOctet := tsc_SpareHalfOctet, /* cl. 9.3 M V 1/2 */ + securityHeaderType := tsc_SHT_NoSecurityProtection, + messageType := tsc_MT_NG_RegistrationComplete, /* cl. 9.7 M V 1 */ + sorTransparentContainer := p_SOR /* cl. 9.11.3.49 O TLV-E 20-2048 IEI=7F */ + } + } // End of template template (present) NG_NAS_UL_Message_Type mw_NG_REGISTRATION_COMPLETE_noSOR( + + + template (omit) NG_NAS_DL_Message_Type m_NG_REGISTRATION_REJECT( + in template (value) GMM_GSM_Cause p_Cause, + in template (omit) GPRS_Timer2 p_T3346 := omit, + in template (omit) GPRS_Timer2 p_T3502 := omit, + in template (omit) EAP_Message p_EAP := omit, + in template (omit) RejectedNSSAI p_RejectedNSSAI := omit, + in template (omit) CAGInfoList p_CAGInfoList := omit, + in template (omit) ExtdRejectedNSSAI p_ExtdRejectedNSSAI := omit, + in template (omit) RegistrationWaitRange p_DisasterReturnWaitRange := omit, + in template (omit) ExtdCAGInfoList p_ExtdCAGInfoList := omit, + in template (omit) GPRS_Timer3 p_LowerBoundTimerValue := omit, + in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_Roaming := omit, + in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := omit + ) modifies cs_NG_REGISTRATION_REJECT := { /* @status APPROVED (NR5GC, NR5GC_IRAT) */ /* 24.501 cl. 8.2.9 */ registration_Reject := { } @@ -728,7 +753,7 @@ module Lib_NG_NAS_Templates { messageType := tsc_MT_NG_SecurityModeCommand, /* cl. 9.7 M V 1 */ nasSecurityAlgorithms := p_Algs, /* cl. 9.11.3.34 M V 1 */ spareHalfOctet2 := tsc_SpareHalfOctet, /* cl. 9.3 M V 1/2 */ - ngNasKSI := {iei := ?, tsc := ?, nasKeySetId := p_KeySetId}, // FIXME FSCOM To be enhanced + ngNasKSI := {iei := *, tsc := ?, nasKeySetId := p_KeySetId}, // FIXME FSCOM To be enhanced ueSecurityCapability := p_UECap, /* cl. 9.11.3.54 M LV 3-9 */ imeisvRequest := p_IMEISV, /* cl. 9.11.3.28 O TV 1 IEI=E */ epsSecurityAlgorithms := p_EPSAlgs, /* cl. 9.11.3.25 O TV 2 IEI=57 */ @@ -756,6 +781,22 @@ module Lib_NG_NAS_Templates { } } // End of template m_NG_SECURITY_MODE_COMPLETE + template (value) NG_NAS_UL_Message_Type m_NG_SECURITY_MODE_COMPLETE_no_NonIMEISV_PEI( + in template (value) NG_MobileIdentity p_IMEISV, + in template (value) ReplayedNASMessageContainer p_NASMsg + ) := { /* 24.501 cl. 8.2.26 */ + /* @status APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */ + security_Mode_Complete := { + protocolDiscriminator := tsc_EPD_GMM, /* cl. 9.2 M V 1 */ + spareHalfOctet := tsc_SpareHalfOctet, /* cl. 9.3 M V 1/2 */ + securityHeaderType := tsc_SHT_NoSecurityProtection, + messageType := tsc_MT_NG_SecurityModeComplete, /* cl. 9.7 M V 1 */ + imeisv := p_IMEISV, /* cl. 9.11.3.4 O TLV 11 IEI=2C */ + nasMsg := p_NASMsg, /* cl. 9.11.3.33 O TLV-E 3-n IEI=7D */ + nonIMEISV_PEI := omit + } + } // End of template m_NG_SECURITY_MODE_COMPLETE + template (present) NG_NAS_UL_Message_Type mw_NG_SECURITY_MODE_COMPLETE( template (present) NG_MobileIdentity p_IMEISV := ?, template (present) ReplayedNASMessageContainer p_NASMsg := ?, @@ -766,6 +807,23 @@ module Lib_NG_NAS_Templates { } } // End of template mw_NG_SECURITY_MODE_COMPLETE + template (present) NG_NAS_UL_Message_Type mw_NG_SECURITY_MODE_COMPLETE_no_nonIMEISV_PEI( + template (present) NG_MobileIdentity p_IMEISV := ?, + template (present) ReplayedNASMessageContainer p_NASMsg := ?, + template NG_MobileIdentity p_NonIMEISV_PEI := * + ) := { /* 24.501 cl. 8.2.26 */ + /* @status APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */ + security_Mode_Complete := { + protocolDiscriminator := tsc_EPD_GMM, /* cl. 9.2 M V 1 */ + spareHalfOctet := tsc_SpareHalfOctet, /* cl. 9.3 M V 1/2 */ + securityHeaderType := tsc_SHT_NoSecurityProtection, + messageType := tsc_MT_NG_SecurityModeComplete, /* cl. 9.7 M V 1 */ + imeisv := p_IMEISV, /* cl. 9.11.3.4 O TLV 11 IEI=2C */ + nasMsg := p_NASMsg, /* cl. 9.11.3.33 O TLV-E 3-n IEI=7D */ + nonIMEISV_PEI := p_NonIMEISV_PEI /* cl. 9.11.3.4 O TLV-E 7-n IEI=78 Sep20 @sic R5s201387 Baseline Moving sic@ */ + } + } // End of template mw_NG_SECURITY_MODE_COMPLETE_no_nonIMEISV_PEI + template (value) NG_NAS_UL_Message_Type m_NG_SECURITY_MODE_REJECT( in template (value) GMM_GSM_Cause p_Cause ) := { /* @status APPROVED (NR5GC) */ @@ -845,7 +903,7 @@ module Lib_NG_NAS_Templates { template (present) NG_NAS_UL_Message_Type mw_NG_PDU_SESSION_ESTABLISHMENT_REQUEST( template (present) NG_PDU_SessionId p_PDU_SessionId := ?, template (present) ProcedureTransactionIdentifier p_PTI := ?, - template PDU_SessionType p_PDU_SessionType, + template PDU_SessionType p_PDU_SessionType := *, template SSC_Mode p_SSC_Mode := *, template NG_UE_SM_Cap p_UECap := *, template MaxNumPacketFilters p_MaxNumPacketFilters := *, @@ -862,39 +920,39 @@ module Lib_NG_NAS_Templates { template ServiceLvlAAContainer p_ServiceLvlAA := *, template RequestedMBSContainer p_RequestedMBS := *, template PDUSessionPairId p_PduSessionPairId := *, - template RSN p_RSN + template RSN p_RSN := * ) modifies cr_NG_PDU_SESSION_ESTABLISHMENT_REQUEST := { /* 24.501 cl. 8.3.1 */ /* @status APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */ pdu_Session_Establishment_Request := { } } // End of template mw_NG_PDU_SESSION_ESTABLISHMENT_REQUEST - template (value) NG_NAS_DL_Message_Type m_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT( - in template (value) NG_PDU_SessionId p_PDU_SessionId, - in ProcedureTransactionIdentifier p_PTI, - in template (value) SSC_Mode p_SSC_Mode, - in template (value) PDU_SessionType p_PDU_SessionType, - in template (value) QoS_Rules p_QoS_Rules, - in template (value) Session_AMBR p_Session_AMBR, - in template (omit) GMM_GSM_Cause p_Cause := omit, - in template (omit) PDU_Address p_PDU_Address := omit, - in template (omit) GPRS_Timer p_RQTimer := omit, - in template (omit) S_NSSAI_Type p_S_NSSAI := omit, - in template (omit) AlwaysOnPDUSessionInd p_AlwaysOnPDUSessionInd := omit, - in template (omit) MappedEPSBearerContexts p_MappedEPSBearerContexts := omit, - in template (omit) EAP_Message p_EAP := omit, - in template (omit) QoSFlowDescr p_QoSFlowDescr := omit, - in template (omit) ExtdProtocolConfigOptions p_ExtdPCO := omit, - in template (omit) DNN p_DNN := omit, - in template (omit) NGSM_NetworkFeatureSupport p_NGSM_NtwkFeatSupport := omit, - in template (omit) ServingPLMNRateControl p_ServingPLMNRateCtrl := omit, - in template (omit) ATSSSContainer p_ATSSSContainer := omit, - in template (omit) ControlPlaneInd p_ControlPlaneInd := omit, - in template (omit) IPHeaderCompressionConfig p_IPHeaderCompConfig := omit, - in template (omit) EthernetHeaderCompressConfig p_EthernetHeaderCompConfig := omit, - in template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit, - in template (omit) ReceivedMBSContainer p_ReceivedMBS := omit - ) modifies cs_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT := { /* 24.501 cl. 8.3.2 */ + template (omit) NG_NAS_DL_Message_Type m_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT( + in template (value) NG_PDU_SessionId p_PDU_SessionId, + in ProcedureTransactionIdentifier p_PTI, + in template (value) SSC_Mode p_SSC_Mode, + in template (value) PDU_SessionType p_PDU_SessionType, + in template (value) QoS_Rules p_QoS_Rules, + in template (value) Session_AMBR p_Session_AMBR, + in template (omit) GMM_GSM_Cause p_Cause := omit, + in template (omit) PDU_Address p_PDU_Address := omit, + in template (omit) GPRS_Timer p_RQTimer := omit, + in template (omit) S_NSSAI_Type p_S_NSSAI := omit, + in template (omit) AlwaysOnPDUSessionInd p_AlwaysOnPDUSessionInd := omit, + in template (omit) MappedEPSBearerContexts p_MappedEPSBearerContexts := omit, + in template (omit) EAP_Message p_EAP := omit, + in template (omit) QoSFlowDescr p_QoSFlowDescr := omit, + in template (omit) ExtdProtocolConfigOptions p_ExtdPCO := omit, + in template (omit) DNN p_DNN := omit, + in template (omit) NGSM_NetworkFeatureSupport p_NGSM_NtwkFeatSupport := omit, + in template (omit) ServingPLMNRateControl p_ServingPLMNRateCtrl := omit, + in template (omit) ATSSSContainer p_ATSSSContainer := omit, + in template (omit) ControlPlaneInd p_ControlPlaneInd := omit, + in template (omit) IPHeaderCompressionConfig p_IPHeaderCompConfig := omit, + in template (omit) EthernetHeaderCompressConfig p_EthernetHeaderCompConfig := omit, + in template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit, + in template (omit) ReceivedMBSContainer p_ReceivedMBS := omit + ) modifies cs_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT := { /* 24.501 cl. 8.3.2 */ /* @status APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */ pdu_Session_Establishment_Accept := { } @@ -957,6 +1015,63 @@ module Lib_NG_NAS_Templates { } } // End of template mw_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT + template (present) NG_NAS_DL_Message_Type mw_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT_noPTI( + template (present) NG_PDU_SessionId p_PDU_SessionId := ?, + template (present) SSC_Mode p_SSC_Mode := ?, + template (present) PDU_SessionType p_PDU_SessionType := ?, + template (present) QoS_Rules p_QoS_Rules := ?, + template (present) Session_AMBR p_Session_AMBR := ?, + template ProcedureTransactionIdentifier p_PTI := *, + template GMM_GSM_Cause p_Cause := *, + template PDU_Address p_PDU_Address := *, + template GPRS_Timer p_RQTimer := *, + template S_NSSAI_Type p_S_NSSAI := *, + template AlwaysOnPDUSessionInd p_AlwaysOnPDUSessionInd := *, + template MappedEPSBearerContexts p_MappedEPSBearerContexts := *, + template EAP_Message p_EAP := *, + template QoSFlowDescr p_QoSFlowDescr := *, + template ExtdProtocolConfigOptions p_ExtdPCO := *, + template DNN p_DNN := *, + template NGSM_NetworkFeatureSupport p_NGSM_NtwkFeatSupport := *, + template ServingPLMNRateControl p_ServingPLMNRateCtrl := *, + template ATSSSContainer p_ATSSSContainer := *, + template ControlPlaneInd p_ControlPlaneInd := *, + template IPHeaderCompressionConfig p_IPHeaderCompConfig := *, + template EthernetHeaderCompressConfig p_EthernetHeaderCompConfig := *, + template ServiceLvlAAContainer p_ServiceLvlAA := *, + template ReceivedMBSContainer p_ReceivedMBS := * + ) := { /* 24.501 cl. 8.3.2 */ + /* @status APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */ + pdu_Session_Establishment_Accept := { + protocolDiscriminator := tsc_EPD_GSM, /* cl. 9.2 M V 1 */ + pduSessionId := p_PDU_SessionId, /* cl. 9.4 M V 1 */ + procedureTransactionIdentifier := p_PTI, /* cl. 9.6 M V 1 */ + messageType := tsc_MT_NG_PDUSessionEstablishmentAccept, /* cl. 9.7 M V 1 */ + sscMode := p_SSC_Mode, /* cl. 9.11.4.16 M V 1/2 */ + pduSessionType := p_PDU_SessionType, /* cl. 9.11.4.11 M V 1/2 */ + authorizedQoSRules := p_QoS_Rules, /* cl. 9.11.4.13 M LV-E 7-65538 */ + sessionAMBR := p_Session_AMBR, /* cl. 9.11.4.14 M LV ? */ + gsmCause := p_Cause, /* cl. 9.11.4.2 O TV 2 IEI=59 */ + pduAddress := p_PDU_Address, /* cl. 9.11.4.10 O TLV 7-15 IEI=29 */ + rqTimerValue := p_RQTimer, /* cl. 9.11.2.3 O TLV 2 IEI=56 */ + s_NSSAI := p_S_NSSAI, /* cl. 9.11.2.6 O TLV 3-10 IEI=22 */ + alwaysOnPDUSessionInd := p_AlwaysOnPDUSessionInd, /* c. 9.11.4.3 O TV 1 IEI=8 */ + mappedEPSContexts := p_MappedEPSBearerContexts, /* cl. 9.11.4.9 O TLV-E 7-65538 IEI=7F */ + eapMessage := p_EAP, /* cl. 9.11.2.2 O TLV-E 7-1503 IEI=78 */ + authorizedQoSFlowDescr := p_QoSFlowDescr, /* cl. 9.11.4.12 O TLV-E 6-65538 IEI=79 */ + extdProtocolConfigurationOptions := p_ExtdPCO, /* cl. 9.11.4.6 O TLV-E 4-65538 IEI=0x7B */ + dnn := p_DNN, /* cl. 9.11.2.1A O TLV 3-102 IEI=25 */ + ngs_NetworkFeatureSupport := p_NGSM_NtwkFeatSupport, /* cl. 9.11.4.18 O TLV 3-15 IEI=17 Sep20 @sic R5s201387 Baseline Moving sic@ */ + servingPLMNRateControl := p_ServingPLMNRateCtrl, /* cl. 9.11.4.20 O TLV 4 IEI=18 Sep20 @sic R5s201387 Baseline Moving sic@ */ + atsssContainer := p_ATSSSContainer, /* cl. 9.11.4.22 O TLV-E 3-65538 IEI=77 Sep20 @sic R5s201387 Baseline Moving sic@ */ + controlPlaneOnlyIndication := p_ControlPlaneInd, /* cl. 9.11.4.23 O TV 1 IEI=C Sep20 @sic R5s201387 Baseline Moving sic@ */ + ipHeaderCompressionConfig := p_IPHeaderCompConfig, /* cl. 9.11.4.24 O TLV 5-257 IEI=66 Sep20 @sic R5s201387 Baseline Moving sic@ */ + ethernetHeaderCompressConfig := p_EthernetHeaderCompConfig, /* cl. 9.11.4.28 O TLV 3 IEI=1F Sep20 @sic R5s201387 Baseline Moving sic@ */ + serviceLvlAA := p_ServiceLvlAA, /* cl. 9.11.2.10 O TLV-E 6-n IEI=72 Sep22 @sic R5s221179 Baseline Moving sic@ */ + receivedMBS := p_ReceivedMBS /* cl. 9.11.4.30 O TLV-E 8-65538 IEI=71 Sep22 @sic R5s221179 Baseline Moving sic@ */ + } + } // End of template mw_NG_PDU_SESSION_ESTABLISHMENT_ACCEPT_noPTI + template (omit) NG_NAS_DL_Message_Type m_NG_PDU_SESSION_ESTABLISHMENT_REJECT( in template (value) NG_PDU_SessionId p_PDU_SessionId, in template (value) ProcedureTransactionIdentifier p_PTI, @@ -1398,8 +1513,22 @@ module Lib_NG_NAS_Templates { in template (omit) NASMessageContainer p_Msg := omit, in template (omit) UE_RequestType p_UeRequestType := omit, in template (omit) NG_PagingRestriction p_PagingRestrict - ) modifies cr_NG_SERVICE_REQUEST := { - service_Request := {} + ) := { + service_Request := { + protocolDiscriminator := tsc_EPD_GMM, /* cl. 9.2 M V 1 */ + spareHalfOctet := tsc_SpareHalfOctet, /* cl. 9.3 M V 1/2 */ + securityHeaderType := tsc_SHT_NoSecurityProtection, + messageType := tsc_MT_NG_ServiceRequest, /* cl. 9.7 M V 1 */ + serviceType := p_ServiceType, /* cl. 9.11.3.50 M V 1/2 */ + ngKSI := p_KSI, /* cl. 9.11.3.32 M V 1/2 */ + s_TMSI := p_S_TMSI, /* cl. 9.11.3.4 M LV 6 */ + ulDataStatus := p_ULDataStatus, /* cl. 9.11.2.57 O TLV 4-34 IEI=40 */ + pduSessionStatus := p_PDU_SessionStatus, /* cl. 9.11.2.44 O TLV 4-34 IEI=50 */ + allowedPDUSessionStatus := p_AllowedPDU_SessionStatus, /* cl. 9.11.3.13 O TLV 4-34 IEI=25 */ + nasMsg := p_Msg, /* cl. 9.11.3.33 O TLV-E 4-n IEI=71 Dec18 */ + ueRequestType := p_UeRequestType, /* cl. 9.11.3.76 O TLV 3 IEI=29 Sep22 @sic R5s221179 Baseline Moving sic@ */ + pagingRestrict := p_PagingRestrict /* cl. 9.11.3.77 O TLV 3-35 IEI=28 Sep22 @sic R5s221179 Baseline Moving sic@ */ + } } // End of template m_NG_SERVICE_REQUEST template (present) NG_NAS_UL_Message_Type mw_NG_SERVICE_REQUEST( @@ -1532,7 +1661,7 @@ module Lib_NG_NAS_Templates { in template (omit) NASMessageContainer p_NASMsg := omit, in template (omit) UE_RequestType p_UeRequestType := omit, in template (omit) NG_PagingRestriction p_PagingRestrict := omit - ) modifies cr_NG_CP_SERVICE_REQUEST := { + ) := { cp_Service_Request := { protocolDiscriminator := tsc_EPD_GMM, /* cl. 9.2 M V 1 */ spareHalfOctet := tsc_SpareHalfOctet, /* cl. 9.3 M V 1/2 */ @@ -2125,8 +2254,24 @@ module Lib_NG_NAS_Templates { } // End of template mw_IdentityType //from template (present) NG_MobileIdentity cr_NG_MobileIdentitySUCI - NG_NAS_Common - template (value) NG_MobileIdentity m_NG_MobileIdentitySUCI(template (value) B4_Type p_SUPIFormat, - template (value) octetstring p_OtherDigits) := + template (value) NG_MobileIdentity m_NG_MobileIdentitySUCI( + in template (value) B4_Type p_SUPIFormat, + in template (value) octetstring p_OtherDigits, + in template (value) NAS_IdType p_typeOfId := tsc_IdType_NG_SUCI + ) := + { /* @status APPROVED (NR5GC) */ + iei := omit, + iel := int2oct(1+lengthof(p_OtherDigits), 2), // @sic R5s190719 sic@ + idDigit1 := p_SUPIFormat, // 4 bits + oddEvenInd := '0'B, // 1 bit + typeOfId := p_typeOfId, // 3 bits + otherDigits := p_OtherDigits + }; + + template (present) NG_MobileIdentity mw_NG_MobileIdentitySUCI( + in template (present) B4_Type p_SUPIFormat := ?, + in template (present) octetstring p_OtherDigits := ? + ) := { /* @status APPROVED (NR5GC) */ iei := omit, iel := int2oct(1+lengthof(p_OtherDigits), 2), // @sic R5s190719 sic@ @@ -2220,4 +2365,215 @@ module Lib_NG_NAS_Templates { iei := p_iei } // End of template mw_NAS_KeySetIdentifier + template (omit) NG_UE_SecurityCapability m_ng_ue_security_capability( + in template (omit) IEI8_Type p_IEI := '2e'O, + in template (value) Type4Length_Type p_iel := '02'O, + in O1_Type p_ngeaCap := 'f0'O, + in O1_Type p_ngiaCap := 'f0'O, + in template (omit) O1_Type p_eeaCap := omit, + in template (omit) O1_Type p_eiaCap := omit, + in template (omit) octetstring p_spare := omit + ) := { + iei := p_IEI, + iel := p_iel, + ngeaCap := p_ngeaCap, + ngiaCap := p_ngiaCap, + eeaCap := p_eeaCap, + eiaCap := p_eiaCap, + spare := p_spare + } // End of template m_ng_ue_security_capability + + template (present) NG_UE_SecurityCapability mw_ng_ue_security_capability( + template IEI8_Type p_IEI := '2e'O, + template (present) Type4Length_Type p_iel := '02'O, + template (present) O1_Type p_ngeaCap := 'f0'O, + template (present) O1_Type p_ngiaCap := 'f0'O, + template O1_Type p_eeaCap := *, + template O1_Type p_eiaCap := *, + template octetstring p_spare := * + ) := { + iei := omit, + iel := p_iel, + ngeaCap := p_ngeaCap, + ngiaCap := p_ngiaCap, + eeaCap := p_eeaCap, + eiaCap := p_eiaCap, + spare := p_spare + } // End of template mw_ng_ue_security_capability + + template (value) NG_NAS_DL_Message_Type m_NG_SecurityProtected_NasMsg( + in SecurityHeaderType p_SecurityHeaderType, + in MessageAuthenticationCode p_MessageAuthenticationCode, + in NAS_SequenceNumber p_NAS_SequenceNumber, + in template (value) NG_NAS_Message p_NAS_Message + ) := { /* @status APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */ + security_Protected_Nas_Message := { + protocolDiscriminator := tsc_EPD_GMM, + spareHalfOctet := tsc_SpareHalfOctet, + securityHeaderType := p_SecurityHeaderType, + messageAuthenticationCode := p_MessageAuthenticationCode, + sequenceNumber := p_NAS_SequenceNumber, + plainNASMessage := p_NAS_Message + } + } // End of template m_NG_SecurityProtected_NasMsg + + template (value) PDU_SessionType m_PDU_SessionType_iei( + in B3_Type p_Type + ) modifies cs_PDU_SessionType := { + iei := '9'H, + spare := tsc_Spare1, + typeValue := p_Type + } + + template (value) NG_UE_SM_Cap m_ng_ue_sm_cap( + in template (value) B1_Type p_tpmic := '0'B, + in template (value) B4_Type p_atsssST := '0000'B, + in template (value) B1_Type p_ept_S1 := '0'B, + in template (value) B1_Type p_mh6_PDU := '0'B, + in template (value) B1_Type p_rQoS := '0'B + ) := { + iei := '28'O, + iel := '01'O, + tpmic := p_tpmic, + atsssST := p_atsssST, + ept_S1 := p_ept_S1, + mh6_PDU := p_mh6_PDU, + rQoS := p_rQoS, + spareBits := omit, + apmqf := omit, + spare := omit + } // End of template m_ng_ue_sm_cap + + template (value) IntegrityProtMaxDataRate m_integrity_prot_max_data_rate( + in template (value) O1_Type p_maxDataRateUL := 'ff'O, + in template (value) O1_Type p_maxDataRateDL := 'ff'O + ) := { + iei := omit, + maxDataRateUL := p_maxDataRateUL, + maxDataRateDL := p_maxDataRateDL + } // End of template m_integrity_prot_max_data_rate + + template (present) NetworkName mw_network_name( + template (present) IEI8_Type p_iei := '43'O, + template (present) Type4Length_Type p_iel := ?, + template (present) B1_Type p_ext := '1'B, + template (present) B3_Type p_codingScheme := '001'B, + template (present) B1_Type p_addCI := '0'B, + template (present) octetstring p_text := ? + ) := { + iei := p_iei, + iel := p_iel, + ext := p_ext, + codingScheme := p_codingScheme, + addCI := p_addCI, + spareBitCnt := ?, + text := p_text + } + + template (omit) AdditionalSecurityInfo m_additional_security_info( + in template (omit) IEI8_Type p_iei := omit, /* present in case of TV; omit in case of V */ + in template (omit) Type4Length_Type p_iel := '01'O, /* present in case of LV or TLV; omit in case of V */ + in template (value) B6_Type p_spareBits := '000000'B, + in template (value) B1_Type p_rinmr := '1'B, + in template (value) B1_Type p_hdp := '0'B + ) := { + iei := p_iei, + iel := p_iel, + spareBits := p_spareBits, + rinmr := p_rinmr, + hdp := p_hdp + } + + template (present) AdditionalSecurityInfo mw_additional_security_info( + template IEI8_Type p_iei := *, /* present in case of TV; omit in case of V */ + template Type4Length_Type p_iel := ?, /* present in case of LV or TLV; omit in case of V */ + template (present) B6_Type p_spareBits := ?, + template (present) B1_Type p_rinmr := '1'B, + template (present) B1_Type p_hdp := ? + ) := { + iei := p_iei, + iel := p_iel, + spareBits := p_spareBits, + rinmr := p_rinmr, + hdp := p_hdp + } + + template (value) NG_TrackingAreaIdList m_NG_TrackingAreaIdList( + in IEI8_Type p_iei := '54'O, + in template (value) NG_TrackingAreaIdList_LV p_lvPart + ) := { + iei := p_iei, + lvPart := p_lvPart + } + + template (present) NG_TrackingAreaIdList mw_NG_TrackingAreaIdList( + template (present) IEI8_Type p_iei := '54'O, + template (present) NG_TrackingAreaIdList_LV p_lvPart := ? + ) := { + iei := p_iei, + lvPart := p_lvPart + } + + template (value) NG_TrackingAreaIdList_LV m_NG_TrackingAreaIdList_LV( + in Type4Length_Type p_iel, + in template (value) NG_TrackingAreaIdList_LV.listOfPartialTais p_listOfPartialTais + ) := { + iel := p_iel, + listOfPartialTais := p_listOfPartialTais + } + + template (present) NG_TrackingAreaIdList_LV mw_NG_TrackingAreaIdList_LV( + template (present) Type4Length_Type p_iel := ?, + template (present) NG_TrackingAreaIdList_LV.listOfPartialTais p_listOfPartialTais := ? + ) := { + iel := p_iel, + listOfPartialTais := p_listOfPartialTais + } + + template (value) NG_ListOfPartialTaiList m_NG_ListOfPartialTaiList( + in B1_Type p_allowedType := '0'B, + in B2_Type p_typeOfList := '10'B, + in B5_Type p_numberOfElements, + in NG_PartialTaiType p_partialTaiList + ) := { + allowedType := p_allowedType, + typeOfList := p_typeOfList, + numberOfElements := p_numberOfElements, + partialTaiList := p_partialTaiList + } + + template (present) NG_ListOfPartialTaiList mw_NG_ListOfPartialTaiList( + template (present) B1_Type p_allowedType := '0'B, + template (present) B2_Type p_typeOfList := '10'B, + template (present) B5_Type p_numberOfElements := ?, + template (present) NG_PartialTaiType p_partialTaiList := ? + ) := { + allowedType := p_allowedType, + typeOfList := p_typeOfList, + numberOfElements := p_numberOfElements, + partialTaiList := p_partialTaiList + } + + template (value) NG_PartialTaiType m_NG_PartialTaiType_type3( + in template (value) NG_Type3Element p_type3 + ) := { + type3 := p_type3 + } + + template (value) NG_Type3Element m_NG_Type3Element( + in template (value) NAS_PlmnId p_plmnId + ) := { + plmnId := p_plmnId + } + + template (value) NG_TrackingAreaId m_NG_TAI( + in NAS_PlmnId p_PlmnId, // O3_Type + in O3_Type p_Tac // O3_Type + ) := { + iei := omit, + plmnId := p_PlmnId, + tac := p_Tac + } + + } // End of module Lib_NG_NAS_Templates \ No newline at end of file diff --git a/ttcn/Lib_NG_NAS/NG_NAS_BaseTemplates.ttcn b/ttcn/Lib_NG_NAS/lib/NG_NAS_BaseTemplates.ttcn similarity index 100% rename from ttcn/Lib_NG_NAS/NG_NAS_BaseTemplates.ttcn rename to ttcn/Lib_NG_NAS/lib/NG_NAS_BaseTemplates.ttcn diff --git a/ttcn/Lib_NG_NAS/lib_system/Lib_NG_NAS_Functions.ttcn b/ttcn/Lib_NG_NAS/lib_system/Lib_NG_NAS_Functions.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..d7461c494d200af52ff938ab00323a38b309048f --- /dev/null +++ b/ttcn/Lib_NG_NAS/lib_system/Lib_NG_NAS_Functions.ttcn @@ -0,0 +1,351 @@ +module Lib_NG_NAS_Functions { + + // Lib_NG_NAS + import from Lib_NG_NAS_Interface all; + import from Lib_NG_NAS_Templates all; + import from Lib_NG_NAS_Security_Functions all; + import from Lib_NG_NAS_Pixits all; + + // NG_NAS + import from NG_NAS_TypeDefs all; + import from NG_NAS_Templates all; + + // Lib3GPP + import from CommonDefs all; + import from Parameters all; + import from NG_NAS_MsgContainers all; + import from NAS_CommonTypeDefs all; + import from NAS_CommonTemplates all; + import from NG_NAS_Common all; + import from NAS_AuthenticationCommon all; + import from NG_NAS_SecurityFunctions all; + + // Lib_NGAP + import from NGAP_IEs language "ASN.1:2002" all; + import from NGAP_Constants language "ASN.1:2002" all; + import from NGAP_PDU_Descriptions language "ASN.1:2002" all; + import from LibNGAP_Pixits all; + import from LibNGAP_Templates all; + import from LibNGAP_Interface all; + import from LibNGAP_Steps all; + import from LibNGAP_Functions all; + + // /** + // * @desc Function to send NAS RegistrationRequest message + // * @see NG_NASTemplateFunctions.f_Check_NG_RegistrationReqMsg + // */ + // function f_send_NasRegistrationRequest() runs on NGNASComponent { + // var octetstring v_other_digits := // ETSI TS 124 501 Figure 9.11.3.4.3: 5GS mobile identity information element for type of identity "SUCI" and SUPI format "IMSI" + // fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC) & + // '0000'O & // Routing Indicator + // '00'O & // Protection scheme + // '00'O & // Home network public key identifier + // PX_MSIN; + // vt_NgNasUl_Msg := m_NG_REGISTRATION_REQUEST( + // cs_RegistrationType(tsc_NG_RegistrationInitial, '1'B), + // tsc_NasKsi_NoKey, + // '0'B, // TSC + // m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT, v_other_digits, PX_TYPE_OF_ID), + // -, -, + // m_ng_ue_security_capability + // ); + // vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); + // f_send_NGAP_PDU( + // m_ngap_initMsg( + // m_n2_initialUeMessage( + // vc_RAN_UE_ID, + // vc_sendNAS_PDU, + // m_uPTransportLayerInformation_userLocationInformationNR( + // m_userLocationInformationNR( + // m_nR_CGI, + // m_tAI + // ))))); + // } + +// /** +// * @desc Function to await NAS RegistrationRequest message +// * @see NG_NASTemplateFunctions.f_Check_NG_RegistrationReqMsg +// */ +// function f_await_registration_request() runs on NGNASComponent { +// f_recv_NGAP_PDU( +// mw_ngap_initMsg( +// mw_n2_initialUeMessage( +// vc_RAN_UE_ID +// ))); +// f_NASPDU_Get(vc_recvNGAP_PDU); +// if (match(vc_recvNgNasUl_Msg, mw_NG_REGISTRATION_REQUEST)) { +// log("Received NG_REGISTRATION_REQUEST NAS message"); + +// // Extract ID-RAN-UE-NGAP-ID +// vc_RAN_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.InitialUEMessage.protocolIEs[1].value_.rAN_UE_NGAP_ID; +// log("vc_RAN_UE_ID: ", vc_RAN_UE_ID); +// } else { +// log("*** " & __SCOPE__ & ": FAIL: Unexpected NAS message ***"); +// setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NAS message ***"); +// } +// } + + // /** + // * @desc Function to await NAS NGSetupResponse message + // */ + // function f_await_registration_accept() runs on NGNASComponent { + // // Await request for REGISTRATION_ACCEPT + // f_recv_NGAP_PDU( + // mw_ngap_initMsg( + // mw_n2_DownlinkNASTransport( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID, + // ? // AuthorizationRequest + // ))); + // f_NASPDU_Get(vc_recvNGAP_PDU); + // var NG_NAS_DL_Message_Type v_message; + // if (f_Check_5GAKA_NAS_DL_Message( + // vc_recvNAS_PDU, + // mw_NG_REGISTRATION_ACCEPT( + // -, + // ?, + // mw_PLMN_List( + // -, -, + // { + // *, + // fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), + // * + // } + // ), + // -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-, + // ? + // ), + // vc_ng_nas_security_params_type, + // vc_previous_nas_count_dl, + // v_message, + // vc_inner_message + // ) == false) { + // setverdict(fail); + // return; + // } + + // setverdict(pass); + // } + + // /** + // * @desc Function to await NAS AuthenticationRequest message and send AuthenticationResponse message with security computation for future encryption + // */ + // function f_await_NasAuthenticationRequest_send_NasAuthenticationResponse() runs on NGNASComponent { + // // Await request for authentication + // f_recv_NGAP_PDU( + // mw_ngap_initMsg( + // mw_n2_DownlinkNASTransport( + // ?,//vc_AMF_UE_ID, + // vc_RAN_UE_ID, + // ? // AuthenticationRequest + // ))); + // f_NASPDU_Get(vc_recvNGAP_PDU); + // var NG_NAS_DL_Message_Type v_message; + // if (f_Check_5GAKA_NAS_DL_Message( + // vc_recvNAS_PDU, + // mw_NG_AUTHENTICATION_REQUEST( + // ?,//'100'B, + // -, + // mw_GMM_AuthRAND, + // mw_GSM_AUTN + // ), + // vc_ng_nas_security_params_type, + // vc_previous_nas_count_dl, + // v_message, + // vc_inner_message + // ) == false) { + // setverdict(fail); + // return; + // } + // setverdict(pass); + + // // Extract ID-RAN-UE-NGAP-ID + // vc_AMF_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[0].value_.aMF_UE_NGAP_ID; + // log("vc_AMF_UE_ID: ", vc_AMF_UE_ID); + + // // Compute RES/XRES + // if (f_5g_aka_compute_res_xres(-, v_message.authentication_Request.rand.randValue, v_message.authentication_Request.autn.aUTN, v_message.authentication_Request.abba, fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC), -/*oct2hex(PX_SUPI_DIGITS)*/, px_IMSI_Def, vc_ng_nas_security_params_type) == false) { + // setverdict(fail); + // return; + // } + // setverdict(pass); + + // // Send response + // vt_NgNasUl_Msg := m_NG_AUTHENTICATION_RESPONSE( + // { iei := '2d'O, iel := '10'O, res := vc_ng_nas_security_params_type.AuthParams.XRES } + // ); + // vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); + // f_send_NGAP_PDU( + // m_ngap_initMsg( + // m_n2_UplinkNASTransport( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID, + // vc_sendNAS_PDU, + // m_uPTransportLayerInformation_userLocationInformationNR( + // m_userLocationInformationNR( + // m_nR_CGI, + // m_tAI + // ))))); + // } + + function f_send_NasAuthenticationFailure( + in NAS_CauseValue_Type p_nas_cause_value := tsc_Cause_MAC_Failure + ) runs on NGNASComponent { + vt_NgNasUl_Msg := m_NG_AUTHENTICATION_FAILURE( + m_GMM_GSM_Cause( + -, + p_nas_cause_value + )); + vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UplinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + vc_sendNAS_PDU, + m_uPTransportLayerInformation_userLocationInformationNR( + m_userLocationInformationNR( + m_nR_CGI, + m_tAI + ))))); + } + + // /******************************************************************************** + // * + // * FIXME Use or enhance check functions from 3GPP library such as NG_NASTemplateFunctions.f_Check_NG_SecurityModeCompleteMsg + // * + // ********************************************************************************/ + + function f_await_NasSecurityModeCommand() runs on NGNASComponent { + // Await SecurityModeCommand + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_DownlinkNASTransport( + vc_AMF_UE_ID, + vc_RAN_UE_ID, + ? // Security mode command + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_SECURITY_MODE_COMMAND, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + setverdict(fail); + return; + } + + setverdict(pass); + // Extract security parameters + if (f_5g_security_context(v_message.security_Mode_Command, vc_ng_nas_security_params_type) == false) { + setverdict(fail); + return; + } + vc_previous_nas_count_ul := f_NasCountInit(); + vc_previous_nas_count_dl := f_NasCountInit(); + } + + + + // function f_await_NasSecurityModeCommand_send_NasSecurityModeComplete() runs on NGNASComponent { + // // Await SecurityModeCommand + // f_recv_NGAP_PDU( + // mw_ngap_initMsg( + // mw_n2_DownlinkNASTransport( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID, + // ? // Security mode command + // ))); + // f_NASPDU_Get(vc_recvNGAP_PDU); + // var NG_NAS_DL_Message_Type v_message; + // if (f_Check_5GAKA_NAS_DL_Message( + // vc_recvNAS_PDU, + // mw_NG_SECURITY_MODE_COMMAND, + // vc_ng_nas_security_params_type, + // vc_previous_nas_count_dl, + // v_message, + // vc_inner_message + // ) == false) { + // setverdict(fail); + // return; + // } + + // setverdict(pass); + // // Extract security parameters + // if (f_5g_security_context(v_message.security_Mode_Command, vc_ng_nas_security_params_type) == false) { + // setverdict(fail); + // return; + // } + // vc_previous_nas_count_ul := f_NasCountInit(); + // vc_previous_nas_count_dl := f_NasCountInit(); + + // // Send SecurityModeComplete + // vt_NgNasUl_Msg := m_NG_SECURITY_MODE_COMPLETE( + // m_NG_MobileIdentitySUCI(PX_TYPE_OF_ID, PX_SUPI_DIGITS), //in template (value) NG_MobileIdentity p_IMEISV, + // { iei := omit, iel := int2oct(0, 2), replayedNASMsgContainerValue := ''O } /* 24.301 cl. 9.9.3.51 @sic R5s170597 Baseline Moving sic@ */, //in template (value) ReplayedNASMessageContainer p_NASMsg, + // m_NG_MobileIdentitySUCI(PX_TYPE_OF_ID,PX_SUPI_DIGITS) //in template (value) NG_MobileIdentity p_NonIMEISV_PEI + // ); + // var octetstring os := ''O; // FIXME f_EncodeAndCipher_NG_NasPdu(vt_NgNasUl_Msg, ); How to calculate NG_NAS_MSG_Request_Type + // vt_NgNasUl_Msg.security_Protected_Nas_Message := m_NG_SECURITY_PROTECTED_NAS_MESSAGE( + // tsc_EPD_GMM, + // tsc_SpareHalfOctet, + // tsc_SHT_IntegrityProtected_Ciphered, + // '00000000'O, // FIXME How to calculate MessageAuthenticationCode? + // '00'O, + // os // Cyphered NAS message + // ) + // vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg))); + // f_send_NGAP_PDU( + // m_ngap_initMsg( + // m_n2_UplinkNASTransport( + // vc_AMF_UE_ID, + // vc_RAN_UE_ID, + // vc_sendNAS_PDU, + // m_uPTransportLayerInformation_userLocationInformationNR( + // m_userLocationInformationNR( + // m_nR_CGI, + // m_tAI + // ))))); + // } + + function f_send_NGUERadioCApabilityInfoIndication() runs on NGNASComponent { + f_send_NGAP_PDU( + m_ngap_initMsg( + m_n2_UERadioCapabilityInfoIndication( + -, -, + ''O // FIXME FSCOM How to deal with UERadioCapability + ))); + } + + function f_await_NGInitialContextSetupRequest_send_NGInitialContextSetupRespone() runs on NGNASComponent { + f_recv_NGAP_PDU( + mw_ngap_initMsg( + mw_n2_InitialContextSetupRequest_withPDUSessionList( // FIXME FSCOM How to deal with it? + + ))); + f_NASPDU_Get(vc_recvNGAP_PDU); + var NG_NAS_DL_Message_Type v_message; + if (f_Check_5GAKA_NAS_DL_Message( + vc_recvNAS_PDU, + mw_NG_REGISTRATION_ACCEPT, + vc_ng_nas_security_params_type, + vc_previous_nas_count_dl, + v_message, + vc_inner_message + ) == false) { + setverdict(fail); + return; + } + + setverdict(pass); + f_send_NGAP_PDU( + m_ngap_succMsg( + m_n2_InitialContextSetupResponse_noPDUSessionResourceSetupListSURes + )); + } + +} // End of module Lib_NG_NAS_Functions \ No newline at end of file diff --git a/ttcn/Lib_NG_NAS/lib_system/Lib_NG_NAS_Interface.ttcn b/ttcn/Lib_NG_NAS/lib_system/Lib_NG_NAS_Interface.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..19486769aee650044da86ec1aab60c4872f01611 --- /dev/null +++ b/ttcn/Lib_NG_NAS/lib_system/Lib_NG_NAS_Interface.ttcn @@ -0,0 +1,31 @@ +/** + * @author ETSI / STF + * @version $URL:$ + * $Id:$ + * @desc This module provides the types used by the test component for NGAP tests. + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * @see ETSI TS / 3GPP TS + */ +module Lib_NG_NAS_Interface { + + // LibCommon + import from LibCommon_Sync all; + + //Lib3GPP + import from NG_NAS_MsgContainers all; + import from NG_NAS_SecurityFunctions all; + + // LibNGAP + import from LibNGAP_Interface all; + + group portDefinitions { + } // End of group portDefinitions + + group interfacePorts { + } // End of group interfacePorts + +} // End of module Lib_NG_NAS_Interface + diff --git a/ttcn/Lib_NG_NAS/module.mk b/ttcn/Lib_NG_NAS/module.mk index 34a512a884a16880a2e9aaf42b267947b0fa481b..944cfaf33a17b00b99065f89650ca15c906bf92f 100644 --- a/ttcn/Lib_NG_NAS/module.mk +++ b/ttcn/Lib_NG_NAS/module.mk @@ -1,10 +1,9 @@ -sources := \ - Lib_NG_NAS_Interface.ttcn \ - Lib_NG_NAS_Templates.ttcn \ - LIB_NG_NAS_Functions.ttcn \ - Lib_NG_NAS_Pixits.ttcn \ - - #../Lib3GPP/NG_NAS_EncdecDeclarations.ttcn +sources := \ + lib/Lib_NG_NAS_Templates.ttcn \ + lib/Lib_NG_NAS_Pixits.ttcn \ + lib/Lib_NG_NAS_Security_Functions.ttcn \ + lib_system/Lib_NG_NAS_Interface.ttcn \ + lib_system/Lib_NG_NAS_Functions.ttcn \ #modules := \ # ../Lib3GPP diff --git a/ttcn/patch_abstract_socket/Abstract_Socket.cc.patch b/ttcn/patch_abstract_socket/Abstract_Socket.cc.patch index 6389855e5993654ac669c4fa8324a3c16dee6ce9..e00c2c7e85c2bd6c6930f1b1cfb280763e65f3fb 100644 --- a/ttcn/patch_abstract_socket/Abstract_Socket.cc.patch +++ b/ttcn/patch_abstract_socket/Abstract_Socket.cc.patch @@ -1,580 +1,170 @@ -diff --git a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module/src/Abstract_Socket.cc b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module/src/Abstract_Socket.cc -old mode 100644 -new mode 100755 -index 910c13e..9d93bed ---- a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module/src/Abstract_Socket.cc -+++ b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module/src/Abstract_Socket.cc -@@ -1,28 +1,17 @@ - /****************************************************************************** --* Copyright (c) 2000-2019 Ericsson Telecom AB --* All rights reserved. This program and the accompanying materials --* are made available under the terms of the Eclipse Public License v2.0 --* which accompanies this distribution, and is available at --* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html --* --* Contributors: --* Zoltan Bibo - initial implementation and initial documentation --* Gergely Futo --* Oliver Ferenc Czerman --* Balasko Jeno --* Zoltan Bibo --* Eduard Czimbalmos --* Kulcsár Endre --* Gabor Szalai --* Jozsef Gyurusi --* Csöndes Tibor --* Zoltan Jasz --******************************************************************************/ -+ * Copyright (c) 2000-2025 Ericsson Telecom AB -+ * All rights reserved. This program and the accompanying materials -+ * are made available under the terms of the Eclipse Public License v2.0 -+ * which accompanies this distribution, and is available at -+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html -+ ******************************************************************************/ - // - // File: Abstract_Socket.cc - // Description: Abstract_Socket implementation file --// Rev: R9B -+// Rev: - // Prodnr: CNL 113 384 -+// Updated: 2012-08-07 -+// Contact: http://ttcn.ericsson.se - // +diff --git a/home/yann/tmp/titan.TestPorts.Common_Components.Abstract_Socket/src/Abstract_Socket.cc b/./Abstract_Socket.cc +index 8b7b753..af41462 100644 +--- a/home/yann/tmp/titan.TestPorts.Common_Components.Abstract_Socket/src/Abstract_Socket.cc ++++ b/./Abstract_Socket.cc +@@ -40,6 +40,7 @@ + # include + #endif + ++#include - #include "Abstract_Socket.hh" -@@ -254,20 +243,16 @@ bool Abstract_Socket::parameter_set(const char *parameter_name, - Free(local_host_name); - local_host_name = mcopystr(parameter_value); - } else if(strcmp(parameter_name, remote_port_name()) == 0){ -- int a; -- if (sscanf(parameter_value, "%d", &a)!=1) log_error("Invalid input as port number given: %s", parameter_value); -- if (a>65535 || a<0){ log_error("Port number must be between 0 and 65535, %d is given", remote_port_number);} -- else {remote_port_number=a;} -+ if (sscanf(parameter_value, "%d", &remote_port_number)!=1) log_error("Invalid input as port number given: %s", parameter_value); -+ if (remote_port_number>65535 || remote_port_number<0) log_error("Port number must be between 0 and 65535, %d is given", remote_port_number); - } else if(strcmp(parameter_name, ai_family_name()) == 0){ - if (strcasecmp(parameter_value,"IPv6")==0 || strcasecmp(parameter_value,"AF_INET6")==0) ai_family = AF_INET6; + #define AS_TCP_CHUNCK_SIZE 4096 + #define AS_SSL_CHUNCK_SIZE 16384 +@@ -171,6 +172,7 @@ Abstract_Socket::Abstract_Socket() { + remote_host_name = NULL; + remote_port_number = 0; + ai_family = AF_UNSPEC; // default: Auto ++ ip_proto = IPPROTO_TCP; // default + test_port_type=NULL; + test_port_name=NULL; + ttcn_buffer_usercontrol=false; +@@ -199,6 +201,7 @@ Abstract_Socket::Abstract_Socket(const char *tp_type, const char *tp_name) { + remote_host_name = NULL; + remote_port_number = 0; + ai_family = AF_UNSPEC; // default: Auto ++ ip_proto = IPPROTO_TCP; // default + test_port_type=tp_type; + test_port_name=tp_name; + ttcn_buffer_usercontrol=false; +@@ -261,6 +264,10 @@ bool Abstract_Socket::parameter_set(const char *parameter_name, else if (strcasecmp(parameter_value,"IPv4")==0 || strcasecmp(parameter_value,"AF_INET")==0) ai_family = AF_INET; else if (strcasecmp(parameter_value,"UNSPEC")==0 || strcasecmp(parameter_value,"AF_UNSPEC")==0) ai_family = AF_UNSPEC; else log_error("Parameter value '%s' not recognized for parameter '%s'", parameter_value, ai_family_name()); ++ } else if(strcmp(parameter_name, ip_proto_name()) == 0){ ++ if (strcasecmp(parameter_value,"IPPROTO_TCP")==0) ip_proto = IPPROTO_TCP; ++ else if (strcasecmp(parameter_value,"IPPROTO_SCTP")==0) ip_proto = IPPROTO_SCTP; ++ else log_error("Parameter value '%s' not recognized for parameter '%s'", parameter_value, ip_proto_name()); } else if(strcmp(parameter_name, local_port_name()) == 0){ -- int a; -- if (sscanf(parameter_value, "%d", &a)!=1) log_error("Invalid input as port number given: %s", parameter_value); -- if (a>65535 || a<0) {log_error("Port number must be between 0 and 65535, %d is given", local_port_number);} -- else {local_port_number=a;} -+ if (sscanf(parameter_value, "%d", &local_port_number)!=1) log_error("Invalid input as port number given: %s", parameter_value); -+ if (local_port_number>65535 || local_port_number<0) log_error("Port number must be between 0 and 65535, %d is given", local_port_number); - } else if (strcmp(parameter_name, nagling_name()) == 0) { - if (strcasecmp(parameter_value,"yes")==0) nagling = true; - else if (strcasecmp(parameter_value,"no")==0) nagling = false; -@@ -316,14 +301,16 @@ void Abstract_Socket::Handle_Socket_Event(int fd, boolean is_readable, boolean i - } else { - if(shutdown(fd, SHUT_RD) != 0) { - if(errno == ENOTCONN) { -+ remove_client(fd); -+ peer_disconnected(fd); - errno = 0; -- } else { -+ } else - log_error("shutdown(SHUT_RD) system call failed"); -- } -+ } else { -+ client_data->tcp_state = CLOSE_WAIT; -+ Remove_Fd_Read_Handler(fd); -+ peer_half_closed(fd); - } -- client_data->tcp_state = CLOSE_WAIT; -- Remove_Fd_Read_Handler(fd); -- peer_half_closed(fd); - } - } // switch (client_data->reading_state) - } else if (messageLength > 0) { -@@ -425,7 +412,6 @@ int Abstract_Socket::receive_message_on_fd(int client_id) - size_t end_len=AS_TCP_CHUNCK_SIZE; - recv_tb->get_end(end_ptr, end_len); - int messageLength = recv(client_id, (char *)end_ptr, end_len, 0); -- log_debug("========> receive_message_on_fd errno: '%d', '%s'", errno, strerror(errno)); - if (messageLength==0) return messageLength; // peer disconnected - else if (messageLength < 0) { - log_warning("Error when reading the received TCP PDU: %s", strerror(errno)); -@@ -464,11 +450,12 @@ int Abstract_Socket::send_message_on_nonblocking_fd(int client_id, - - log_debug("entering Abstract_Socket::" - "send_message_on_nonblocking_fd(id: %d)", client_id); -- as_client_struct * client_data = get_peer(client_id); -+ as_client_struct * client_data; - int sent_len = 0; - while(sent_len < length){ - int ret; - log_debug("Abstract_Socket::send_message_on_nonblocking_fd(id: %d): new iteration", client_id); -+ client_data = get_peer(client_id); - if (client_data->reading_state == STATE_DONT_CLOSE){ - goto client_closed_connection; - } else ret = send(client_id, send_par + sent_len, length - sent_len, 0); -@@ -549,7 +536,7 @@ const PacketHeaderDescr* Abstract_Socket::Get_Header_Descriptor() const - return NULL; - } - --void Abstract_Socket::peer_connected(int /*client_id*/, sockaddr_in& /*remote_addr*/) -+void Abstract_Socket::peer_connected(int client_id, sockaddr_in& remote_addr) - { - } - -@@ -614,8 +601,8 @@ void Abstract_Socket::map_user() - - char remotePort[6]; - char localPort[6]; -- sprintf(localPort, "%u", local_port_number); -- sprintf(remotePort, "%u", remote_port_number); -+ sprintf(localPort, "%d", local_port_number); -+ sprintf(remotePort, "%d", remote_port_number); - - if(!use_connection_ASPs) - { -@@ -797,7 +784,6 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc - log_warning("Cannot open socket when trying to open the listen port: %s", strerror(errno)); - listen_port_opened(-1); - errno = 0; -- freeaddrinfo(aip); - return -1; - } - else log_error("Cannot open socket"); -@@ -815,7 +801,6 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc - log_warning("Setsockopt failed when trying to open the listen port: %s", strerror(errno)); - listen_port_opened(-1); - errno = 0; -- freeaddrinfo(aip); - return -1; - } + int a; + if (sscanf(parameter_value, "%d", &a)!=1) log_error("Invalid input as port number given: %s", parameter_value); +@@ -760,6 +767,7 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc + hints.ai_flags = /*AI_ALL|*/AI_ADDRCONFIG|AI_PASSIVE; + hints.ai_socktype = SOCK_STREAM; + hints.ai_family = ai_family; ++ hints.ai_protocol = ip_proto; + + error = getaddrinfo(localHostname, localServicename, &hints, &aip); + if (error != 0) { +@@ -818,6 +826,26 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc else log_error("Setsockopt failed"); -@@ -828,10 +813,10 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc - - log_debug("Bind to port..."); - if (bind(listen_fd, res->ai_addr, res->ai_addrlen) == -1) { -- error = errno; // save it for the warning message - close(listen_fd); - listen_fd = -1; - log_debug("Cannot bind to port when trying to open the listen port: %s", strerror(errno)); -+ error = errno; // save it for the warning message - errno = 0; - continue; - } -@@ -843,8 +828,8 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc - { - log_warning("Cannot bind to port when trying to open the listen port: %s", strerror(error)); - listen_port_opened(-1); -+ error = errno; // save it for the warning message - error = 0; -- freeaddrinfo(aip); - return -1; } - else log_error("Cannot bind to port"); -@@ -858,7 +843,6 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc - log_warning("Cannot listen at port when trying to open the listen port: %s", strerror(errno)); - listen_port_opened(-1); - errno = 0; -- freeaddrinfo(aip); - return -1; - } - else log_error("Cannot listen at port"); -@@ -877,14 +861,13 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc - log_warning("getsockname() system call failed on the server socket when trying to open the listen port: %s", strerror(errno)); - listen_port_opened(-1); - errno = 0; -- freeaddrinfo(aip); - return -1; - } - else log_error("getsockname() system call failed on the server socket"); - } - char hname[NI_MAXHOST]; - char sname[NI_MAXSERV]; --/* error = getnameinfo(res->ai_addr, res->ai_addrlen, -+ error = getnameinfo(res->ai_addr, res->ai_addrlen, - hname, sizeof (hname), sname, sizeof (sname), NI_NUMERICSERV); - if (error) { - close(listen_fd); -@@ -893,14 +876,13 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc - { - log_warning("getnameinfo() system call failed on the server socket when trying to open the listen port: %s", gai_strerror(error)); - listen_port_opened(-1); -- freeaddrinfo(aip); - return -1; - } - else log_error("getsockname() system call failed on the server socket"); - } else { - log_debug("Listening on (name): %s/%s\n", - hname, sname); -- }*/ -+ } - error = getnameinfo(res->ai_addr, res->ai_addrlen, - hname, sizeof (hname), sname, sizeof (sname), NI_NUMERICHOST|NI_NUMERICSERV); - if (error) { -@@ -910,7 +892,6 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc - { - log_warning("getnameinfo() system call failed on the server socket when trying to open the listen port: %s", gai_strerror(error)); - listen_port_opened(-1); -- freeaddrinfo(aip); - return -1; - } - else log_error("getsockname() system call failed on the server socket"); -@@ -932,12 +913,11 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc - if(use_connection_ASPs) - listen_port_opened(listenPort); - -- freeaddrinfo(aip); - return listenPort; - #endif - } --void Abstract_Socket::listen_port_opened(int /*port_number*/) -+void Abstract_Socket::listen_port_opened(int port_number) - { - // Intentionally blank - } -@@ -1084,9 +1064,7 @@ int Abstract_Socket::open_client_connection(const struct sockaddr_in & new_remot - Add_Fd_Read_Handler(socket_fd); // Done here - as in case of error: remove_client expects the handler as added - log_debug("Abstract_Socket::open_client_connection(). Handler set to socket fd %d", socket_fd); - client_data->fd_buff = new TTCN_Buffer; --// client_data->clientAddr = *(struct sockaddr_storage*)&new_remote_addr; -- memset(&client_data->clientAddr,0,sizeof(client_data->clientAddr)); -- memcpy(&client_data->clientAddr,&new_remote_addr,sizeof(new_remote_addr)); -+ client_data->clientAddr = *(struct sockaddr_storage*)&new_remote_addr; - client_data->clientAddrlen = sizeof(new_remote_addr); - client_data->tcp_state = ESTABLISHED; - client_data->reading_state = STATE_NORMAL; -@@ -1259,22 +1237,22 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch - ); - - if(bind(socket_fd, aip2->ai_addr, aip2->ai_addrlen)<0) { --/* if(use_connection_ASPs) // the if else branches are the same -- {*/ -+ if(use_connection_ASPs) -+ { - log_debug("Cannot bind to port when trying to open client connection: %s", strerror(errno)); - //client_connection_opened(-1); - //freeaddrinfo(localAddrinfo); - errno = 0; - continue; //aip2 cycle - //return -1; --/* } -+ } - else { - //freeaddrinfo(localAddrinfo); - //log_error("Cannot bind to port."); - log_debug("Cannot bind to port when trying to open client connection: %s", strerror(errno)); - errno = 0; - continue; //aip2 cycle -- }*/ -+ } - } - log_debug("Bind successful on client."); - freeaddrinfo(localAddrinfo); -@@ -1358,7 +1336,7 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch - } - char hname[NI_MAXHOST]; - char sname[NI_MAXSERV]; --/* error = getnameinfo(aip->ai_addr, aip->ai_addrlen, -+ error = getnameinfo(aip->ai_addr, aip->ai_addrlen, - hname, sizeof (hname), sname, sizeof (sname), NI_NUMERICSERV); - if (error) { - close(socket_fd); -@@ -1373,19 +1351,18 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch - log_debug("Connection established (name): %s/%s -> %s/%s\n", - hname, sname, - remoteHostname, remoteServicename); -- }*/ ++ if (ip_proto==IPPROTO_SCTP){ ++ // Subscribe to SCTP events ++ sctp_event_subscribe events{}; ++ memset(&events, 0, sizeof(events)); ++ events.sctp_data_io_event = 1; ++ //events.sctp_association_event = 1; ++ //events.sctp_shutdown_event = 1; ++ if (setsockopt(listen_fd, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(events))==-1){ ++ log_error("Setsockopt SCTP event failed"); ++ } ++ ++ linger l; ++ memset(&l, 0, sizeof(l)); ++ l.l_onoff=1; /* option on/off */ ++ l.l_linger=0; ++ if (setsockopt(listen_fd, SOL_SOCKET, SO_LINGER, (void *)&l, sizeof (l)) == -1){ ++ log_error("Setsockopt SCTP socket linger failed"); ++ } + } - error = getnameinfo(aip->ai_addr, aip->ai_addrlen, - hname, sizeof (hname), sname, sizeof (sname), NI_NUMERICHOST|NI_NUMERICSERV); - if (error) { --/* close(socket_fd); -+ close(socket_fd); - if(use_connection_ASPs) - { - log_warning("getnameinfo() system call failed on the client socket when trying to connect to server: %s", gai_strerror(error)); --// client_connection_opened(-1); --// return -1; -+ client_connection_opened(-1); -+ return -1; - } -- else*/ -- log_warning("getnameinfo() system call failed on the client socket when trying to connect to server: %s", gai_strerror(error)); -+ else log_error("getnameinfo() system call failed on the client socket when trying to connect to server: %s", gai_strerror(error)); - } else { - log_debug("Connection established (addr): %s/%s -> %s/%s\n", - hname, sname, -@@ -1421,20 +1398,18 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch - return -1; - } - else log_error("Set blocking mode failed."); -- } -+ } - - as_client_struct * client_data=peer_list_add_peer(socket_fd); - Add_Fd_Read_Handler(socket_fd); // Done here - as in case of error: remove_client expects the handler as added - log_debug("Abstract_Socket::open_client_connection(). Handler set to socket fd %d", socket_fd); - client_data->fd_buff = new TTCN_Buffer; --// client_data->clientAddr = *(struct sockaddr_storage*)aip->ai_addr; -- memset(&client_data->clientAddr,0,sizeof(client_data->clientAddr)); -- memcpy(&client_data->clientAddr,aip->ai_addr,sizeof(*aip->ai_addr)); -+ client_data->clientAddr = *(struct sockaddr_storage*)aip->ai_addr; - client_data->clientAddrlen = aip->ai_addrlen; - client_data->tcp_state = ESTABLISHED; - client_data->reading_state = STATE_NORMAL; - -- freeaddrinfo(res); -+ freeaddrinfo(res); - - if (!add_user_data(socket_fd)) { - remove_client(socket_fd); -@@ -1449,7 +1424,7 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch - } - - --void Abstract_Socket::client_connection_opened(int /*client_id*/) -+void Abstract_Socket::client_connection_opened(int client_id) - { - // Intentionally blank - } -@@ -1463,7 +1438,7 @@ void Abstract_Socket::unmap_user() - log_debug("leaving Abstract_Socket::unmap_user()"); - } - --void Abstract_Socket::peer_disconnected(int /*fd*/) -+void Abstract_Socket::peer_disconnected(int fd) - { - // virtual peer_disconnected() needs to be overriden in test ports! - if(!use_connection_ASPs) { -@@ -1547,19 +1522,11 @@ void Abstract_Socket::send_outgoing(const unsigned char* send_par, int length, i - nrOfBytesSent = use_non_blocking_socket ? send_message_on_nonblocking_fd(dest_fd, send_par, length) : - send_message_on_fd(dest_fd, send_par, length); - -- if (nrOfBytesSent == -1){ -- log_debug("Client %d closed connection. Error: %d %s", client_id, errno, strerror(errno)); -- report_unsent(dest_fd,length,nrOfBytesSent,send_par,"Client closed the connection"); -- -- if(client_data->tcp_state == CLOSE_WAIT){ -- log_debug("Client %d waiting for close ASP.", client_id); -- } else { -- errno = 0; -- log_debug("Client %d closed connection", client_id); -- client_data->tcp_state = CLOSE_WAIT; -- Remove_Fd_Read_Handler(dest_fd); -- peer_half_closed(dest_fd); -- } -+ if (nrOfBytesSent == -1 && errno == EPIPE){ // means connection was interrupted by peer -+ errno = 0; -+ log_debug("Client %d closed connection", client_id); -+ remove_client(dest_fd); -+ peer_disconnected(dest_fd); - }else if (nrOfBytesSent != length) { - char *error_text=mprintf("Send system call failed: %d bytes were sent instead of %d", nrOfBytesSent, length); - report_error(client_id,length,nrOfBytesSent,send_par,error_text); -@@ -1570,16 +1537,11 @@ void Abstract_Socket::send_outgoing(const unsigned char* send_par, int length, i - log_debug("leaving Abstract_Socket::send_outgoing()"); - } - --void Abstract_Socket::report_error(int /*client_id*/, int /*msg_length*/, int /*sent_length*/, const unsigned char* /*msg*/, const char* error_text) -+void Abstract_Socket::report_error(int client_id, int msg_length, int sent_length, const unsigned char* msg, const char* error_text) - { - log_error("%s",error_text); - } - --void Abstract_Socket::report_unsent(int /*client_id*/, int /*msg_length*/, int /*sent_length*/, const unsigned char* /*msg*/, const char* error_text) --{ -- log_debug("%s",error_text); --} -- - void Abstract_Socket::all_mandatory_configparameters_present() - { - if(!use_connection_ASPs) -@@ -1813,6 +1775,7 @@ void Abstract_Socket::peer_list_resize_list(int client_id) { - new_length++; // index starts from 0 - log_debug("Abstract_Socket::peer_list_resize_list: Resizing to %d", new_length); - peer_list_root = (as_client_struct **)Realloc(peer_list_root, new_length*sizeof(as_client_struct *)); -+ log_debug("Abstract_Socket::peer_list_resize_list: After Resizing: %p", peer_list_root); - - // initialize new entries - for (int i = peer_list_length; i < new_length; i++) -@@ -1974,13 +1937,6 @@ SSL_Socket::SSL_Socket() - ssl_password=NULL; - test_port_type=NULL; - test_port_name=NULL; -- ssl_ctx = NULL; -- ssl_current_ssl = NULL; -- SSLv2=true; -- SSLv3=true; -- TLSv1=true; -- TLSv1_1=true; -- TLSv1_2=true; - } - - SSL_Socket::SSL_Socket(const char *tp_type, const char *tp_name) -@@ -1997,13 +1953,6 @@ SSL_Socket::SSL_Socket(const char *tp_type, const char *tp_name) - ssl_password=NULL; - test_port_type=tp_type; - test_port_name=tp_name; -- ssl_ctx = NULL; -- ssl_current_ssl = NULL; -- SSLv2=true; -- SSLv3=true; -- TLSv1=true; -- TLSv1_1=true; -- TLSv1_2=true; - } - - SSL_Socket::~SSL_Socket() -@@ -2056,26 +2005,6 @@ bool SSL_Socket::parameter_set(const char *parameter_name, - if(strcasecmp(parameter_value, "yes") == 0) ssl_verify_certificate = true; - else if(strcasecmp(parameter_value, "no") == 0) ssl_verify_certificate = false; - else log_error("Parameter value '%s' not recognized for parameter '%s'", parameter_value, ssl_verifycertificate_name()); -- } else if(strcasecmp(parameter_name, ssl_disable_SSLv2()) == 0) { -- if(strcasecmp(parameter_value, "yes") == 0) SSLv2= false; -- else if(strcasecmp(parameter_value, "no") == 0) SSLv2 = true; -- else log_error("Parameter value '%s' not recognized for parameter '%s'", parameter_value, ssl_disable_SSLv2()); -- } else if(strcasecmp(parameter_name, ssl_disable_SSLv3()) == 0) { -- if(strcasecmp(parameter_value, "yes") == 0) SSLv2 = false; -- else if(strcasecmp(parameter_value, "no") == 0) SSLv2 = true; -- else log_error("Parameter value '%s' not recognized for parameter '%s'", parameter_value, ssl_disable_SSLv3()); -- } else if(strcasecmp(parameter_name, ssl_disable_TLSv1()) == 0) { -- if(strcasecmp(parameter_value, "yes") == 0) TLSv1= false; -- else if(strcasecmp(parameter_value, "no") == 0) TLSv1 = true; -- else log_error("Parameter value '%s' not recognized for parameter '%s'", parameter_value, ssl_disable_TLSv1()); -- } else if(strcasecmp(parameter_name, ssl_disable_TLSv1_1()) == 0) { -- if(strcasecmp(parameter_value, "yes") == 0) TLSv1_1 = false; -- else if(strcasecmp(parameter_value, "no") == 0) TLSv1_1 = true; -- else log_error("Parameter value '%s' not recognized for parameter '%s'", parameter_value, ssl_disable_TLSv1_1()); -- } else if(strcasecmp(parameter_name, ssl_disable_TLSv1_2()) == 0) { -- if(strcasecmp(parameter_value, "yes") == 0) TLSv1_2 = false; -- else if(strcasecmp(parameter_value, "no") == 0) TLSv1_2 = true; -- else log_error("Parameter value '%s' not recognized for parameter '%s'", parameter_value, ssl_disable_TLSv1_2()); - } else { - log_debug("leaving SSL_Socket::parameter_set(%s, %s)", parameter_name, parameter_value); - return Abstract_Socket::parameter_set(parameter_name, parameter_value); -@@ -2102,32 +2031,6 @@ bool SSL_Socket::add_user_data(int client_id) { ++ + if(!nagling) { + int on = 1; + setsockopt(listen_fd, IPPROTO_TCP, TCP_NODELAY, (const char*)&on, sizeof(on)); +@@ -1143,6 +1171,7 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch + } + hints.ai_socktype = SOCK_STREAM; + hints.ai_family = ai_family; ++ hints.ai_protocol = ip_proto; - if (ssl_current_ssl==NULL) - log_error("Creation of SSL object failed"); --#ifdef SSL_OP_NO_SSLv2 -- if(!SSLv2){ -- SSL_set_options(ssl_current_ssl,SSL_OP_NO_SSLv2); -- } --#endif --#ifdef SSL_OP_NO_SSLv3 -- if(!SSLv3){ -- SSL_set_options(ssl_current_ssl,SSL_OP_NO_SSLv3); -- } --#endif --#ifdef SSL_OP_NO_TLSv1 -- if(!TLSv1){ -- SSL_set_options(ssl_current_ssl,SSL_OP_NO_TLSv1); -- } --#endif --#ifdef SSL_OP_NO_TLSv1_1 -- if(!TLSv1_1){ -- SSL_set_options(ssl_current_ssl,SSL_OP_NO_TLSv1_1); -- } --#endif --#ifdef SSL_OP_NO_TLSv1_2 -- if(!TLSv1_2){ -- SSL_set_options(ssl_current_ssl,SSL_OP_NO_TLSv1_2); -- } --#endif -- - set_user_data(client_id, ssl_current_ssl); - log_debug("New client added with key '%d'", client_id); - log_debug("Binding SSL to the socket"); -@@ -2362,10 +2265,9 @@ int SSL_Socket::send_message_on_fd(int client_id, const unsigned char* send_par, - log_debug("SSL_ERROR_ZERO_RETURN is received, setting SSL SHUTDOWN mode to QUIET"); - ssl_current_client=NULL; - log_debug("leaving SSL_Socket::send_message_on_fd()"); -- return -1; -+ return 0; - default: -- log_debug("SSL error occured"); -- return -1; -+ log_error("SSL error occured"); + error = getaddrinfo(remoteHostname, remoteServicename, &hints, &res); + if (error != 0) { +@@ -1191,12 +1220,13 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch + } } - } - // avoid compiler warnings -@@ -2457,8 +2359,7 @@ int SSL_Socket::send_message_on_nonblocking_fd(int client_id, const unsigned cha - case SSL_ERROR_ZERO_RETURN: - goto client_closed_connection; - default: -- log_warning("SSL error occured"); -- return -1; -+ log_error("SSL error occured"); + +- log_debug("Using address family for socket %d: %s",socket_fd, ++ log_debug("Using address family for socket %d: %s - %s",socket_fd, + ((aip->ai_family==AF_INET)?"IPv4": +- ((aip->ai_family==AF_INET6)?"IPv6":"unknown")) ++ ((aip->ai_family==AF_INET6)?"IPv6":"unknown")), ++ ((aip->ai_protocol==IPPROTO_TCP)?"IPPROTO_TCP": ++ ((aip->ai_protocol==IPPROTO_SCTP)?"IPPROTO_SCTP":"unknown")) + ); +- +- ++ + if(!nagling) { + int on = 1; + setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, (const char*)&on, sizeof(on)); +@@ -1225,6 +1255,7 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch + hints.ai_flags = AI_PASSIVE; + hints.ai_socktype = SOCK_STREAM; + hints.ai_family = ai_family;//aip->ai_family; // NOTE: On solaris 10 if is set to aip->ai_family, getaddrinfo will crash for IPv4-mapped addresses! ++ hints.ai_protocol = ip_proto; + + error = getaddrinfo(localHostname, localServicename, &hints, &localAddrinfo); + if (error != 0) { +@@ -1390,10 +1421,35 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch } - } - -@@ -2547,11 +2448,6 @@ const char* SSL_Socket::ssl_certificate_file_name() { return "ssl_certific - const char* SSL_Socket::ssl_password_name() { return "ssl_private_key_password";} - const char* SSL_Socket::ssl_cipher_list_name() { return "ssl_allowed_ciphers_list";} - const char* SSL_Socket::ssl_verifycertificate_name() { return "ssl_verify_certificate";} --const char* SSL_Socket::ssl_disable_SSLv2() { return "ssl_disable_SSLv2";} --const char* SSL_Socket::ssl_disable_SSLv3() { return "ssl_disable_SSLv3";} --const char* SSL_Socket::ssl_disable_TLSv1() { return "ssl_disable_TLSv1";} --const char* SSL_Socket::ssl_disable_TLSv1_1() { return "ssl_disable_TLSv1_1";} --const char* SSL_Socket::ssl_disable_TLSv1_2() { return "ssl_disable_TLSv1_2";} - - void SSL_Socket::ssl_actions_to_seed_PRNG() { -@@ -2654,10 +2550,10 @@ void SSL_Socket::ssl_init_SSL() - - // check the other side's certificates - if (ssl_verify_certificate) { -- log_debug("Setting verification behaviour: verification required and do not allow to continue on failure.."); -+ log_debug("Setting verification behaviour: verification required and do not allow to continue on failure"); - SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, ssl_verify_callback); - } else { -- log_debug("Setting verification behaviour: verification not required and do allow to continue on failure.."); -+ log_debug("Setting verification behaviour: verification not required and do allow to continue on failure"); - SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_NONE, ssl_verify_callback); + log_debug( +- "connected to: host %s service %s via address family %s\n", ++ "connected to: host %s service %s via address family %s with ip_proto %s\n", + remoteHostname, remoteServicename, + ((aip->ai_family==AF_INET)?"IPv4": +- ((aip->ai_family==AF_INET6)?"IPv6":"unknown"))); ++ ((aip->ai_family==AF_INET6)?"IPv6":"unknown")), ++ ((aip->ai_protocol==IPPROTO_TCP)?"IPPROTO_TCP": ++ ((aip->ai_protocol==IPPROTO_SCTP)?"IPPROTO_SCTP":"unknown")) ++ ); ++ ++ if(ip_proto==IPPROTO_SCTP){ ++ //if (aip->ai_protocol==IPPROTO_SCTP){ ++ log_debug("Setting events,linger for SCTP socket!"); ++ // Subscribe to SCTP events ++ sctp_event_subscribe events{}; ++ memset(&events, 0, sizeof(events)); ++ events.sctp_data_io_event = 1; ++ //events.sctp_association_event = 1; ++ //events.sctp_shutdown_event = 1; ++ if (setsockopt(socket_fd, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(events))==-1){ ++ log_error("Setsockopt SCTP event failed"); ++ } ++ ++ linger l; ++ memset(&l, 0, sizeof(l)); ++ l.l_onoff=1; /* option on/off */ ++ l.l_linger=0; ++ if (setsockopt(socket_fd, SOL_SOCKET, SO_LINGER, (void *)&l, sizeof (l)) == -1){ ++ log_error("Setsockopt SCTP socket linger failed"); ++ } ++ }//else{log_debug("not ipproto sctp!");} + break; } + if (aip==NULL) { +@@ -1774,18 +1830,19 @@ const char* Abstract_Socket::remote_address_name() { return "destIPAddr + const char* Abstract_Socket::local_address_name() { return "serverIPAddr";} + const char* Abstract_Socket::remote_port_name() { return "destPort";} + const char* Abstract_Socket::ai_family_name() { return "ai_family";} ++const char* Abstract_Socket::ip_proto_name() { return "ip_proto";} + const char* Abstract_Socket::use_connection_ASPs_name() { return "use_connection_ASPs";} + const char* Abstract_Socket::halt_on_connection_reset_name(){ return "halt_on_connection_reset";} +-const char* Abstract_Socket::client_TCP_reconnect_name() { return "client_TCP_reconnect";} ++const char* Abstract_Socket::client_TCP_reconnect_name() { return "client_TCP_reconnect";} + const char* Abstract_Socket::TCP_reconnect_attempts_name() { return "TCP_reconnect_attempts";} +-const char* Abstract_Socket::TCP_reconnect_delay_name() { return "TCP_reconnect_delay";} ++const char* Abstract_Socket::TCP_reconnect_delay_name() { return "TCP_reconnect_delay";} + const char* Abstract_Socket::server_mode_name() { return "server_mode";} + const char* Abstract_Socket::socket_debugging_name() { return "socket_debugging";} + const char* Abstract_Socket::nagling_name() { return "nagling";} + const char* Abstract_Socket::use_non_blocking_socket_name() { return "use_non_blocking_socket";} + const char* Abstract_Socket::server_backlog_name() { return "server_backlog";} +-bool Abstract_Socket::add_user_data(int) {return true;} +-bool Abstract_Socket::remove_user_data(int) {return true;} ++bool Abstract_Socket::add_user_data(int) {return true;} ++bool Abstract_Socket::remove_user_data(int) {return true;} + bool Abstract_Socket::user_all_mandatory_configparameters_present() { return true; } -@@ -2757,7 +2653,7 @@ int SSL_Socket::ssl_getresult(int res) - return err; - } - --int SSL_Socket::ssl_verify_certificates_at_handshake(int /*preverify_ok*/, X509_STORE_CTX */*ssl_ctx*/) { -+int SSL_Socket::ssl_verify_certificates_at_handshake(int preverify_ok, X509_STORE_CTX *ssl_ctx) { - // don't care by default - return -1; - } -@@ -2765,7 +2661,7 @@ int SSL_Socket::ssl_verify_certificates_at_handshake(int /*preverify_ok*/, X50 - // Callback function used by OpenSSL. - // Called when a password is needed to decrypt the private key file. - // NOTE: not thread safe --int SSL_Socket::ssl_password_cb(char *buf, int num, int /*rwflag*/,void */*userdata*/) { -+int SSL_Socket::ssl_password_cb(char *buf, int num, int rwflag,void *userdata) { - - if (ssl_current_client!=NULL) { - char *ssl_client_password; -@@ -2795,23 +2691,18 @@ int SSL_Socket::ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ssl_ctx) - ctx_pointer = SSL_get_SSL_CTX(ssl_pointer); - if (ssl_current_client!=NULL) { -- // if ssl_verifiycertificate == "no", then always accept connections -- if(((SSL_Socket *)ssl_current_client)->ssl_verify_certificate) { -- user_result=((SSL_Socket *)ssl_current_client)->ssl_verify_certificates_at_handshake(preverify_ok, ssl_ctx); -- if (user_result>=0) return user_result; -- } else { -- return 1; -- } -+ user_result=((SSL_Socket *)ssl_current_client)->ssl_verify_certificates_at_handshake(preverify_ok, ssl_ctx); -+ if (user_result>=0) return user_result; - } else { // go on with default authentication - fprintf(stderr, "Warning: no current SSL object found but ssl_verify_callback is called, programming error\n"); - } - - // if ssl_verifiycertificate == "no", then always accept connections -- if (SSL_CTX_get_verify_mode(ctx_pointer) == SSL_VERIFY_NONE) -+ if (SSL_CTX_get_verify_mode(ctx_pointer) && SSL_VERIFY_NONE) - return 1; - // if ssl_verifiycertificate == "yes", then accept connections only if the - // certificate is valid -- else if (SSL_CTX_get_verify_mode(ctx_pointer) & SSL_VERIFY_PEER) { -+ else if (SSL_CTX_get_verify_mode(ctx_pointer) && SSL_VERIFY_PEER) { - return preverify_ok; - } - // something went wrong diff --git a/ttcn/patch_abstract_socket/Abstract_Socket.hh.patch b/ttcn/patch_abstract_socket/Abstract_Socket.hh.patch index 2b4445e916cb402de628f5626322e94e9751d21b..bce5667c9379427f8c787a494a45063e633ca6cb 100644 --- a/ttcn/patch_abstract_socket/Abstract_Socket.hh.patch +++ b/ttcn/patch_abstract_socket/Abstract_Socket.hh.patch @@ -1,108 +1,38 @@ -diff --git a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module/src/Abstract_Socket.hh b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module/src/Abstract_Socket.hh -old mode 100644 -new mode 100755 -index 7de8446..ad2d65d ---- a/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module/src/Abstract_Socket.hh -+++ b/ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module/src/Abstract_Socket.hh -@@ -1,28 +1,17 @@ - /****************************************************************************** --* Copyright (c) 2000-2019 Ericsson Telecom AB --* All rights reserved. This program and the accompanying materials --* are made available under the terms of the Eclipse Public License v2.0 --* which accompanies this distribution, and is available at --* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html --* --* Contributors: --* Zoltan Bibo - initial implementation and initial documentation --* Gergely Futo --* Oliver Ferenc Czerman --* Balasko Jeno --* Zoltan Bibo --* Eduard Czimbalmos --* Kulcsár Endre --* Gabor Szalai --* Jozsef Gyurusi --* Csöndes Tibor --* Zoltan Jasz --******************************************************************************/ -+ * Copyright (c) 2000-2025 Ericsson Telecom AB -+ * All rights reserved. This program and the accompanying materials -+ * are made available under the terms of the Eclipse Public License v2.0 -+ * which accompanies this distribution, and is available at -+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html -+ ******************************************************************************/ - // - // File: Abstract_Socket.hh - // Description: Abstract_Socket header file --// Rev: R9B -+// Rev: - // Prodnr: CNL 113 384 -+// Updated: 2010-11-24 -+// Contact: http://ttcn.ericsson.se - // +diff --git a/src/Abstract_Socket.hh b/src/Abstract_Socket.hh +index 6d7bc3d..a068662 100644 +--- a/src/Abstract_Socket.hh ++++ b/src/Abstract_Socket.hh +@@ -134,7 +134,7 @@ protected: + bool get_handle_half_close() const {return handle_half_close;} + int get_socket_fd() const; + int get_listen_fd() const {return listen_fd;} +- ++ + //set non-blocking mode + int set_non_block_mode(int fd, bool enable_nonblock); - -@@ -120,7 +109,7 @@ protected: - // Shall be called from Handle_Fd_Event() - void Handle_Socket_Event(int fd, boolean is_readable, boolean is_writable, boolean is_error); - // Shall be called from Handle_Timeout() - for possible future development -- void Handle_Timeout_Event(double /*time_since_last_call*/) {}; -+ void Handle_Timeout_Event(double time_since_last_call) {}; - - // Shall be called from outgoing_send() - void send_outgoing(const unsigned char* message_buffer, int length, int client_id = -1); -@@ -144,9 +133,9 @@ protected: - bool increase_send_buffer(int fd, int &old_size, int& new_size); - - const char* get_local_host_name(){return local_host_name; }; -- unsigned int get_local_port_number(){return local_port_number; }; -+ const unsigned int get_local_port_number(){return local_port_number; }; - const char* get_remote_host_name(){return remote_host_name; }; -- unsigned int get_remote_port_number(){return remote_port_number; }; -+ const unsigned int get_remote_port_number(){return remote_port_number; }; - const struct sockaddr_in & get_remote_addr() {return remoteAddr; }; /* FIXME: This function is deprecated and should be removed! */ +@@ -149,6 +149,8 @@ protected: const struct sockaddr_in & get_local_addr() {return localAddr; }; /* FIXME: This function is deprecated and should be removed! */ const int& get_ai_family() const {return ai_family;} -@@ -190,15 +179,13 @@ protected: - virtual int send_message_on_nonblocking_fd(int client_id, const unsigned char *message_buffer, int message_length); - // Called after a peer is connected - virtual void peer_connected(int client_id, sockaddr_in& remote_addr); /* This function should be removed! deprecated by: */ -- virtual void peer_connected(int /*client_id*/, const char * /*host*/, const int /*port*/) {}; -+ virtual void peer_connected(int client_id, const char * host, const int port) {}; - // Called after a peer is disconnected - virtual void peer_disconnected(int client_id); - // Called when a peer shut down its fd for writing - virtual void peer_half_closed(int client_id); - // Called after a send error - virtual void report_error(int client_id, int msg_length, int sent_length, const unsigned char* msg, const char* error_text); -- // Called after a unsent message -- virtual void report_unsent(int client_id, int msg_length, int sent_length, const unsigned char* msg, const char* error_text); - - // Test port parameters - virtual const char* local_port_name(); -@@ -365,11 +352,6 @@ protected: - virtual const char* ssl_password_name(); - virtual const char* ssl_cipher_list_name(); - virtual const char* ssl_verifycertificate_name(); -- virtual const char* ssl_disable_SSLv2(); -- virtual const char* ssl_disable_SSLv3(); -- virtual const char* ssl_disable_TLSv1(); -- virtual const char* ssl_disable_TLSv1_1(); -- virtual const char* ssl_disable_TLSv1_2(); - - private: - bool ssl_verify_certificate; // verify other part's certificate or not -@@ -377,13 +359,6 @@ private: - bool ssl_initialized; // whether SSL already initialized or not - bool ssl_use_session_resumption; // use SSL sessions or not - -- bool SSLv2; -- bool SSLv3; -- bool TLSv1; -- bool TLSv1_1; -- bool TLSv1_2; -- -- - char *ssl_key_file; // private key file - char *ssl_certificate_file; // own certificate file - char *ssl_trustedCAlist_file; // trusted CA list file + void set_ai_family(int parameter_value) {ai_family=parameter_value;} ++ const int& get_ip_proto() const {return ip_proto;} ++ void set_ip_proto(int parameter_value) {ip_proto=parameter_value;} + bool get_ttcn_buffer_usercontrol() const {return ttcn_buffer_usercontrol; } + void set_nagling(bool parameter_value) {nagling=parameter_value;} + void set_server_mode(bool parameter_value) {server_mode=parameter_value;} +@@ -204,6 +206,7 @@ protected: + virtual const char* local_address_name(); + virtual const char* remote_port_name(); + virtual const char* ai_family_name(); ++ virtual const char* ip_proto_name(); + virtual const char* use_connection_ASPs_name(); + virtual const char* halt_on_connection_reset_name(); + virtual const char* client_TCP_reconnect_name(); +@@ -269,6 +272,7 @@ private: + char* remote_host_name; + unsigned int remote_port_number; + int ai_family; // address family to use ++ int ip_proto; // protocol to use (e.g. IPPROTO_TCP, IPPROTO_SCTP) + // remoteAddr and localAddr is filled when map_user is called + struct sockaddr_in remoteAddr; /* FIXME: not used! should be removed */ + struct sockaddr_in localAddr; /* FIXME: not used! should be removed */