diff --git a/.github/workflows/cwf-integ-test.yml b/.github/workflows/cwf-integ-test.yml index 00c9cf038e72..a7564ddf5f76 100644 --- a/.github/workflows/cwf-integ-test.yml +++ b/.github/workflows/cwf-integ-test.yml @@ -128,10 +128,11 @@ jobs: path: cwf/gateway/tests.xml - name: Publish Unit Test Results if: always() - uses: EnricoMi/publish-unit-test-result-action/composite@7377632048da85434c30810c38353542d3162dc4 # pin@v1 + uses: EnricoMi/publish-unit-test-result-action/composite@2a60c5d47eb29cd5cc922f51bbea18e148f56203 # pin@v2 with: + check_name: CWF integration test results + junit_files: cwf/gateway/tests.xml check_run_annotations: all tests - files: cwf/gateway/tests.xml - name: Fetch logs if: always() run: | diff --git a/.github/workflows/federated-integ-test.yml b/.github/workflows/federated-integ-test.yml index 90e5b4867778..2572cac8ff69 100644 --- a/.github/workflows/federated-integ-test.yml +++ b/.github/workflows/federated-integ-test.yml @@ -186,21 +186,22 @@ jobs: name: test-results path: lte/gateway/test-results/**/*.xml - name: Get test logs - if: failure() + if: always() run: | cd lte/gateway fab get_test_logs:dst_path=./logs.tar.gz - name: Upload test logs uses: actions/upload-artifact@v2 - if: failure() + if: always() with: name: test-logs path: lte/gateway/logs.tar.gz - name: Publish Unit Test Results if: always() - uses: EnricoMi/publish-unit-test-result-action/composite@7377632048da85434c30810c38353542d3162dc4 # pin@v1 + uses: EnricoMi/publish-unit-test-result-action/composite@2a60c5d47eb29cd5cc922f51bbea18e148f56203 # pin@v2 with: - files: lte/gateway/test-results/**/*.xml + check_name: FEG integration test results + junit_files: lte/gateway/test-results/**/*.xml check_run_annotations: all tests - name: Publish results to Firebase if: always() && github.event.workflow_run.event == 'push' diff --git a/.github/workflows/lte-integ-test-bazel.yml b/.github/workflows/lte-integ-test-bazel.yml index 053fd309bcb1..88be84554cad 100644 --- a/.github/workflows/lte-integ-test-bazel.yml +++ b/.github/workflows/lte-integ-test-bazel.yml @@ -91,6 +91,36 @@ jobs: export MAGMA_DEV_CPUS=3 export MAGMA_DEV_MEMORY_MB=9216 fab bazel_integ_test_post_build + - name: Get test results + if: always() + run: | + cd lte/gateway + fab get_test_summaries:dst_path="test-results,sudo_tests=False" + ls -R + - name: Upload test results + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3 + if: always() + with: + name: test-results + path: lte/gateway/test-results/**/*.xml + - name: Get test logs + if: always() + run: | + cd lte/gateway + fab get_test_logs:dst_path=./logs.tar.gz + - name: Upload test logs + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3 + if: always() + with: + name: test-logs + path: lte/gateway/logs.tar.gz + - name: Publish Unit Test Results + if: always() + uses: EnricoMi/publish-unit-test-result-action/composite@2a60c5d47eb29cd5cc922f51bbea18e148f56203 # pin@v2 + with: + check_name: LTE Bazel integration test results + junit_files: lte/gateway/test-results/**/*.xml + check_run_annotations: all tests - name: Publish bazel profile uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3 if: always() diff --git a/.github/workflows/lte-integ-test-magma-deb.yml b/.github/workflows/lte-integ-test-magma-deb.yml index 63f4060b136c..41bd52897463 100644 --- a/.github/workflows/lte-integ-test-magma-deb.yml +++ b/.github/workflows/lte-integ-test-magma-deb.yml @@ -62,3 +62,22 @@ jobs: run: | cd lte/gateway fab integ_test_deb_installation + - name: Get test results + if: always() + run: | + cd lte/gateway + fab get_test_summaries:dst_path="test-results",sudo_tests=False,dev_vm_name="magma_deb" + ls -R + - name: Upload test results + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3 + if: always() + with: + name: test-results + path: lte/gateway/test-results/**/*.xml + - name: Publish Unit Test Results + if: always() + uses: EnricoMi/publish-unit-test-result-action/composite@2a60c5d47eb29cd5cc922f51bbea18e148f56203 # pin@v2 + with: + check_name: LTE Debian integration test results + junit_files: lte/gateway/test-results/**/*.xml + check_run_annotations: all tests diff --git a/.github/workflows/lte-integ-test.yml b/.github/workflows/lte-integ-test.yml index def198cfaa16..5fe2cd9f355d 100644 --- a/.github/workflows/lte-integ-test.yml +++ b/.github/workflows/lte-integ-test.yml @@ -89,21 +89,22 @@ jobs: name: test-results path: lte/gateway/test-results/**/*.xml - name: Get test logs - if: failure() + if: always() run: | cd lte/gateway fab get_test_logs:dst_path=./logs.tar.gz - name: Upload test logs uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3 - if: failure() + if: always() with: name: test-logs path: lte/gateway/logs.tar.gz - name: Publish Unit Test Results if: always() - uses: EnricoMi/publish-unit-test-result-action/composite@7377632048da85434c30810c38353542d3162dc4 # pin@v1 + uses: EnricoMi/publish-unit-test-result-action/composite@2a60c5d47eb29cd5cc922f51bbea18e148f56203 # pin@v2 with: - files: lte/gateway/test-results/**/*.xml + check_name: LTE integration test results + junit_files: lte/gateway/test-results/**/*.xml check_run_annotations: all tests - name: Publish results to Firebase if: always() && github.event.workflow_run.event == 'push' diff --git a/.github/workflows/sudo-python-tests.yml b/.github/workflows/sudo-python-tests.yml index b7883a336d4b..d3eeeb39970f 100644 --- a/.github/workflows/sudo-python-tests.yml +++ b/.github/workflows/sudo-python-tests.yml @@ -69,6 +69,25 @@ jobs: cd lte/gateway vagrant ssh -c 'cd ~/magma; bazel/scripts/remote_cache_bazelrc_setup.sh "${{ env.CACHE_KEY }}" "${{ env.REMOTE_DOWNLOAD_OPTIMIZATION }}" "${{ secrets.BAZEL_REMOTE_PASSWORD }}";' magma vagrant ssh -c 'cd ~/magma; bazel/scripts/run_sudo_tests.sh --retry-on-failure --retry-attempts 1;' magma + - name: Get test results + if: always() + run: | + cd lte/gateway + fab get_test_summaries:dst_path="test-results",integration_tests=False + ls -R + - name: Upload test results + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3 + if: always() + with: + name: test-results + path: lte/gateway/test-results/**/*.xml + - name: Publish Unit Test Results + if: always() + uses: EnricoMi/publish-unit-test-result-action/composite@2a60c5d47eb29cd5cc922f51bbea18e148f56203 # pin@v2 + with: + check_name: Sudo Python test results + junit_files: lte/gateway/test-results/**/*.xml + check_run_annotations: all tests - name: Notify failure to slack if: failure() && github.repository_owner == 'magma' uses: Ilshidur/action-slack@689ad44a9c9092315abd286d0e3a9a74d31ab78a # pin@2.1.0 diff --git a/bazel/scripts/check_py_bazel.sh b/bazel/scripts/check_py_bazel.sh index c4570ffb3b9f..2bc548486a02 100755 --- a/bazel/scripts/check_py_bazel.sh +++ b/bazel/scripts/check_py_bazel.sh @@ -58,29 +58,30 @@ DENY_LIST_NOT_YET_BAZELIFIED=( "./lte/gateway/python/integ_tests/cloud_tests" "./lte/gateway/python/integ_tests/federated_tests" "./lte/gateway/python/integ_tests/s1aptests/workflow" + "./lte/gateway/python/integ_tests/s1aptests/test_enable_ipv6_iface.py" + "./lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_ul_tcp.py" + "./lte/gateway/python/integ_tests/s1aptests/test_disable_ipv6_iface.py" + # as of 2022.09.19 commented out in make "./lte/gateway/python/integ_tests/s1aptests/test_agw_offload_mixed_idle_active_multiue.py" "./lte/gateway/python/integ_tests/s1aptests/test_attach_detach_two_pdns_with_tcptraffic.py" - "./lte/gateway/python/integ_tests/s1aptests/test_stateless_multi_ue_mixedstate_mme_restart.py" - "./lte/gateway/python/integ_tests/s1aptests/test_attach_ul_udp_data_multi_ue.py" - "./lte/gateway/python/integ_tests/s1aptests/test_attach_standalone_act_dflt_ber_ctxt_rej_ded_bearer_activation.py" + "./lte/gateway/python/integ_tests/s1aptests/test_attach_dl_tcp_data_multi_ue.py" "./lte/gateway/python/integ_tests/s1aptests/test_attach_dl_udp_data_multi_ue.py" - "./lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ul_tcp.py" - "./lte/gateway/python/integ_tests/s1aptests/test_attach_ul_tcp_data_multi_ue.py" "./lte/gateway/python/integ_tests/s1aptests/test_attach_dl_ul_tcp_data_multi_ue.py" + "./lte/gateway/python/integ_tests/s1aptests/test_attach_standalone_act_dflt_ber_ctxt_rej_ded_bearer_activation.py" + "./lte/gateway/python/integ_tests/s1aptests/test_attach_ul_tcp_data_multi_ue.py" + "./lte/gateway/python/integ_tests/s1aptests/test_attach_ul_udp_data_multi_ue.py" + "./lte/gateway/python/integ_tests/s1aptests/test_attach_with_multiple_mme_restarts.py" "./lte/gateway/python/integ_tests/s1aptests/test_data_flow_after_service_request.py" - "./lte/gateway/python/integ_tests/s1aptests/test_outoforder_erab_setup_rsp_default_bearer.py" - "./lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_tcp.py" - "./lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_udp.py" - "./lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_ded_bearer_ul_tcp.py" "./lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ded_bearer_dl_tcp.py" "./lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ded_bearer_ul_tcp.py" + "./lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ul_tcp.py" "./lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_ded_bearer_dl_tcp.py" - "./lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_ul_tcp.py" + "./lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_ded_bearer_ul_tcp.py" + "./lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_tcp.py" + "./lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_udp.py" + "./lte/gateway/python/integ_tests/s1aptests/test_outoforder_erab_setup_rsp_default_bearer.py" "./lte/gateway/python/integ_tests/s1aptests/test_scalability_attach_detach_multi_ue.py" - "./lte/gateway/python/integ_tests/s1aptests/test_attach_dl_tcp_data_multi_ue.py" - "./lte/gateway/python/integ_tests/s1aptests/test_attach_with_multiple_mme_restarts.py" - "./lte/gateway/python/integ_tests/s1aptests/test_enable_ipv6_iface.py" - "./lte/gateway/python/integ_tests/s1aptests/test_disable_ipv6_iface.py" + "./lte/gateway/python/integ_tests/s1aptests/test_stateless_multi_ue_mixedstate_mme_restart.py" # TODO: GH12754 move to (lte|orc8r)/gateway/python/scripts/ "./orc8r/gateway/python/magma/common/health/docker_health_service.py" "./orc8r/gateway/python/magma/common/health/health_service.py" diff --git a/bazel/scripts/run_integ_tests.sh b/bazel/scripts/run_integ_tests.sh index 78b8fe7f4533..dc6785f2c998 100755 --- a/bazel/scripts/run_integ_tests.sh +++ b/bazel/scripts/run_integ_tests.sh @@ -299,10 +299,11 @@ run_test() { } create_xml_report() { - rm -f "${MERGED_REPORT_FOLDER}/"*.xml - mkdir -p "${MERGED_REPORT_FOLDER}" - python3 lte/gateway/python/scripts/runtime_report.py -i "[^\/]+\.xml" -w "${INTEGTEST_REPORT_FOLDER}" -o "${MERGED_REPORT_FOLDER}/integtests_report.xml" - rm -f "${INTEGTEST_REPORT_FOLDER}/"*.xml + local MERGED_REPORT_XML="integtests_report.xml" + rm -f "${MERGED_REPORT_FOLDER}/${MERGED_REPORT_XML}" + mkdir -p "${INTEGTEST_REPORT_FOLDER}" + python3 lte/gateway/python/scripts/runtime_report.py -i "[^\/]+\.xml" -w "${INTEGTEST_REPORT_FOLDER}" -o "${MERGED_REPORT_FOLDER}/${MERGED_REPORT_XML}" + sudo rm -f "${INTEGTEST_REPORT_FOLDER}/"*.xml } print_summary() { @@ -345,8 +346,8 @@ RETRY_ATTEMPTS=2 RERUN_PREVIOUSLY_FAILED="false" FAILED_LIST=() FAILED_LIST_FILE="/tmp/last_failed_integration_tests.txt" -INTEGTEST_REPORT_FOLDER="/var/tmp/test_results" -MERGED_REPORT_FOLDER="${INTEGTEST_REPORT_FOLDER}/integtest_merged_report" +MERGED_REPORT_FOLDER="/var/tmp/test_results" +INTEGTEST_REPORT_FOLDER="${MERGED_REPORT_FOLDER}/integtest_reports" BOLD='\033[1m' RED='\033[0;31m' diff --git a/bazel/scripts/run_sudo_tests.sh b/bazel/scripts/run_sudo_tests.sh index 4b44783e3a05..7f02c3fccf46 100755 --- a/bazel/scripts/run_sudo_tests.sh +++ b/bazel/scripts/run_sudo_tests.sh @@ -76,10 +76,11 @@ run_test() { } create_xml_report() { - rm -f "${MERGED_REPORT_FOLDER}/"*.xml - mkdir -p "${MERGED_REPORT_FOLDER}" - python3 lte/gateway/python/scripts/runtime_report.py -i "[^\/]+\.xml" -w "${SUDO_TEST_REPORT_FOLDER}" -o "${MERGED_REPORT_FOLDER}/sudo_tests_report.xml" - rm -f "${SUDO_TEST_REPORT_FOLDER}/"*.xml + local MERGED_REPORT_XML="sudotests_report.xml" + rm -f "${MERGED_REPORT_FOLDER}/${MERGED_REPORT_XML}" + mkdir -p "${SUDO_TEST_REPORT_FOLDER}" + python3 lte/gateway/python/scripts/runtime_report.py -i "[^\/]+\.xml" -w "${SUDO_TEST_REPORT_FOLDER}" -o "${MERGED_REPORT_FOLDER}/${MERGED_REPORT_XML}" + sudo rm -f "${SUDO_TEST_REPORT_FOLDER}/"*.xml } print_summary() { @@ -104,8 +105,8 @@ NUM_SUCCESS=0 NUM_RUN=1 RETRY_ON_FAILURE="false" RETRY_ATTEMPTS=2 -SUDO_TEST_REPORT_FOLDER="/var/tmp/test_results" -MERGED_REPORT_FOLDER="${SUDO_TEST_REPORT_FOLDER}/sudo_merged_report" +MERGED_REPORT_FOLDER="/var/tmp/test_results" +SUDO_TEST_REPORT_FOLDER="${MERGED_REPORT_FOLDER}/sudotest_reports" BOLD='\033[1m' RED='\033[0;31m' diff --git a/ci-scripts/JenkinsFile-OAI-Container-GitHub b/ci-scripts/JenkinsFile-OAI-Container-GitHub index 417e26e2f4b0..18816eab4a89 100644 --- a/ci-scripts/JenkinsFile-OAI-Container-GitHub +++ b/ci-scripts/JenkinsFile-OAI-Container-GitHub @@ -295,12 +295,11 @@ pipeline { } catch (Exception e) { echo 'OK if not present' } - // In case of the full build, we need the host RHEL8 credentials. - if (params.REGRESSION_TEST) { - sh('mkdir -p tmp/ca tmp/entitlement') - sh('cp /etc/pki/entitlement/*pem tmp/entitlement') - sh('sudo cp /etc/rhsm/ca/redhat-uep.pem tmp/ca') - } + // Copying the host RHEL8 credentials all the time + sh('mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca') + sh('cp /etc/pki/entitlement/*pem ./etc-pki-entitlement') + sh('sudo cp /etc/rhsm/rhsm.conf ./rhsm-conf') + sh('sudo cp /etc/rhsm/ca/*.pem ./rhsm-ca') // Create the image to use // Once again, we are not using the full dockerfile from scratch: too long --> when it is a pull request // On the daily master build, we are doing from scratch diff --git a/docs/readmes/lte/deploy_install.md b/docs/readmes/lte/deploy_install.md index cee45e02c7f1..013044a7ab20 100644 --- a/docs/readmes/lte/deploy_install.md +++ b/docs/readmes/lte/deploy_install.md @@ -6,8 +6,6 @@ hide_title: true # Install Access Gateway on Ubuntu (Bare Metal) -> NOTE: Debian-based AGW deployments are no longer supported as of v1.6. If you want to install to Debian, refer to [v1.5 of the documentation](https://magma.github.io/magma/versions). - ## Prerequisites To set up a Magma Access Gateway, you will need a machine that @@ -37,7 +35,7 @@ satisfies the following requirements: ### 1. Create boot USB stick and install Ubuntu on your AGW host -- Download the Ubuntu Server 20.04 LTS `.iso` image from the Ubuntu website +- Download the Ubuntu Server 20.04 LTS `.iso` image from the Ubuntu website. Verify its integrity by checking [the hash](https://releases.ubuntu.com/20.04/SHA256SUMS). - Create a bootable USB using this [Etcher tutorial](https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-macos#0) - Boot your AGW host from USB - Press F11 to select boot sequence. WARNING: This might be different for your machine. @@ -45,7 +43,7 @@ satisfies the following requirements: - Install and configure your Access Gateway according to your network defaults. - Make sure to enable ssh server and utilities (untick every other). - Connect your SGi interface to the internet and select this port during the -installation process to get an IP using DHCP. +installation process to get an IP using DHCP. (Consider enabling DHCP snooping to mitigate [Rogue DHCP](https://en.wikipedia.org/wiki/Rogue_DHCP)) ### 2. Deploy magma on the AGW_HOST @@ -55,7 +53,7 @@ To install on a server with a DHCP-configured SGi interface ```bash su -wget https://raw.githubusercontent.com/magma/magma/v1.6/lte/gateway/deploy/agw_install_ubuntu.sh +wget https://raw.githubusercontent.com/magma/magma/v1.8/lte/gateway/deploy/agw_install_ubuntu.sh bash agw_install_ubuntu.sh ``` @@ -64,7 +62,7 @@ if SGi has an IP of 1.1.1.1/24 and the upstream router IP is 1.1.1.200 ```bash su -wget https://raw.githubusercontent.com/magma/magma/v1.6/lte/gateway/deploy/agw_install_ubuntu.sh +wget https://raw.githubusercontent.com/magma/magma/v1.8/lte/gateway/deploy/agw_install_ubuntu.sh bash agw_install_ubuntu.sh 1.1.1.1/24 1.1.1.200 ``` @@ -94,7 +92,7 @@ journalctl -fu agw_installation When you see "AGW installation is done.", it means that your installation is complete. You can make sure magma is running by executing ```bash -service magma@* status +service 'magma@*' status ``` #### Post-install check diff --git a/lte/cloud/go/protos/oai/s1ap_state.pb.go b/lte/cloud/go/protos/oai/s1ap_state.pb.go index d5a51f8fb78f..0116edd7dd7b 100644 --- a/lte/cloud/go/protos/oai/s1ap_state.pb.go +++ b/lte/cloud/go/protos/oai/s1ap_state.pb.go @@ -20,6 +20,115 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type S1ApEnbState int32 + +const ( + S1ApEnbState_S1AP_INIT S1ApEnbState = 0 /// The sctp association has been established but s1 hasn't been + /// setup. + S1ApEnbState_S1AP_RESETING S1ApEnbState = 1 /// The s1state is resetting due to an SCTP reset on the bound + /// association. + S1ApEnbState_S1AP_READY S1ApEnbState = 2 ///< MME and eNB are S1 associated, UE contexts can be added + S1ApEnbState_S1AP_SHUTDOWN S1ApEnbState = 3 /// The S1 state is being torn down due to sctp shutdown. +) + +// Enum value maps for S1ApEnbState. +var ( + S1ApEnbState_name = map[int32]string{ + 0: "S1AP_INIT", + 1: "S1AP_RESETING", + 2: "S1AP_READY", + 3: "S1AP_SHUTDOWN", + } + S1ApEnbState_value = map[string]int32{ + "S1AP_INIT": 0, + "S1AP_RESETING": 1, + "S1AP_READY": 2, + "S1AP_SHUTDOWN": 3, + } +) + +func (x S1ApEnbState) Enum() *S1ApEnbState { + p := new(S1ApEnbState) + *p = x + return p +} + +func (x S1ApEnbState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (S1ApEnbState) Descriptor() protoreflect.EnumDescriptor { + return file_lte_protos_oai_s1ap_state_proto_enumTypes[0].Descriptor() +} + +func (S1ApEnbState) Type() protoreflect.EnumType { + return &file_lte_protos_oai_s1ap_state_proto_enumTypes[0] +} + +func (x S1ApEnbState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use S1ApEnbState.Descriptor instead. +func (S1ApEnbState) EnumDescriptor() ([]byte, []int) { + return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{0} +} + +type S1ApUeState int32 + +const ( + S1ApUeState_S1AP_UE_INVALID_STATE S1ApUeState = 0 + S1ApUeState_S1AP_UE_WAITING_ICSR S1ApUeState = 1 ///< Waiting for Initial Context Setup Response + S1ApUeState_S1AP_UE_HANDOVER S1ApUeState = 2 ///< Handover procedure triggered + S1ApUeState_S1AP_UE_CONNECTED S1ApUeState = 3 ///< UE context ready + S1ApUeState_S1AP_UE_WAITING_CRC S1ApUeState = 4 /// UE Context release Procedure initiated , waiting for +) + +// Enum value maps for S1ApUeState. +var ( + S1ApUeState_name = map[int32]string{ + 0: "S1AP_UE_INVALID_STATE", + 1: "S1AP_UE_WAITING_ICSR", + 2: "S1AP_UE_HANDOVER", + 3: "S1AP_UE_CONNECTED", + 4: "S1AP_UE_WAITING_CRC", + } + S1ApUeState_value = map[string]int32{ + "S1AP_UE_INVALID_STATE": 0, + "S1AP_UE_WAITING_ICSR": 1, + "S1AP_UE_HANDOVER": 2, + "S1AP_UE_CONNECTED": 3, + "S1AP_UE_WAITING_CRC": 4, + } +) + +func (x S1ApUeState) Enum() *S1ApUeState { + p := new(S1ApUeState) + *p = x + return p +} + +func (x S1ApUeState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (S1ApUeState) Descriptor() protoreflect.EnumDescriptor { + return file_lte_protos_oai_s1ap_state_proto_enumTypes[1].Descriptor() +} + +func (S1ApUeState) Type() protoreflect.EnumType { + return &file_lte_protos_oai_s1ap_state_proto_enumTypes[1] +} + +func (x S1ApUeState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use S1ApUeState.Descriptor instead. +func (S1ApUeState) EnumDescriptor() ([]byte, []int) { + return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{1} +} + type S1ApTimer struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -204,12 +313,131 @@ func (x *SupportedTaList) GetSupportedTaiItems() []*SupportedTaiItems { return nil } +type ERabAdmittedItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ERabId uint32 `protobuf:"varint,1,opt,name=e_rab_id,json=eRabId,proto3" json:"e_rab_id,omitempty"` + TransportLayerAddress []byte `protobuf:"bytes,2,opt,name=transport_layer_address,json=transportLayerAddress,proto3" json:"transport_layer_address,omitempty"` + GtpTeid uint32 `protobuf:"varint,3,opt,name=gtp_teid,json=gtpTeid,proto3" json:"gtp_teid,omitempty"` +} + +func (x *ERabAdmittedItem) Reset() { + *x = ERabAdmittedItem{} + if protoimpl.UnsafeEnabled { + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ERabAdmittedItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ERabAdmittedItem) ProtoMessage() {} + +func (x *ERabAdmittedItem) ProtoReflect() protoreflect.Message { + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ERabAdmittedItem.ProtoReflect.Descriptor instead. +func (*ERabAdmittedItem) Descriptor() ([]byte, []int) { + return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{3} +} + +func (x *ERabAdmittedItem) GetERabId() uint32 { + if x != nil { + return x.ERabId + } + return 0 +} + +func (x *ERabAdmittedItem) GetTransportLayerAddress() []byte { + if x != nil { + return x.TransportLayerAddress + } + return nil +} + +func (x *ERabAdmittedItem) GetGtpTeid() uint32 { + if x != nil { + return x.GtpTeid + } + return 0 +} + +type ERabAdmittedList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NoOfItems uint32 `protobuf:"varint,1,opt,name=no_of_items,json=noOfItems,proto3" json:"no_of_items,omitempty"` + Item []*ERabAdmittedItem `protobuf:"bytes,2,rep,name=item,proto3" json:"item,omitempty"` +} + +func (x *ERabAdmittedList) Reset() { + *x = ERabAdmittedList{} + if protoimpl.UnsafeEnabled { + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ERabAdmittedList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ERabAdmittedList) ProtoMessage() {} + +func (x *ERabAdmittedList) ProtoReflect() protoreflect.Message { + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ERabAdmittedList.ProtoReflect.Descriptor instead. +func (*ERabAdmittedList) Descriptor() ([]byte, []int) { + return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{4} +} + +func (x *ERabAdmittedList) GetNoOfItems() uint32 { + if x != nil { + return x.NoOfItems + } + return 0 +} + +func (x *ERabAdmittedList) GetItem() []*ERabAdmittedItem { + if x != nil { + return x.Item + } + return nil +} + type EnbDescription struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - EnbId uint32 `protobuf:"varint,1,opt,name=enb_id,json=enbId,proto3" json:"enb_id,omitempty"` + EnbId uint32 `protobuf:"varint,1,opt,name=enb_id,json=enbId,proto3" json:"enb_id,omitempty"` + // Deprecated: Do not use. S1State int32 `protobuf:"varint,2,opt,name=s1_state,json=s1State,proto3" json:"s1_state,omitempty"` // enum mme_s1_enb_state_s EnbName []byte `protobuf:"bytes,3,opt,name=enb_name,json=enbName,proto3" json:"enb_name,omitempty"` // char[] DefaultPagingDrx uint32 `protobuf:"varint,4,opt,name=default_paging_drx,json=defaultPagingDrx,proto3" json:"default_paging_drx,omitempty"` // uint8_t @@ -224,12 +452,13 @@ type EnbDescription struct { RanCpIpaddr []byte `protobuf:"bytes,12,opt,name=ran_cp_ipaddr,json=ranCpIpaddr,proto3" json:"ran_cp_ipaddr,omitempty"` // eNB sctp end point IP addr RanCpIpaddrSz uint32 `protobuf:"varint,13,opt,name=ran_cp_ipaddr_sz,json=ranCpIpaddrSz,proto3" json:"ran_cp_ipaddr_sz,omitempty"` // eNB sctp end point IP addr size UeIdMap map[uint32]uint64 `protobuf:"bytes,14,rep,name=ue_id_map,json=ueIdMap,proto3" json:"ue_id_map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // mme_ue_s1ap_id -> comp_s1ap_id + S1EnbState S1ApEnbState `protobuf:"varint,15,opt,name=s1_enb_state,json=s1EnbState,proto3,enum=magma.lte.oai.S1ApEnbState" json:"s1_enb_state,omitempty"` } func (x *EnbDescription) Reset() { *x = EnbDescription{} if protoimpl.UnsafeEnabled { - mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[3] + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -242,7 +471,7 @@ func (x *EnbDescription) String() string { func (*EnbDescription) ProtoMessage() {} func (x *EnbDescription) ProtoReflect() protoreflect.Message { - mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[3] + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -255,7 +484,7 @@ func (x *EnbDescription) ProtoReflect() protoreflect.Message { // Deprecated: Use EnbDescription.ProtoReflect.Descriptor instead. func (*EnbDescription) Descriptor() ([]byte, []int) { - return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{3} + return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{5} } func (x *EnbDescription) GetEnbId() uint32 { @@ -265,6 +494,7 @@ func (x *EnbDescription) GetEnbId() uint32 { return 0 } +// Deprecated: Do not use. func (x *EnbDescription) GetS1State() int32 { if x != nil { return x.S1State @@ -357,11 +587,19 @@ func (x *EnbDescription) GetUeIdMap() map[uint32]uint64 { return nil } +func (x *EnbDescription) GetS1EnbState() S1ApEnbState { + if x != nil { + return x.S1EnbState + } + return S1ApEnbState_S1AP_INIT +} + type UeDescription struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // Deprecated: Do not use. S1UeState int32 `protobuf:"varint,2,opt,name=s1_ue_state,json=s1UeState,proto3" json:"s1_ue_state,omitempty"` // enum s1_ue_state_s EnbUeS1ApId uint32 `protobuf:"varint,3,opt,name=enb_ue_s1ap_id,json=enbUeS1apId,proto3" json:"enb_ue_s1ap_id,omitempty"` // enb_ue_s1ap_id_t MmeUeS1ApId uint32 `protobuf:"varint,4,opt,name=mme_ue_s1ap_id,json=mmeUeS1apId,proto3" json:"mme_ue_s1ap_id,omitempty"` // mme_ue_s1ap_id_t @@ -370,12 +608,14 @@ type UeDescription struct { S1ApUeContextRelTimer *S1ApTimer `protobuf:"bytes,7,opt,name=s1ap_ue_context_rel_timer,json=s1apUeContextRelTimer,proto3" json:"s1ap_ue_context_rel_timer,omitempty"` // struct s1ap_timer_t SctpAssocId uint32 `protobuf:"varint,8,opt,name=sctp_assoc_id,json=sctpAssocId,proto3" json:"sctp_assoc_id,omitempty"` // sctp_assoc_id_t S1ApHandoverState *S1ApHandoverState `protobuf:"bytes,9,opt,name=s1ap_handover_state,json=s1apHandoverState,proto3" json:"s1ap_handover_state,omitempty"` // s1ap_handover_state_t + CompS1ApId uint64 `protobuf:"varint,10,opt,name=comp_s1ap_id,json=compS1apId,proto3" json:"comp_s1ap_id,omitempty"` // sctp_assoc_id & enb_ue_s1ap_id + S1ApUeState S1ApUeState `protobuf:"varint,11,opt,name=s1ap_ue_state,json=s1apUeState,proto3,enum=magma.lte.oai.S1ApUeState" json:"s1ap_ue_state,omitempty"` } func (x *UeDescription) Reset() { *x = UeDescription{} if protoimpl.UnsafeEnabled { - mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[4] + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -388,7 +628,7 @@ func (x *UeDescription) String() string { func (*UeDescription) ProtoMessage() {} func (x *UeDescription) ProtoReflect() protoreflect.Message { - mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[4] + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -401,9 +641,10 @@ func (x *UeDescription) ProtoReflect() protoreflect.Message { // Deprecated: Use UeDescription.ProtoReflect.Descriptor instead. func (*UeDescription) Descriptor() ([]byte, []int) { - return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{4} + return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{6} } +// Deprecated: Do not use. func (x *UeDescription) GetS1UeState() int32 { if x != nil { return x.S1UeState @@ -460,6 +701,20 @@ func (x *UeDescription) GetS1ApHandoverState() *S1ApHandoverState { return nil } +func (x *UeDescription) GetCompS1ApId() uint64 { + if x != nil { + return x.CompS1ApId + } + return 0 +} + +func (x *UeDescription) GetS1ApUeState() S1ApUeState { + if x != nil { + return x.S1ApUeState + } + return S1ApUeState_S1AP_UE_INVALID_STATE +} + type S1ApState struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -473,7 +728,7 @@ type S1ApState struct { func (x *S1ApState) Reset() { *x = S1ApState{} if protoimpl.UnsafeEnabled { - mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[5] + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -486,7 +741,7 @@ func (x *S1ApState) String() string { func (*S1ApState) ProtoMessage() {} func (x *S1ApState) ProtoReflect() protoreflect.Message { - mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[5] + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -499,7 +754,7 @@ func (x *S1ApState) ProtoReflect() protoreflect.Message { // Deprecated: Use S1ApState.ProtoReflect.Descriptor instead. func (*S1ApState) Descriptor() ([]byte, []int) { - return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{5} + return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{7} } func (x *S1ApState) GetEnbs() map[uint32]*EnbDescription { @@ -536,7 +791,7 @@ type S1ApImsiMap struct { func (x *S1ApImsiMap) Reset() { *x = S1ApImsiMap{} if protoimpl.UnsafeEnabled { - mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[6] + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -549,7 +804,7 @@ func (x *S1ApImsiMap) String() string { func (*S1ApImsiMap) ProtoMessage() {} func (x *S1ApImsiMap) ProtoReflect() protoreflect.Message { - mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[6] + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -562,7 +817,7 @@ func (x *S1ApImsiMap) ProtoReflect() protoreflect.Message { // Deprecated: Use S1ApImsiMap.ProtoReflect.Descriptor instead. func (*S1ApImsiMap) Descriptor() ([]byte, []int) { - return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{6} + return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{8} } // Deprecated: Do not use. @@ -585,18 +840,22 @@ type S1ApHandoverState struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MmeUeS1ApId uint32 `protobuf:"varint,1,opt,name=mme_ue_s1ap_id,json=mmeUeS1apId,proto3" json:"mme_ue_s1ap_id,omitempty"` - SourceEnbId uint32 `protobuf:"varint,2,opt,name=source_enb_id,json=sourceEnbId,proto3" json:"source_enb_id,omitempty"` - TargetEnbId uint32 `protobuf:"varint,3,opt,name=target_enb_id,json=targetEnbId,proto3" json:"target_enb_id,omitempty"` - TargetEnbUeS1ApId uint32 `protobuf:"varint,4,opt,name=target_enb_ue_s1ap_id,json=targetEnbUeS1apId,proto3" json:"target_enb_ue_s1ap_id,omitempty"` // enb_ue_s1ap_id_t - TargetSctpStreamRecv uint32 `protobuf:"varint,5,opt,name=target_sctp_stream_recv,json=targetSctpStreamRecv,proto3" json:"target_sctp_stream_recv,omitempty"` // sctp_stream_id_t - TargetSctpStreamSend uint32 `protobuf:"varint,6,opt,name=target_sctp_stream_send,json=targetSctpStreamSend,proto3" json:"target_sctp_stream_send,omitempty"` // sctp_stream_id_t + MmeUeS1ApId uint32 `protobuf:"varint,1,opt,name=mme_ue_s1ap_id,json=mmeUeS1apId,proto3" json:"mme_ue_s1ap_id,omitempty"` + SourceEnbId uint32 `protobuf:"varint,2,opt,name=source_enb_id,json=sourceEnbId,proto3" json:"source_enb_id,omitempty"` + TargetEnbId uint32 `protobuf:"varint,3,opt,name=target_enb_id,json=targetEnbId,proto3" json:"target_enb_id,omitempty"` + TargetEnbUeS1ApId uint32 `protobuf:"varint,4,opt,name=target_enb_ue_s1ap_id,json=targetEnbUeS1apId,proto3" json:"target_enb_ue_s1ap_id,omitempty"` // enb_ue_s1ap_id_t + TargetSctpStreamRecv uint32 `protobuf:"varint,5,opt,name=target_sctp_stream_recv,json=targetSctpStreamRecv,proto3" json:"target_sctp_stream_recv,omitempty"` // sctp_stream_id_t + TargetSctpStreamSend uint32 `protobuf:"varint,6,opt,name=target_sctp_stream_send,json=targetSctpStreamSend,proto3" json:"target_sctp_stream_send,omitempty"` // sctp_stream_id_t + SourceEnbUeS1ApId uint32 `protobuf:"varint,7,opt,name=source_enb_ue_s1ap_id,json=sourceEnbUeS1apId,proto3" json:"source_enb_ue_s1ap_id,omitempty"` + SourceSctpStreamRecv uint32 `protobuf:"varint,8,opt,name=source_sctp_stream_recv,json=sourceSctpStreamRecv,proto3" json:"source_sctp_stream_recv,omitempty"` + SourceSctpStreamSend uint32 `protobuf:"varint,9,opt,name=source_sctp_stream_send,json=sourceSctpStreamSend,proto3" json:"source_sctp_stream_send,omitempty"` + ERabAdmittedList *ERabAdmittedList `protobuf:"bytes,10,opt,name=e_rab_admitted_list,json=eRabAdmittedList,proto3" json:"e_rab_admitted_list,omitempty"` } func (x *S1ApHandoverState) Reset() { *x = S1ApHandoverState{} if protoimpl.UnsafeEnabled { - mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[7] + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -609,7 +868,7 @@ func (x *S1ApHandoverState) String() string { func (*S1ApHandoverState) ProtoMessage() {} func (x *S1ApHandoverState) ProtoReflect() protoreflect.Message { - mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[7] + mi := &file_lte_protos_oai_s1ap_state_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -622,7 +881,7 @@ func (x *S1ApHandoverState) ProtoReflect() protoreflect.Message { // Deprecated: Use S1ApHandoverState.ProtoReflect.Descriptor instead. func (*S1ApHandoverState) Descriptor() ([]byte, []int) { - return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{7} + return file_lte_protos_oai_s1ap_state_proto_rawDescGZIP(), []int{9} } func (x *S1ApHandoverState) GetMmeUeS1ApId() uint32 { @@ -667,6 +926,34 @@ func (x *S1ApHandoverState) GetTargetSctpStreamSend() uint32 { return 0 } +func (x *S1ApHandoverState) GetSourceEnbUeS1ApId() uint32 { + if x != nil { + return x.SourceEnbUeS1ApId + } + return 0 +} + +func (x *S1ApHandoverState) GetSourceSctpStreamRecv() uint32 { + if x != nil { + return x.SourceSctpStreamRecv + } + return 0 +} + +func (x *S1ApHandoverState) GetSourceSctpStreamSend() uint32 { + if x != nil { + return x.SourceSctpStreamSend + } + return 0 +} + +func (x *S1ApHandoverState) GetERabAdmittedList() *ERabAdmittedList { + if x != nil { + return x.ERabAdmittedList + } + return nil +} + var File_lte_protos_oai_s1ap_state_proto protoreflect.FileDescriptor var file_lte_protos_oai_s1ap_state_proto_rawDesc = []byte{ @@ -692,142 +979,196 @@ var file_lte_protos_oai_s1ap_state_proto_rawDesc = []byte{ 0x20, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x54, 0x61, 0x69, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x11, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x54, 0x61, 0x69, 0x49, - 0x74, 0x65, 0x6d, 0x73, 0x22, 0xdd, 0x05, 0x0a, 0x0e, 0x45, 0x6e, 0x62, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x62, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x65, 0x6e, 0x62, 0x49, 0x64, 0x12, 0x19, - 0x0a, 0x08, 0x73, 0x31, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x07, 0x73, 0x31, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x62, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x65, 0x6e, 0x62, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, - 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x72, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x44, - 0x72, 0x78, 0x12, 0x28, 0x0a, 0x10, 0x6e, 0x62, 0x5f, 0x75, 0x65, 0x5f, 0x61, 0x73, 0x73, 0x6f, - 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x6e, 0x62, - 0x55, 0x65, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0d, - 0x73, 0x63, 0x74, 0x70, 0x5f, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x73, 0x63, 0x74, 0x70, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x49, 0x64, - 0x12, 0x28, 0x0a, 0x10, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x63, 0x74, 0x70, 0x5f, 0x73, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x6e, 0x65, 0x78, 0x74, - 0x53, 0x63, 0x74, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, - 0x6e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x75, 0x74, 0x73, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6f, 0x75, - 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x75, 0x65, 0x5f, 0x69, - 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, - 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x45, 0x6e, 0x62, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x65, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x42, 0x02, 0x18, 0x01, 0x52, 0x05, 0x75, 0x65, 0x49, 0x64, 0x73, 0x12, 0x4a, 0x0a, - 0x11, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x61, 0x5f, 0x6c, 0x69, - 0x73, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, - 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x64, 0x54, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x0f, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x64, 0x54, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x72, 0x61, 0x6e, - 0x5f, 0x63, 0x70, 0x5f, 0x69, 0x70, 0x61, 0x64, 0x64, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x0b, 0x72, 0x61, 0x6e, 0x43, 0x70, 0x49, 0x70, 0x61, 0x64, 0x64, 0x72, 0x12, 0x27, 0x0a, - 0x10, 0x72, 0x61, 0x6e, 0x5f, 0x63, 0x70, 0x5f, 0x69, 0x70, 0x61, 0x64, 0x64, 0x72, 0x5f, 0x73, - 0x7a, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x72, 0x61, 0x6e, 0x43, 0x70, 0x49, 0x70, - 0x61, 0x64, 0x64, 0x72, 0x53, 0x7a, 0x12, 0x46, 0x0a, 0x09, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x5f, - 0x6d, 0x61, 0x70, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6d, 0x61, 0x67, 0x6d, - 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x45, 0x6e, 0x62, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x65, 0x49, 0x64, 0x4d, 0x61, 0x70, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x75, 0x65, 0x49, 0x64, 0x4d, 0x61, 0x70, 0x1a, 0x38, - 0x0a, 0x0a, 0x55, 0x65, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3a, 0x0a, 0x0c, 0x55, 0x65, 0x49, 0x64, - 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0x97, 0x03, 0x0a, 0x0d, 0x55, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0b, 0x73, 0x31, 0x5f, 0x75, 0x65, 0x5f, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x31, 0x55, - 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x23, 0x0a, 0x0e, 0x65, 0x6e, 0x62, 0x5f, 0x75, 0x65, - 0x5f, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, - 0x65, 0x6e, 0x62, 0x55, 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0e, 0x6d, - 0x6d, 0x65, 0x5f, 0x75, 0x65, 0x5f, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x6d, 0x6d, 0x65, 0x55, 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, 0x64, - 0x12, 0x28, 0x0a, 0x10, 0x73, 0x63, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, - 0x72, 0x65, 0x63, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x73, 0x63, 0x74, 0x70, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x63, 0x76, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x63, - 0x74, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x73, 0x63, 0x74, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x53, 0x65, 0x6e, 0x64, 0x12, 0x52, 0x0a, 0x19, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x75, 0x65, 0x5f, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, - 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x31, 0x61, 0x70, 0x54, 0x69, 0x6d, 0x65, - 0x72, 0x52, 0x15, 0x73, 0x31, 0x61, 0x70, 0x55, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x52, 0x65, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0d, 0x73, 0x63, 0x74, 0x70, - 0x5f, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x0b, 0x73, 0x63, 0x74, 0x70, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x50, 0x0a, 0x13, - 0x73, 0x31, 0x61, 0x70, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6f, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6d, 0x61, 0x67, 0x6d, - 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x31, 0x61, 0x70, 0x48, 0x61, - 0x6e, 0x64, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x11, 0x73, 0x31, 0x61, - 0x70, 0x48, 0x61, 0x6e, 0x64, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0xcb, - 0x02, 0x0a, 0x09, 0x53, 0x31, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x36, 0x0a, 0x04, - 0x65, 0x6e, 0x62, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6d, 0x61, 0x67, - 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x31, 0x61, 0x70, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x2e, 0x45, 0x6e, 0x62, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, - 0x65, 0x6e, 0x62, 0x73, 0x12, 0x51, 0x0a, 0x0d, 0x6d, 0x6d, 0x65, 0x69, 0x64, 0x32, 0x61, 0x73, - 0x73, 0x6f, 0x63, 0x69, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6d, 0x61, - 0x67, 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x31, 0x61, 0x70, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x6d, 0x65, 0x69, 0x64, 0x32, 0x61, 0x73, 0x73, 0x6f, - 0x63, 0x69, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d, 0x6d, 0x6d, 0x65, 0x69, 0x64, 0x32, - 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x75, 0x6d, 0x5f, 0x65, - 0x6e, 0x62, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6e, 0x75, 0x6d, 0x45, 0x6e, - 0x62, 0x73, 0x1a, 0x56, 0x0a, 0x09, 0x45, 0x6e, 0x62, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1d, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, - 0x2e, 0x45, 0x6e, 0x62, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x40, 0x0a, 0x12, 0x4d, 0x6d, - 0x65, 0x69, 0x64, 0x32, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xe0, 0x02, 0x0a, - 0x0b, 0x53, 0x31, 0x61, 0x70, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x12, 0x5e, 0x0a, 0x12, - 0x6d, 0x6d, 0x65, 0x5f, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x5f, 0x69, 0x6d, 0x73, 0x69, 0x5f, 0x6d, - 0x61, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, - 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x31, 0x61, 0x70, 0x49, 0x6d, 0x73, - 0x69, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x6d, 0x65, 0x55, 0x65, 0x49, 0x64, 0x49, 0x6d, 0x73, 0x69, - 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0e, 0x6d, 0x6d, - 0x65, 0x55, 0x65, 0x49, 0x64, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x12, 0x67, 0x0a, 0x17, - 0x6d, 0x6d, 0x65, 0x5f, 0x75, 0x65, 0x5f, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, 0x64, 0x5f, 0x69, - 0x6d, 0x73, 0x69, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, + 0x74, 0x65, 0x6d, 0x73, 0x22, 0x7f, 0x0a, 0x10, 0x45, 0x52, 0x61, 0x62, 0x41, 0x64, 0x6d, 0x69, + 0x74, 0x74, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x18, 0x0a, 0x08, 0x65, 0x5f, 0x72, 0x61, + 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x65, 0x52, 0x61, 0x62, + 0x49, 0x64, 0x12, 0x36, 0x0a, 0x17, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x15, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x74, + 0x70, 0x5f, 0x74, 0x65, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x67, 0x74, + 0x70, 0x54, 0x65, 0x69, 0x64, 0x22, 0x67, 0x0a, 0x10, 0x45, 0x52, 0x61, 0x62, 0x41, 0x64, 0x6d, + 0x69, 0x74, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0b, 0x6e, 0x6f, 0x5f, + 0x6f, 0x66, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, + 0x6e, 0x6f, 0x4f, 0x66, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x33, 0x0a, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, + 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x45, 0x52, 0x61, 0x62, 0x41, 0x64, 0x6d, 0x69, + 0x74, 0x74, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xa0, + 0x06, 0x0a, 0x0e, 0x45, 0x6e, 0x62, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x65, 0x6e, 0x62, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x08, 0x73, 0x31, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x02, 0x18, 0x01, 0x52, 0x07, + 0x73, 0x31, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x62, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x65, 0x6e, 0x62, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x61, + 0x67, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x72, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x44, 0x72, 0x78, + 0x12, 0x28, 0x0a, 0x10, 0x6e, 0x62, 0x5f, 0x75, 0x65, 0x5f, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, + 0x61, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x6e, 0x62, 0x55, 0x65, + 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x73, 0x63, + 0x74, 0x70, 0x5f, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0b, 0x73, 0x63, 0x74, 0x70, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x28, + 0x0a, 0x10, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x63, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x63, + 0x74, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x6e, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x75, 0x74, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x73, + 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, 0x6c, + 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x45, 0x6e, 0x62, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x65, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x42, 0x02, 0x18, 0x01, 0x52, 0x05, 0x75, 0x65, 0x49, 0x64, 0x73, 0x12, 0x4a, 0x0a, 0x11, 0x73, + 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x61, 0x5f, 0x6c, 0x69, 0x73, 0x74, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, 0x6c, + 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, + 0x54, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x0f, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x64, 0x54, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x72, 0x61, 0x6e, 0x5f, 0x63, + 0x70, 0x5f, 0x69, 0x70, 0x61, 0x64, 0x64, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, + 0x72, 0x61, 0x6e, 0x43, 0x70, 0x49, 0x70, 0x61, 0x64, 0x64, 0x72, 0x12, 0x27, 0x0a, 0x10, 0x72, + 0x61, 0x6e, 0x5f, 0x63, 0x70, 0x5f, 0x69, 0x70, 0x61, 0x64, 0x64, 0x72, 0x5f, 0x73, 0x7a, 0x18, + 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x72, 0x61, 0x6e, 0x43, 0x70, 0x49, 0x70, 0x61, 0x64, + 0x64, 0x72, 0x53, 0x7a, 0x12, 0x46, 0x0a, 0x09, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x5f, 0x6d, 0x61, + 0x70, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, + 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x45, 0x6e, 0x62, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x65, 0x49, 0x64, 0x4d, 0x61, 0x70, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x07, 0x75, 0x65, 0x49, 0x64, 0x4d, 0x61, 0x70, 0x12, 0x3d, 0x0a, 0x0c, + 0x73, 0x31, 0x5f, 0x65, 0x6e, 0x62, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0f, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, + 0x61, 0x69, 0x2e, 0x53, 0x31, 0x61, 0x70, 0x45, 0x6e, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, + 0x0a, 0x73, 0x31, 0x45, 0x6e, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x38, 0x0a, 0x0a, 0x55, + 0x65, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3a, 0x0a, 0x0c, 0x55, 0x65, 0x49, 0x64, 0x4d, 0x61, 0x70, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x22, 0xfd, 0x03, 0x0a, 0x0d, 0x55, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0b, 0x73, 0x31, 0x5f, 0x75, 0x65, 0x5f, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x02, 0x18, 0x01, 0x52, 0x09, 0x73, 0x31, + 0x55, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x23, 0x0a, 0x0e, 0x65, 0x6e, 0x62, 0x5f, 0x75, + 0x65, 0x5f, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x0b, 0x65, 0x6e, 0x62, 0x55, 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0e, + 0x6d, 0x6d, 0x65, 0x5f, 0x75, 0x65, 0x5f, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x6d, 0x6d, 0x65, 0x55, 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, + 0x64, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x63, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x5f, 0x72, 0x65, 0x63, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x73, 0x63, 0x74, + 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x63, 0x76, 0x12, 0x28, 0x0a, 0x10, 0x73, + 0x63, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x73, 0x63, 0x74, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x52, 0x0a, 0x19, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x75, 0x65, + 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, + 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x31, 0x61, 0x70, 0x54, 0x69, 0x6d, + 0x65, 0x72, 0x52, 0x15, 0x73, 0x31, 0x61, 0x70, 0x55, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, + 0x74, 0x52, 0x65, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0d, 0x73, 0x63, 0x74, + 0x70, 0x5f, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x0b, 0x73, 0x63, 0x74, 0x70, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x49, 0x64, 0x12, 0x50, 0x0a, + 0x13, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6f, 0x76, 0x65, 0x72, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6d, 0x61, 0x67, + 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x31, 0x61, 0x70, 0x48, + 0x61, 0x6e, 0x64, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x11, 0x73, 0x31, + 0x61, 0x70, 0x48, 0x61, 0x6e, 0x64, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x20, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x5f, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, 0x64, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x53, 0x31, 0x61, 0x70, 0x49, + 0x64, 0x12, 0x3e, 0x0a, 0x0d, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x75, 0x65, 0x5f, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, + 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x31, 0x61, 0x70, 0x55, 0x65, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x31, 0x61, 0x70, 0x55, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x22, 0xcb, 0x02, 0x0a, 0x09, 0x53, 0x31, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x36, 0x0a, 0x04, 0x65, 0x6e, 0x62, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x31, - 0x61, 0x70, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x6d, 0x65, 0x55, 0x65, 0x53, - 0x31, 0x61, 0x70, 0x49, 0x64, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x12, 0x6d, 0x6d, 0x65, 0x55, 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, 0x64, 0x49, 0x6d, - 0x73, 0x69, 0x4d, 0x61, 0x70, 0x1a, 0x41, 0x0a, 0x13, 0x4d, 0x6d, 0x65, 0x55, 0x65, 0x49, 0x64, - 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x45, 0x0a, 0x17, 0x4d, 0x6d, 0x65, 0x55, - 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, 0x64, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x45, 0x6e, + 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x45, 0x6e, 0x62, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x04, 0x65, 0x6e, 0x62, 0x73, 0x12, 0x51, 0x0a, 0x0d, 0x6d, 0x6d, 0x65, 0x69, 0x64, + 0x32, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, + 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, + 0x31, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x6d, 0x65, 0x69, 0x64, 0x32, 0x61, + 0x73, 0x73, 0x6f, 0x63, 0x69, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d, 0x6d, 0x6d, 0x65, + 0x69, 0x64, 0x32, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x75, + 0x6d, 0x5f, 0x65, 0x6e, 0x62, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6e, 0x75, + 0x6d, 0x45, 0x6e, 0x62, 0x73, 0x1a, 0x56, 0x0a, 0x09, 0x45, 0x6e, 0x62, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, + 0x6f, 0x61, 0x69, 0x2e, 0x45, 0x6e, 0x62, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x40, 0x0a, + 0x12, 0x4d, 0x6d, 0x65, 0x69, 0x64, 0x32, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, - 0xa0, 0x02, 0x0a, 0x11, 0x53, 0x31, 0x61, 0x70, 0x48, 0x61, 0x6e, 0x64, 0x6f, 0x76, 0x65, 0x72, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x23, 0x0a, 0x0e, 0x6d, 0x6d, 0x65, 0x5f, 0x75, 0x65, 0x5f, - 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x6d, - 0x6d, 0x65, 0x55, 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, 0x6e, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x6e, 0x62, 0x49, 0x64, 0x12, 0x22, - 0x0a, 0x0d, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x65, 0x6e, 0x62, 0x5f, 0x69, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x45, 0x6e, 0x62, - 0x49, 0x64, 0x12, 0x30, 0x0a, 0x15, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x65, 0x6e, 0x62, - 0x5f, 0x75, 0x65, 0x5f, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x11, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x45, 0x6e, 0x62, 0x55, 0x65, 0x53, 0x31, - 0x61, 0x70, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x17, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x73, - 0x63, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x72, 0x65, 0x63, 0x76, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x53, 0x63, 0x74, - 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x63, 0x76, 0x12, 0x35, 0x0a, 0x17, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x73, 0x63, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x74, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x53, 0x63, 0x74, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x65, - 0x6e, 0x64, 0x42, 0x1f, 0x5a, 0x1d, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2f, 0x6c, 0x74, 0x65, 0x2f, - 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, - 0x6f, 0x61, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0xe0, 0x02, 0x0a, 0x0b, 0x53, 0x31, 0x61, 0x70, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x12, + 0x5e, 0x0a, 0x12, 0x6d, 0x6d, 0x65, 0x5f, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x5f, 0x69, 0x6d, 0x73, + 0x69, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6d, 0x61, + 0x67, 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, 0x2e, 0x53, 0x31, 0x61, 0x70, + 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x6d, 0x65, 0x55, 0x65, 0x49, 0x64, 0x49, + 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x02, 0x18, 0x01, 0x52, + 0x0e, 0x6d, 0x6d, 0x65, 0x55, 0x65, 0x49, 0x64, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x12, + 0x67, 0x0a, 0x17, 0x6d, 0x6d, 0x65, 0x5f, 0x75, 0x65, 0x5f, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, + 0x64, 0x5f, 0x69, 0x6d, 0x73, 0x69, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x32, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, 0x61, 0x69, + 0x2e, 0x53, 0x31, 0x61, 0x70, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x6d, 0x65, + 0x55, 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, 0x64, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x12, 0x6d, 0x6d, 0x65, 0x55, 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, + 0x64, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x1a, 0x41, 0x0a, 0x13, 0x4d, 0x6d, 0x65, 0x55, + 0x65, 0x49, 0x64, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x45, 0x0a, 0x17, 0x4d, + 0x6d, 0x65, 0x55, 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, 0x64, 0x49, 0x6d, 0x73, 0x69, 0x4d, 0x61, + 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x22, 0x90, 0x04, 0x0a, 0x11, 0x53, 0x31, 0x61, 0x70, 0x48, 0x61, 0x6e, 0x64, 0x6f, + 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x23, 0x0a, 0x0e, 0x6d, 0x6d, 0x65, 0x5f, + 0x75, 0x65, 0x5f, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x0b, 0x6d, 0x6d, 0x65, 0x55, 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, 0x64, 0x12, 0x22, 0x0a, + 0x0d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, 0x6e, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x6e, 0x62, 0x49, + 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x65, 0x6e, 0x62, 0x5f, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x45, 0x6e, 0x62, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x15, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, + 0x65, 0x6e, 0x62, 0x5f, 0x75, 0x65, 0x5f, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x45, 0x6e, 0x62, 0x55, + 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x17, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x5f, 0x73, 0x63, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x72, 0x65, + 0x63, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x53, 0x63, 0x74, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x63, 0x76, 0x12, 0x35, + 0x0a, 0x17, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x73, 0x63, 0x74, 0x70, 0x5f, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x14, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x53, 0x63, 0x74, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x30, 0x0a, 0x15, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, + 0x65, 0x6e, 0x62, 0x5f, 0x75, 0x65, 0x5f, 0x73, 0x31, 0x61, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x6e, 0x62, 0x55, + 0x65, 0x53, 0x31, 0x61, 0x70, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x17, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x5f, 0x73, 0x63, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x72, 0x65, + 0x63, 0x76, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x53, 0x63, 0x74, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x63, 0x76, 0x12, 0x35, + 0x0a, 0x17, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x74, 0x70, 0x5f, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x14, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x63, 0x74, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x4e, 0x0a, 0x13, 0x65, 0x5f, 0x72, 0x61, 0x62, 0x5f, 0x61, + 0x64, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2e, 0x6c, 0x74, 0x65, 0x2e, 0x6f, + 0x61, 0x69, 0x2e, 0x45, 0x52, 0x61, 0x62, 0x41, 0x64, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x10, 0x65, 0x52, 0x61, 0x62, 0x41, 0x64, 0x6d, 0x69, 0x74, 0x74, 0x65, + 0x64, 0x4c, 0x69, 0x73, 0x74, 0x2a, 0x53, 0x0a, 0x0c, 0x53, 0x31, 0x61, 0x70, 0x45, 0x6e, 0x62, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x31, 0x41, 0x50, 0x5f, 0x49, 0x4e, + 0x49, 0x54, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x31, 0x41, 0x50, 0x5f, 0x52, 0x45, 0x53, + 0x45, 0x54, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x31, 0x41, 0x50, 0x5f, + 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x31, 0x41, 0x50, 0x5f, + 0x53, 0x48, 0x55, 0x54, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x2a, 0x88, 0x01, 0x0a, 0x0b, 0x53, + 0x31, 0x61, 0x70, 0x55, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x31, + 0x41, 0x50, 0x5f, 0x55, 0x45, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x53, 0x54, + 0x41, 0x54, 0x45, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x31, 0x41, 0x50, 0x5f, 0x55, 0x45, + 0x5f, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x49, 0x43, 0x53, 0x52, 0x10, 0x01, 0x12, + 0x14, 0x0a, 0x10, 0x53, 0x31, 0x41, 0x50, 0x5f, 0x55, 0x45, 0x5f, 0x48, 0x41, 0x4e, 0x44, 0x4f, + 0x56, 0x45, 0x52, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x31, 0x41, 0x50, 0x5f, 0x55, 0x45, + 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x17, 0x0a, 0x13, + 0x53, 0x31, 0x41, 0x50, 0x5f, 0x55, 0x45, 0x5f, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, + 0x43, 0x52, 0x43, 0x10, 0x04, 0x42, 0x1f, 0x5a, 0x1d, 0x6d, 0x61, 0x67, 0x6d, 0x61, 0x2f, 0x6c, + 0x74, 0x65, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2f, 0x6f, 0x61, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -842,40 +1183,49 @@ func file_lte_protos_oai_s1ap_state_proto_rawDescGZIP() []byte { return file_lte_protos_oai_s1ap_state_proto_rawDescData } -var file_lte_protos_oai_s1ap_state_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_lte_protos_oai_s1ap_state_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_lte_protos_oai_s1ap_state_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_lte_protos_oai_s1ap_state_proto_goTypes = []interface{}{ - (*S1ApTimer)(nil), // 0: magma.lte.oai.S1apTimer - (*SupportedTaiItems)(nil), // 1: magma.lte.oai.SupportedTaiItems - (*SupportedTaList)(nil), // 2: magma.lte.oai.SupportedTaList - (*EnbDescription)(nil), // 3: magma.lte.oai.EnbDescription - (*UeDescription)(nil), // 4: magma.lte.oai.UeDescription - (*S1ApState)(nil), // 5: magma.lte.oai.S1apState - (*S1ApImsiMap)(nil), // 6: magma.lte.oai.S1apImsiMap - (*S1ApHandoverState)(nil), // 7: magma.lte.oai.S1apHandoverState - nil, // 8: magma.lte.oai.EnbDescription.UeIdsEntry - nil, // 9: magma.lte.oai.EnbDescription.UeIdMapEntry - nil, // 10: magma.lte.oai.S1apState.EnbsEntry - nil, // 11: magma.lte.oai.S1apState.Mmeid2associdEntry - nil, // 12: magma.lte.oai.S1apImsiMap.MmeUeIdImsiMapEntry - nil, // 13: magma.lte.oai.S1apImsiMap.MmeUeS1apIdImsiMapEntry + (S1ApEnbState)(0), // 0: magma.lte.oai.S1apEnbState + (S1ApUeState)(0), // 1: magma.lte.oai.S1apUeState + (*S1ApTimer)(nil), // 2: magma.lte.oai.S1apTimer + (*SupportedTaiItems)(nil), // 3: magma.lte.oai.SupportedTaiItems + (*SupportedTaList)(nil), // 4: magma.lte.oai.SupportedTaList + (*ERabAdmittedItem)(nil), // 5: magma.lte.oai.ERabAdmittedItem + (*ERabAdmittedList)(nil), // 6: magma.lte.oai.ERabAdmittedList + (*EnbDescription)(nil), // 7: magma.lte.oai.EnbDescription + (*UeDescription)(nil), // 8: magma.lte.oai.UeDescription + (*S1ApState)(nil), // 9: magma.lte.oai.S1apState + (*S1ApImsiMap)(nil), // 10: magma.lte.oai.S1apImsiMap + (*S1ApHandoverState)(nil), // 11: magma.lte.oai.S1apHandoverState + nil, // 12: magma.lte.oai.EnbDescription.UeIdsEntry + nil, // 13: magma.lte.oai.EnbDescription.UeIdMapEntry + nil, // 14: magma.lte.oai.S1apState.EnbsEntry + nil, // 15: magma.lte.oai.S1apState.Mmeid2associdEntry + nil, // 16: magma.lte.oai.S1apImsiMap.MmeUeIdImsiMapEntry + nil, // 17: magma.lte.oai.S1apImsiMap.MmeUeS1apIdImsiMapEntry } var file_lte_protos_oai_s1ap_state_proto_depIdxs = []int32{ - 1, // 0: magma.lte.oai.SupportedTaList.supported_tai_items:type_name -> magma.lte.oai.SupportedTaiItems - 8, // 1: magma.lte.oai.EnbDescription.ue_ids:type_name -> magma.lte.oai.EnbDescription.UeIdsEntry - 2, // 2: magma.lte.oai.EnbDescription.supported_ta_list:type_name -> magma.lte.oai.SupportedTaList - 9, // 3: magma.lte.oai.EnbDescription.ue_id_map:type_name -> magma.lte.oai.EnbDescription.UeIdMapEntry - 0, // 4: magma.lte.oai.UeDescription.s1ap_ue_context_rel_timer:type_name -> magma.lte.oai.S1apTimer - 7, // 5: magma.lte.oai.UeDescription.s1ap_handover_state:type_name -> magma.lte.oai.S1apHandoverState - 10, // 6: magma.lte.oai.S1apState.enbs:type_name -> magma.lte.oai.S1apState.EnbsEntry - 11, // 7: magma.lte.oai.S1apState.mmeid2associd:type_name -> magma.lte.oai.S1apState.Mmeid2associdEntry - 12, // 8: magma.lte.oai.S1apImsiMap.mme_ue_id_imsi_map:type_name -> magma.lte.oai.S1apImsiMap.MmeUeIdImsiMapEntry - 13, // 9: magma.lte.oai.S1apImsiMap.mme_ue_s1ap_id_imsi_map:type_name -> magma.lte.oai.S1apImsiMap.MmeUeS1apIdImsiMapEntry - 3, // 10: magma.lte.oai.S1apState.EnbsEntry.value:type_name -> magma.lte.oai.EnbDescription - 11, // [11:11] is the sub-list for method output_type - 11, // [11:11] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 3, // 0: magma.lte.oai.SupportedTaList.supported_tai_items:type_name -> magma.lte.oai.SupportedTaiItems + 5, // 1: magma.lte.oai.ERabAdmittedList.item:type_name -> magma.lte.oai.ERabAdmittedItem + 12, // 2: magma.lte.oai.EnbDescription.ue_ids:type_name -> magma.lte.oai.EnbDescription.UeIdsEntry + 4, // 3: magma.lte.oai.EnbDescription.supported_ta_list:type_name -> magma.lte.oai.SupportedTaList + 13, // 4: magma.lte.oai.EnbDescription.ue_id_map:type_name -> magma.lte.oai.EnbDescription.UeIdMapEntry + 0, // 5: magma.lte.oai.EnbDescription.s1_enb_state:type_name -> magma.lte.oai.S1apEnbState + 2, // 6: magma.lte.oai.UeDescription.s1ap_ue_context_rel_timer:type_name -> magma.lte.oai.S1apTimer + 11, // 7: magma.lte.oai.UeDescription.s1ap_handover_state:type_name -> magma.lte.oai.S1apHandoverState + 1, // 8: magma.lte.oai.UeDescription.s1ap_ue_state:type_name -> magma.lte.oai.S1apUeState + 14, // 9: magma.lte.oai.S1apState.enbs:type_name -> magma.lte.oai.S1apState.EnbsEntry + 15, // 10: magma.lte.oai.S1apState.mmeid2associd:type_name -> magma.lte.oai.S1apState.Mmeid2associdEntry + 16, // 11: magma.lte.oai.S1apImsiMap.mme_ue_id_imsi_map:type_name -> magma.lte.oai.S1apImsiMap.MmeUeIdImsiMapEntry + 17, // 12: magma.lte.oai.S1apImsiMap.mme_ue_s1ap_id_imsi_map:type_name -> magma.lte.oai.S1apImsiMap.MmeUeS1apIdImsiMapEntry + 6, // 13: magma.lte.oai.S1apHandoverState.e_rab_admitted_list:type_name -> magma.lte.oai.ERabAdmittedList + 7, // 14: magma.lte.oai.S1apState.EnbsEntry.value:type_name -> magma.lte.oai.EnbDescription + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_lte_protos_oai_s1ap_state_proto_init() } @@ -921,7 +1271,7 @@ func file_lte_protos_oai_s1ap_state_proto_init() { } } file_lte_protos_oai_s1ap_state_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnbDescription); i { + switch v := v.(*ERabAdmittedItem); i { case 0: return &v.state case 1: @@ -933,7 +1283,7 @@ func file_lte_protos_oai_s1ap_state_proto_init() { } } file_lte_protos_oai_s1ap_state_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UeDescription); i { + switch v := v.(*ERabAdmittedList); i { case 0: return &v.state case 1: @@ -945,7 +1295,7 @@ func file_lte_protos_oai_s1ap_state_proto_init() { } } file_lte_protos_oai_s1ap_state_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*S1ApState); i { + switch v := v.(*EnbDescription); i { case 0: return &v.state case 1: @@ -957,7 +1307,7 @@ func file_lte_protos_oai_s1ap_state_proto_init() { } } file_lte_protos_oai_s1ap_state_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*S1ApImsiMap); i { + switch v := v.(*UeDescription); i { case 0: return &v.state case 1: @@ -969,6 +1319,30 @@ func file_lte_protos_oai_s1ap_state_proto_init() { } } file_lte_protos_oai_s1ap_state_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*S1ApState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_lte_protos_oai_s1ap_state_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*S1ApImsiMap); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_lte_protos_oai_s1ap_state_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*S1ApHandoverState); i { case 0: return &v.state @@ -986,13 +1360,14 @@ func file_lte_protos_oai_s1ap_state_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_lte_protos_oai_s1ap_state_proto_rawDesc, - NumEnums: 0, - NumMessages: 14, + NumEnums: 2, + NumMessages: 16, NumExtensions: 0, NumServices: 0, }, GoTypes: file_lte_protos_oai_s1ap_state_proto_goTypes, DependencyIndexes: file_lte_protos_oai_s1ap_state_proto_depIdxs, + EnumInfos: file_lte_protos_oai_s1ap_state_proto_enumTypes, MessageInfos: file_lte_protos_oai_s1ap_state_proto_msgTypes, }.Build() File_lte_protos_oai_s1ap_state_proto = out.File diff --git a/lte/gateway/c/core/BUILD.bazel b/lte/gateway/c/core/BUILD.bazel index f77e913faf0e..85feedc4e279 100644 --- a/lte/gateway/c/core/BUILD.bazel +++ b/lte/gateway/c/core/BUILD.bazel @@ -170,22 +170,22 @@ MME_SRCS = [ "oai/tasks/mme_app/mme_config.c", "oai/tasks/mme_app/mme_events.cpp", "oai/tasks/mme_app/s6a_2_nas_cause.c", - "oai/tasks/nas/api/mme/mme_api.c", - "oai/tasks/nas/api/network/nas_message.c", - "oai/tasks/nas/emm/Attach.c", - "oai/tasks/nas/emm/Authentication.c", - "oai/tasks/nas/emm/Detach.c", - "oai/tasks/nas/emm/EmmCommon.c", - "oai/tasks/nas/emm/EmmInformation.c", - "oai/tasks/nas/emm/EmmStatusHdl.c", - "oai/tasks/nas/emm/Identification.c", - "oai/tasks/nas/emm/LowerLayer.c", - "oai/tasks/nas/emm/NasTransportHdl.c", - "oai/tasks/nas/emm/SecurityModeControl.c", - "oai/tasks/nas/emm/ServiceRequestHdl.c", - "oai/tasks/nas/emm/TrackingAreaUpdate.c", - "oai/tasks/nas/emm/emm_data_ctx.c", - "oai/tasks/nas/emm/emm_main.c", + "oai/tasks/nas/api/mme/mme_api.cpp", + "oai/tasks/nas/api/network/nas_message.cpp", + "oai/tasks/nas/emm/Attach.cpp", + "oai/tasks/nas/emm/Authentication.cpp", + "oai/tasks/nas/emm/Detach.cpp", + "oai/tasks/nas/emm/EmmCommon.cpp", + "oai/tasks/nas/emm/EmmInformation.cpp", + "oai/tasks/nas/emm/EmmStatusHdl.cpp", + "oai/tasks/nas/emm/Identification.cpp", + "oai/tasks/nas/emm/LowerLayer.cpp", + "oai/tasks/nas/emm/NasTransportHdl.cpp", + "oai/tasks/nas/emm/SecurityModeControl.cpp", + "oai/tasks/nas/emm/ServiceRequestHdl.cpp", + "oai/tasks/nas/emm/TrackingAreaUpdate.cpp", + "oai/tasks/nas/emm/emm_data_ctx.cpp", + "oai/tasks/nas/emm/emm_main.cpp", "oai/tasks/nas/emm/msg/AttachAccept.cpp", "oai/tasks/nas/emm/msg/AttachComplete.cpp", "oai/tasks/nas/emm/msg/AttachReject.cpp", @@ -216,18 +216,18 @@ MME_SRCS = [ "oai/tasks/nas/emm/msg/TrackingAreaUpdateRequest.cpp", "oai/tasks/nas/emm/msg/UplinkNasTransport.cpp", "oai/tasks/nas/emm/msg/emm_msg.cpp", - "oai/tasks/nas/emm/sap/EmmCommonProcedureInitiated.c", - "oai/tasks/nas/emm/sap/EmmDeregistered.c", - "oai/tasks/nas/emm/sap/EmmDeregisteredInitiated.c", - "oai/tasks/nas/emm/sap/EmmRegistered.c", - "oai/tasks/nas/emm/sap/emm_as.c", - "oai/tasks/nas/emm/sap/emm_cn.c", - "oai/tasks/nas/emm/sap/emm_esm.c", - "oai/tasks/nas/emm/sap/emm_fsm.c", - "oai/tasks/nas/emm/sap/emm_recv.c", - "oai/tasks/nas/emm/sap/emm_reg.c", - "oai/tasks/nas/emm/sap/emm_sap.c", - "oai/tasks/nas/emm/sap/emm_send.c", + "oai/tasks/nas/emm/sap/EmmCommonProcedureInitiated.cpp", + "oai/tasks/nas/emm/sap/EmmDeregistered.cpp", + "oai/tasks/nas/emm/sap/EmmDeregisteredInitiated.cpp", + "oai/tasks/nas/emm/sap/EmmRegistered.cpp", + "oai/tasks/nas/emm/sap/emm_as.cpp", + "oai/tasks/nas/emm/sap/emm_cn.cpp", + "oai/tasks/nas/emm/sap/emm_esm.cpp", + "oai/tasks/nas/emm/sap/emm_fsm.cpp", + "oai/tasks/nas/emm/sap/emm_recv.cpp", + "oai/tasks/nas/emm/sap/emm_reg.cpp", + "oai/tasks/nas/emm/sap/emm_sap.cpp", + "oai/tasks/nas/emm/sap/emm_send.cpp", "oai/tasks/nas/esm/DedicatedEpsBearerContextActivation.cpp", "oai/tasks/nas/esm/DefaultEpsBearerContextActivation.cpp", "oai/tasks/nas/esm/EpsBearerContextDeactivation.cpp", @@ -336,13 +336,13 @@ MME_SRCS = [ "oai/tasks/nas/ies/UeNetworkCapability.c", "oai/tasks/nas/ies/UeRadioCapabilityInformationUpdateNeeded.c", "oai/tasks/nas/ies/UeSecurityCapability.c", - "oai/tasks/nas/nas_network.c", - "oai/tasks/nas/nas_proc.c", - "oai/tasks/nas/nas_procedures.c", + "oai/tasks/nas/nas_network.cpp", + "oai/tasks/nas/nas_proc.cpp", + "oai/tasks/nas/nas_procedures.cpp", "oai/tasks/nas/nas_state_converter.cpp", - "oai/tasks/nas/util/nas_timer.c", - "oai/tasks/nas/util/parser.c", - "oai/tasks/nas/util/socket.c", + "oai/tasks/nas/util/nas_timer.cpp", + "oai/tasks/nas/util/parser.cpp", + "oai/tasks/nas/util/socket.cpp", "oai/tasks/nas5g/src/AmfMessage.cpp", "oai/tasks/nas5g/src/M5GAuthenticationFailure.cpp", "oai/tasks/nas5g/src/M5GAuthenticationReject.cpp", @@ -693,13 +693,14 @@ MME_HDRS = [ "oai/tasks/mme_app/mme_app_timer.h", "oai/tasks/mme_app/mme_app_timer_management.hpp", "oai/tasks/mme_app/mme_app_ueip_imsi_map.h", - "oai/tasks/nas/api/mme/mme_api.h", - "oai/tasks/nas/api/network/nas_message.h", - "oai/tasks/nas/emm/EmmCommon.h", - "oai/tasks/nas/emm/LowerLayer.h", - "oai/tasks/nas/emm/emm_data.h", - "oai/tasks/nas/emm/emm_main.h", - "oai/tasks/nas/emm/emm_proc.h", + "oai/tasks/nas/api/mme/mme_api.hpp", + "oai/tasks/nas/api/network/nas_message.hpp", + "oai/tasks/nas/emm/EmmCommon.hpp", + "oai/tasks/nas/emm/LowerLayer.hpp", + "oai/tasks/nas/emm/emm_data.hpp", + "oai/tasks/nas/emm/emm_headers.hpp", + "oai/tasks/nas/emm/emm_main.hpp", + "oai/tasks/nas/emm/emm_proc.hpp", "oai/tasks/nas/emm/msg/AttachAccept.hpp", "oai/tasks/nas/emm/msg/AttachComplete.hpp", "oai/tasks/nas/emm/msg/AttachReject.hpp", @@ -732,18 +733,18 @@ MME_HDRS = [ "oai/tasks/nas/emm/msg/emm_cause.hpp", "oai/tasks/nas/emm/msg/emm_msg.hpp", "oai/tasks/nas/emm/msg/emm_msgDef.hpp", - "oai/tasks/nas/emm/sap/emm_as.h", - "oai/tasks/nas/emm/sap/emm_asDef.h", - "oai/tasks/nas/emm/sap/emm_cn.h", - "oai/tasks/nas/emm/sap/emm_cnDef.h", - "oai/tasks/nas/emm/sap/emm_esm.h", - "oai/tasks/nas/emm/sap/emm_esmDef.h", - "oai/tasks/nas/emm/sap/emm_fsm.h", - "oai/tasks/nas/emm/sap/emm_recv.h", - "oai/tasks/nas/emm/sap/emm_reg.h", - "oai/tasks/nas/emm/sap/emm_regDef.h", - "oai/tasks/nas/emm/sap/emm_sap.h", - "oai/tasks/nas/emm/sap/emm_send.h", + "oai/tasks/nas/emm/sap/emm_as.hpp", + "oai/tasks/nas/emm/sap/emm_asDef.hpp", + "oai/tasks/nas/emm/sap/emm_cn.hpp", + "oai/tasks/nas/emm/sap/emm_cnDef.hpp", + "oai/tasks/nas/emm/sap/emm_esm.hpp", + "oai/tasks/nas/emm/sap/emm_esmDef.hpp", + "oai/tasks/nas/emm/sap/emm_fsm.hpp", + "oai/tasks/nas/emm/sap/emm_recv.hpp", + "oai/tasks/nas/emm/sap/emm_reg.hpp", + "oai/tasks/nas/emm/sap/emm_regDef.hpp", + "oai/tasks/nas/emm/sap/emm_sap.hpp", + "oai/tasks/nas/emm/sap/emm_send.hpp", "oai/tasks/nas/esm/esm_data.hpp", "oai/tasks/nas/esm/esm_ebr.hpp", "oai/tasks/nas/esm/esm_ebr_context.hpp", @@ -847,13 +848,13 @@ MME_HDRS = [ "oai/tasks/nas/ies/UeNetworkCapability.h", "oai/tasks/nas/ies/UeRadioCapabilityInformationUpdateNeeded.h", "oai/tasks/nas/ies/UeSecurityCapability.h", - "oai/tasks/nas/nas_network.h", + "oai/tasks/nas/nas_network.hpp", "oai/tasks/nas/nas_proc.hpp", - "oai/tasks/nas/nas_procedures.h", + "oai/tasks/nas/nas_procedures.hpp", "oai/tasks/nas/nas_state_converter.hpp", - "oai/tasks/nas/util/nas_timer.h", - "oai/tasks/nas/util/parser.h", - "oai/tasks/nas/util/socket.h", + "oai/tasks/nas/util/nas_timer.hpp", + "oai/tasks/nas/util/parser.hpp", + "oai/tasks/nas/util/socket.hpp", "oai/tasks/nas5g/include/AmfMessage.hpp", "oai/tasks/nas5g/include/M5GAuthenticationFailure.hpp", "oai/tasks/nas5g/include/M5GAuthenticationReject.hpp", diff --git a/lte/gateway/c/core/oai/common/common_types.h b/lte/gateway/c/core/oai/common/common_types.h index ef116e56f0c2..1a841cf8c122 100644 --- a/lte/gateway/c/core/oai/common/common_types.h +++ b/lte/gateway/c/core/oai/common/common_types.h @@ -118,6 +118,8 @@ typedef uint64_t imei64_t; //------------------------------------------------------------------------------ // PLMN +#define ASCII_ZERO 0x30 +#define PLMN_BYTES 7 //------------------------------------------------------------------------------ diff --git a/lte/gateway/c/core/oai/common/itti_free_defined_msg.c b/lte/gateway/c/core/oai/common/itti_free_defined_msg.c index f42927146a28..c9d92a2230f4 100644 --- a/lte/gateway/c/core/oai/common/itti_free_defined_msg.c +++ b/lte/gateway/c/core/oai/common/itti_free_defined_msg.c @@ -222,6 +222,15 @@ void itti_free_msg_content(MessageDef* const message_p) { bdestroy_wrapper( &message_p->ittiMsg.s1ap_handover_request_ack.tgt_src_container); break; + case S1AP_HANDOVER_NOTIFY: { + e_rab_admitted_list_t e_rab_admitted_list = {}; + e_rab_admitted_list = + message_p->ittiMsg.s1ap_handover_notify.e_rab_admitted_list; + for (uint8_t idx = 0; idx < e_rab_admitted_list.no_of_items; idx++) { + bdestroy_wrapper( + &e_rab_admitted_list.item[idx].transport_layer_address); + } + } break; case S6A_UPDATE_LOCATION_REQ: case S6A_UPDATE_LOCATION_ANS: case S6A_AUTH_INFO_REQ: diff --git a/lte/gateway/c/core/oai/include/amf_config.hpp b/lte/gateway/c/core/oai/include/amf_config.hpp index 9e9d38fbe42a..6c2821d30428 100644 --- a/lte/gateway/c/core/oai/include/amf_config.hpp +++ b/lte/gateway/c/core/oai/include/amf_config.hpp @@ -50,6 +50,7 @@ #define AMF_CONFIG_STRING_AMF_REGION_ID "AMF_REGION_ID" #define AMF_CONFIG_STRING_AMF_SET_ID "AMF_SET_ID" #define AMF_CONFIG_STRING_AMF_POINTER "AMF_POINTER" +#define AMF_CONFIG_STRING_NAS_ENABLE_IMS_VoPS_3GPP "ENABLE_IMS_VoPS_3GPP" typedef struct nas5g_config_s { uint8_t preferred_integrity_algorithm[8]; @@ -70,6 +71,7 @@ typedef struct nas5g_config_s { bool force_reject_tau; bool force_reject_sr; bool disable_esm_information; + bool enable_IMS_VoPS_3GPP; } nas5g_config_t; typedef struct m5g_apn_map_s { diff --git a/lte/gateway/c/core/oai/include/mme_app_ue_context.h b/lte/gateway/c/core/oai/include/mme_app_ue_context.h index df761f0d2c99..1ae8787d1332 100644 --- a/lte/gateway/c/core/oai/include/mme_app_ue_context.h +++ b/lte/gateway/c/core/oai/include/mme_app_ue_context.h @@ -45,10 +45,10 @@ #include "lte/gateway/c/core/oai/lib/hashtable/obj_hashtable.h" #include "lte/gateway/c/core/oai/lib/itti/intertask_interface_types.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" typedef enum { ECM_IDLE = 0, diff --git a/lte/gateway/c/core/oai/include/mme_config.h b/lte/gateway/c/core/oai/include/mme_config.h index 3567807818ad..7b72db53a5eb 100644 --- a/lte/gateway/c/core/oai/include/mme_config.h +++ b/lte/gateway/c/core/oai/include/mme_config.h @@ -45,10 +45,18 @@ #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_23.003.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.008.h" + +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/include/service303.hpp" #include "lte/gateway/c/core/oai/lib/hashtable/hashtable.h" #include "lte/gateway/c/core/oai/lib/hashtable/obj_hashtable.h" +#ifdef __cplusplus +} +#endif + +#include "lte/gateway/c/core/oai/include/service303.hpp" #include "orc8r/gateway/c/common/sentry/SentryWrapper.hpp" /* Currently supporting max 5 GUMMEI's in the mme configuration */ diff --git a/lte/gateway/c/core/oai/include/mme_init.hpp b/lte/gateway/c/core/oai/include/mme_init.hpp index 22138d8f5a96..78dde5d80b55 100644 --- a/lte/gateway/c/core/oai/include/mme_init.hpp +++ b/lte/gateway/c/core/oai/include/mme_init.hpp @@ -30,7 +30,3 @@ * @returns -1 in case of failure **/ status_code_e s1ap_mme_init(const mme_config_t* mme_config); - -/** \brief S1AP layer top exit - **/ -void s1ap_mme_exit(void); diff --git a/lte/gateway/c/core/oai/include/proto_map.hpp b/lte/gateway/c/core/oai/include/proto_map.hpp index 5262dc97b7ef..7c23a44ba5e0 100644 --- a/lte/gateway/c/core/oai/include/proto_map.hpp +++ b/lte/gateway/c/core/oai/include/proto_map.hpp @@ -220,8 +220,14 @@ struct proto_map_s { return PROTO_MAP_NOT_CREATED; } if (!(map->empty())) { - map->clear(); + for (auto itr = map->begin(); itr != map->end(); itr++) { + if (free_callback_func) { + valueT value = itr->second; + free_callback_func(reinterpret_cast(&value)); + } + } } + map->clear(); return PROTO_MAP_OK; } /*************************************************************************** diff --git a/lte/gateway/c/core/oai/include/s1ap_state.hpp b/lte/gateway/c/core/oai/include/s1ap_state.hpp index 9ce005c9ffa2..1e02b6d51038 100644 --- a/lte/gateway/c/core/oai/include/s1ap_state.hpp +++ b/lte/gateway/c/core/oai/include/s1ap_state.hpp @@ -21,8 +21,13 @@ #ifdef __cplusplus extern "C" { #endif - #include "lte/gateway/c/core/oai/include/mme_config.h" +#ifdef __cplusplus +} +#endif + +namespace magma { +namespace lte { int s1ap_state_init(uint32_t max_ues, uint32_t max_enbs, bool use_stateless); @@ -32,15 +37,15 @@ s1ap_state_t* get_s1ap_state(bool read_from_db); void put_s1ap_state(void); -enb_description_t* s1ap_state_get_enb(s1ap_state_t* state, - sctp_assoc_id_t assoc_id); +oai::EnbDescription* s1ap_state_get_enb(s1ap_state_t* state, + sctp_assoc_id_t assoc_id); -ue_description_t* s1ap_state_get_ue_enbid(sctp_assoc_id_t sctp_assoc_id, - enb_ue_s1ap_id_t enb_ue_s1ap_id); +oai::UeDescription* s1ap_state_get_ue_enbid(sctp_assoc_id_t sctp_assoc_id, + enb_ue_s1ap_id_t enb_ue_s1ap_id); -ue_description_t* s1ap_state_get_ue_mmeid(mme_ue_s1ap_id_t mme_ue_s1ap_id); +oai::UeDescription* s1ap_state_get_ue_mmeid(mme_ue_s1ap_id_t mme_ue_s1ap_id); -ue_description_t* s1ap_state_get_ue_imsi(imsi64_t imsi64); +oai::UeDescription* s1ap_state_get_ue_imsi(imsi64_t imsi64); /** * Return unique composite id for S1AP UE context @@ -70,18 +75,17 @@ void put_s1ap_ue_state(imsi64_t imsi64); void delete_s1ap_ue_state(imsi64_t imsi64); bool s1ap_ue_compare_by_mme_ue_id_cb(__attribute__((unused)) uint64_t keyP, - struct ue_description_s* elementP, + oai::UeDescription* elementP, void* parameterP, void** resultP); bool s1ap_ue_compare_by_imsi(__attribute__((unused)) uint64_t keyP, - struct ue_description_s* elementP, - void* parameterP, void** resultP); + oai::UeDescription* elementP, void* parameterP, + void** resultP); void remove_ues_without_imsi_from_ue_id_coll(void); void clean_stale_enb_state(s1ap_state_t* state, - enb_description_t* new_enb_association); + oai::EnbDescription* new_enb_association); -#ifdef __cplusplus -} -#endif +} // namespace lte +} // namespace magma diff --git a/lte/gateway/c/core/oai/include/s1ap_types.hpp b/lte/gateway/c/core/oai/include/s1ap_types.hpp index c2fbb083f789..8e949ab0e216 100644 --- a/lte/gateway/c/core/oai/include/s1ap_types.hpp +++ b/lte/gateway/c/core/oai/include/s1ap_types.hpp @@ -19,9 +19,12 @@ #include +#include "lte/protos/oai/s1ap_state.pb.h" + #include "lte/gateway/c/core/oai/include/proto_map.hpp" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.413.h" + #ifdef __cplusplus extern "C" { #endif @@ -30,15 +33,13 @@ extern "C" { } #endif -// Forward declarations -struct enb_description_s; - #define S1AP_TIMER_INACTIVE_ID (-1) #define S1AP_UE_CONTEXT_REL_COMP_TIMER 1 // in seconds -// Map- Key: uint32_t , Data: enb_description_t* -typedef magma::proto_map_s +// Map- Key: sctp_assoc_id (uint32_t) , Data: enb_description_t* +typedef magma::proto_map_s map_uint32_enb_description_t; + typedef struct s1ap_state_s { // key:sctp_assoc_id, value: pointer to eNB_description_s map_uint32_enb_description_t enbs; @@ -52,85 +53,9 @@ typedef struct s1ap_imsi_map_s { magma::proto_map_uint32_uint64_t mme_ueid2imsi_map; } s1ap_imsi_map_t; -enum s1_timer_class_s { - S1AP_INVALID_TIMER_CLASS, - S1AP_ENB_TIMER, - S1AP_UE_TIMER -}; - -/* Timer structure */ -struct s1ap_timer_t { - long id; /* The timer identifier */ - long msec; /* The timer interval value in seconds */ -}; - -// The current s1 state of the MME relating to the specific eNB. -enum mme_s1_enb_state_s { - S1AP_INIT, /// The sctp association has been established but s1 hasn't been - /// setup. - S1AP_RESETING, /// The s1state is resetting due to an SCTP reset on the bound - /// association. - S1AP_READY, ///< MME and eNB are S1 associated, UE contexts can be added - S1AP_SHUTDOWN /// The S1 state is being torn down due to sctp shutdown. -}; - -enum s1_ue_state_s { - S1AP_UE_INVALID_STATE, - S1AP_UE_WAITING_CSR, ///< Waiting for Initial Context Setup Response - S1AP_UE_HANDOVER, ///< Handover procedure triggered - S1AP_UE_CONNECTED, ///< UE context ready - S1AP_UE_WAITING_CRR, /// UE Context release Procedure initiated , waiting for - /// UE context Release Complete -}; - -typedef struct s1ap_handover_state_s { - mme_ue_s1ap_id_t mme_ue_s1ap_id; - uint32_t source_enb_id; - uint32_t target_enb_id; - enb_ue_s1ap_id_t source_enb_ue_s1ap_id : 24; - enb_ue_s1ap_id_t target_enb_ue_s1ap_id : 24; - sctp_stream_id_t source_sctp_stream_recv; ///< source eNB -> MME stream - sctp_stream_id_t target_sctp_stream_recv; ///< target eNB -> MME stream - sctp_stream_id_t source_sctp_stream_send; ///< MME -> source eNB stream - sctp_stream_id_t target_sctp_stream_send; ///< MME -> target eNB stream - e_rab_admitted_list_t e_rab_admitted_list; -} s1ap_handover_state_t; - -/** Main structure representing UE association over s1ap - * Generated every time a new InitialUEMessage is received - **/ -typedef struct ue_description_s { - enum s1_ue_state_s s1_ue_state; ///< S1AP UE state - - enb_ue_s1ap_id_t - enb_ue_s1ap_id : 24; ///< Unique UE id over eNB (24 bits wide) - mme_ue_s1ap_id_t mme_ue_s1ap_id; ///< Unique UE id over MME (32 bits wide) - sctp_assoc_id_t sctp_assoc_id; ///< Assoc id of eNB which this UE is attached - uint64_t comp_s1ap_id; ///< Unique composite UE id (sctp_assoc_id & - ///< enb_ue_s1ap_id) - - /** SCTP stream on which S1 message will be sent/received. - * During an UE S1 connection, a pair of streams is - * allocated and is used during all the connection. - * Stream 0 is reserved for non UE signalling. - * @name sctp stream identifier - **/ - /*@{*/ - sctp_stream_id_t sctp_stream_recv; ///< eNB -> MME stream - sctp_stream_id_t sctp_stream_send; ///< MME -> eNB stream - /*@}*/ - - // UE Context Release procedure guard timer - struct s1ap_timer_t s1ap_ue_context_rel_timer; - - // Handover status. We intentionally do not persist all of this state since - // it's time sensitive; if the MME restarts during a HO procedure the RAN - // will abort the procedure due to timeouts, rendering this state useless. - s1ap_handover_state_t s1ap_handover_state; -} ue_description_t; - -// Map- Key:uint64_t, Data:ue_description_s* -typedef magma::proto_map_s +// Map- Key:comp_s1ap_id (uint64_t), Data: pointer to protobuf object, +// UeDescription +typedef magma::proto_map_s map_uint64_ue_description_t; /* Maximum no. of Broadcast PLMNs. Value is 6 @@ -153,36 +78,3 @@ typedef struct supported_ta_list_s { supported_tai_items_t supported_tai_items[S1AP_MAX_TAI_ITEMS]; ///< List of TAIs } supported_ta_list_t; - -/* Main structure representing eNB association over s1ap - * Generated (or updated) every time a new S1SetupRequest is received. - */ -typedef struct enb_description_s { - enum mme_s1_enb_state_s - s1_state; ///< State of the eNB specific S1AP association - - /** eNB related parameters **/ - /*@{*/ - char enb_name[150]; ///< Printable eNB Name - uint32_t enb_id; ///< Unique eNB ID - uint8_t default_paging_drx; ///< Default paging DRX interval for eNB - supported_ta_list_t supported_ta_list; ///< Supported TAs by eNB - /*@}*/ - - /** UE list for this eNB **/ - /*@{*/ - uint32_t nb_ue_associated; ///< Number of NAS associated UE on this eNB - magma::proto_map_uint32_uint64_t - ue_id_coll; ///< key: mme_ue_s1ap_id, value: comp_s1ap_id - /*@}*/ - /** SCTP stuff **/ - /*@{*/ - sctp_assoc_id_t sctp_assoc_id; ///< SCTP association id on this machine - sctp_stream_id_t next_sctp_stream; ///< Next SCTP stream - sctp_stream_id_t instreams; ///< Number of streams avalaible on eNB -> MME - sctp_stream_id_t outstreams; ///< Number of streams avalaible on MME -> eNB - char ran_cp_ipaddr[16]; ///< Network byte order IP address of eNB SCTP end - ///< point - uint8_t ran_cp_ipaddr_sz; ///< IP addr size for ran_cp_ipaddr - /*@}*/ -} enb_description_t; diff --git a/lte/gateway/c/core/oai/include/state_converter.hpp b/lte/gateway/c/core/oai/include/state_converter.hpp index 6ca7bd02c05b..919253640df0 100644 --- a/lte/gateway/c/core/oai/include/state_converter.hpp +++ b/lte/gateway/c/core/oai/include/state_converter.hpp @@ -44,8 +44,6 @@ extern "C" { namespace magma { namespace lte { -#define ASCII_ZERO 0x30 -#define PLMN_BYTES 7 #define BSTRING_TO_STRING(bstr, str_ptr) \ do { \ *str_ptr = std::string(bdata(bstr), blength(bstr)); \ diff --git a/lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h b/lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h index 6d01c6a31e28..8878c950ecff 100644 --- a/lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h +++ b/lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h @@ -507,5 +507,5 @@ typedef struct nr_ue_security_capability_s { #define ESM_CAUSE_MESSAGE_NOT_COMPATIBLE 101 #define ESM_CAUSE_PROTOCOL_ERROR 111 -extern const char* emm_cause_str[256]; +extern const char* emm_cause_str(uint32_t); #endif /* FILE_3GPP_24_301_SEEN */ diff --git a/lte/gateway/c/core/oai/lib/secu/secu_defs.h b/lte/gateway/c/core/oai/lib/secu/secu_defs.h index f4fc86a84ea0..84d1b53f3f2c 100644 --- a/lte/gateway/c/core/oai/lib/secu/secu_defs.h +++ b/lte/gateway/c/core/oai/lib/secu/secu_defs.h @@ -31,8 +31,14 @@ void kdf(const uint8_t* key, const unsigned key_len, uint8_t* s, int derive_keNB(const uint8_t* kasme_32, const uint32_t nas_count, uint8_t* keNB); +#ifdef __cplusplus +extern "C" { +#endif int derive_key_nas(algorithm_type_dist_t nas_alg_type, uint8_t nas_enc_alg_id, const uint8_t* kasme_32, uint8_t* knas); +#ifdef __cplusplus +} +#endif int derive_5gkey_amf(const uint8_t* imsi, uint8_t imsi_length, const uint8_t* kasme_32, uint8_t* knas); @@ -75,17 +81,20 @@ typedef struct { uint32_t blength; } nas_stream_cipher_t; +#ifdef __cplusplus +extern "C" { +#endif int nas_stream_encrypt_eea1(nas_stream_cipher_t* const stream_cipher, uint8_t* const out); - -int nas_stream_encrypt_eia1(nas_stream_cipher_t* const stream_cipher, - uint8_t const out[4]); - int nas_stream_encrypt_eea2(nas_stream_cipher_t* const stream_cipher, uint8_t* const out); - +int nas_stream_encrypt_eia1(nas_stream_cipher_t* const stream_cipher, + uint8_t const out[4]); int nas_stream_encrypt_eia2(nas_stream_cipher_t* const stream_cipher, uint8_t const out[4]); +#ifdef __cplusplus +} +#endif int derive_5gkey_gnb(const uint8_t* kamf, uint32_t ul_count, uint8_t* kgnb); diff --git a/lte/gateway/c/core/oai/tasks/amf/amf_as.cpp b/lte/gateway/c/core/oai/tasks/amf/amf_as.cpp index 77dd9ebae9ee..32404b7e6641 100644 --- a/lte/gateway/c/core/oai/tasks/amf/amf_as.cpp +++ b/lte/gateway/c/core/oai/tasks/amf/amf_as.cpp @@ -513,7 +513,8 @@ int amf_reg_acceptmsg(const guti_m5_t* guti, const tai_t* tai, nas_msg->security_protected.plain.amf.msg.registrationacceptmsg .network_feature.IMS_VoPS_N3GPP = 0; nas_msg->security_protected.plain.amf.msg.registrationacceptmsg - .network_feature.IMS_VoPS_3GPP = 0; + .network_feature.IMS_VoPS_3GPP = + amf_config.nas_config.enable_IMS_VoPS_3GPP; nas_msg->security_protected.plain.amf.msg.registrationacceptmsg .network_feature.MCSI = 0; nas_msg->security_protected.plain.amf.msg.registrationacceptmsg diff --git a/lte/gateway/c/core/oai/tasks/amf/amf_config.c b/lte/gateway/c/core/oai/tasks/amf/amf_config.c index de353bcb2c80..3e61db072f02 100644 --- a/lte/gateway/c/core/oai/tasks/amf/amf_config.c +++ b/lte/gateway/c/core/oai/tasks/amf/amf_config.c @@ -63,6 +63,7 @@ void nas5g_config_init(nas5g_config_t* nas_conf) { nas_conf->force_reject_tau = true; nas_conf->force_reject_sr = true; nas_conf->disable_esm_information = false; + nas_conf->enable_IMS_VoPS_3GPP = false; } /*************************************************************************** diff --git a/lte/gateway/c/core/oai/tasks/amf/amf_smf_send.cpp b/lte/gateway/c/core/oai/tasks/amf/amf_smf_send.cpp index d04801f6fc07..574c422f4bfc 100644 --- a/lte/gateway/c/core/oai/tasks/amf/amf_smf_send.cpp +++ b/lte/gateway/c/core/oai/tasks/amf/amf_smf_send.cpp @@ -38,7 +38,7 @@ extern "C" { #include "lte/gateway/c/core/oai/tasks/amf/include/amf_client_servicer.hpp" #include "lte/gateway/c/core/oai/tasks/amf/include/amf_session_manager_pco.hpp" #include "lte/gateway/c/core/oai/tasks/amf/include/amf_smf_packet_handler.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" #include "lte/gateway/c/core/oai/tasks/nas5g/include/M5GNasEnums.h" #include "lte/gateway/c/core/oai/tasks/nas5g/include/M5gNasMessage.h" diff --git a/lte/gateway/c/core/oai/tasks/grpc_service/CMakeLists.txt b/lte/gateway/c/core/oai/tasks/grpc_service/CMakeLists.txt index 9b394a7bcf19..439af2452084 100644 --- a/lte/gateway/c/core/oai/tasks/grpc_service/CMakeLists.txt +++ b/lte/gateway/c/core/oai/tasks/grpc_service/CMakeLists.txt @@ -53,8 +53,8 @@ generate_grpc_protos("${SMOSRV_LTE_GRPC_PROTOS}" "${PROTO_SRCS}" "${PROTO_HDRS}" ${LTE_PROTO_DIR} ${LTE_OUT_DIR}) # S1ap Service -set(S1APSRV_LTE_CPP_PROTOS s1ap_service) -set(S1APSRV_LTE_GRPC_PROTOS s1ap_service) +set(S1APSRV_LTE_CPP_PROTOS s1ap_service oai/s1ap_state) +set(S1APSRV_LTE_GRPC_PROTOS s1ap_service oai/s1ap_state) generate_cpp_protos("${S1APSRV_LTE_CPP_PROTOS}" "${PROTO_SRCS}" "${PROTO_HDRS}" ${LTE_PROTO_DIR} ${LTE_OUT_DIR}) generate_grpc_protos("${S1APSRV_LTE_GRPC_PROTOS}" "${PROTO_SRCS}" diff --git a/lte/gateway/c/core/oai/tasks/grpc_service/S1apServiceImpl.cpp b/lte/gateway/c/core/oai/tasks/grpc_service/S1apServiceImpl.cpp index b883dec8e301..ee4ebb68cc99 100644 --- a/lte/gateway/c/core/oai/tasks/grpc_service/S1apServiceImpl.cpp +++ b/lte/gateway/c/core/oai/tasks/grpc_service/S1apServiceImpl.cpp @@ -51,10 +51,10 @@ Status S1apServiceImpl::GetENBState(ServerContext* context, const Void* request, for (auto itr = s1ap_state->enbs.map->begin(); itr != s1ap_state->enbs.map->end(); itr++) { - enb_description_t* enb_ref = itr->second; + oai::EnbDescription* enb_ref = itr->second; if (enb_ref) { - (*response->mutable_enb_state_map())[enb_ref->enb_id] = - enb_ref->nb_ue_associated; + (*response->mutable_enb_state_map())[enb_ref->enb_id()] = + enb_ref->nb_ue_associated(); } } } diff --git a/lte/gateway/c/core/oai/tasks/ha/ha_service_handler.cpp b/lte/gateway/c/core/oai/tasks/ha/ha_service_handler.cpp index ea453f5d970a..8b3dab20a881 100644 --- a/lte/gateway/c/core/oai/tasks/ha/ha_service_handler.cpp +++ b/lte/gateway/c/core/oai/tasks/ha/ha_service_handler.cpp @@ -98,12 +98,18 @@ bool trigger_agw_offload_for_ue(const hash_key_t keyP, void* const elementP, IMSI_STRING_TO_IMSI64(offload_request->imsi, &imsi64); - enb_description_t* enb_ref_p = - s1ap_state_get_enb(s1ap_state, ue_context_p->sctp_assoc_id_key); + magma::lte::oai::EnbDescription* enb_ref_p = magma::lte::s1ap_state_get_enb( + s1ap_state, ue_context_p->sctp_assoc_id_key); + if (!enb_ref_p) { + OAILOG_ERROR_UE(LOG_UTIL, imsi64, + "Failed to find enb_ref_p for assoc_id :%u", + ue_context_p->sctp_assoc_id_key); + return false; + } // Return if this UE does not satisfy any of the filtering criteria if ((imsi64 != ue_context_p->emm_context._imsi64) && - (offload_request->eNB_id != enb_ref_p->enb_id)) { + (offload_request->eNB_id != enb_ref_p->enb_id())) { return false; } @@ -120,7 +126,7 @@ bool trigger_agw_offload_for_ue(const hash_key_t keyP, void* const elementP, ue_context_p->mme_ue_s1ap_id; S1AP_UE_CONTEXT_RELEASE_REQ(message_p).enb_ue_s1ap_id = ue_context_p->enb_ue_s1ap_id; - S1AP_UE_CONTEXT_RELEASE_REQ(message_p).enb_id = enb_ref_p->enb_id; + S1AP_UE_CONTEXT_RELEASE_REQ(message_p).enb_id = enb_ref_p->enb_id(); S1AP_UE_CONTEXT_RELEASE_REQ(message_p).relCause = S1AP_NAS_MME_OFFLOADING; OAILOG_INFO( @@ -133,7 +139,7 @@ bool trigger_agw_offload_for_ue(const hash_key_t keyP, void* const elementP, ue_context_p->emm_context._imsi64, offload_request->imsi, ue_context_p->mme_ue_s1ap_id, ue_context_p->enb_ue_s1ap_id, ue_context_p->e_utran_cgi.cell_identity.enb_id, - ue_context_p->e_utran_cgi.cell_identity.cell_id, enb_ref_p->enb_id); + ue_context_p->e_utran_cgi.cell_identity.cell_id, enb_ref_p->enb_id()); OAILOG_INFO(LOG_UTIL, "UE Context Release procedure initiated for IMSI%s", offload_request->imsi); IMSI_STRING_TO_IMSI64(offload_request->imsi, diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_apn_selection.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_apn_selection.c index ebbdbcb6ab99..4b5fe8a83e35 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_apn_selection.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_apn_selection.c @@ -29,7 +29,7 @@ #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_apn_selection.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/common/conversions.h" //------------------------------------------------------------------------------ diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_bearer.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_bearer.c index 84196d925e37..8198e2602f99 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_bearer.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_bearer.c @@ -67,8 +67,9 @@ #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_pdn_context.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_procedures.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/CsfbResponse.h" @@ -3703,10 +3704,8 @@ void mme_app_handle_handover_notify( "Id: " MME_UE_S1AP_ID_FMT " (4 or 16 bytes was expected)\n", blength(e_rab_admitted_list.item[i].transport_layer_address), handover_notify_p->mme_ue_s1ap_id); - bdestroy_wrapper(&e_rab_admitted_list.item[i].transport_layer_address); OAILOG_FUNC_OUT(LOG_MME_APP); } - bdestroy_wrapper(&e_rab_admitted_list.item[i].transport_layer_address); s11_modify_bearer_request->bearer_contexts_to_be_modified .num_bearer_context++; diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_context.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_context.c index 5760054e62d2..8d70c7ab6d7e 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_context.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_context.c @@ -65,13 +65,13 @@ #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_pdn_context.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_procedures.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.hpp" #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" extern task_zmq_ctx_t mme_app_task_zmq_ctx; diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h index 9088ce5143c2..7e0fd47c3165 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h @@ -30,13 +30,20 @@ #ifndef FILE_MME_APP_DEFS_SEEN #define FILE_MME_APP_DEFS_SEEN -#include "lte/gateway/c/core/oai/lib/itti/intertask_interface.h" +#include #include "lte/gateway/c/core/oai/include/mme_app_desc.h" #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" -#include + +#ifdef __cplusplus +extern "C" { +#endif +#include "lte/gateway/c/core/oai/lib/itti/intertask_interface.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" +#ifdef __cplusplus +} +#endif #define INVALID_BEARER_INDEX (-1) #define IPV6_ADDRESS_SIZE 16 @@ -76,6 +83,25 @@ int mme_app_send_s6a_update_location_req( ue_mm_context_t* mme_app_get_ue_context_for_timer( mme_ue_s1ap_id_t mme_ue_s1ap_id, char* timer_name); + +void mme_app_handle_detach_req(mme_ue_s1ap_id_t ue_id); + +void mme_app_handle_conn_est_cnf(nas_establish_rsp_t* nas_conn_est_cnf_pP); + +int mme_app_handle_nas_dl_req(mme_ue_s1ap_id_t ue_id, bstring nas_msg, + nas_error_code_t transaction_status); + +void mme_app_handle_create_dedicated_bearer_rsp(ue_mm_context_t* ue_context_p, + + ebi_t ebi); +void mme_app_handle_create_dedicated_bearer_rej(ue_mm_context_t* ue_context_p, + ebi_t ebi); + +status_code_e mme_app_handle_detach_t3422_expiry(zloop_t* loop, int timer_id, + void* args); + +void mme_app_handle_sgs_detach_req(ue_mm_context_t* ue_context_p, + emm_proc_sgs_detach_type_t detach_type); #ifdef __cplusplus } #endif @@ -90,11 +116,6 @@ int mme_app_handle_nas_extended_service_req(mme_ue_s1ap_id_t ue_id, uint8_t servicetype, uint8_t csfb_response); -void mme_app_handle_detach_req(mme_ue_s1ap_id_t ue_id); - -void mme_app_handle_sgs_detach_req(ue_mm_context_t* ue_context_p, - emm_proc_sgs_detach_type_t detach_type); - int mme_app_handle_sgs_eps_detach_ack( mme_app_desc_t* mme_app_desc_p, const itti_sgsap_eps_detach_ack_t* eps_detach_ack_p); @@ -103,8 +124,6 @@ int mme_app_handle_sgs_imsi_detach_ack( mme_app_desc_t* mme_app_desc_p, const itti_sgsap_imsi_detach_ack_t* imsi_detach_ack_p); -void mme_app_handle_conn_est_cnf(nas_establish_rsp_t* nas_conn_est_cnf_pP); - imsi64_t mme_app_handle_initial_ue_message( mme_app_desc_t* mme_app_desc_p, itti_s1ap_initial_ue_message_t* conn_est_ind_pP); @@ -147,24 +166,9 @@ void mme_app_handle_modify_bearer_rsp_erab_mod_ind( itti_s11_modify_bearer_response_t* s11_modify_bearer_response, ue_mm_context_t* ue_context_p); -int mme_app_handle_nas_dl_req(mme_ue_s1ap_id_t ue_id, bstring nas_msg, - nas_error_code_t transaction_status); - void mme_app_handle_e_rab_setup_rsp( itti_s1ap_e_rab_setup_rsp_t* e_rab_setup_rsp); -#ifdef __cplusplus -extern "C" { -#endif -void mme_app_handle_create_dedicated_bearer_rsp(ue_mm_context_t* ue_context_p, - - ebi_t ebi); -void mme_app_handle_create_dedicated_bearer_rej(ue_mm_context_t* ue_context_p, - ebi_t ebi); -#ifdef __cplusplus -} -#endif - void mme_ue_context_update_ue_sig_connection_state( mme_ue_context_t* mme_ue_context_p, struct ue_mm_context_s* ue_context_p, ecm_state_t new_ecm_state); @@ -191,20 +195,23 @@ imsi64_t mme_app_handle_initial_paging_request( const itti_s11_paging_request_t* paging_req); int mme_app_handle_paging_timer_expiry(zloop_t* loop, int timer_id, void* args); -int mme_app_handle_air_timer_expiry(zloop_t* loop, int timer_id, void* args); +status_code_e mme_app_handle_air_timer_expiry(zloop_t* loop, int timer_id, + void* args); int mme_app_handle_ulr_timer_expiry(zloop_t* loop, int timer_id, void* args); -int mme_app_handle_auth_t3460_expiry(zloop_t* loop, int timer_id, void* args); -int mme_app_handle_security_t3460_expiry(zloop_t* loop, int timer_id, - void* args); -int mme_app_handle_identification_t3470_expiry(zloop_t* loop, int timer_id, +status_code_e mme_app_handle_auth_t3460_expiry(zloop_t* loop, int timer_id, void* args); -int mme_app_handle_tau_t3450_expiry(zloop_t* loop, int timer_id, void* args); -int mme_app_handle_emm_attach_t3450_expiry(zloop_t* loop, int timer_id, - void* args); +status_code_e mme_app_handle_security_t3460_expiry(zloop_t* loop, int timer_id, + void* args); +status_code_e mme_app_handle_identification_t3470_expiry(zloop_t* loop, + int timer_id, + void* args); +status_code_e mme_app_handle_tau_t3450_expiry(zloop_t* loop, int timer_id, + void* args); +status_code_e mme_app_handle_emm_attach_t3450_expiry(zloop_t* loop, + int timer_id, void* args); status_code_e mme_app_handle_esm_information_t3489_expiry(zloop_t* loop, int timer_id, void* args); -int mme_app_handle_detach_t3422_expiry(zloop_t* loop, int timer_id, void* args); int mme_app_handle_sgs_eps_detach_timer_expiry(zloop_t* loop, int timer_id, void* args); @@ -241,9 +248,14 @@ int mme_app_send_sgsap_service_request(uint8_t service_indicator, int mme_app_handle_nw_initiated_detach_request(mme_ue_s1ap_id_t ue_id, uint8_t detach_type); - +#ifdef __cplusplus +extern "C" { +#endif int mme_app_handle_nas_cs_domain_location_update_req( ue_mm_context_t* ue_context_p, uint8_t msg_type); +#ifdef __cplusplus +} +#endif int mme_app_handle_sgsap_location_update_acc( mme_app_desc_t* mme_app_desc_p, @@ -306,10 +318,16 @@ void mme_app_handle_nw_init_ded_bearer_actv_req( int mme_app_handle_sgs_status_message(mme_app_desc_t* mme_app_desc_p, itti_sgsap_status_t* sgsap_status_pP); +#ifdef __cplusplus +extern "C" { +#endif void mme_app_handle_erab_rel_cmd(mme_ue_s1ap_id_t ue_id, ebi_t ebi, bstring nas_msg); void mme_app_handle_e_rab_rel_rsp(itti_s1ap_e_rab_rel_rsp_t* e_rab_rel_rsp); +#ifdef __cplusplus +} +#endif void mme_app_handle_nw_init_bearer_deactv_req( mme_app_desc_t* mme_app_desc_p, @@ -343,9 +361,6 @@ void mme_app_handle_path_switch_req_failure( void mme_app_send_itti_sgsap_ue_activity_ind(const char* imsi, unsigned int imsi_len); -status_code_e emm_send_cs_domain_attach_or_tau_accept( - struct ue_mm_context_s* ue_context_p); - void mme_app_update_paging_tai_list(paging_tai_list_t* p_tai_list, partial_tai_list_t* tai_list, uint8_t num_of_tac); @@ -353,6 +368,9 @@ void mme_app_update_paging_tai_list(paging_tai_list_t* p_tai_list, #ifdef __cplusplus extern "C" { #endif +status_code_e emm_send_cs_domain_attach_or_tau_accept( + struct ue_mm_context_s* ue_context_p); + void send_delete_dedicated_bearer_rsp(struct ue_mm_context_s* ue_context_p, bool delete_default_bearer, ebi_t ebi[], uint32_t num_bearer_context, @@ -360,14 +378,14 @@ void send_delete_dedicated_bearer_rsp(struct ue_mm_context_s* ue_context_p, gtpv2c_cause_value_t cause, bool route_s11_messages_to_s8_task, bool mme_initiated_local_deact); + +int map_sgs_emm_cause(SgsRejectCause_t sgs_cause); #ifdef __cplusplus } #endif int mme_app_create_sgs_context(ue_mm_context_t* ue_context_p); -int map_sgs_emm_cause(SgsRejectCause_t sgs_cause); - void mme_app_handle_modify_bearer_rsp( itti_s11_modify_bearer_response_t* s11_modify_bearer_response, ue_mm_context_t* ue_context_p); diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_detach.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_detach.c index e9db6acd1bd0..a2e9ad7d9fcf 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_detach.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_detach.c @@ -45,7 +45,7 @@ #include "lte/gateway/c/core/oai/lib/itti/intertask_interface_types.h" #include "lte/gateway/c/core/oai/lib/itti/itti_types.h" #include "lte/gateway/c/core/oai/include/mme_app_state.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp" #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" #include "lte/gateway/c/core/oai/include/s11_messages_types.h" #include "lte/gateway/c/core/oai/include/s1ap_messages_types.h" diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_hss_reset.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_hss_reset.c index 38d7ff371db3..d44e8b669869 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_hss_reset.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_hss_reset.c @@ -35,7 +35,7 @@ #include "lte/gateway/c/core/oai/include/s6a_messages_types.h" #include "lte/gateway/c/core/oai/lib/hashtable/hashtable.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" status_code_e mme_app_handle_s6a_reset_req( const s6a_reset_req_t* const rsr_pP) { diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.c index f5d778b39311..b391cfc8ecc1 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.c @@ -48,7 +48,7 @@ #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_bearer_context.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgw_selection.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #if EMBEDDED_SGW diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_location.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_location.c index fe3fb56955d6..a4d1c47388a3 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_location.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_location.c @@ -49,9 +49,9 @@ #include "lte/gateway/c/core/oai/lib/itti/itti_types.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_main.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_main.c index 2beb0c396228..643d0a65393c 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_main.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_main.c @@ -48,8 +48,15 @@ #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_edns_emulation.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_extern.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_ha.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/nas_network.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_network.hpp" + +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" +#ifdef __cplusplus +} +#endif static void check_mme_healthy_and_notify_service(void); static bool is_mme_app_healthy(void); diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_alert.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_alert.c index 3c006c5e4948..ea7e553b4eb9 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_alert.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_alert.c @@ -52,7 +52,7 @@ #include "lte/gateway/c/core/oai/lib/itti/itti_types.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" static int mme_app_send_sgsap_alert_reject( diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_paging.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_paging.c index 82b3228cfc12..007e1a3b3a68 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_paging.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_paging.c @@ -44,8 +44,8 @@ #include "lte/gateway/c/core/oai/lib/itti/itti_types.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp" #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_reset.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_reset.c index 0d71ce85f890..46013e50efc1 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_reset.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_reset.c @@ -43,7 +43,7 @@ #include "lte/gateway/c/core/oai/lib/hashtable/hashtable.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgsap_location_update.c b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgsap_location_update.c index 046748cdf81a..478be063d3e2 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgsap_location_update.c +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgsap_location_update.c @@ -48,7 +48,7 @@ #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_fsm.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_messages.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/EpsAttachType.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/EpsUpdateType.h" #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_state_manager.cpp b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_state_manager.cpp index a486ce0505f9..e6f3237a0e9f 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_state_manager.cpp +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_state_manager.cpp @@ -20,7 +20,7 @@ extern "C" { #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" } #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_state_manager.hpp" diff --git a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h index 21ce366cce44..8e47a956225b 100644 --- a/lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h +++ b/lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h @@ -20,7 +20,7 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/itti/intertask_interface.h" #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" #define MME_APP_TIMER_INACTIVE_ID (-1) diff --git a/lte/gateway/c/core/oai/tasks/nas/CMakeLists.txt b/lte/gateway/c/core/oai/tasks/nas/CMakeLists.txt index df1d835a78e0..32e05e63b72a 100644 --- a/lte/gateway/c/core/oai/tasks/nas/CMakeLists.txt +++ b/lte/gateway/c/core/oai/tasks/nas/CMakeLists.txt @@ -13,11 +13,11 @@ message("Proto_srcs are ${PROTO_SRCS}") include_directories("${S1AP_C_DIR}") include_directories(${CMAKE_SOURCE_DIR}) set(libnas_api_OBJS - ${CMAKE_CURRENT_SOURCE_DIR}/api/network/nas_message.c + ${CMAKE_CURRENT_SOURCE_DIR}/api/network/nas_message.cpp ) set(libnas_mme_api_OBJS - ${CMAKE_CURRENT_SOURCE_DIR}/api/mme/mme_api.c + ${CMAKE_CURRENT_SOURCE_DIR}/api/mme/mme_api.cpp ) set(libnas_emm_msg_OBJS @@ -130,46 +130,46 @@ set(libnas_ies_OBJS include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util) set(libnas_utils_OBJS - ${CMAKE_CURRENT_SOURCE_DIR}/util/nas_timer.c + ${CMAKE_CURRENT_SOURCE_DIR}/util/nas_timer.cpp ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/api/mme) set(libnas_mme_api_OBJS - ${CMAKE_CURRENT_SOURCE_DIR}/api/mme/mme_api.c + ${CMAKE_CURRENT_SOURCE_DIR}/api/mme/mme_api.cpp ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/emm) set(libnas_mme_emm_OBJS - ${CMAKE_CURRENT_SOURCE_DIR}/emm/Attach.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/Authentication.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/Detach.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/EmmInformation.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/emm_data_ctx.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/emm_main.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/EmmStatusHdl.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/Identification.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/LowerLayer.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/SecurityModeControl.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/ServiceRequestHdl.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/TrackingAreaUpdate.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/EmmCommon.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/NasTransportHdl.c + ${CMAKE_CURRENT_SOURCE_DIR}/emm/Attach.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/Authentication.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/Detach.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/EmmInformation.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/emm_data_ctx.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/emm_main.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/EmmStatusHdl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/Identification.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/LowerLayer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/SecurityModeControl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/ServiceRequestHdl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/TrackingAreaUpdate.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/EmmCommon.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/NasTransportHdl.cpp ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/emm/sap) set(libnas_mme_emm_sap_OBJS - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_as.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_cn.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/EmmCommonProcedureInitiated.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/EmmDeregistered.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/EmmDeregisteredInitiated.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_esm.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_fsm.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_recv.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_reg.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/EmmRegistered.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_sap.c - ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_send.c + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_as.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_cn.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/EmmCommonProcedureInitiated.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/EmmDeregistered.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/EmmDeregisteredInitiated.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_esm.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_fsm.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_recv.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_reg.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/EmmRegistered.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_sap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/emm/sap/emm_send.cpp ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/esm) @@ -197,9 +197,9 @@ set(libnas_mme_esm_sap_OBJS ) add_library(TASK_NAS - nas_network.c - nas_proc.c - nas_procedures.c + nas_network.cpp + nas_proc.cpp + nas_procedures.cpp nas_state_converter.cpp ${libnas_api_OBJS} ${libnas_mme_api_OBJS} diff --git a/lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.c b/lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.cpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.c rename to lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.cpp index 95044b42c70e..448c6c78c940 100644 --- a/lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.c +++ b/lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.cpp @@ -16,7 +16,7 @@ */ /***************************************************************************** - Source mme_api.c + Source mme_api.cpp Version 0.1 @@ -32,25 +32,34 @@ to interact with a Mobility Management Entity *****************************************************************************/ + +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" + #include #include #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/conversions.h" #include "lte/gateway/c/core/oai/common/log.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/mme_app_state.hpp" #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/include/mme_config.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_23.003.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/EpsNetworkFeatureSupport.h" /****************************************************************************/ @@ -137,7 +146,8 @@ status_code_e mme_api_get_emm_config(mme_api_emm_config_t* config, } if (mme_config_p->unauthenticated_imsi_supported != 0) { - config->features |= MME_API_UNAUTHENTICATED_IMSI; + config->features = + (mme_api_feature_t)(config->features | MME_API_UNAUTHENTICATED_IMSI); } for (int i = 0; i < 8; i++) { @@ -171,19 +181,22 @@ status_code_e mme_api_get_emm_config(mme_api_emm_config_t* config, status_code_e mme_api_get_esm_config(mme_api_esm_config_t* config) { OAILOG_FUNC_IN(LOG_NAS); if (mme_config.non_eps_service_control == NULL) { - config->features = 0; + config->features = MME_API_NO_FEATURE_SUPPORTED; OAILOG_FUNC_RETURN(LOG_NAS, RETURNok); } if (strcmp((const char*)mme_config.non_eps_service_control->data, "SMS") == 0) { - config->features = config->features | MME_API_SMS_SUPPORTED; + config->features = + (mme_api_feature_t)(config->features | MME_API_SMS_SUPPORTED); } else if (strcmp((const char*)mme_config.non_eps_service_control->data, "CSFB_SMS") == 0) { - config->features = config->features | MME_API_CSFB_SMS_SUPPORTED; + config->features = + (mme_api_feature_t)(config->features | MME_API_CSFB_SMS_SUPPORTED); } else if (strcmp((const char*)mme_config.non_eps_service_control->data, "SMS_ORC8R") == 0) { - config->features = config->features | MME_API_SMS_ORC8R_SUPPORTED; + config->features = + (mme_api_feature_t)(config->features | MME_API_SMS_ORC8R_SUPPORTED); } OAILOG_FUNC_RETURN(LOG_NAS, RETURNok); diff --git a/lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h b/lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp similarity index 87% rename from lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h rename to lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp index 45b463e470b5..5d56906579be 100644 --- a/lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h +++ b/lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source mme_api.h +Source mme_api.hpp Version 0.1 @@ -156,32 +156,41 @@ status_code_e mme_api_unsubscribe(bstring apn); } #endif -status_code_e mme_api_notify_imsi(const mme_ue_s1ap_id_t id, - const imsi64_t imsi64); - status_code_e mme_api_notify_new_guti(const mme_ue_s1ap_id_t ueid, guti_t* const guti); +/*TODO: These declarations are temporarily moved to emm_headers.hpp file to + * resolve undefined references. Uncomment these functions and delete + * emm_headers.hpp after moving all the files to c++ + * GH issue: https://github.com/magma/magma/issues/13096 + */ +/*status_code_e mme_api_notify_imsi(const mme_ue_s1ap_id_t id, + const imsi64_t imsi64); status_code_e mme_api_new_guti(const imsi_t* const imsi, const guti_t* const old_guti, guti_t* const guti, const tai_t* const originating_tai, - tai_list_t* const tai_list); + tai_list_t* const tai_list);*/ status_code_e mme_api_subscribe(bstring* apn, mme_api_ip_version_t mme_pdn_index, bstring* pdn_addr, int is_emergency, mme_api_qos_t* qos); +#ifdef __cplusplus +extern "C" { +#endif void mme_ue_context_update_ue_emm_state(mme_ue_s1ap_id_t mme_ue_s1ap_id, mm_state_t new_emm_state); +bool mme_ue_context_get_ue_sgs_neaf(mme_ue_s1ap_id_t mme_ue_s1ap_id); +#ifdef __cplusplus +} +#endif bool mme_ue_context_get_ue_sgs_vlr_reliable(mme_ue_s1ap_id_t mme_ue_s1ap_id); void mme_ue_context_update_ue_sgs_vlr_reliable(mme_ue_s1ap_id_t mme_ue_s1ap_id, bool vlr_reliable); -bool mme_ue_context_get_ue_sgs_neaf(mme_ue_s1ap_id_t mme_ue_s1ap_id); - void mme_ue_context_update_ue_sgs_neaf(mme_ue_s1ap_id_t mme_ue_s1ap_id, bool neaf); @@ -228,6 +237,26 @@ void mme_ue_context_update_ue_sgs_neaf(mme_ue_s1ap_id_t mme_ue_s1ap_id, pLMN1.mnc[2] = pLMN2.mnc_digit3; \ } while (0) +#define COPY_PLMN_IN_CHAR_ARRAY_FMT(pLMN1, pLMN2) \ + do { \ + pLMN1[0] = pLMN2.mcc_digit1 + ASCII_ZERO; \ + pLMN1[1] = pLMN2.mcc_digit2 + ASCII_ZERO; \ + pLMN1[2] = pLMN2.mcc_digit3 + ASCII_ZERO; \ + pLMN1[3] = pLMN2.mnc_digit1 + ASCII_ZERO; \ + pLMN1[4] = pLMN2.mnc_digit2 + ASCII_ZERO; \ + pLMN1[5] = pLMN2.mnc_digit3 + ASCII_ZERO; \ + } while (0) + +#define COPY_PLMN_FROM_CHAR_ARRAY_FMT(pLMN1, pLMN2) \ + do { \ + pLMN1.mcc_digit1 = pLMN2[0] - ASCII_ZERO; \ + pLMN1.mcc_digit2 = pLMN2[1] - ASCII_ZERO; \ + pLMN1.mcc_digit3 = pLMN2[2] - ASCII_ZERO; \ + pLMN1.mnc_digit1 = pLMN2[3] - ASCII_ZERO; \ + pLMN1.mnc_digit2 = pLMN2[4] - ASCII_ZERO; \ + pLMN1.mnc_digit3 = pLMN2[5] - ASCII_ZERO; \ + } while (0) + #define OAILOG_DEBUG_GUTI(gUTI_p) \ do { \ OAILOG_DEBUG( \ diff --git a/lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.c b/lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.cpp similarity index 99% rename from lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.c rename to lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.cpp index 45e4e925263c..5ec3b8b050a8 100644 --- a/lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.c +++ b/lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.cpp @@ -21,14 +21,21 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/common/log.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/nas/securityDef.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" #include "lte/gateway/c/core/oai/lib/secu/secu_defs.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/ServiceRequest.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_msgDef.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/KsiAndSequenceNumber.h" @@ -348,7 +355,7 @@ int nas_message_decode(const unsigned char* const buffer, nas_message_t* msg, * Decode the header */ OAILOG_STREAM_HEX(OAILOG_LEVEL_DEBUG, LOG_NAS, - "Incoming NAS message: ", buffer, length); + "Incoming NAS message: ", (const char*)buffer, length); if (emm_security_context) { status->security_context_available = 1; } diff --git a/lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.h b/lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.hpp similarity index 92% rename from lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.h rename to lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.hpp index cf71f3aaed1c..37443397ed20 100644 --- a/lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.h +++ b/lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.hpp @@ -17,7 +17,7 @@ /***************************************************************************** -Source nas_message.h +Source nas_message.hpp Version 0.1 @@ -43,7 +43,7 @@ Description Defines the layer 3 messages supported by the NAS sublayer #include "lte/gateway/c/core/oai/include/nas/commonDef.h" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_msg.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/msg/esm_msg.hpp" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.007.h" @@ -113,11 +113,12 @@ int nas_message_header_decode(const unsigned char* const buffer, nas_message_decode_status_t* const status, bool* const is_sr); -int nas_message_encrypt(const unsigned char* inbuf, unsigned char* outbuf, - const nas_message_security_header_t* header, - size_t length, void* security); +/*TODO: These declarations are temporarily moved to emm_headers.hpp file to + * resolve undefined references. Uncomment these functions and delete + * emm_headers.hpp after moving all the files to c++ + */ -int nas_message_decrypt(const unsigned char* const inbuf, +/*int nas_message_decrypt(const unsigned char* const inbuf, unsigned char* const outbuf, nas_message_security_header_t* header, size_t length, void* security, nas_message_decode_status_t* status); @@ -129,4 +130,8 @@ int nas_message_decode(const unsigned char* const buffer, nas_message_t* msg, int nas_message_encode(unsigned char* buffer, const nas_message_t* const msg, size_t length, void* security); +int nas_message_encrypt(const unsigned char* inbuf, unsigned char* outbuf, + const nas_message_security_header_t* header, + size_t length, void* security);*/ + #endif /* FILE_NAS_MESSAGE_SEEN*/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/Attach.c b/lte/gateway/c/core/oai/tasks/nas/emm/Attach.cpp similarity index 92% rename from lte/gateway/c/core/oai/tasks/nas/emm/Attach.c rename to lte/gateway/c/core/oai/tasks/nas/emm/Attach.cpp index 57d4b2dd276e..b910f9e6fef0 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/Attach.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/Attach.cpp @@ -17,7 +17,7 @@ /***************************************************************************** - Source Attach.c + Source Attach.cpp Version 0.1 @@ -54,47 +54,55 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/common/dynamic_memory_check.h" -#include "lte/gateway/c/core/oai/common/common_ies.h" -#include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/conversions.h" #include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" +#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" +#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" +#ifdef __cplusplus +} +#endif + +#include "lte/gateway/c/core/oai/common/common_ies.h" +#include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/include/mme_app_state.hpp" #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/include/mme_config.h" #include "lte/gateway/c/core/oai/include/mme_events.hpp" -#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" -#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" +#include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.008.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_23.003.h" -#include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" #include "lte/gateway/c/core/oai/include/3gpp_requirements_24.301.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_cause.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sapDef.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/AdditionalUpdateType.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/EmmCause.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/EpsNetworkFeatureSupport.h" #include "lte/gateway/c/core/oai/include/TrackingAreaIdentity.h" @@ -122,7 +130,7 @@ static const char* emm_attach_type_str[] = {"EPS", "IMSI", "EMERGENCY", /* Functions that may initiate EMM common procedures */ -static int emm_start_attach_proc_authentication( +static status_code_e emm_start_attach_proc_authentication( emm_context_t* emm_context, nas_emm_attach_proc_t* attach_proc); static int emm_start_attach_proc_security(emm_context_t* emm_context, nas_emm_attach_proc_t* attach_proc); @@ -144,8 +152,8 @@ static int emm_attach_identification_after_smc_success_cb( static int emm_attach_release(emm_context_t* emm_context); static int emm_attach_abort(struct emm_context_s* emm_context, struct nas_base_proc_s* base_proc); -static int emm_attach_run_procedure(emm_context_t* emm_context); -static int emm_send_attach_accept(emm_context_t* emm_context); +static status_code_e emm_attach_run_procedure(emm_context_t* emm_context); +static status_code_e emm_send_attach_accept(emm_context_t* emm_context); static bool emm_attach_ies_have_changed(mme_ue_s1ap_id_t ue_id, emm_attach_request_ies_t* const ies1, @@ -356,7 +364,7 @@ status_code_e emm_proc_attach_request( "not_handled"); } else { REQUIREMENT_3GPP_24_301(R10_5_4_4_6_d); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_ABORT; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = &imsi_ue_mm_ctx->emm_context; @@ -612,7 +620,7 @@ status_code_e emm_proc_attach_reject(mme_ue_s1ap_id_t ue_id, // TODO could be in callback of attach procedure triggered by // EMMREG_ATTACH_REJ rc = _emm_attach_reject(emm_ctx, (struct nas_base_proc_s*)attach_proc); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_ATTACH_REJ; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -662,8 +670,8 @@ status_code_e emm_proc_attach_complete( ue_mm_context_t* ue_mm_context = NULL; nas_emm_attach_proc_t* attach_proc = NULL; status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; - esm_sap_t esm_sap = {0}; + emm_sap_t emm_sap = {}; + esm_sap_t esm_sap = {}; emm_context_t* emm_ctx = NULL; /* @@ -832,25 +840,27 @@ status_code_e emm_proc_attach_complete( */ void set_callbacks_for_attach_proc(nas_emm_attach_proc_t* attach_proc) { - ((nas_base_proc_t*)attach_proc)->abort = emm_attach_abort; - ((nas_base_proc_t*)attach_proc)->fail_in = NULL; - ((nas_base_proc_t*)attach_proc)->time_out = - mme_app_handle_emm_attach_t3450_expiry; - ((nas_base_proc_t*)attach_proc)->fail_out = _emm_attach_reject; + (reinterpret_cast(attach_proc))->abort = + (proc_abort_t)emm_attach_abort; + (reinterpret_cast(attach_proc))->fail_in = NULL; + (reinterpret_cast(attach_proc))->time_out = + (time_out_t)mme_app_handle_emm_attach_t3450_expiry; + (reinterpret_cast(attach_proc))->fail_out = + _emm_attach_reject; } void set_notif_callbacks_for_auth_proc(nas_emm_auth_proc_t* auth_proc) { auth_proc->emm_com_proc.emm_proc.base_proc.success_notif = - emm_attach_success_authentication_cb; + (success_cb_t)emm_attach_success_authentication_cb; auth_proc->emm_com_proc.emm_proc.base_proc.failure_notif = - emm_attach_failure_authentication_cb; + (failure_cb_t)emm_attach_failure_authentication_cb; } void set_notif_callbacks_for_smc_proc(nas_emm_smc_proc_t* smc_proc) { smc_proc->emm_com_proc.emm_proc.base_proc.success_notif = - emm_attach_success_security_cb; + (success_cb_t)emm_attach_success_security_cb; smc_proc->emm_com_proc.emm_proc.base_proc.failure_notif = - emm_attach_failure_security_cb; + (failure_cb_t)emm_attach_failure_security_cb; } /****************************************************************************/ @@ -866,11 +876,14 @@ static void emm_proc_create_procedure_attach_request( if ((attach_proc)) { attach_proc->ies = ies; attach_proc->ue_id = ue_mm_context->mme_ue_s1ap_id; - ((nas_base_proc_t*)attach_proc)->abort = emm_attach_abort; - ((nas_base_proc_t*)attach_proc)->fail_in = NULL; // No parent procedure - ((nas_base_proc_t*)attach_proc)->time_out = - mme_app_handle_emm_attach_t3450_expiry; - ((nas_base_proc_t*)attach_proc)->fail_out = _emm_attach_reject; + (reinterpret_cast(attach_proc))->abort = + (proc_abort_t)emm_attach_abort; + (reinterpret_cast(attach_proc))->fail_in = + NULL; // No parent procedure + (reinterpret_cast(attach_proc))->time_out = + (time_out_t)mme_app_handle_emm_attach_t3450_expiry; + (reinterpret_cast(attach_proc))->fail_out = + _emm_attach_reject; } } /* @@ -897,7 +910,7 @@ static void emm_proc_create_procedure_attach_request( * Others: None * * Outputs: None - * Return: None + * Return: RETURNok, RETURNerror * Others: None * */ @@ -913,7 +926,7 @@ status_code_e mme_app_handle_emm_attach_t3450_expiry(zloop_t* loop, } struct ue_mm_context_s* ue_context_p = mme_app_get_ue_context_for_timer( - mme_ue_s1ap_id, "Attach Procedure T3450 Timer"); + mme_ue_s1ap_id, const_cast("Attach Procedure T3450 Timer")); if (ue_context_p == NULL) { OAILOG_ERROR( LOG_MME_APP, @@ -947,7 +960,7 @@ status_code_e mme_app_handle_emm_attach_t3450_expiry(zloop_t* loop, /* * Abort the attach procedure */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_ATTACH_ABORT; emm_sap.u.emm_reg.ue_id = attach_proc->ue_id; emm_sap.u.emm_reg.ctx = emm_context; @@ -1007,14 +1020,14 @@ status_code_e _emm_attach_reject(emm_context_t* emm_context, status_code_e rc = RETURNerror; attach_reject_event(emm_context->_imsi64); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; struct nas_emm_attach_proc_s* attach_proc = (struct nas_emm_attach_proc_s*)nas_base_proc; OAILOG_WARNING(LOG_NAS_EMM, "EMM-PROC - EMM attach procedure not accepted " "by the network (ue_id=" MME_UE_S1AP_ID_FMT ", cause=%s)\n", - attach_proc->ue_id, emm_cause_str[attach_proc->emm_cause]); + attach_proc->ue_id, emm_cause_str(attach_proc->emm_cause)); /* * Notify EMM-AS SAP that Attach Reject message has to be sent * onto the network @@ -1081,7 +1094,7 @@ static int emm_attach_abort(struct emm_context_s* emm_context, attach_proc->ue_id); // Trigger clean up - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMCN_IMPLICIT_DETACH_UE; emm_sap.u.emm_cn.u.emm_cn_implicit_detach.ue_id = attach_proc->ue_id; rc = emm_sap_send(&emm_sap); @@ -1098,9 +1111,9 @@ static int emm_attach_abort(struct emm_context_s* emm_context, */ //------------------------------------------------------------------------------ -static int emm_attach_run_procedure(emm_context_t* emm_context) { +static status_code_e emm_attach_run_procedure(emm_context_t* emm_context) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNerror; + status_code_e rc = RETURNerror; nas_emm_attach_proc_t* attach_proc = get_nas_specific_procedure_attach(emm_context); @@ -1144,16 +1157,18 @@ static int emm_attach_run_procedure(emm_context_t* emm_context) { } } else { // force identification, even if not necessary - rc = emm_proc_identification(emm_context, (nas_emm_proc_t*)attach_proc, - IDENTITY_TYPE_2_IMSI, - emm_attach_success_identification_cb, - emm_attach_failure_identification_cb); + rc = emm_proc_identification( + emm_context, reinterpret_cast(attach_proc), + IDENTITY_TYPE_2_IMSI, + (success_cb_t)emm_attach_success_identification_cb, + (failure_cb_t)emm_attach_failure_identification_cb); } } else if (attach_proc->ies->guti) { - rc = emm_proc_identification(emm_context, (nas_emm_proc_t*)attach_proc, - IDENTITY_TYPE_2_IMSI, - emm_attach_success_identification_cb, - emm_attach_failure_identification_cb); + rc = emm_proc_identification( + emm_context, reinterpret_cast(attach_proc), + IDENTITY_TYPE_2_IMSI, + (success_cb_t)emm_attach_success_identification_cb, + (failure_cb_t)emm_attach_failure_identification_cb); } else if (attach_proc->ies->imei) { // Emergency attach is not supported OAILOG_ERROR(LOG_NAS_EMM, "Emergency attach is not supported"); @@ -1207,15 +1222,16 @@ static int emm_attach_failure_identification_cb(emm_context_t* emm_context) { } //------------------------------------------------------------------------------ -static int emm_start_attach_proc_authentication( +static status_code_e emm_start_attach_proc_authentication( emm_context_t* emm_context, nas_emm_attach_proc_t* attach_proc) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNerror; + status_code_e rc = RETURNerror; if ((emm_context) && (attach_proc)) { - rc = emm_proc_authentication(emm_context, &attach_proc->emm_spec_proc, - emm_attach_success_authentication_cb, - emm_attach_failure_authentication_cb); + rc = emm_proc_authentication( + emm_context, &attach_proc->emm_spec_proc, + (success_cb_t)emm_attach_success_authentication_cb, + (failure_cb_t)emm_attach_failure_authentication_cb); } OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1265,7 +1281,7 @@ static int emm_attach_failure_authentication_cb(emm_context_t* emm_context) { emm_context->emm_cause = EMM_CAUSE_NETWORK_FAILURE; attach_proc->emm_cause = emm_context->emm_cause; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_ATTACH_REJ; emm_sap.u.emm_reg.ue_id = attach_proc->ue_id; emm_sap.u.emm_reg.ctx = emm_context; @@ -1295,7 +1311,8 @@ static int emm_start_attach_proc_security(emm_context_t* emm_context, emm_ctx_clear_security(emm_context); rc = emm_proc_security_mode_control( emm_context, &attach_proc->emm_spec_proc, attach_proc->ksi, - emm_attach_success_security_cb, emm_attach_failure_security_cb); + (success_cb_t)emm_attach_success_security_cb, + (failure_cb_t)emm_attach_failure_security_cb); if (rc != RETURNok) { /* * Failed to initiate the security mode control procedure @@ -1309,7 +1326,7 @@ static int emm_start_attach_proc_security(emm_context_t* emm_context, /* * Do not accept the UE to attach to the network */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_ATTACH_REJ; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_context; @@ -1349,10 +1366,11 @@ static int emm_attach_success_security_cb(emm_context_t* emm_context) { emm_context->initiate_identity_after_smc = false; OAILOG_DEBUG_UE(LOG_NAS_EMM, emm_context->_imsi64, "Trigger identity procedure\n"); - rc = emm_proc_identification(emm_context, (nas_emm_proc_t*)attach_proc, - IDENTITY_TYPE_2_IMEISV, - emm_attach_identification_after_smc_success_cb, - emm_attach_failure_identification_cb); + rc = emm_proc_identification( + emm_context, reinterpret_cast(attach_proc), + IDENTITY_TYPE_2_IMEISV, + (success_cb_t)emm_attach_identification_after_smc_success_cb, + (failure_cb_t)emm_attach_failure_identification_cb); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1442,7 +1460,7 @@ static int emm_attach(emm_context_t* emm_context) { if (attach_proc) { if (attach_proc->ies->esm_msg) { - esm_sap_t esm_sap = {0}; + esm_sap_t esm_sap = {}; esm_sap.primitive = ESM_UNITDATA_IND; esm_sap.is_standalone = false; esm_sap.ue_id = ue_id; @@ -1467,7 +1485,7 @@ static int emm_attach(emm_context_t* emm_context) { LOG_NAS_EMM, "Sending Attach Reject to UE for ue_id = " MME_UE_S1AP_ID_FMT ", emm_cause = (%s)\n", - ue_id, emm_cause_str[attach_proc->emm_cause]); + ue_id, emm_cause_str(attach_proc->emm_cause)); rc = _emm_attach_reject(emm_context, &attach_proc->emm_spec_proc.emm_proc.base_proc); } else { @@ -1502,7 +1520,7 @@ static int emm_attach(emm_context_t* emm_context) { OAILOG_ERROR(LOG_NAS_EMM, "Sending Attach Reject to UE ue_id = " MME_UE_S1AP_ID_FMT ", emm_cause = (%s)\n", - ue_id, emm_cause_str[attach_proc->emm_cause]); + ue_id, emm_cause_str(attach_proc->emm_cause)); rc = _emm_attach_reject(emm_context, &attach_proc->emm_spec_proc.emm_proc.base_proc); increment_counter("ue_attach", 1, 2, "result", "failure", "cause", @@ -1597,13 +1615,13 @@ status_code_e emm_cn_wrapper_attach_accept(emm_context_t* emm_context) { ** Others: T3450 ** ** ** ***************************************************************************/ -static int emm_send_attach_accept(emm_context_t* emm_context) { +static status_code_e emm_send_attach_accept(emm_context_t* emm_context) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNerror; + status_code_e rc = RETURNerror; // may be caused by timer not stopped when deleted context if (emm_context) { - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; nas_emm_attach_proc_t* attach_proc = get_nas_specific_procedure_attach(emm_context); ue_mm_context_t* ue_mm_context_p = @@ -1644,11 +1662,9 @@ static int emm_send_attach_accept(emm_context_t* emm_context) { if (!IS_EMM_CTXT_PRESENT_GUTI(emm_context)) { // Sure it is an unknown GUTI in this MME guti_t old_guti = emm_context->_old_guti; - guti_t guti = {.gummei.plmn = {0}, - .gummei.mme_gid = 0, - .gummei.mme_code = 0, - .m_tmsi = INVALID_M_TMSI}; + guti_t guti = {}; clear_guti(&guti); + guti.m_tmsi = INVALID_M_TMSI; rc = mme_api_new_guti(&emm_context->_imsi, &old_guti, &guti, &emm_context->originating_tai, @@ -1836,7 +1852,7 @@ static void encode_csfb_parameters_attach_accept_retx(emm_context_t* emm_ctx, ***************************************************************************/ static int emm_attach_accept_retx(emm_context_t* emm_context) { OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; int rc = RETURNerror; if (!emm_context) { @@ -2530,44 +2546,79 @@ void proc_new_attach_req(mme_ue_context_t* const mme_ue_context_p, OAILOG_FUNC_OUT(LOG_NAS_EMM); } -const char* emm_cause_str[] = { - [EMM_CAUSE_IMSI_UNKNOWN_IN_HSS] = "EMM_CAUSE_IMSI_UNKNOWN_IN_HSS", - [EMM_CAUSE_ILLEGAL_UE] = "EMM_CAUSE_ILLEGAL_UE", - [EMM_CAUSE_IMEI_NOT_ACCEPTED] = "EMM_CAUSE_IMEI_NOT_ACCEPTED", - [EMM_CAUSE_ILLEGAL_ME] = "EMM_CAUSE_ILLEGAL_ME", - [EMM_CAUSE_EPS_NOT_ALLOWED] = "EMM_CAUSE_EPS_NOT_ALLOWED", - [EMM_CAUSE_BOTH_NOT_ALLOWED] = "EMM_CAUSE_BOTH_NOT_ALLOWED", - [EMM_CAUSE_UE_IDENTITY_CANT_BE_DERIVED_BY_NW] = - "EMM_CAUSE_UE_IDENTITY_CANT_BE_DERIVED_BY_NW", - [EMM_CAUSE_IMPLICITLY_DETACHED] = "EMM_CAUSE_IMPLICITLY_DETACHED", - [EMM_CAUSE_PLMN_NOT_ALLOWED] = "EMM_CAUSE_PLMN_NOT_ALLOWED", - [EMM_CAUSE_TA_NOT_ALLOWED] = "EMM_CAUSE_TA_NOT_ALLOWED", - [EMM_CAUSE_ROAMING_NOT_ALLOWED] = "EMM_CAUSE_ROAMING_NOT_ALLOWED", - [EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN] = "EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN", - [EMM_CAUSE_NO_SUITABLE_CELLS] = "EMM_CAUSE_NO_SUITABLE_CELLS", - [EMM_CAUSE_MSC_NOT_REACHABLE] = "EMM_CAUSE_MSC_NOT_REACHABLE", - [EMM_CAUSE_NETWORK_FAILURE] = "EMM_CAUSE_NETWORK_FAILURE", - [EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE] = "EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE", - [EMM_CAUSE_ESM_FAILURE] = "EMM_CAUSE_ESM_FAILURE", - [EMM_CAUSE_MAC_FAILURE] = "EMM_CAUSE_MAC_FAILURE", - [EMM_CAUSE_SYNCH_FAILURE] = "EMM_CAUSE_SYNCH_FAILURE", - [EMM_CAUSE_CONGESTION] = "EMM_CAUSE_CONGESTION", - [EMM_CAUSE_UE_SECURITY_MISMATCH] = "EMM_CAUSE_UE_SECURITY_MISMATCH", - [EMM_CAUSE_SECURITY_MODE_REJECTED] = "EMM_CAUSE_SECURITY_MODE_REJECTED", - [EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE] = - "EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE", - [EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN] = "EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN", - [EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE] = "EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE", - [EMM_CAUSE_NO_EPS_BEARER_CTX_ACTIVE] = "EMM_CAUSE_NO_EPS_BEARER_CTX_ACTIVE", - [EMM_CAUSE_SEMANTICALLY_INCORRECT] = "EMM_CAUSE_SEMANTICALLY_INCORRECT", - [EMM_CAUSE_INVALID_MANDATORY_INFO] = "EMM_CAUSE_INVALID_MANDATORY_INFO", - [EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED] = - "EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED", - [EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE] = - "EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE", - [EMM_CAUSE_IE_NOT_IMPLEMENTED] = "EMM_CAUSE_IE_NOT_IMPLEMENTED", - [EMM_CAUSE_CONDITIONAL_IE_ERROR] = "EMM_CAUSE_CONDITIONAL_IE_ERROR", - [EMM_CAUSE_MESSAGE_NOT_COMPATIBLE] = "EMM_CAUSE_MESSAGE_NOT_COMPATIBLE", - [AMF_CAUSE_PROTOCOL_ERROR] = "AMF_CAUSE_PROTOCOL_ERROR", - [EMM_CAUSE_SUCCESS] = "EMM_CAUSE_SUCCESS", -}; +const char* emm_cause_str(uint32_t emm_cause) { + switch (emm_cause) { + case EMM_CAUSE_IMSI_UNKNOWN_IN_HSS: + return "EMM_CAUSE_IMSI_UNKNOWN_IN_HSS"; + case EMM_CAUSE_ILLEGAL_UE: + return "EMM_CAUSE_ILLEGAL_UE"; + case EMM_CAUSE_IMEI_NOT_ACCEPTED: + return "EMM_CAUSE_IMEI_NOT_ACCEPTED"; + case EMM_CAUSE_ILLEGAL_ME: + return "EMM_CAUSE_ILLEGAL_ME"; + case EMM_CAUSE_EPS_NOT_ALLOWED: + return "EMM_CAUSE_EPS_NOT_ALLOWED"; + case EMM_CAUSE_BOTH_NOT_ALLOWED: + return "EMM_CAUSE_BOTH_NOT_ALLOWED"; + case EMM_CAUSE_UE_IDENTITY_CANT_BE_DERIVED_BY_NW: + return "EMM_CAUSE_UE_IDENTITY_CANT_BE_DERIVED_BY_NW"; + case EMM_CAUSE_IMPLICITLY_DETACHED: + return "EMM_CAUSE_IMPLICITLY_DETACHED"; + case EMM_CAUSE_PLMN_NOT_ALLOWED: + return "EMM_CAUSE_PLMN_NOT_ALLOWED"; + case EMM_CAUSE_TA_NOT_ALLOWED: + return "EMM_CAUSE_TA_NOT_ALLOWED"; + case EMM_CAUSE_ROAMING_NOT_ALLOWED: + return "EMM_CAUSE_ROAMING_NOT_ALLOWED"; + case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN: + return "EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN"; + case EMM_CAUSE_NO_SUITABLE_CELLS: + return "EMM_CAUSE_NO_SUITABLE_CELLS"; + case EMM_CAUSE_MSC_NOT_REACHABLE: + return "EMM_CAUSE_MSC_NOT_REACHABLE"; + case EMM_CAUSE_NETWORK_FAILURE: + return "EMM_CAUSE_NETWORK_FAILURE"; + case EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE: + return "EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE"; + case EMM_CAUSE_ESM_FAILURE: + return "EMM_CAUSE_ESM_FAILURE"; + case EMM_CAUSE_MAC_FAILURE: + return "EMM_CAUSE_MAC_FAILURE"; + case EMM_CAUSE_SYNCH_FAILURE: + return "EMM_CAUSE_SYNCH_FAILURE"; + case EMM_CAUSE_CONGESTION: + return "EMM_CAUSE_CONGESTION"; + case EMM_CAUSE_UE_SECURITY_MISMATCH: + return "EMM_CAUSE_UE_SECURITY_MISMATCH"; + case EMM_CAUSE_SECURITY_MODE_REJECTED: + return "EMM_CAUSE_SECURITY_MODE_REJECTED"; + case EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE: + return "EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE"; + case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN: + return "EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN"; + case EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE: + return "EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE"; + case EMM_CAUSE_NO_EPS_BEARER_CTX_ACTIVE: + return "EMM_CAUSE_NO_EPS_BEARER_CTX_ACTIVE"; + case EMM_CAUSE_SEMANTICALLY_INCORRECT: + return "EMM_CAUSE_SEMANTICALLY_INCORRECT"; + case EMM_CAUSE_INVALID_MANDATORY_INFO: + return "EMM_CAUSE_INVALID_MANDATORY_INFO"; + case EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED: + return "EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED"; + case EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE: + return "EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE"; + case EMM_CAUSE_IE_NOT_IMPLEMENTED: + return "EMM_CAUSE_IE_NOT_IMPLEMENTED"; + case EMM_CAUSE_CONDITIONAL_IE_ERROR: + return "EMM_CAUSE_CONDITIONAL_IE_ERROR"; + case EMM_CAUSE_MESSAGE_NOT_COMPATIBLE: + return "EMM_CAUSE_MESSAGE_NOT_COMPATIBLE"; + case AMF_CAUSE_PROTOCOL_ERROR: + return "AMF_CAUSE_PROTOCOL_ERROR"; + case EMM_CAUSE_SUCCESS: + return "EMM_CAUSE_SUCCESS"; + default: + return "UNKNOWN_CAUSE"; + } +} diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/Authentication.c b/lte/gateway/c/core/oai/tasks/nas/emm/Authentication.cpp similarity index 93% rename from lte/gateway/c/core/oai/tasks/nas/emm/Authentication.c rename to lte/gateway/c/core/oai/tasks/nas/emm/Authentication.cpp index 90c0d036d3d1..189bca822142 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/Authentication.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/Authentication.cpp @@ -20,12 +20,20 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/conversions.h" #include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#include "lte/gateway/c/core/oai/lib/itti/intertask_interface.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/common/security_types.h" #include "lte/gateway/c/core/oai/include/3gpp_requirements_24.301.h" #include "lte/gateway/c/core/oai/include/TrackingAreaIdentity.h" @@ -37,22 +45,22 @@ #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_33.401.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/lib/itti/intertask_interface.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/AuthenticationResponse.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_cause.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" +#include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" /****************************************************************************/ @@ -62,7 +70,6 @@ extern long mme_app_last_msg_latency; extern long pre_mme_task_msg_latency; extern bool mme_congestion_control_enabled; extern mme_congestion_params_t mme_congestion_params; - /****************************************************************************/ /******************* L O C A L D E F I N I T I O N S *******************/ /****************************************************************************/ @@ -86,7 +93,7 @@ static int authentication_non_delivered_ho(struct emm_context_s* emm_context, static int authentication_abort(struct emm_context_s* emm_context, struct nas_base_proc_s* base_proc); -static int start_authentication_information_procedure( +static status_code_e start_authentication_information_procedure( struct emm_context_s* emm_context, nas_emm_auth_proc_t* const auth_proc, const_bstring auts); static int auth_info_proc_success_cb(struct emm_context_s* emm_ctx); @@ -96,10 +103,10 @@ static int authentication_check_imsi_5_4_2_5__1( struct emm_context_s* emm_context); static int authentication_check_imsi_5_4_2_5__1_fail( struct emm_context_s* emm_context); -static int authentication_request(struct emm_context_s* emm_ctx, - nas_emm_auth_proc_t* auth_proc); -static int authentication_reject(struct emm_context_s* emm_context, - struct nas_base_proc_s* base_proc); +static status_code_e authentication_request(struct emm_context_s* emm_ctx, + nas_emm_auth_proc_t* auth_proc); +static status_code_e authentication_reject(struct emm_context_s* emm_context, + struct nas_base_proc_s* base_proc); static void nas_itti_auth_info_req(const mme_ue_s1ap_id_t ue_idP, const imsi_t* const imsiP, @@ -209,18 +216,19 @@ status_code_e emm_proc_authentication_ksi( auth_proc->emm_com_proc.emm_proc.previous_emm_fsm_state = emm_fsm_get_state(emm_context); auth_proc->emm_com_proc.emm_proc.not_delivered = - authentication_ll_failure; + (sdu_out_not_delivered_t)authentication_ll_failure; auth_proc->emm_com_proc.emm_proc.not_delivered_ho = - authentication_non_delivered_ho; + (sdu_out_not_delivered_ho_t)authentication_non_delivered_ho; auth_proc->emm_com_proc.emm_proc.base_proc.success_notif = success; auth_proc->emm_com_proc.emm_proc.base_proc.failure_notif = failure; - auth_proc->emm_com_proc.emm_proc.base_proc.abort = authentication_abort; + auth_proc->emm_com_proc.emm_proc.base_proc.abort = + (proc_abort_t)authentication_abort; auth_proc->emm_com_proc.emm_proc.base_proc.fail_in = NULL; // only response auth_proc->emm_com_proc.emm_proc.base_proc.fail_out = - authentication_reject; + (pdu_out_rej_t)authentication_reject; auth_proc->emm_com_proc.emm_proc.base_proc.time_out = - mme_app_handle_auth_t3460_expiry; + (time_out_t)mme_app_handle_auth_t3460_expiry; } /* @@ -232,7 +240,7 @@ status_code_e emm_proc_authentication_ksi( /* * Notify EMM that common procedure has been initiated */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REQ; emm_sap.u.emm_reg.ue_id = ue_id; @@ -279,9 +287,11 @@ status_code_e emm_proc_authentication( auth_proc->emm_com_proc.emm_proc.not_delivered_ho = NULL; auth_proc->emm_com_proc.emm_proc.base_proc.success_notif = success; auth_proc->emm_com_proc.emm_proc.base_proc.failure_notif = failure; - auth_proc->emm_com_proc.emm_proc.base_proc.abort = authentication_abort; + auth_proc->emm_com_proc.emm_proc.base_proc.abort = + (proc_abort_t)authentication_abort; auth_proc->emm_com_proc.emm_proc.base_proc.fail_in = NULL; // only response - auth_proc->emm_com_proc.emm_proc.base_proc.fail_out = authentication_reject; + auth_proc->emm_com_proc.emm_proc.base_proc.fail_out = + (pdu_out_rej_t)authentication_reject; auth_proc->emm_com_proc.emm_proc.base_proc.time_out = NULL; bool run_auth_info_proc = false; @@ -331,7 +341,7 @@ status_code_e emm_proc_authentication( } //------------------------------------------------------------------------------ -static int start_authentication_information_procedure( +static status_code_e start_authentication_information_procedure( struct emm_context_s* emm_context, nas_emm_auth_proc_t* const auth_proc, const_bstring auts) { OAILOG_FUNC_IN(LOG_NAS_EMM); @@ -350,13 +360,14 @@ static int start_authentication_information_procedure( &auth_proc->emm_com_proc.emm_proc.base_proc; auth_proc->emm_com_proc.emm_proc.base_proc.child = &auth_info_proc->cn_proc.base_proc; - auth_info_proc->success_notif = auth_info_proc_success_cb; - auth_info_proc->failure_notif = auth_info_proc_failure_cb; - auth_info_proc->cn_proc.base_proc.time_out = mme_app_handle_air_timer_expiry; + auth_info_proc->success_notif = (success_cb_t)auth_info_proc_success_cb; + auth_info_proc->failure_notif = (failure_cb_t)auth_info_proc_failure_cb; + auth_info_proc->cn_proc.base_proc.time_out = + (time_out_t)mme_app_handle_air_timer_expiry; auth_info_proc->ue_id = ue_id; auth_info_proc->resync = auth_info_proc->request_sent; - plmn_t visited_plmn = {0}; + plmn_t visited_plmn = {}; COPY_PLMN(visited_plmn, emm_context->originating_tai.plmn); bool is_initial_req = !(auth_info_proc->request_sent); @@ -475,7 +486,7 @@ static int auth_info_proc_success_cb(struct emm_context_s* emm_ctx) { auth_proc->ksi = eksi; // re-enter previous EMM state, before re-initiating the procedure - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_ABORT; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -520,7 +531,7 @@ static int auth_info_proc_success_cb(struct emm_context_s* emm_ctx) { nas_delete_cn_procedure(emm_ctx, &auth_info_proc->cn_proc); if (rc != RETURNok) { - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -559,7 +570,7 @@ static int auth_info_proc_failure_cb(struct emm_context_s* emm_ctx) { auth_proc->emm_cause = emm_cause; if (EMM_COMMON_PROCEDURE_INITIATED == emm_fsm_get_state(emm_ctx)) { - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -639,7 +650,8 @@ status_code_e emm_proc_authentication_failure(mme_ue_s1ap_id_t ue_id, // Pass back the current rand. REQUIREMENT_3GPP_24_301(R10_5_4_2_7_e__2); struct tagbstring resync_param; - resync_param.data = (unsigned char*)calloc(1, RESYNC_PARAM_LENGTH); + resync_param.data = + reinterpret_cast(calloc(1, RESYNC_PARAM_LENGTH)); DevAssert(resync_param.data != NULL); if (resync_param.data == NULL) { OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); @@ -661,7 +673,7 @@ status_code_e emm_proc_authentication_failure(mme_ue_s1ap_id_t ue_id, } else { REQUIREMENT_3GPP_24_301(R10_5_4_2_7_e__NOTE3); auth_proc->emm_cause = EMM_CAUSE_SYNCH_FAILURE; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -682,7 +694,7 @@ status_code_e emm_proc_authentication_failure(mme_ue_s1ap_id_t ue_id, if (1 == auth_proc->mac_fail_count) { // Only to return to a "valid" EMM state { - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_ABORT; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -695,8 +707,9 @@ status_code_e emm_proc_authentication_failure(mme_ue_s1ap_id_t ue_id, } rc = emm_proc_identification( emm_ctx, &auth_proc->emm_com_proc.emm_proc, - IDENTITY_TYPE_2_IMSI, authentication_check_imsi_5_4_2_5__1, - authentication_check_imsi_5_4_2_5__1_fail); + IDENTITY_TYPE_2_IMSI, + (success_cb_t)authentication_check_imsi_5_4_2_5__1, + (failure_cb_t)authentication_check_imsi_5_4_2_5__1_fail); } else { rc = RETURNerror; } @@ -710,7 +723,7 @@ status_code_e emm_proc_authentication_failure(mme_ue_s1ap_id_t ue_id, /* * Notify EMM that the authentication procedure failed */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -730,7 +743,7 @@ status_code_e emm_proc_authentication_failure(mme_ue_s1ap_id_t ue_id, auth_proc->emm_cause = EMM_CAUSE_MAC_FAILURE; // EMM_CAUSE_ILLEGAL_UE; // Do not accept the UE to attach to the network - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -761,7 +774,7 @@ status_code_e emm_proc_authentication_failure(mme_ue_s1ap_id_t ue_id, } else { // Only to return to a "valid" EMM state { - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_ABORT; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -775,14 +788,14 @@ status_code_e emm_proc_authentication_failure(mme_ue_s1ap_id_t ue_id, if (auth_proc->unchecked_imsi) { free_wrapper((void**)&auth_proc->unchecked_imsi); } - auth_proc->unchecked_imsi = - calloc(1, sizeof(*auth_proc->unchecked_imsi)); + auth_proc->unchecked_imsi = reinterpret_cast( + calloc(1, sizeof(*auth_proc->unchecked_imsi))); memcpy(auth_proc->unchecked_imsi, &emm_ctx->_imsi, sizeof(*auth_proc->unchecked_imsi)); rc = emm_proc_identification( emm_ctx, &auth_proc->emm_com_proc.emm_proc, IDENTITY_TYPE_2_IMSI, - authentication_check_imsi_5_4_2_5__1, - authentication_check_imsi_5_4_2_5__1_fail); + (success_cb_t)authentication_check_imsi_5_4_2_5__1, + (failure_cb_t)authentication_check_imsi_5_4_2_5__1_fail); } if (rc != RETURNok) { REQUIREMENT_3GPP_24_301( @@ -795,7 +808,7 @@ status_code_e emm_proc_authentication_failure(mme_ue_s1ap_id_t ue_id, ue_mm_context->mme_ue_s1ap_id); auth_proc->emm_cause = EMM_CAUSE_ILLEGAL_UE; // Do not accept the UE to attach to the network - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -923,10 +936,10 @@ status_code_e emm_proc_authentication_complete(mme_ue_s1ap_id_t ue_id, "XRES/RES Validation Failed for (ue_id=" MME_UE_S1AP_ID_FMT ")\n", ue_id); REQUIREMENT_3GPP_24_301(R10_5_4_2_7_c__2); - rc = emm_proc_identification(emm_ctx, &auth_proc->emm_com_proc.emm_proc, - IDENTITY_TYPE_2_IMSI, - authentication_check_imsi_5_4_2_5__1, - authentication_check_imsi_5_4_2_5__1_fail); + rc = emm_proc_identification( + emm_ctx, &auth_proc->emm_com_proc.emm_proc, IDENTITY_TYPE_2_IMSI, + (success_cb_t)authentication_check_imsi_5_4_2_5__1, + (failure_cb_t)authentication_check_imsi_5_4_2_5__1_fail); if (rc != RETURNok) { REQUIREMENT_3GPP_24_301( @@ -965,7 +978,7 @@ status_code_e emm_proc_authentication_complete(mme_ue_s1ap_id_t ue_id, LOG_NAS_EMM, emm_ctx->_imsi64, "EMM-PROC - Notify EMM that the authentication procedure successfully " "completed\n"); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_CNF; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -993,20 +1006,24 @@ status_code_e emm_proc_authentication_complete(mme_ue_s1ap_id_t ue_id, */ void set_callbacks_for_auth_info_proc(nas_auth_info_proc_t* auth_info_proc) { - auth_info_proc->success_notif = auth_info_proc_success_cb; - auth_info_proc->failure_notif = auth_info_proc_failure_cb; - auth_info_proc->cn_proc.base_proc.time_out = mme_app_handle_air_timer_expiry; + auth_info_proc->success_notif = (success_cb_t)auth_info_proc_success_cb; + auth_info_proc->failure_notif = (failure_cb_t)auth_info_proc_failure_cb; + auth_info_proc->cn_proc.base_proc.time_out = + (time_out_t)mme_app_handle_air_timer_expiry; } void set_callbacks_for_auth_proc(nas_emm_auth_proc_t* auth_proc) { - auth_proc->emm_com_proc.emm_proc.not_delivered = authentication_ll_failure; + auth_proc->emm_com_proc.emm_proc.not_delivered = + (sdu_out_not_delivered_t)authentication_ll_failure; auth_proc->emm_com_proc.emm_proc.not_delivered_ho = - authentication_non_delivered_ho; - auth_proc->emm_com_proc.emm_proc.base_proc.abort = authentication_abort; + (sdu_out_not_delivered_ho_t)authentication_non_delivered_ho; + auth_proc->emm_com_proc.emm_proc.base_proc.abort = + (proc_abort_t)authentication_abort; auth_proc->emm_com_proc.emm_proc.base_proc.fail_in = NULL; - auth_proc->emm_com_proc.emm_proc.base_proc.fail_out = authentication_reject; + auth_proc->emm_com_proc.emm_proc.base_proc.fail_out = + (pdu_out_rej_t)authentication_reject; auth_proc->emm_com_proc.emm_proc.base_proc.time_out = - mme_app_handle_auth_t3460_expiry; + (time_out_t)mme_app_handle_auth_t3460_expiry; } /****************************************************************************/ @@ -1052,7 +1069,7 @@ status_code_e mme_app_handle_auth_t3460_expiry(zloop_t* loop, int timer_id, } struct ue_mm_context_s* ue_context_p = mme_app_get_ue_context_for_timer( - mme_ue_s1ap_id, "Authentication T3460 Timer"); + mme_ue_s1ap_id, const_cast("Authentication T3460 Timer")); if (ue_context_p == NULL) { OAILOG_ERROR( LOG_MME_APP, @@ -1100,7 +1117,7 @@ status_code_e mme_app_handle_auth_t3460_expiry(zloop_t* loop, int timer_id, increment_counter("nas_auth_rsp_timer_expired", 1, NO_LABELS); increment_counter("ue_attach", 1, 2, "result", "failure", "cause", "no_response_for_auth_request"); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_ABORT; emm_sap.u.emm_reg.ue_id = auth_proc->ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -1154,7 +1171,7 @@ static int authentication_check_imsi_5_4_2_5__1( nas_emm_specific_proc_t* emm_specific_proc = (nas_emm_specific_proc_t*)((nas_base_proc_t*)auth_proc)->parent; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_ABORT; emm_sap.u.emm_reg.ue_id = auth_proc->ue_id; emm_sap.u.emm_reg.ctx = emm_context; @@ -1171,7 +1188,7 @@ static int authentication_check_imsi_5_4_2_5__1( } } REQUIREMENT_3GPP_24_301(R10_5_4_2_5__2); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ue_id = auth_proc->ue_id; emm_sap.u.emm_reg.ctx = emm_context; @@ -1198,7 +1215,7 @@ static int authentication_check_imsi_5_4_2_5__1_fail( if (auth_proc) { REQUIREMENT_3GPP_24_301(R10_5_4_2_5__2); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ue_id = auth_proc->ue_id; emm_sap.u.emm_reg.ctx = emm_context; @@ -1225,17 +1242,17 @@ static int authentication_check_imsi_5_4_2_5__1_fail( ** Return: RETURNok, RETURNerror ** ** ** ***************************************************************************/ -static int authentication_request(struct emm_context_s* emm_ctx, - nas_emm_auth_proc_t* auth_proc) { +static status_code_e authentication_request(struct emm_context_s* emm_ctx, + nas_emm_auth_proc_t* auth_proc) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNerror; + status_code_e rc = RETURNerror; if (auth_proc) { /* * Notify EMM-AS SAP that Authentication Request message has to be sent * to the UE */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMAS_SECURITY_REQ; emm_sap.u.emm_as.u.security.puid = auth_proc->emm_com_proc.emm_proc.base_proc.nas_puid; @@ -1285,11 +1302,11 @@ static int authentication_request(struct emm_context_s* emm_ctx, ** Others: None ** ** ** ***************************************************************************/ -static int authentication_reject(emm_context_t* emm_context, - struct nas_base_proc_s* base_proc) { +static status_code_e authentication_reject(emm_context_t* emm_context, + struct nas_base_proc_s* base_proc) { OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_sap_t emm_sap = {0}; - int rc = RETURNerror; + emm_sap_t emm_sap = {}; + status_code_e rc = RETURNerror; if ((base_proc) && (emm_context)) { nas_emm_auth_proc_t* auth_proc = (nas_emm_auth_proc_t*)base_proc; @@ -1333,7 +1350,7 @@ static int authentication_ll_failure(struct emm_context_s* emm_context, if ((emm_proc) && (emm_context)) { REQUIREMENT_3GPP_24_301(R10_5_4_2_7_a); nas_emm_auth_proc_t* auth_proc = (nas_emm_auth_proc_t*)emm_proc; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_ABORT; emm_sap.u.emm_reg.ue_id = auth_proc->ue_id; @@ -1394,7 +1411,7 @@ static int authentication_non_delivered_ho(struct emm_context_s* emm_ctx, /* * Abort authentication and attach procedure */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_ABORT; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -1560,7 +1577,7 @@ status_code_e mme_app_handle_air_timer_expiry(zloop_t* loop, int timer_id, OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } struct ue_mm_context_s* ue_context_p = mme_app_get_ue_context_for_timer( - mme_ue_s1ap_id, "Authentication Info Request Timer"); + mme_ue_s1ap_id, const_cast("Authentication Info Request Timer")); if (ue_context_p == NULL) { OAILOG_ERROR( LOG_MME_APP, diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/Detach.c b/lte/gateway/c/core/oai/tasks/nas/emm/Detach.cpp similarity index 94% rename from lte/gateway/c/core/oai/tasks/nas/emm/Detach.c rename to lte/gateway/c/core/oai/tasks/nas/emm/Detach.cpp index 390de4d213e3..166abfd3ec21 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/Detach.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/Detach.cpp @@ -19,30 +19,38 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/include/mme_app_statistics.h" +#ifdef __cplusplus +} +#endif + +#include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/include/mme_events.hpp" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/DetachRequest.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sapDef.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" /****************************************************************************/ @@ -114,7 +122,7 @@ status_code_e mme_app_handle_detach_t3422_expiry(zloop_t* loop, int timer_id, } struct ue_mm_context_s* ue_context_p = mme_app_get_ue_context_for_timer( - mme_ue_s1ap_id, "Detach Procedure T3422 Timer"); + mme_ue_s1ap_id, const_cast("Detach Procedure T3422 Timer")); if (ue_context_p == NULL) { OAILOG_ERROR( LOG_MME_APP, @@ -154,7 +162,7 @@ status_code_e mme_app_handle_detach_t3422_expiry(zloop_t* loop, int timer_id, * switched-off to avoid sending of detach accept message */ emm_detach_request_params.switch_off = 1; - emm_detach_request_params.type = 0; + emm_detach_request_params.type = EMM_DETACH_TYPE_EPS; // 0 emm_proc_detach_request(mme_ue_s1ap_id, &emm_detach_request_params); } if (data) { @@ -169,7 +177,7 @@ status_code_e mme_app_handle_detach_t3422_expiry(zloop_t* loop, int timer_id, status_code_e release_esm_pdn_context(emm_context_t* emm_context, mme_ue_s1ap_id_t ue_id) { OAILOG_FUNC_IN(LOG_NAS_EMM); - esm_sap_t esm_sap = {0}; + esm_sap_t esm_sap = {}; esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ; esm_sap.ue_id = ue_id; esm_sap.ctx = emm_context; @@ -180,6 +188,9 @@ status_code_e release_esm_pdn_context(emm_context_t* emm_context, OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } +#ifdef __cplusplus +extern "C" { +#endif void clear_emm_ctxt(emm_context_t* emm_context) { OAILOG_FUNC_IN(LOG_NAS_EMM); if (!emm_context) { @@ -207,6 +218,9 @@ void clear_emm_ctxt(emm_context_t* emm_context) { emm_ctx_clear_non_current_security(emm_context); OAILOG_FUNC_OUT(LOG_NAS_EMM); } +#ifdef __cplusplus +} +#endif /* -------------------------------------------------------------------------- @@ -353,7 +367,7 @@ status_code_e emm_proc_detach_request(mme_ue_s1ap_id_t ue_id, /* * Normal detach without UE switch-off */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_as_data_t* emm_as = &emm_sap.u.emm_as.u.data; /* @@ -392,7 +406,7 @@ status_code_e emm_proc_detach_request(mme_ue_s1ap_id_t ue_id, } } if (rc != RETURNerror) { - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; /* * Notify EMM FSM that the UE has been implicitly detached @@ -450,7 +464,7 @@ status_code_e emm_proc_detach_accept(mme_ue_s1ap_id_t ue_id) { // if detach type = IMSI_DETACH, we are not clearing the UE context if (emm_ctx->is_imsi_only_detach == false) { - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; /* * Notify EMM FSM that the UE has been detached */ @@ -501,7 +515,7 @@ status_code_e emm_proc_nw_initiated_detach_request(mme_ue_s1ap_id_t ue_id, /* * Send Detach Request to UE */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_as_data_t* emm_as = &emm_sap.u.emm_as.u.data; /* @@ -532,17 +546,17 @@ status_code_e emm_proc_nw_initiated_detach_request(mme_ue_s1ap_id_t ue_id, */ nas_stop_T3422(emm_ctx->_imsi64, &(emm_ctx->T3422)); nas_start_T3422(ue_id, &(emm_ctx->T3422), - mme_app_handle_detach_t3422_expiry); + (time_out_t)mme_app_handle_detach_t3422_expiry); } else { /* * Start T3422 timer */ if (emm_ctx->t3422_arg) { nas_start_T3422(ue_id, &(emm_ctx->T3422), - mme_app_handle_detach_t3422_expiry); + (time_out_t)mme_app_handle_detach_t3422_expiry); } else { - nw_detach_data_t* data = - (nw_detach_data_t*)calloc(1, sizeof(nw_detach_data_t)); + nw_detach_data_t* data = reinterpret_cast( + calloc(1, sizeof(nw_detach_data_t))); if (!data) { OAILOG_ERROR_UE( LOG_NAS_EMM, emm_ctx->_imsi64, @@ -556,7 +570,7 @@ status_code_e emm_proc_nw_initiated_detach_request(mme_ue_s1ap_id_t ue_id, data->detach_type = detach_type; emm_ctx->t3422_arg = (void*)data; nas_start_T3422(ue_id, &(emm_ctx->T3422), - mme_app_handle_detach_t3422_expiry); + (time_out_t)mme_app_handle_detach_t3422_expiry); } } } diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.c b/lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.cpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.c rename to lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.cpp index 4fad4b042c1e..6d9954e70d21 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.cpp @@ -16,7 +16,7 @@ */ /***************************************************************************** - Source EmmCommon.h + Source EmmCommon.cpp Version 0.1 @@ -41,18 +41,25 @@ EMM information *****************************************************************************/ +#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.hpp" + #include #include #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/common/dynamic_memory_check.h" -#include "lte/gateway/c/core/oai/common/log.h" #include "lte/gateway/c/core/oai/include/mme_config.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.h" +#ifdef __cplusplus +} +#endif +#include "lte/gateway/c/core/common/dynamic_memory_check.h" +#include "lte/gateway/c/core/oai/lib/gtpv2-c/nwgtpv2c-0.11/include/tree.h" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ /****************************************************************************/ @@ -67,6 +74,8 @@ emm_common_data_head_t emm_common_data_head = {PTHREAD_MUTEX_INITIALIZER, static inline int emm_common_data_compare_ueid(struct emm_common_data_s* p1, struct emm_common_data_s* p2); +RB_HEAD(emm_common_data_map, emm_common_data_s) emm_common_data_root; + RB_PROTOTYPE(emm_common_data_map, emm_common_data_s, entries, emm_common_data_compare_ueid); @@ -101,7 +110,8 @@ struct emm_common_data_s* emm_common_data_context_get( reference.ue_id = _ueid; pthread_mutex_lock(&root->mutex); reference_p = - RB_FIND(emm_common_data_map, &root->emm_common_data_root, &reference); + RB_FIND(emm_common_data_map, + (emm_common_data_map*)&root->emm_common_data_root, &reference); pthread_mutex_unlock(&root->mutex); return reference_p; } @@ -149,11 +159,12 @@ status_code_e emm_proc_common_initialize( emm_common_data_context_get(&emm_common_data_head, ue_id); if (emm_common_data_ctx == NULL) { - emm_common_data_ctx = - (emm_common_data_t*)calloc(1, sizeof(emm_common_data_t)); + emm_common_data_ctx = reinterpret_cast( + calloc(1, sizeof(emm_common_data_t))); emm_common_data_ctx->ue_id = ue_id; pthread_mutex_lock(&emm_common_data_head.mutex); - RB_INSERT(emm_common_data_map, &emm_common_data_head.emm_common_data_root, + RB_INSERT(emm_common_data_map, + (emm_common_data_map*)&emm_common_data_head.emm_common_data_root, emm_common_data_ctx); pthread_mutex_unlock(&emm_common_data_head.mutex); @@ -446,8 +457,10 @@ void emm_common_cleanup(emm_common_data_t* emm_common_data_ctx) { * Release the callback functions */ pthread_mutex_lock(&emm_common_data_head.mutex); - RB_REMOVE(emm_common_data_map, &emm_common_data_head.emm_common_data_root, - emm_common_data_ctx); + RB_REMOVE( + emm_common_data_map, + (emm_common_data_map*)&emm_common_data_head.emm_common_data_root, + emm_common_data_ctx); free_wrapper(&emm_common_data_ctx->args); free_wrapper((void**)&emm_common_data_ctx); pthread_mutex_unlock(&emm_common_data_head.mutex); @@ -466,7 +479,8 @@ void emm_common_cleanup_by_ueid(mme_ue_s1ap_id_t ue_id) { if (emm_common_data_ctx) { __sync_fetch_and_sub(&emm_common_data_ctx->ref_count, 1); pthread_mutex_lock(&emm_common_data_head.mutex); - RB_REMOVE(emm_common_data_map, &emm_common_data_head.emm_common_data_root, + RB_REMOVE(emm_common_data_map, + (emm_common_data_map*)&emm_common_data_head.emm_common_data_root, emm_common_data_ctx); if (emm_common_data_ctx->args) { free_wrapper(&emm_common_data_ctx->args); @@ -494,7 +508,8 @@ void create_new_attach_info(emm_context_t* emm_context_p, STOLEN_REF struct emm_attach_request_ies_s* ies, bool is_mm_ctx_new) { OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_context_p->new_attach_info = calloc(1, sizeof(new_attach_info_t)); + emm_context_p->new_attach_info = reinterpret_cast( + calloc(1, sizeof(new_attach_info_t))); emm_context_p->new_attach_info->mme_ue_s1ap_id = mme_ue_s1ap_id; emm_context_p->new_attach_info->ies = ies; emm_context_p->new_attach_info->is_mm_ctx_new = is_mm_ctx_new; @@ -642,7 +657,7 @@ status_code_e update_tai_list_to_emm_context( } break; default: - OAILOG_ERROR_UE(imsi64, LOG_NAS, + OAILOG_ERROR_UE(LOG_NAS, imsi64, "BAD TAI list configuration, unknown TAI list type %u", par_tai_list->list_type); } diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.h b/lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.hpp similarity index 90% rename from lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.h rename to lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.hpp index 976e799caf83..c91460c38ca6 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source EmmCommon.h +Source EmmCommon.hpp Version 0.1 @@ -48,8 +48,8 @@ Description Defines callback functions executed within EMM common procedures #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/lib/gtpv2-c/nwgtpv2c-0.11/include/tree.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/TrackingAreaIdentityList.h" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ @@ -68,15 +68,15 @@ Description Defines callback functions executed within EMM common procedures * - The EMM common procedure failed or is rejected * - Lower layer failure occured before the EMM common procedure completion */ -typedef int (*emm_common_success_callback_t)(void*); -typedef int (*emm_common_reject_callback_t)(void*); -typedef int (*emm_common_failure_callback_t)(void*); -typedef int (*emm_common_ll_failure_callback_t)(void*); -typedef int (*emm_common_non_delivered_callback_t)(void*); +typedef status_code_e (*emm_common_success_callback_t)(void*); +typedef status_code_e (*emm_common_reject_callback_t)(void*); +typedef status_code_e (*emm_common_failure_callback_t)(void*); +typedef status_code_e (*emm_common_ll_failure_callback_t)(void*); +typedef status_code_e (*emm_common_non_delivered_callback_t)(void*); /* EMM common procedure to be executed when the ongoing EMM procedure is * aborted. */ -typedef int (*emm_common_abort_callback_t)(void*); +typedef status_code_e (*emm_common_abort_callback_t)(void*); /* Ongoing EMM procedure callback functions */ typedef struct emm_common_data_s { @@ -138,12 +138,18 @@ void create_new_attach_info(emm_context_t* emm_context_p, mme_ue_s1ap_id_t mme_ue_s1ap_id, STOLEN_REF struct emm_attach_request_ies_s* ies, bool is_mm_ctx_new); -partial_list_t* emm_verify_orig_tai(const tai_t orig_tai); status_code_e verify_tau_tai(uint64_t imsi64, guti_t guti, tai_t tai, tai_list_t* emm_ctx_tai); +#ifdef __cplusplus +extern "C" { +#endif +partial_list_t* emm_verify_orig_tai(const tai_t orig_tai); status_code_e update_tai_list_to_emm_context( uint64_t imsi64, guti_t guti, const partial_list_t* const par_tai_list, tai_list_t* tai_list); +#ifdef __cplusplus +} +#endif #endif /* FILE_EMM_COMMON_SEEN*/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/EmmInformation.c b/lte/gateway/c/core/oai/tasks/nas/emm/EmmInformation.cpp similarity index 92% rename from lte/gateway/c/core/oai/tasks/nas/emm/EmmInformation.c rename to lte/gateway/c/core/oai/tasks/nas/emm/EmmInformation.cpp index 80389444a15c..017e3f285c56 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/EmmInformation.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/EmmInformation.cpp @@ -16,7 +16,7 @@ */ /***************************************************************************** - Source EmmInformation.c + Source EmmInformation.cpp Version 0.1 @@ -41,14 +41,21 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#ifdef __cplusplus +} +#endif + +#include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -71,7 +78,7 @@ static void emm_information_pack_gsm_7Bit(bstring str, unsigned char* result); status_code_e emm_proc_emm_information(ue_mm_context_t* ue_emm_ctx) { status_code_e rc = RETURNerror; unsigned char result[256] = {0}; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_as_data_t* emm_as = &emm_sap.u.emm_as.u.data; emm_context_t* emm_ctx = &(ue_emm_ctx->emm_context); OAILOG_FUNC_IN(LOG_NAS_EMM); diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/EmmStatusHdl.c b/lte/gateway/c/core/oai/tasks/nas/emm/EmmStatusHdl.cpp similarity index 93% rename from lte/gateway/c/core/oai/tasks/nas/emm/EmmStatusHdl.c rename to lte/gateway/c/core/oai/tasks/nas/emm/EmmStatusHdl.cpp index 8b8eb77335b9..5a143fc3a664 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/EmmStatusHdl.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/EmmStatusHdl.cpp @@ -18,14 +18,21 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/log.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/EmmCause.h" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" @@ -93,11 +100,11 @@ status_code_e emm_proc_status_ind(mme_ue_s1ap_id_t ue_id, ** Others: None ** ** ** ***************************************************************************/ -int emm_proc_status(mme_ue_s1ap_id_t ue_id, emm_cause_t emm_cause) { +status_code_e emm_proc_status(mme_ue_s1ap_id_t ue_id, emm_cause_t emm_cause) { OAILOG_FUNC_IN(LOG_NAS_EMM); increment_counter("emm_status_sent", 1, NO_LABELS); - int rc; - emm_sap_t emm_sap = {0}; + status_code_e rc = RETURNerror; + emm_sap_t emm_sap = {}; emm_security_context_t* sctx = NULL; struct emm_context_s* ctx = NULL; diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/Identification.c b/lte/gateway/c/core/oai/tasks/nas/emm/Identification.cpp similarity index 94% rename from lte/gateway/c/core/oai/tasks/nas/emm/Identification.c rename to lte/gateway/c/core/oai/tasks/nas/emm/Identification.cpp index 48fcc0e63fa2..ba479070648a 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/Identification.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/Identification.cpp @@ -19,11 +19,18 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/conversions.h" #include "lte/gateway/c/core/oai/common/log.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/3gpp_requirements_24.301.h" #include "lte/gateway/c/core/oai/include/mme_app_state.hpp" #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" @@ -32,18 +39,19 @@ #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_cause.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" /****************************************************************************/ @@ -72,7 +80,7 @@ static int identification_non_delivered_ho(struct emm_context_s* emm_context, static int identification_abort(struct emm_context_s* emm_context, struct nas_base_proc_s* base_proc); -static int identification_request(nas_emm_ident_proc_t* const proc); +static status_code_e identification_request(nas_emm_ident_proc_t* const proc); /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ @@ -151,16 +159,17 @@ status_code_e emm_proc_identification(struct emm_context_s* const emm_context, ident_proc->emm_com_proc.emm_proc.previous_emm_fsm_state = emm_fsm_get_state(emm_context); ident_proc->emm_com_proc.emm_proc.not_delivered = - identification_ll_failure; + (sdu_out_not_delivered_t)identification_ll_failure; ident_proc->emm_com_proc.emm_proc.not_delivered_ho = - identification_non_delivered_ho; + (sdu_out_not_delivered_ho_t)identification_non_delivered_ho; ident_proc->emm_com_proc.emm_proc.base_proc.success_notif = success; ident_proc->emm_com_proc.emm_proc.base_proc.failure_notif = failure; - ident_proc->emm_com_proc.emm_proc.base_proc.abort = identification_abort; + ident_proc->emm_com_proc.emm_proc.base_proc.abort = + (proc_abort_t)identification_abort; ident_proc->emm_com_proc.emm_proc.base_proc.fail_in = NULL; // only response ident_proc->emm_com_proc.emm_proc.base_proc.time_out = - mme_app_handle_identification_t3470_expiry; + (time_out_t)mme_app_handle_identification_t3470_expiry; } rc = identification_request(ident_proc); @@ -169,7 +178,7 @@ status_code_e emm_proc_identification(struct emm_context_s* const emm_context, /* * Notify EMM that common procedure has been initiated */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REQ; emm_sap.u.emm_reg.ue_id = ue_id; @@ -210,7 +219,7 @@ status_code_e emm_proc_identification_complete(const mme_ue_s1ap_id_t ue_id, uint32_t* const tmsi) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_context_t* emm_ctx = NULL; bool notify = true; @@ -339,7 +348,8 @@ status_code_e emm_proc_identification_complete(const mme_ue_s1ap_id_t ue_id, // Helper ident proc ptr to avoid double free from unknown GUTI attach // processing. nas_emm_ident_proc_t* ident_proc_p = - calloc(1, sizeof(nas_emm_ident_proc_t)); + reinterpret_cast( + calloc(1, sizeof(nas_emm_ident_proc_t))); memcpy(ident_proc_p, ident_proc, sizeof(nas_emm_ident_proc_t)); /* @@ -403,7 +413,7 @@ status_code_e mme_app_handle_identification_t3470_expiry(zloop_t* loop, } struct ue_mm_context_s* ue_context_p = mme_app_get_ue_context_for_timer( - mme_ue_s1ap_id, "Identification T3470 Timer"); + mme_ue_s1ap_id, const_cast("Identification T3470 Timer")); if (ue_context_p == NULL) { OAILOG_ERROR( LOG_MME_APP, @@ -448,7 +458,7 @@ status_code_e mme_app_handle_identification_t3470_expiry(zloop_t* loop, */ mme_ue_s1ap_id_t ue_id = ident_proc->ue_id; REQUIREMENT_3GPP_24_301(R10_5_4_4_6_b__2); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_ABORT; emm_sap.u.emm_reg.ue_id = ident_proc->ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -489,13 +499,13 @@ status_code_e mme_app_handle_identification_t3470_expiry(zloop_t* loop, * Others: None * * Outputs: None - * Return: None + * Return: RETURNok, RETURNerror * Others: T3470 */ -static int identification_request(nas_emm_ident_proc_t* const proc) { +static status_code_e identification_request(nas_emm_ident_proc_t* const proc) { OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_sap_t emm_sap = {0}; - int rc = RETURNok; + emm_sap_t emm_sap = {}; + status_code_e rc = RETURNok; struct emm_context_s* emm_ctx = NULL; ue_mm_context_t* ue_mm_context = @@ -544,7 +554,7 @@ static int identification_ll_failure(struct emm_context_s* emm_ctx, if ((emm_ctx) && (emm_proc)) { nas_emm_ident_proc_t* ident_proc = (nas_emm_ident_proc_t*)emm_proc; REQUIREMENT_3GPP_24_301(R10_5_4_4_6_a); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_ABORT; emm_sap.u.emm_reg.ue_id = ident_proc->ue_id; @@ -586,7 +596,7 @@ static int identification_non_delivered_ho(struct emm_context_s* emm_ctx, /* * Abort identification and attach procedure */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_ABORT; emm_sap.u.emm_reg.ue_id = ident_proc->ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.c b/lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.cpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.c rename to lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.cpp index 66076726a35e..d75a366bc21f 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.cpp @@ -20,21 +20,29 @@ #include #include +#include "lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.hpp" + +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/include/nas/securityDef.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.007.h" -#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sapDef.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -77,7 +85,7 @@ status_code_e esm_sap_send(esm_sap_t* msg); ***************************************************************************/ status_code_e lowerlayer_success(mme_ue_s1ap_id_t ue_id, bstring* nas_msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; status_code_e rc = RETURNok; emm_sap.primitive = EMMREG_LOWERLAYER_SUCCESS; @@ -124,7 +132,7 @@ status_code_e lowerlayer_success(mme_ue_s1ap_id_t ue_id, bstring* nas_msg) { status_code_e lowerlayer_failure(mme_ue_s1ap_id_t ue_id, STOLEN_REF bstring* nas_msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; status_code_e rc = RETURNok; emm_sap.primitive = EMMREG_LOWERLAYER_FAILURE; @@ -170,7 +178,7 @@ status_code_e lowerlayer_failure(mme_ue_s1ap_id_t ue_id, status_code_e lowerlayer_non_delivery_indication(mme_ue_s1ap_id_t ue_id, STOLEN_REF bstring* nas_msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; status_code_e rc = RETURNok; emm_sap.primitive = EMMREG_LOWERLAYER_NON_DELIVERY; @@ -235,7 +243,7 @@ status_code_e lowerlayer_establish(void) { ***************************************************************************/ status_code_e lowerlayer_release(mme_ue_s1ap_id_t ue_id, int cause) { OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; status_code_e rc = RETURNok; emm_sap.primitive = EMMREG_LOWERLAYER_RELEASE; @@ -268,7 +276,7 @@ status_code_e lowerlayer_release(mme_ue_s1ap_id_t ue_id, int cause) { ** ** ***************************************************************************/ status_code_e lowerlayer_data_ind(mme_ue_s1ap_id_t ue_id, const_bstring data) { - esm_sap_t esm_sap = {0}; + esm_sap_t esm_sap = {}; status_code_e rc = RETURNok; OAILOG_FUNC_IN(LOG_NAS_EMM); @@ -302,7 +310,7 @@ status_code_e lowerlayer_data_ind(mme_ue_s1ap_id_t ue_id, const_bstring data) { status_code_e lowerlayer_data_req(mme_ue_s1ap_id_t ue_id, bstring data) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNok; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_security_context_t* sctx = NULL; ue_mm_context_t* ue_mm_context = mme_ue_context_exists_mme_ue_s1ap_id(ue_id); @@ -332,7 +340,7 @@ status_code_e lowerlayer_activate_bearer_req( bstring data) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNok; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_security_context_t* sctx = NULL; ue_mm_context_t* ue_mm_context = mme_ue_context_exists_mme_ue_s1ap_id(ue_id); @@ -364,7 +372,7 @@ status_code_e lowerlayer_deactivate_bearer_req(const mme_ue_s1ap_id_t ue_id, const ebi_t ebi, bstring data) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNok; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_security_context_t* sctx = NULL; ue_mm_context_t* ue_mm_context = mme_ue_context_exists_mme_ue_s1ap_id(ue_id); @@ -435,9 +443,11 @@ void emm_as_set_security_data(emm_as_security_data_t* data, const void* args, is_new, context->eksi, context->ul_count.seq_num, *(uint32_t*)(&context->ul_count)); OAILOG_STREAM_HEX(OAILOG_LEVEL_DEBUG, LOG_NAS_EMM, - "knas_int:", context->knas_int, AUTH_KNAS_INT_SIZE); + "knas_int:", (const char*)context->knas_int, + AUTH_KNAS_INT_SIZE); OAILOG_STREAM_HEX(OAILOG_LEVEL_DEBUG, LOG_NAS_EMM, - "knas_enc:", context->knas_enc, AUTH_KNAS_ENC_SIZE); + "knas_enc:", (const char*)context->knas_enc, + AUTH_KNAS_ENC_SIZE); data->is_new = is_new; data->ksi = context->eksi; data->sqn = context->dl_count diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.h b/lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.hpp similarity index 99% rename from lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.h rename to lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.hpp index 01e61277d062..acead34bee2f 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source lowerlayer.h +Source lowerlayer.hpp Version 0.1 diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/NasTransportHdl.c b/lte/gateway/c/core/oai/tasks/nas/emm/NasTransportHdl.cpp similarity index 95% rename from lte/gateway/c/core/oai/tasks/nas/emm/NasTransportHdl.c rename to lte/gateway/c/core/oai/tasks/nas/emm/NasTransportHdl.cpp index 01d92a452e85..fc675637a706 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/NasTransportHdl.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/NasTransportHdl.cpp @@ -19,7 +19,7 @@ #include /***************************************************************************** - Source NasTransportHdl.c + Source NasTransportHdl.cpp Version 0.1 @@ -38,17 +38,25 @@ the nas message from ue to msc/vlr and vice versa *****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/conversions.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/lib/3gpp/3gpp_23.003.h" -#include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#ifdef __cplusplus +} +#endif + +#include "lte/gateway/c/core/oai/lib/3gpp/3gpp_23.003.h" +#include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/DetachRequest.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/MobileStationClassmark2.h" diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/SecurityModeControl.c b/lte/gateway/c/core/oai/tasks/nas/emm/SecurityModeControl.cpp similarity index 94% rename from lte/gateway/c/core/oai/tasks/nas/emm/SecurityModeControl.c rename to lte/gateway/c/core/oai/tasks/nas/emm/SecurityModeControl.cpp index 05ce3a3cdc10..7bdd17d83430 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/SecurityModeControl.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/SecurityModeControl.cpp @@ -16,7 +16,7 @@ */ /***************************************************************************** - Source SecurityModeControl.c + Source SecurityModeControl.cpp Version 0.1 @@ -46,14 +46,21 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/conversions.h" #include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/common/security_types.h" #include "lte/gateway/c/core/oai/include/3gpp_requirements_24.301.h" -#include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/include/nas/securityDef.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_23.003.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.008.h" @@ -63,18 +70,19 @@ #include "lte/gateway/c/core/oai/lib/secu/secu_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_cause.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/NasSecurityAlgorithms.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" /****************************************************************************/ @@ -84,7 +92,6 @@ extern long mme_app_last_msg_latency; extern long pre_mme_task_msg_latency; extern bool mme_congestion_control_enabled; extern mme_congestion_params_t mme_congestion_params; - /****************************************************************************/ /******************* L O C A L D E F I N I T I O N S *******************/ /****************************************************************************/ @@ -115,10 +122,12 @@ static int security_non_delivered_ho(emm_context_t* emm_context, */ static int security_abort(emm_context_t* emm_context, struct nas_base_proc_s* base_proc); -static int security_select_algorithms(const int ue_eiaP, const int ue_eeaP, - int* const mme_eiaP, int* const mme_eeaP); +static status_code_e security_select_algorithms(const int ue_eiaP, + const int ue_eeaP, + int* const mme_eiaP, + int* const mme_eeaP); -static int security_request(nas_emm_smc_proc_t* const smc_proc); +static status_code_e security_request(nas_emm_smc_proc_t* const smc_proc); /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ @@ -278,16 +287,18 @@ status_code_e emm_proc_security_mode_control( smc_proc->emm_com_proc.emm_proc.delivered = NULL; smc_proc->emm_com_proc.emm_proc.previous_emm_fsm_state = emm_fsm_get_state(emm_ctx); - smc_proc->emm_com_proc.emm_proc.not_delivered = security_ll_failure; + smc_proc->emm_com_proc.emm_proc.not_delivered = + (sdu_out_not_delivered_t)security_ll_failure; smc_proc->emm_com_proc.emm_proc.not_delivered_ho = - security_non_delivered_ho; + (sdu_out_not_delivered_ho_t)security_non_delivered_ho; smc_proc->emm_com_proc.emm_proc.base_proc.success_notif = success; smc_proc->emm_com_proc.emm_proc.base_proc.failure_notif = failure; - smc_proc->emm_com_proc.emm_proc.base_proc.abort = security_abort; + smc_proc->emm_com_proc.emm_proc.base_proc.abort = + (proc_abort_t)security_abort; smc_proc->emm_com_proc.emm_proc.base_proc.fail_in = NULL; // only response smc_proc->emm_com_proc.emm_proc.base_proc.fail_out = NULL; smc_proc->emm_com_proc.emm_proc.base_proc.time_out = - mme_app_handle_security_t3460_expiry; + (time_out_t)mme_app_handle_security_t3460_expiry; /* * Set the UE identifier @@ -372,7 +383,7 @@ status_code_e emm_proc_security_mode_control( /* * Notify EMM that common procedure has been initiated */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REQ; emm_sap.u.emm_reg.ue_id = ue_id; @@ -570,7 +581,7 @@ status_code_e emm_proc_security_mode_complete( /* * Notify EMM that the authentication procedure successfully completed */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_CNF; emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -671,7 +682,7 @@ status_code_e emm_proc_security_mode_reject(mme_ue_s1ap_id_t ue_id) { /* * Notify EMM that the security mode procedure failed */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; REQUIREMENT_3GPP_24_301(R10_5_4_3_5__2); emm_sap.primitive = EMMREG_COMMON_PROC_REJ; @@ -697,13 +708,16 @@ status_code_e emm_proc_security_mode_reject(mme_ue_s1ap_id_t ue_id) { */ void set_callbacks_for_smc_proc(nas_emm_smc_proc_t* smc_proc) { - smc_proc->emm_com_proc.emm_proc.not_delivered = security_ll_failure; - smc_proc->emm_com_proc.emm_proc.not_delivered_ho = security_non_delivered_ho; - smc_proc->emm_com_proc.emm_proc.base_proc.abort = security_abort; + smc_proc->emm_com_proc.emm_proc.not_delivered = + (sdu_out_not_delivered_t)security_ll_failure; + smc_proc->emm_com_proc.emm_proc.not_delivered_ho = + (sdu_out_not_delivered_ho_t)security_non_delivered_ho; + smc_proc->emm_com_proc.emm_proc.base_proc.abort = + (proc_abort_t)security_abort; smc_proc->emm_com_proc.emm_proc.base_proc.fail_in = NULL; smc_proc->emm_com_proc.emm_proc.base_proc.fail_out = NULL; smc_proc->emm_com_proc.emm_proc.base_proc.time_out = - mme_app_handle_security_t3460_expiry; + (time_out_t)mme_app_handle_security_t3460_expiry; } /****************************************************************************/ @@ -732,7 +746,7 @@ void set_callbacks_for_smc_proc(nas_emm_smc_proc_t* smc_proc) { ** Others: None ** ** ** ** Outputs: None ** - ** Return: None ** + ** Return: RETURNok, RETURNerror ** ** Others: None ** ** ** ***************************************************************************/ @@ -795,7 +809,7 @@ status_code_e mme_app_handle_security_t3460_expiry(zloop_t* loop, int timer_id, "no_response_for_security_mode_command"); security_abort(emm_ctx, (struct nas_base_proc_s*)smc_proc); emm_common_cleanup_by_ueid(smc_proc->ue_id); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMCN_IMPLICIT_DETACH_UE; emm_sap.u.emm_cn.u.emm_cn_implicit_detach.ue_id = smc_proc->ue_id; emm_sap_send(&emm_sap); @@ -827,12 +841,12 @@ status_code_e mme_app_handle_security_t3460_expiry(zloop_t* loop, int timer_id, ** Others: T3460 ** ** ** ***************************************************************************/ -static int security_request(nas_emm_smc_proc_t* const smc_proc) { +static status_code_e security_request(nas_emm_smc_proc_t* const smc_proc) { OAILOG_FUNC_IN(LOG_NAS_EMM); ue_mm_context_t* ue_mm_context = NULL; struct emm_context_s* emm_ctx = NULL; - emm_sap_t emm_sap = {0}; - int rc = RETURNerror; + emm_sap_t emm_sap = {}; + status_code_e rc = RETURNerror; if (smc_proc) { /* @@ -906,7 +920,7 @@ static int security_ll_failure(emm_context_t* emm_context, if (nas_emm_proc) { nas_emm_smc_proc_t* smc_proc = (nas_emm_smc_proc_t*)nas_emm_proc; REQUIREMENT_3GPP_24_301(R10_5_4_3_7_a); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; mme_ue_s1ap_id_t ue_id = PARENT_STRUCT(emm_context, struct ue_mm_context_s, emm_context) ->mme_ue_s1ap_id; @@ -948,7 +962,7 @@ static int security_non_delivered_ho(emm_context_t* emm_ctx, security_abort(emm_ctx, (struct nas_base_proc_s*)smc_proc); emm_common_cleanup_by_ueid(smc_proc->ue_id); // Clean up MME APP UE context - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMCN_IMPLICIT_DETACH_UE; emm_sap.u.emm_cn.u.emm_cn_implicit_detach.ue_id = smc_proc->ue_id; emm_sap_send(&emm_sap); @@ -1022,9 +1036,10 @@ static int security_abort(emm_context_t* emm_ctx, ** Others: None ** ** ** ***************************************************************************/ -static int security_select_algorithms(const int ue_eiaP, const int ue_eeaP, - int* const mme_eiaP, - int* const mme_eeaP) { +static status_code_e security_select_algorithms(const int ue_eiaP, + const int ue_eeaP, + int* const mme_eiaP, + int* const mme_eeaP) { OAILOG_FUNC_IN(LOG_NAS_EMM); int preference_index; diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/ServiceRequestHdl.c b/lte/gateway/c/core/oai/tasks/nas/emm/ServiceRequestHdl.cpp similarity index 94% rename from lte/gateway/c/core/oai/tasks/nas/emm/ServiceRequestHdl.c rename to lte/gateway/c/core/oai/tasks/nas/emm/ServiceRequestHdl.cpp index a5ce5026617e..bb6617d30a03 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/ServiceRequestHdl.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/ServiceRequestHdl.cpp @@ -20,25 +20,33 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/conversions.h" #include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_23.003.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" -#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/DetachRequest.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/ExtendedServiceRequest.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_cause.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/ServiceType.h" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" @@ -50,7 +58,8 @@ /****************************************************************************/ /******************* L O C A L D E F I N I T I O N S *******************/ /****************************************************************************/ -static int emm_service_reject(mme_ue_s1ap_id_t ue_id, uint8_t emm_cause); +static status_code_e emm_service_reject(mme_ue_s1ap_id_t ue_id, + uint8_t emm_cause); static int check_paging_received_without_lai(mme_ue_s1ap_id_t ue_id); /* @@ -81,14 +90,15 @@ status_code_e emm_proc_service_reject(const mme_ue_s1ap_id_t ue_id, @param [in]args UE EMM context data @returns status of operation */ -static int emm_service_reject(mme_ue_s1ap_id_t ue_id, uint8_t emm_cause) +static status_code_e emm_service_reject(mme_ue_s1ap_id_t ue_id, + uint8_t emm_cause) { - int rc = RETURNerror; + status_code_e rc = RETURNerror; OAILOG_FUNC_IN(LOG_NAS_EMM); emm_context_t* emm_ctx = emm_context_get(&_emm_data, ue_id); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; /* * Notify EMM-AS SAP that Service Reject message has to be sent @@ -210,7 +220,7 @@ status_code_e emm_recv_initial_ext_service_request( OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNok; emm_context_t* emm_ctx = NULL; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; /* * Get the UE context @@ -323,7 +333,7 @@ static int check_paging_received_without_lai(mme_ue_s1ap_id_t ue_id) { status_code_e emm_send_service_reject_in_dl_nas(const mme_ue_s1ap_id_t ue_id, const uint8_t emm_cause) { status_code_e rc = RETURNok; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_context_t* emm_ctx = emm_context_get(&_emm_data, ue_id); OAILOG_FUNC_IN(LOG_NAS_EMM); diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/TrackingAreaUpdate.c b/lte/gateway/c/core/oai/tasks/nas/emm/TrackingAreaUpdate.cpp similarity index 97% rename from lte/gateway/c/core/oai/tasks/nas/emm/TrackingAreaUpdate.c rename to lte/gateway/c/core/oai/tasks/nas/emm/TrackingAreaUpdate.cpp index ef0f50251669..47efd05a245c 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/TrackingAreaUpdate.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/TrackingAreaUpdate.cpp @@ -19,14 +19,22 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/common/common_ies.h" #include "lte/gateway/c/core/oai/common/common_types.h" -#include "lte/gateway/c/core/oai/common/common_utility_funs.hpp" #include "lte/gateway/c/core/oai/common/conversions.h" #include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" +#ifdef __cplusplus +} +#endif + +#include "lte/gateway/c/core/common/dynamic_memory_check.h" +#include "lte/gateway/c/core/oai/common/common_utility_funs.hpp" #include "lte/gateway/c/core/oai/include/3gpp_requirements_24.301.h" #include "lte/gateway/c/core/oai/include/mme_app_state.hpp" #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" @@ -36,28 +44,27 @@ #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" -#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/EmmCommon.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_cause.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/AdditionalUpdateType.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/EpsUpdateResult.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/EpsUpdateType.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/MobileStationClassmark2.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/TrackingAreaIdentityList.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ /****************************************************************************/ - /****************************************************************************/ /******************* L O C A L D E F I N I T I O N S *******************/ /****************************************************************************/ @@ -73,9 +80,10 @@ * Other aspects of TAU are TODOs for future. */ -static int emm_tracking_area_update_reject(const mme_ue_s1ap_id_t ue_id, - const int emm_cause); -static int emm_tracking_area_update_accept(nas_emm_tau_proc_t* const tau_proc); +static status_code_e emm_tracking_area_update_reject( + const mme_ue_s1ap_id_t ue_id, const int emm_cause); +static status_code_e emm_tracking_area_update_accept( + nas_emm_tau_proc_t* const tau_proc); static int emm_tracking_area_update_abort(struct emm_context_s* emm_context, struct nas_base_proc_s* base_proc); @@ -227,14 +235,14 @@ static status_code_e handle_and_fill_eps_bearer_cntxt_status( */ pid = ue_mm_context->bearer_contexts[EBI_TO_INDEX(ebi)]->pdn_cx_id; if (pid >= MAX_APN_PER_UE) { - OAILOG_ERROR_UE(ue_mm_context->emm_context._imsi64, LOG_NAS_EMM, + OAILOG_ERROR_UE(LOG_NAS_EMM, ue_mm_context->emm_context._imsi64, "No PDN connection found for pid=%d, EBI=%d \n", pid, ebi); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } pdn_context_t* pdn_context = ue_mm_context->pdn_contexts[pid]; if (!pdn_context) { - OAILOG_ERROR_UE(ue_mm_context->emm_context._imsi64, LOG_NAS_EMM, + OAILOG_ERROR_UE(LOG_NAS_EMM, ue_mm_context->emm_context._imsi64, "PDN context is NULL for pid=%d, EBI=%d \n", pid, ebi); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } @@ -596,7 +604,7 @@ status_code_e mme_app_handle_tau_t3450_expiry(zloop_t* loop, int timer_id, } struct ue_mm_context_s* ue_context_p = mme_app_get_ue_context_for_timer( - mme_ue_s1ap_id, "Authentication T3450 Timer"); + mme_ue_s1ap_id, const_cast("Authentication T3450 Timer")); if (ue_context_p == NULL) { OAILOG_ERROR( LOG_MME_APP, @@ -642,7 +650,7 @@ status_code_e mme_app_handle_tau_t3450_expiry(zloop_t* loop, int timer_id, /* * Abort the security mode control procedure */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_ATTACH_ABORT; emm_sap.u.emm_reg.ue_id = tau_proc->ue_id; emm_sap.u.emm_reg.ctx = emm_context; @@ -674,16 +682,16 @@ static int _emm_tracking_area_update_security (emm_context_t * emm_context) \brief Performs the tracking area update procedure not accepted by the network. @param [in]args UE EMM context data - @returns status of operation + @returns RETURNok, RETURNerror */ //------------------------------------------------------------------------------ -static int emm_tracking_area_update_reject(const mme_ue_s1ap_id_t ue_id, - const int emm_cause) +static status_code_e emm_tracking_area_update_reject( + const mme_ue_s1ap_id_t ue_id, const int emm_cause) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNok; - emm_sap_t emm_sap = {0}; + status_code_e rc = RETURNok; + emm_sap_t emm_sap = {}; ue_mm_context_t* ue_mm_context = NULL; emm_context_t* emm_context = NULL; @@ -768,10 +776,11 @@ static int build_csfb_parameters_combined_tau(emm_context_t* emm_ctx, @returns status of operation (RETURNok, RETURNerror) */ //------------------------------------------------------------------------------ -static int emm_tracking_area_update_accept(nas_emm_tau_proc_t* const tau_proc) { +static status_code_e emm_tracking_area_update_accept( + nas_emm_tau_proc_t* const tau_proc) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNerror; - emm_sap_t emm_sap = {0}; + status_code_e rc = RETURNerror; + emm_sap_t emm_sap = {}; ue_mm_context_t* ue_mm_context = NULL; emm_context_t* emm_context = NULL; uint8_t eps_update_result = 0; @@ -1020,7 +1029,7 @@ static int emm_tracking_area_update_abort(struct emm_context_s* emm_context, /* * Notify EMM that EPS attach procedure failed */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_ATTACH_REJ; emm_sap.u.emm_reg.ue_id = ue_id; @@ -1158,11 +1167,11 @@ static nas_emm_tau_proc_t* emm_proc_create_procedure_tau( tau_proc->ies = ies; tau_proc->ue_id = ue_mm_context->mme_ue_s1ap_id; tau_proc->emm_spec_proc.emm_proc.base_proc.abort = - emm_tracking_area_update_abort; + (proc_abort_t)emm_tracking_area_update_abort; tau_proc->emm_spec_proc.emm_proc.base_proc.fail_in = NULL; // No parent procedure tau_proc->emm_spec_proc.emm_proc.base_proc.time_out = - mme_app_handle_tau_t3450_expiry; + (time_out_t)mme_app_handle_tau_t3450_expiry; tau_proc->emm_spec_proc.emm_proc.base_proc.fail_out = NULL; OAILOG_FUNC_RETURN(LOG_NAS_EMM, tau_proc); } diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h b/lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp similarity index 97% rename from lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h rename to lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp index 3e9eccb34519..95130e60c23e 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source emm_data.h +Source emm_data.hpp Version 0.1 @@ -43,7 +43,7 @@ Description Defines internal private data handled by EPS Mobility #include "lte/gateway/c/core/oai/lib/gtpv2-c/nwgtpv2c-0.11/include/queue.h" #include "lte/gateway/c/core/oai/lib/hashtable/hashtable.h" #include "lte/gateway/c/core/oai/lib/hashtable/obj_hashtable.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/AdditionalUpdateType.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/EpsBearerContextStatus.h" @@ -51,8 +51,8 @@ Description Defines internal private data handled by EPS Mobility #include "lte/gateway/c/core/oai/tasks/nas/ies/MobileStationClassmark2.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/TrackingAreaIdentityList.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/UeNetworkCapability.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ @@ -419,129 +419,128 @@ void emm_ctx_unmark_common_procedure_running(emm_context_t* const ctxt, const int attribute_bit_pos) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_set_attribute_present(emm_context_t* const ctxt, - const int attribute_bit_pos) - __attribute__((nonnull)) __attribute__((flatten)); void emm_ctx_clear_attribute_present(emm_context_t* const ctxt, const int attribute_bit_pos) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_set_attribute_valid(emm_context_t* const ctxt, - const int attribute_bit_pos) - __attribute__((nonnull)) __attribute__((flatten)); void emm_ctx_clear_attribute_valid(emm_context_t* const ctxt, const int attribute_bit_pos) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_clear_guti(emm_context_t* const ctxt) __attribute__((nonnull)) -__attribute__((flatten)); -void emm_ctx_set_guti(emm_context_t* const ctxt, guti_t* guti) - __attribute__((nonnull)) __attribute__((flatten)); void emm_ctx_set_valid_guti(emm_context_t* const ctxt, guti_t* guti) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_clear_old_guti(emm_context_t* const ctxt) __attribute__((nonnull)) -__attribute__((flatten)); void emm_ctx_set_old_guti(emm_context_t* const ctxt, guti_t* guti) __attribute__((nonnull)) __attribute__((flatten)); void emm_ctx_set_valid_old_guti(emm_context_t* const ctxt, guti_t* guti) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_clear_imsi(emm_context_t* const ctxt) __attribute__((nonnull)) -__attribute__((nonnull)) __attribute__((flatten)); void emm_ctx_set_imsi(emm_context_t* const ctxt, imsi_t* imsi, imsi64_t imsi64) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_set_valid_imsi(emm_context_t* const ctxt, imsi_t* imsi, - imsi64_t imsi64) __attribute__((nonnull)) -__attribute__((flatten)); -void emm_ctx_clear_imei(emm_context_t* const ctxt) __attribute__((nonnull)) -__attribute__((flatten)); void emm_ctx_set_imei(emm_context_t* const ctxt, imei_t* imei) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_set_valid_imei(emm_context_t* const ctxt, imei_t* imei) - __attribute__((nonnull)) __attribute__((flatten)); void emm_ctx_clear_imeisv(emm_context_t* const ctxt) __attribute__((nonnull)) __attribute__((flatten)); void emm_ctx_set_imeisv(emm_context_t* const ctxt, imeisv_t* imeisv) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_set_valid_imeisv(emm_context_t* const ctxt, imeisv_t* imeisv) - __attribute__((nonnull)) __attribute__((flatten)); void emm_ctx_clear_lvr_tai(emm_context_t* const ctxt) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_set_valid_lvr_tai(emm_context_t* const ctxt, tai_t* lvr_tai) - __attribute__((nonnull)) __attribute__((flatten)); - -void emm_ctx_clear_auth_vectors(emm_context_t* const ctxt) - __attribute__((nonnull)) __attribute__((flatten)); void emm_ctx_clear_auth_vector(emm_context_t* const ctxt, ksi_t eksi) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_clear_security(emm_context_t* const ctxt) __attribute__((nonnull)) -__attribute__((flatten)); void emm_ctx_set_security_type(emm_context_t* const ctxt, emm_sc_type_t sc_type) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_set_security_eksi(emm_context_t* const ctxt, ksi_t eksi) - __attribute__((nonnull)) __attribute__((flatten)); void emm_ctx_clear_security_vector_index(emm_context_t* const ctxt) __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_set_security_vector_index(emm_context_t* const ctxt, - int vector_index) - __attribute__((nonnull)) __attribute__((flatten)); -void emm_ctx_clear_non_current_security(emm_context_t* const ctxt) - __attribute__((nonnull)) __attribute__((flatten)); void emm_ctx_clear_non_current_security_vector_index(emm_context_t* const ctxt) __attribute__((nonnull)); void emm_ctx_set_non_current_security_vector_index(emm_context_t* const ctxt, int vector_index) __attribute__((nonnull)); -void emm_ctx_clear_ue_nw_cap(emm_context_t* const ctxt) - __attribute__((nonnull)); void emm_ctx_set_ue_nw_cap(emm_context_t* const ctxt, const ue_network_capability_t* const ue_nw_cap_ie) __attribute__((nonnull)); + +/*TODO: These declarations are temporarily moved to emm_headers.hpp file to + * resolve undefined references. Uncomment these functions and delete + * emm_headers.hpp after moving all the files to c++ + * GH issue: https://github.com/magma/magma/issues/13096 + */ + +/*#ifdef __cplusplus +extern "C" { +#endif +void emm_ctx_set_valid_lvr_tai(emm_context_t* const ctxt, tai_t* lvr_tai) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_set_valid_imeisv(emm_context_t* const ctxt, imeisv_t* imeisv) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_clear_imei(emm_context_t* const ctxt) __attribute__((nonnull)) +__attribute__((flatten)); +void emm_ctx_set_valid_imei(emm_context_t* const ctxt, imei_t* imei) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_clear_auth_vectors(emm_context_t* const ctxt) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_set_security_eksi(emm_context_t* const ctxt, ksi_t eksi) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_clear_security(emm_context_t* const ctxt) __attribute__((nonnull)) +__attribute__((flatten)); +void emm_ctx_clear_non_current_security(emm_context_t* const ctxt) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_set_security_vector_index(emm_context_t* const ctxt, + int vector_index) + __attribute__((nonnull)) __attribute__((flatten));*/ + +/*void emm_ctx_clear_imsi(emm_context_t* const ctxt) __attribute__((nonnull)) +__attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_set_attribute_present(emm_context_t* const ctxt, + const int attribute_bit_pos) + __attribute__((nonnull)); void emm_ctx_set_valid_ue_nw_cap( emm_context_t* const ctxt, const ue_network_capability_t* const ue_nw_cap_ie) __attribute__((nonnull)); - -void emm_ctx_clear_ms_nw_cap(emm_context_t* const ctxt) - __attribute__((nonnull)); -void emm_ctx_set_ms_nw_cap(emm_context_t* const ctxt, - const ms_network_capability_t* const ms_nw_cap_ie); +#ifdef __cplusplus +} void emm_ctx_set_valid_ms_nw_cap( emm_context_t* const ctxt, const ms_network_capability_t* const ms_nw_cap_ie); -void emm_ctx_clear_mobile_station_clsMark2(emm_context_t* const ctxt) - __attribute__((nonnull)); void emm_ctx_set_mobile_station_clsMark2( emm_context_t* const ctxt, MobileStationClassmark2* mob_st_clsMark2) __attribute__((nonnull)); +#endif +void emm_ctx_clear_ms_nw_cap(emm_context_t* const ctxt) + __attribute__((nonnull)); +void emm_ctx_set_ms_nw_cap(emm_context_t* const ctxt, + const ms_network_capability_t* const ms_nw_cap_ie); +void emm_ctx_clear_mobile_station_clsMark2(emm_context_t* const ctxt) + __attribute__((nonnull)); void emm_ctx_clear_drx_parameter(emm_context_t* const ctxt) __attribute__((nonnull)); void emm_ctx_set_drx_parameter(emm_context_t* const ctxt, drx_parameter_t* drx) __attribute__((nonnull)); -void emm_ctx_set_valid_drx_parameter(emm_context_t* const ctxt, - drx_parameter_t* drx) - __attribute__((nonnull)); void emm_ctx_clear_ue_additional_security_capability(emm_context_t* const ctxt) __attribute__((nonnull)); -void emm_ctx_set_ue_additional_security_capability( - emm_context_t* const ctxt, ue_additional_security_capability_t* drx) - __attribute__((nonnull)); void free_emm_ctx_memory(emm_context_t* const ctxt, const mme_ue_s1ap_id_t ue_id); -struct emm_context_s* emm_context_get(emm_data_t* emm_data, - const mme_ue_s1ap_id_t ue_id); struct emm_context_s* emm_context_get_by_imsi(emm_data_t* emm_data, imsi64_t imsi64); +void emm_ctx_set_valid_drx_parameter(emm_context_t* const ctxt, + drx_parameter_t* drx) + __attribute__((nonnull)); +void emm_ctx_set_ue_additional_security_capability( + emm_context_t* const ctxt, ue_additional_security_capability_t* drx) + __attribute__((nonnull)); +struct emm_context_s* emm_context_get(emm_data_t* emm_data, + const mme_ue_s1ap_id_t ue_id); + status_code_e emm_context_upsert_imsi(emm_data_t* emm_data, struct emm_context_s* elm) __attribute__((nonnull)); @@ -561,11 +560,26 @@ void nas_stop_T3460(const mme_ue_s1ap_id_t ue_id, void nas_stop_T3470(const mme_ue_s1ap_id_t ue_id, struct nas_timer_s* const T3470); void nas_stop_T3422(const imsi64_t imsi64, struct nas_timer_s* const T3422); +void emm_ctx_set_valid_imsi(emm_context_t* const ctxt, imsi_t* imsi, + imsi64_t imsi64) __attribute__((nonnull)) +__attribute__((flatten)); +void emm_ctx_set_attribute_valid(emm_context_t* const ctxt, + const int attribute_bit_pos) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_set_guti(emm_context_t* const ctxt, guti_t* guti) + __attribute__((nonnull)) __attribute__((flatten)); void nas_start_Ts6a_auth_info(const mme_ue_s1ap_id_t ue_id, struct nas_timer_s* const Ts6a_auth_info, time_out_t time_out_cb); +void emm_ctx_clear_old_guti(emm_context_t* const ctxt) __attribute__((nonnull)) +__attribute__((flatten)); +void emm_ctx_clear_guti(emm_context_t* const ctxt) __attribute__((nonnull)) +__attribute__((flatten)); void emm_init_context(struct emm_context_s* const emm_ctx, const bool init_esm_ctxt) __attribute__((nonnull)); +void emm_ctx_clear_ue_nw_cap(emm_context_t* const ctxt) + __attribute__((nonnull));*/ + void emm_context_free(struct emm_context_s* const emm_ctx) __attribute__((nonnull)); void emm_context_free_content(struct emm_context_s* const emm_ctx) diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/emm_data_ctx.c b/lte/gateway/c/core/oai/tasks/nas/emm/emm_data_ctx.cpp similarity index 92% rename from lte/gateway/c/core/oai/tasks/nas/emm/emm_data_ctx.c rename to lte/gateway/c/core/oai/tasks/nas/emm/emm_data_ctx.cpp index 1eaa5ccb47fc..fd2b3f08771f 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/emm_data_ctx.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/emm_data_ctx.cpp @@ -21,12 +21,22 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/common/dynamic_memory_check.h" +#include "lte/gateway/c/core/oai/common/log.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/conversions.h" -#include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#include "lte/gateway/c/core/oai/lib/hashtable/hashtable.h" +#include "lte/gateway/c/core/oai/lib/itti/intertask_interface.h" +#ifdef __cplusplus +} +#endif + +#include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/common/security_types.h" #include "lte/gateway/c/core/oai/include/TrackingAreaIdentity.h" #include "lte/gateway/c/core/oai/include/mme_app_state.hpp" @@ -37,21 +47,19 @@ #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_33.401.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/lib/hashtable/hashtable.h" -#include "lte/gateway/c/core/oai/lib/itti/intertask_interface.h" #include "lte/gateway/c/core/oai/lib/secu/secu_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/EpsBearerContextStatus.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/MobileStationClassmark2.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/NasSecurityAlgorithms.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/TrackingAreaIdentityList.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" //------------------------------------------------------------------------------ mme_ue_s1ap_id_t emm_ctx_get_new_ue_id(const emm_context_t* const ctxt) { @@ -59,8 +67,8 @@ mme_ue_s1ap_id_t emm_ctx_get_new_ue_id(const emm_context_t* const ctxt) { } //------------------------------------------------------------------------------ -inline void emm_ctx_set_attribute_present(emm_context_t* const ctxt, - const int attribute_bit_pos) { +void emm_ctx_set_attribute_present(emm_context_t* const ctxt, + const int attribute_bit_pos) { ctxt->member_present_mask |= attribute_bit_pos; } @@ -70,8 +78,8 @@ inline void emm_ctx_clear_attribute_present(emm_context_t* const ctxt, ctxt->member_valid_mask &= ~attribute_bit_pos; } -inline void emm_ctx_set_attribute_valid(emm_context_t* const ctxt, - const int attribute_bit_pos) { +void emm_ctx_set_attribute_valid(emm_context_t* const ctxt, + const int attribute_bit_pos) { ctxt->member_present_mask |= attribute_bit_pos; ctxt->member_valid_mask |= attribute_bit_pos; } @@ -83,7 +91,7 @@ inline void emm_ctx_clear_attribute_valid(emm_context_t* const ctxt, //------------------------------------------------------------------------------ /* Clear GUTI */ -inline void emm_ctx_clear_guti(emm_context_t* const ctxt) { +void emm_ctx_clear_guti(emm_context_t* const ctxt) { clear_guti(&ctxt->_guti); emm_ctx_clear_attribute_present(ctxt, EMM_CTXT_MEMBER_GUTI); OAILOG_DEBUG(LOG_NAS_EMM, "ue_id=" MME_UE_S1AP_ID_FMT " GUTI cleared\n", @@ -92,7 +100,7 @@ inline void emm_ctx_clear_guti(emm_context_t* const ctxt) { } /* Set GUTI */ -inline void emm_ctx_set_guti(emm_context_t* const ctxt, guti_t* guti) { +void emm_ctx_set_guti(emm_context_t* const ctxt, guti_t* guti) { ctxt->_guti = *guti; emm_ctx_set_attribute_present(ctxt, EMM_CTXT_MEMBER_GUTI); OAILOG_DEBUG(LOG_NAS_EMM, @@ -115,7 +123,7 @@ inline void emm_ctx_set_valid_guti(emm_context_t* const ctxt, guti_t* guti) { //------------------------------------------------------------------------------ /* Clear old GUTI */ -inline void emm_ctx_clear_old_guti(emm_context_t* const ctxt) { +void emm_ctx_clear_old_guti(emm_context_t* const ctxt) { clear_guti(&ctxt->_old_guti); emm_ctx_clear_attribute_present(ctxt, EMM_CTXT_MEMBER_OLD_GUTI); OAILOG_DEBUG(LOG_NAS_EMM, "ue_id=" MME_UE_S1AP_ID_FMT " old GUTI cleared\n", @@ -150,7 +158,7 @@ inline void emm_ctx_set_valid_old_guti(emm_context_t* const ctxt, //------------------------------------------------------------------------------ /* Clear IMSI */ -inline void emm_ctx_clear_imsi(emm_context_t* const ctxt) { +void emm_ctx_clear_imsi(emm_context_t* const ctxt) { clear_imsi(&ctxt->_imsi); ctxt->_imsi64 = INVALID_IMSI64; emm_ctx_clear_attribute_present(ctxt, EMM_CTXT_MEMBER_IMSI); @@ -175,8 +183,8 @@ inline void emm_ctx_set_imsi(emm_context_t* const ctxt, imsi_t* imsi, } /* Set IMSI, mark it as valid */ -inline void emm_ctx_set_valid_imsi(emm_context_t* const ctxt, imsi_t* imsi, - imsi64_t imsi64) { +void emm_ctx_set_valid_imsi(emm_context_t* const ctxt, imsi_t* imsi, + imsi64_t imsi64) { ctxt->_imsi = *imsi; ctxt->_imsi64 = imsi64; emm_ctx_set_attribute_valid(ctxt, EMM_CTXT_MEMBER_IMSI); @@ -194,7 +202,7 @@ inline void emm_ctx_set_valid_imsi(emm_context_t* const ctxt, imsi_t* imsi, //------------------------------------------------------------------------------ /* Clear IMEI */ -inline void emm_ctx_clear_imei(emm_context_t* const ctxt) { +void emm_ctx_clear_imei(emm_context_t* const ctxt) { clear_imei(&ctxt->_imei); emm_ctx_clear_attribute_present(ctxt, EMM_CTXT_MEMBER_IMEI); OAILOG_DEBUG(LOG_NAS_EMM, "ue_id=" MME_UE_S1AP_ID_FMT " IMEI cleared\n", @@ -216,7 +224,7 @@ inline void emm_ctx_set_imei(emm_context_t* const ctxt, imei_t* imei) { } /* Set IMEI, mark it as valid */ -inline void emm_ctx_set_valid_imei(emm_context_t* const ctxt, imei_t* imei) { +void emm_ctx_set_valid_imei(emm_context_t* const ctxt, imei_t* imei) { ctxt->_imei = *imei; emm_ctx_set_attribute_valid(ctxt, EMM_CTXT_MEMBER_IMEI); char imei_str[16]; @@ -249,8 +257,7 @@ inline void emm_ctx_set_imeisv(emm_context_t* const ctxt, imeisv_t* imeisv) { } /* Set IMEI_SV, mark it as valid */ -inline void emm_ctx_set_valid_imeisv(emm_context_t* const ctxt, - imeisv_t* imeisv) { +void emm_ctx_set_valid_imeisv(emm_context_t* const ctxt, imeisv_t* imeisv) { ctxt->_imeisv = *imeisv; emm_ctx_set_attribute_valid(ctxt, EMM_CTXT_MEMBER_IMEI_SV); OAILOG_DEBUG(LOG_NAS_EMM, @@ -272,8 +279,7 @@ inline void emm_ctx_clear_lvr_tai(emm_context_t* const ctxt) { } /* Set last_visited_registered_tai, mark it as valid */ -inline void emm_ctx_set_valid_lvr_tai(emm_context_t* const ctxt, - tai_t* lvr_tai) { +void emm_ctx_set_valid_lvr_tai(emm_context_t* const ctxt, tai_t* lvr_tai) { ctxt->_lvr_tai = *lvr_tai; emm_ctx_set_attribute_valid(ctxt, EMM_CTXT_MEMBER_LVR_TAI); // OAILOG_DEBUG (LOG_NAS_EMM, "ue_id="MME_UE_S1AP_ID_FMT" set last visited @@ -283,7 +289,7 @@ inline void emm_ctx_set_valid_lvr_tai(emm_context_t* const ctxt, //------------------------------------------------------------------------------ /* Clear AUTH vectors */ -inline void emm_ctx_clear_auth_vectors(emm_context_t* const ctxt) { +void emm_ctx_clear_auth_vectors(emm_context_t* const ctxt) { emm_ctx_clear_attribute_present(ctxt, EMM_CTXT_MEMBER_AUTH_VECTORS); for (int i = 0; i < MAX_EPS_AUTH_VECTORS; i++) { memset((void*)&ctxt->_vector[i], 0, sizeof(ctxt->_vector[i])); @@ -325,7 +331,7 @@ inline void emm_ctx_clear_auth_vector(emm_context_t* const ctxt, ksi_t eksi) { } //------------------------------------------------------------------------------ /* Clear security */ -inline void emm_ctx_clear_security(emm_context_t* const ctxt) { +void emm_ctx_clear_security(emm_context_t* const ctxt) { memset(&ctxt->_security, 0, sizeof(ctxt->_security)); emm_ctx_set_security_type(ctxt, SECURITY_CTX_TYPE_NOT_AVAILABLE); emm_ctx_set_security_eksi(ctxt, KSI_NO_KEY_AVAILABLE); @@ -341,8 +347,8 @@ inline void emm_ctx_clear_security(emm_context_t* const ctxt) { } //------------------------------------------------------------------------------ -inline void emm_ctx_set_security_type(emm_context_t* const ctxt, - emm_sc_type_t sc_type) { +void emm_ctx_set_security_type(emm_context_t* const ctxt, + emm_sc_type_t sc_type) { ctxt->_security.sc_type = sc_type; OAILOG_TRACE(LOG_NAS_EMM, "ue_id=" MME_UE_S1AP_ID_FMT @@ -353,7 +359,7 @@ inline void emm_ctx_set_security_type(emm_context_t* const ctxt, } //------------------------------------------------------------------------------ -inline void emm_ctx_set_security_eksi(emm_context_t* const ctxt, ksi_t eksi) { +void emm_ctx_set_security_eksi(emm_context_t* const ctxt, ksi_t eksi) { ctxt->_security.eksi = eksi; OAILOG_TRACE(LOG_NAS_EMM, "ue_id=" MME_UE_S1AP_ID_FMT " set security context eksi %d\n", @@ -372,8 +378,8 @@ inline void emm_ctx_clear_security_vector_index(emm_context_t* const ctxt) { ->mme_ue_s1ap_id); } //------------------------------------------------------------------------------ -inline void emm_ctx_set_security_vector_index(emm_context_t* const ctxt, - int vector_index) { +void emm_ctx_set_security_vector_index(emm_context_t* const ctxt, + int vector_index) { ctxt->_security.vector_index = vector_index; OAILOG_TRACE(LOG_NAS_EMM, "ue_id=" MME_UE_S1AP_ID_FMT @@ -385,7 +391,7 @@ inline void emm_ctx_set_security_vector_index(emm_context_t* const ctxt, //------------------------------------------------------------------------------ /* Clear non current security */ -inline void emm_ctx_clear_non_current_security(emm_context_t* const ctxt) { +void emm_ctx_clear_non_current_security(emm_context_t* const ctxt) { memset(&ctxt->_non_current_security, 0, sizeof(ctxt->_non_current_security)); ctxt->_non_current_security.sc_type = SECURITY_CTX_TYPE_NOT_AVAILABLE; ctxt->_non_current_security.eksi = KSI_NO_KEY_AVAILABLE; @@ -405,7 +411,11 @@ inline void emm_ctx_clear_non_current_security(emm_context_t* const ctxt) { //------------------------------------------------------------------------------ /* Clear UE network capability IE */ -inline void emm_ctx_clear_ue_nw_cap(emm_context_t* const ctxt) { + +#ifdef __cplusplus +extern "C" { +#endif +void emm_ctx_clear_ue_nw_cap(emm_context_t* const ctxt) { memset(&ctxt->_ue_network_capability, 0, sizeof(ctxt->_ue_network_capability)); emm_ctx_clear_attribute_present(ctxt, @@ -416,6 +426,9 @@ inline void emm_ctx_clear_ue_nw_cap(emm_context_t* const ctxt) { (PARENT_STRUCT(ctxt, struct ue_mm_context_s, emm_context)) ->mme_ue_s1ap_id); } +#ifdef __cplusplus +} +#endif /* Set UE network capability IE */ inline void emm_ctx_set_ue_nw_cap( @@ -431,7 +444,10 @@ inline void emm_ctx_set_ue_nw_cap( } /* Set UE network capability IE, mark it as valid */ -inline void emm_ctx_set_valid_ue_nw_cap( +#ifdef __cplusplus +extern "C" { +#endif +void emm_ctx_set_valid_ue_nw_cap( emm_context_t* const ctxt, const ue_network_capability_t* const ue_nw_cap_ie) { ctxt->_ue_network_capability = *ue_nw_cap_ie; @@ -442,10 +458,13 @@ inline void emm_ctx_set_valid_ue_nw_cap( (PARENT_STRUCT(ctxt, struct ue_mm_context_s, emm_context)) ->mme_ue_s1ap_id); } +#ifdef __cplusplus +} +#endif //------------------------------------------------------------------------------ /* Clear MS network capability IE */ -inline void emm_ctx_clear_ms_nw_cap(emm_context_t* const ctxt) { +void emm_ctx_clear_ms_nw_cap(emm_context_t* const ctxt) { memset(&ctxt->_ms_network_capability, 0, sizeof(ctxt->_ms_network_capability)); emm_ctx_clear_attribute_present(ctxt, @@ -458,9 +477,8 @@ inline void emm_ctx_clear_ms_nw_cap(emm_context_t* const ctxt) { } /* Set UE network capability IE */ -inline void emm_ctx_set_ms_nw_cap( - emm_context_t* const ctxt, - const ms_network_capability_t* const ms_nw_cap_ie) { +void emm_ctx_set_ms_nw_cap(emm_context_t* const ctxt, + const ms_network_capability_t* const ms_nw_cap_ie) { ctxt->_ms_network_capability = *ms_nw_cap_ie; emm_ctx_set_attribute_present(ctxt, EMM_CTXT_MEMBER_MS_NETWORK_CAPABILITY_IE); OAILOG_DEBUG(LOG_NAS_EMM, @@ -471,7 +489,7 @@ inline void emm_ctx_set_ms_nw_cap( } /* Set UE network capability IE, mark it as valid */ -inline void emm_ctx_set_valid_ms_nw_cap( +void emm_ctx_set_valid_ms_nw_cap( emm_context_t* const ctxt, const ms_network_capability_t* const ms_nw_cap_ie) { ctxt->_ms_network_capability = *ms_nw_cap_ie; @@ -485,7 +503,7 @@ inline void emm_ctx_set_valid_ms_nw_cap( //------------------------------------------------------------------------------ /* Clear current DRX parameter */ -inline void emm_ctx_clear_drx_parameter(emm_context_t* const ctxt) { +void emm_ctx_clear_drx_parameter(emm_context_t* const ctxt) { memset(&ctxt->_drx_parameter, 0, sizeof(drx_parameter_t)); emm_ctx_clear_attribute_present(ctxt, EMM_CTXT_MEMBER_CURRENT_DRX_PARAMETER); OAILOG_DEBUG(LOG_NAS_EMM, @@ -495,8 +513,8 @@ inline void emm_ctx_clear_drx_parameter(emm_context_t* const ctxt) { } /* Set current DRX parameter */ -inline void emm_ctx_set_drx_parameter(emm_context_t* const ctxt, - drx_parameter_t* drx) { +void emm_ctx_set_drx_parameter(emm_context_t* const ctxt, + drx_parameter_t* drx) { memcpy(&ctxt->_drx_parameter, drx, sizeof(drx_parameter_t)); emm_ctx_set_attribute_present(ctxt, EMM_CTXT_MEMBER_CURRENT_DRX_PARAMETER); OAILOG_DEBUG(LOG_NAS_EMM, @@ -507,8 +525,8 @@ inline void emm_ctx_set_drx_parameter(emm_context_t* const ctxt, } /* Set current DRX parameter, mark it as valid */ -inline void emm_ctx_set_valid_drx_parameter(emm_context_t* const ctxt, - drx_parameter_t* drx) { +void emm_ctx_set_valid_drx_parameter(emm_context_t* const ctxt, + drx_parameter_t* drx) { emm_ctx_set_drx_parameter(ctxt, drx); emm_ctx_set_attribute_valid(ctxt, EMM_CTXT_MEMBER_CURRENT_DRX_PARAMETER); OAILOG_DEBUG(LOG_NAS_EMM, @@ -534,7 +552,7 @@ inline void emm_ctx_clear_ue_additional_security_capability( } /* Set UE additional security capability */ -inline void emm_ctx_set_ue_additional_security_capability( +void emm_ctx_set_ue_additional_security_capability( emm_context_t* const ctxt, ue_additional_security_capability_t* uasc) { memcpy(&ctxt->ue_additional_security_capability, uasc, sizeof(ue_additional_security_capability_t)); @@ -599,7 +617,7 @@ inline void emm_ctx_clear_mobile_station_clsMark2(emm_context_t* const ctxt) { } /* Set mob_station_clsMark2 */ -inline void emm_ctx_set_mobile_station_clsMark2( +void emm_ctx_set_mobile_station_clsMark2( emm_context_t* const ctxt, MobileStationClassmark2* mob_st_clsMark2) { ctxt->_mob_st_clsMark2 = *mob_st_clsMark2; emm_ctx_set_attribute_present(ctxt, EMM_CTXT_MEMBER_MOB_STATION_CLSMARK2); @@ -607,6 +625,9 @@ inline void emm_ctx_set_mobile_station_clsMark2( //------------------------------------------------------------------------------ /* Free dynamically allocated memory */ +#ifdef __cplusplus +extern "C" { +#endif void free_emm_ctx_memory(emm_context_t* const ctxt, const mme_ue_s1ap_id_t ue_id) { OAILOG_DEBUG(LOG_NAS_EMM, @@ -620,6 +641,9 @@ void free_emm_ctx_memory(emm_context_t* const ctxt, nas_delete_all_emm_procedures(ctxt); free_esm_context_content(&ctxt->esm_ctx); } +#ifdef __cplusplus +} +#endif //------------------------------------------------------------------------------ struct emm_context_s* emm_context_get(emm_data_t* emm_data, // TODO REMOVE @@ -815,6 +839,9 @@ void nas_start_Ts6a_auth_info(const mme_ue_s1ap_id_t ue_id, } } //------------------------------------------------------------------------------ +#ifdef __cplusplus +extern "C" { +#endif void nas_stop_T3450(const mme_ue_s1ap_id_t ue_id, struct nas_timer_s* const T3450) { if ((T3450) && (T3450->id != NAS_TIMER_INACTIVE_ID)) { @@ -824,6 +851,9 @@ void nas_stop_T3450(const mme_ue_s1ap_id_t ue_id, ue_id); } } +#ifdef __cplusplus +} +#endif //------------------------------------------------------------------------------ void nas_stop_T3460(const mme_ue_s1ap_id_t ue_id, diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp b/lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp new file mode 100644 index 000000000000..0ae3d355917d --- /dev/null +++ b/lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp @@ -0,0 +1,215 @@ +/* +Copyright 2022 The Magma Authors. + +This source code is licensed under the BSD-style license found in the +LICENSE file in the root directory of this source tree. + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#ifndef FILE_EMM_HEARDERS_SEEN +#define FILE_EMM_HEADERS_SEEN + +/*TODO: This file has temporary function declarations to + * resolve undefined references. Delete + * this file after moving all the files to c++ + * GH issue: https://github.com/magma/magma/issues/13096 + */ +#include + +#include "lte/gateway/c/core/common/common_defs.h" +#include "lte/gateway/c/core/oai/include/nas/securityDef.h" +#include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.008.h" +#include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" +#include "lte/gateway/c/core/oai/lib/gtpv2-c/nwgtpv2c-0.11/include/queue.h" +#include "lte/gateway/c/core/oai/lib/hashtable/hashtable.h" +#include "lte/gateway/c/core/oai/lib/hashtable/obj_hashtable.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/ies/AdditionalUpdateType.h" +#include "lte/gateway/c/core/oai/tasks/nas/ies/EpsBearerContextStatus.h" +#include "lte/gateway/c/core/oai/tasks/nas/ies/EpsNetworkFeatureSupport.h" +#include "lte/gateway/c/core/oai/tasks/nas/ies/MobileStationClassmark2.h" +#include "lte/gateway/c/core/oai/tasks/nas/ies/TrackingAreaIdentityList.h" +#include "lte/gateway/c/core/oai/tasks/nas/ies/UeNetworkCapability.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" + +/****************************************************************************/ +/********************* G L O B A L C O N S T A N T S *******************/ +/****************************************************************************/ + +/****************************************************************************/ +/************************ G L O B A L T Y P E S ************************/ +/****************************************************************************/ +void nas_start_T3422(const mme_ue_s1ap_id_t ue_id, + struct nas_timer_s* const T3422, time_out_t time_out_cb); +void nas_stop_T3460(const mme_ue_s1ap_id_t ue_id, + struct nas_timer_s* const T3460); +void nas_stop_T3470(const mme_ue_s1ap_id_t ue_id, + struct nas_timer_s* const T3470); +void nas_stop_T3422(const imsi64_t imsi64, struct nas_timer_s* const T3422); + +struct emm_context_s* emm_context_get(emm_data_t* emm_data, + const mme_ue_s1ap_id_t ue_id); +void free_emm_detach_request_ies(emm_detach_request_ies_t** const ies); +void free_emm_tau_request_ies(emm_tau_request_ies_t** const ies); +void free_emm_attach_request_ies(emm_attach_request_ies_t** const params); +void nas_start_T3450(const mme_ue_s1ap_id_t ue_id, + struct nas_timer_s* const T3450, time_out_t time_out_cb); +void nas_start_T3460(const mme_ue_s1ap_id_t ue_id, + struct nas_timer_s* const T3460, time_out_t time_out_cb); +void nas_start_T3470(const mme_ue_s1ap_id_t ue_id, + struct nas_timer_s* const T3470, time_out_t time_out_cb); +status_code_e emm_context_upsert_imsi(emm_data_t* emm_data, + struct emm_context_s* elm) + __attribute__((nonnull)); +bool is_nas_common_procedure_identification_running( + const struct emm_context_s* const ctxt); + +nas_emm_ident_proc_t* get_nas_common_procedure_identification( + const struct emm_context_s* const ctxt); +bool is_nas_attach_reject_sent(const nas_emm_attach_proc_t* const attach_proc); +bool is_nas_specific_procedure_attach_running( + const struct emm_context_s* const ctxt); +void emm_ctx_set_mobile_station_clsMark2( + emm_context_t* const ctxt, MobileStationClassmark2* mob_st_clsMark2) + __attribute__((nonnull)); +void emm_ctx_set_ue_additional_security_capability( + emm_context_t* const ctxt, ue_additional_security_capability_t* drx) + __attribute__((nonnull)); +status_code_e mme_api_new_guti(const imsi_t* const imsi, + const guti_t* const old_guti, guti_t* const guti, + const tai_t* const originating_tai, + tai_list_t* const tai_list); +void emm_ctx_set_guti(emm_context_t* const ctxt, guti_t* guti) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_set_attribute_valid(emm_context_t* const ctxt, + const int attribute_bit_pos) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_set_valid_ms_nw_cap( + emm_context_t* const ctxt, + const ms_network_capability_t* const ms_nw_cap_ie); +void emm_ctx_set_valid_imsi(emm_context_t* const ctxt, imsi_t* imsi, + imsi64_t imsi64) __attribute__((nonnull)) +__attribute__((flatten)); +bool is_nas_specific_procedure_attach_running( + const struct emm_context_s* const ctxt); +struct emm_context_s* emm_context_get_by_imsi(emm_data_t* emm_data, + imsi64_t imsi64); +void emm_ctx_clear_ms_nw_cap(emm_context_t* const ctxt) + __attribute__((nonnull)); +void emm_ctx_set_valid_drx_parameter(emm_context_t* const ctxt, + drx_parameter_t* drx); +status_code_e emm_proc_emm_information(ue_mm_context_t* emm_ctx); +nas_emm_attach_proc_t* nas_new_attach_procedure( + struct emm_context_s* const emm_context); +emm_fsm_state_t emm_fsm_get_state( + const struct emm_context_s* const emm_context); +void emm_ctx_set_valid_lvr_tai(emm_context_t* const ctxt, tai_t* lvr_tai) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_set_valid_imei(emm_context_t* const ctxt, imei_t* imei) + __attribute__((nonnull)) __attribute__((flatten)); +void nas_start_Ts6a_auth_info(const mme_ue_s1ap_id_t ue_id, + struct nas_timer_s* const Ts6a_auth_info, + time_out_t time_out_cb); +void emm_ctx_set_attribute_present(emm_context_t* const ctxt, + const int attribute_bit_pos) + __attribute__((nonnull)); +void emm_ctx_clear_auth_vectors(emm_context_t* const ctxt) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_set_security_eksi(emm_context_t* const ctxt, ksi_t eksi) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_clear_old_guti(emm_context_t* const ctxt) __attribute__((nonnull)) +__attribute__((flatten)); +void emm_ctx_clear_imsi(emm_context_t* const ctxt) __attribute__((nonnull)) +__attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_clear_imei(emm_context_t* const ctxt) __attribute__((nonnull)) +__attribute__((flatten)); +void emm_ctx_clear_security(emm_context_t* const ctxt) __attribute__((nonnull)) +__attribute__((flatten)); +void emm_ctx_clear_non_current_security(emm_context_t* const ctxt) + __attribute__((nonnull)) __attribute__((flatten)); +status_code_e mme_api_notify_imsi(const mme_ue_s1ap_id_t id, + const imsi64_t imsi64); +nas_emm_ident_proc_t* nas_new_identification_procedure( + struct emm_context_s* const emm_context); +void emm_ctx_clear_guti(emm_context_t* const ctxt) __attribute__((nonnull)) +__attribute__((flatten)); +void emm_ctx_set_valid_imeisv(emm_context_t* const ctxt, imeisv_t* imeisv) + __attribute__((nonnull)) __attribute__((flatten)); +void emm_ctx_set_security_vector_index(emm_context_t* const ctxt, + int vector_index) + __attribute__((nonnull)) __attribute__((flatten)); +nas_emm_smc_proc_t* get_nas_common_procedure_smc( + const struct emm_context_s* const ctxt); +nas_emm_smc_proc_t* nas_new_smc_procedure( + struct emm_context_s* const emm_context); +nas_emm_tau_proc_t* get_nas_specific_procedure_tau( + const struct emm_context_s* const ctxt); +nas_emm_tau_proc_t* nas_new_tau_procedure( + struct emm_context_s* const emm_context); +nas_auth_info_proc_t* get_nas_cn_procedure_auth_info( + const struct emm_context_s* const ctxt); +int nas_message_encode(unsigned char* buffer, const nas_message_t* const msg, + size_t length, void* security); +void nas_emm_procedure_register_emm_message(mme_ue_s1ap_id_t ue_id, + const uint64_t puid, + bstring nas_msg); +int nas_message_encrypt(const unsigned char* inbuf, unsigned char* outbuf, + const nas_message_security_header_t* header, + size_t length, void* security); +int nas_message_decrypt(const unsigned char* const inbuf, + unsigned char* const outbuf, + nas_message_security_header_t* header, size_t length, + void* security, nas_message_decode_status_t* status); + +int nas_message_decode(const unsigned char* const buffer, nas_message_t* msg, + size_t length, void* security, + nas_message_decode_status_t* status); +status_code_e emm_proc_status_ind(mme_ue_s1ap_id_t ue_id, + emm_cause_t emm_cause); +status_code_e emm_proc_status(mme_ue_s1ap_id_t ue_id, emm_cause_t emm_cause); +void set_callbacks_for_attach_proc(nas_emm_attach_proc_t* attach_proc); +void free_emm_tau_request_ies(emm_tau_request_ies_t** const ies); +void set_callbacks_for_auth_proc(nas_emm_auth_proc_t* auth_proc); +void free_emm_detach_request_ies(emm_detach_request_ies_t** const ies); +status_code_e emm_proc_emm_information(ue_mm_context_t* emm_ctx); +void set_callbacks_for_auth_info_proc(nas_auth_info_proc_t* auth_info_proc); +void set_notif_callbacks_for_auth_proc(nas_emm_auth_proc_t* auth_proc); +void set_callbacks_for_smc_proc(nas_emm_smc_proc_t* smc_proc); +void set_notif_callbacks_for_smc_proc(nas_emm_smc_proc_t* smc_proc); +#ifdef __cplusplus +extern "C" { +#endif +void free_emm_ctx_memory(emm_context_t* const ctxt, + const mme_ue_s1ap_id_t ue_id); + +void clear_emm_ctxt(emm_context_t* emm_ctx); +void emm_ctx_set_valid_ue_nw_cap( + emm_context_t* const ctxt, + const ue_network_capability_t* const ue_nw_cap_ie) __attribute__((nonnull)); + +bool is_nas_attach_accept_sent(const nas_emm_attach_proc_t* const attach_proc); + +void nas_stop_T3450(const mme_ue_s1ap_id_t ue_id, + struct nas_timer_s* const T3450); +void emm_init_context(struct emm_context_s* const emm_ctx, + const bool init_esm_ctxt) __attribute__((nonnull)); + +void emm_ctx_clear_ue_nw_cap(emm_context_t* const ctxt) + __attribute__((nonnull)); +#ifdef __cplusplus +} +#endif + +bool is_nas_common_procedure_authentication_running( + const struct emm_context_s* const ctxt); +status_code_e nas_timer_init(void); +void nas_timer_cleanup(void); +#endif /* FILE_EMM_HEADERS_SEEN*/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/emm_main.c b/lte/gateway/c/core/oai/tasks/nas/emm/emm_main.cpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/emm/emm_main.c rename to lte/gateway/c/core/oai/tasks/nas/emm/emm_main.cpp index 2c579ec4f201..ffff0080194b 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/emm_main.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/emm_main.cpp @@ -17,12 +17,19 @@ #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/log.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/mme_config.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_main.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_main.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/emm_main.h b/lte/gateway/c/core/oai/tasks/nas/emm/emm_main.hpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/emm/emm_main.h rename to lte/gateway/c/core/oai/tasks/nas/emm/emm_main.hpp index 9a2cc2cf8f4b..46dc2d376457 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/emm_main.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/emm_main.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source emm_main.h +Source emm_main.hpp Version 0.1 @@ -38,7 +38,7 @@ Description Defines the EPS Mobility Management procedure call manager, #include "lte/gateway/c/core/oai/include/mme_config.h" #include "lte/gateway/c/core/oai/include/nas/commonDef.h" #include "lte/gateway/c/core/oai/include/nas/networkDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h b/lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp similarity index 90% rename from lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h rename to lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp index b6cd36e5d0fd..fd9bd95183e7 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source emm_proc.h +Source emm_proc.hpp Version 0.1 @@ -37,14 +37,19 @@ Description Defines the EPS Mobility Management procedures executed at #include "lte/gateway/c/core/common/common_defs.h" +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/oai/include/nas/commonDef.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#ifdef __cplusplus +} +#endif -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" - -#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.h" //nas_message_decode_status_t -#include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.hpp" // nas_message_decode_status_t +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/MobileStationClassmark2.h" +#include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ /****************************************************************************/ @@ -172,9 +177,15 @@ typedef struct emm_tau_request_ies_s { * EMM status procedure *--------------------------------------------------------------------------- */ -status_code_e emm_proc_status_ind(mme_ue_s1ap_id_t ue_id, +/*TODO: These declarations are temporarily moved to emm_headers.hpp file to + * resolve undefined references. Uncomment these functions and delete + * emm_headers.hpp after moving all the files to c++ + * GH issue: https://github.com/magma/magma/issues/13096 + */ + +/*status_code_e emm_proc_status_ind(mme_ue_s1ap_id_t ue_id, emm_cause_t emm_cause); -int emm_proc_status(mme_ue_s1ap_id_t ue_id, emm_cause_t emm_cause); +status_code_e emm_proc_status(mme_ue_s1ap_id_t ue_id, emm_cause_t emm_cause);*/ /* *--------------------------------------------------------------------------- @@ -194,7 +205,21 @@ int emm_proc_status(mme_ue_s1ap_id_t ue_id, emm_cause_t emm_cause); * -------------------------------------------------------------------------- */ -void free_emm_attach_request_ies(emm_attach_request_ies_t** const params); +/* TODO:These declarations are temporarily moved to emm_headers.hpp file to + * resolve undefined references. Uncomment these functions and delete + * emm_headers.hpp after moving all the files to c++ + * GH issue: https://github.com/magma/magma/issues/13096 + */ + +/*void free_emm_attach_request_ies(emm_attach_request_ies_t** const params); +void set_callbacks_for_attach_proc(nas_emm_attach_proc_t* attach_proc); +void free_emm_tau_request_ies(emm_tau_request_ies_t** const ies); +void set_callbacks_for_auth_proc(nas_emm_auth_proc_t* auth_proc); +void free_emm_detach_request_ies(emm_detach_request_ies_t** const ies); +status_code_e emm_proc_emm_information(ue_mm_context_t* emm_ctx); +void set_callbacks_for_auth_info_proc(nas_auth_info_proc_t* auth_info_proc); +void set_callbacks_for_smc_proc(nas_emm_smc_proc_t* smc_proc); +void set_notif_callbacks_for_smc_proc(nas_emm_smc_proc_t* smc_proc);*/ status_code_e emm_proc_attach_request( mme_ue_s1ap_id_t ue_id, const bool ctx_is_new, @@ -210,10 +235,6 @@ status_code_e emm_proc_attach_complete( mme_ue_s1ap_id_t ue_id, const_bstring esm_msg_pP, int emm_cause, const nas_message_decode_status_t status); -void set_callbacks_for_attach_proc(nas_emm_attach_proc_t* attach_proc); - -void free_emm_tau_request_ies(emm_tau_request_ies_t** const ies); - status_code_e emm_proc_tracking_area_update_request( const mme_ue_s1ap_id_t ue_id, emm_tau_request_ies_t* ies, int* emm_cause, tai_t tai); @@ -237,7 +258,6 @@ status_code_e emm_proc_sgs_detach_request(mme_ue_s1ap_id_t ue_id, emm_proc_sgs_detach_type_t type); status_code_e emm_proc_nw_initiated_detach_request(mme_ue_s1ap_id_t ue_id, uint8_t detach_type); -void free_emm_detach_request_ies(emm_detach_request_ies_t** const ies); status_code_e emm_proc_detach_request(mme_ue_s1ap_id_t ue_id, emm_detach_request_ies_t* params); status_code_e emm_proc_detach_accept(mme_ue_s1ap_id_t ue_id); @@ -285,9 +305,15 @@ status_code_e emm_proc_authentication_complete(mme_ue_s1ap_id_t ue_id, int emm_cause, const_bstring const res); -void set_notif_callbacks_for_auth_proc(nas_emm_auth_proc_t* auth_proc); -void set_callbacks_for_auth_proc(nas_emm_auth_proc_t* auth_proc); -void set_callbacks_for_auth_info_proc(nas_auth_info_proc_t* auth_info_proc); +/* TODO:These declarations are temporarily moved to emm_headers.hpp file to + * resolve undefined references. Uncomment these functions and delete + * emm_headers.hpp after moving all the files to c++ + * GH issue: https://github.com/magma/magma/issues/13096 + */ + +/*void set_notif_callbacks_for_auth_proc(nas_emm_auth_proc_t* auth_proc); +void clear_emm_ctxt(emm_context_t* emm_ctx);*/ + /* * -------------------------------------------------------------------------- * Security mode control procedure @@ -301,11 +327,9 @@ status_code_e emm_proc_security_mode_control( status_code_e emm_proc_security_mode_complete( mme_ue_s1ap_id_t ue_id, const imeisv_mobile_identity_t* const imeisv); status_code_e emm_proc_security_mode_reject(mme_ue_s1ap_id_t ue_id); -status_code_e emm_proc_emm_information(ue_mm_context_t* emm_ctx); status_code_e release_esm_pdn_context(emm_context_t* emm_ctx, mme_ue_s1ap_id_t ue_id); -void clear_emm_ctxt(emm_context_t* emm_ctx); status_code_e emm_proc_tau_complete(mme_ue_s1ap_id_t ue_id); status_code_e emm_send_service_reject_in_dl_nas(const mme_ue_s1ap_id_t ue_id, @@ -313,8 +337,6 @@ status_code_e emm_send_service_reject_in_dl_nas(const mme_ue_s1ap_id_t ue_id, status_code_e emm_proc_uplink_nas_transport(mme_ue_s1ap_id_t ue_id, bstring nas_msg); -void set_notif_callbacks_for_smc_proc(nas_emm_smc_proc_t* smc_proc); -void set_callbacks_for_smc_proc(nas_emm_smc_proc_t* smc_proc); /* *--------------------------------------------------------------------------- * Network indication handlers diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/msg/TrackingAreaUpdateAccept.cpp b/lte/gateway/c/core/oai/tasks/nas/emm/msg/TrackingAreaUpdateAccept.cpp index aca084457ecb..160f69be36f4 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/msg/TrackingAreaUpdateAccept.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/emm/msg/TrackingAreaUpdateAccept.cpp @@ -25,10 +25,10 @@ extern "C" { #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/TLVDecoder.h" #include "lte/gateway/c/core/oai/common/TLVEncoder.h" +#include "lte/gateway/c/core/oai/common/log.h" #ifdef __cplusplus } #endif -#include "lte/gateway/c/core/oai/common/log.h" int decode_tracking_area_update_accept( tracking_area_update_accept_msg* tracking_area_update_accept, diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmCommonProcedureInitiated.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmCommonProcedureInitiated.cpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmCommonProcedureInitiated.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmCommonProcedureInitiated.cpp index 661c3246cbce..18b1d3634c15 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmCommonProcedureInitiated.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmCommonProcedureInitiated.cpp @@ -17,7 +17,7 @@ /***************************************************************************** - Source EmmCommonProcedureInitiated.c + Source EmmCommonProcedureInitiated.cpp Version 0.1 @@ -40,12 +40,19 @@ #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" +#ifdef __cplusplus +} +#endif +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregistered.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregistered.cpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregistered.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregistered.cpp index 77bb46e34a8a..343201e9e942 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregistered.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregistered.cpp @@ -17,7 +17,7 @@ /***************************************************************************** - Source EmmDeregistered.c + Source EmmDeregistered.cpp Version 0.1 @@ -46,12 +46,19 @@ #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" +#ifdef __cplusplus +} +#endif +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregisteredInitiated.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregisteredInitiated.cpp similarity index 95% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregisteredInitiated.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregisteredInitiated.cpp index 87310aa9d1a4..9be449c86152 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregisteredInitiated.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmDeregisteredInitiated.cpp @@ -17,12 +17,19 @@ #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" +#ifdef __cplusplus +} +#endif +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -51,7 +58,7 @@ ** Others: emm_fsm_status ** ** ** ***************************************************************************/ -status_code_e EmmDeregisteredInitiated(const emm_reg_t* evt) { +status_code_e EmmDeregisteredInitiated(emm_reg_t* const evt) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNerror; emm_context_t* emm_ctx = evt->ctx; diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmRegistered.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmRegistered.cpp similarity index 95% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmRegistered.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmRegistered.cpp index 7008a8399a42..de266b605e65 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmRegistered.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/EmmRegistered.cpp @@ -17,12 +17,19 @@ #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" +#ifdef __cplusplus +} +#endif +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -51,7 +58,7 @@ ** Others: emm_fsm_status ** ** ** ***************************************************************************/ -status_code_e EmmRegistered(const emm_reg_t* evt) { +status_code_e EmmRegistered(emm_reg_t* const evt) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNerror; emm_context_t* emm_ctx = evt->ctx; diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.cpp similarity index 95% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.cpp index b76e0ef4d2b8..20f4387772f6 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.cpp @@ -21,11 +21,19 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/common/dynamic_memory_check.h" +#include "lte/gateway/c/core/oai/common/log.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/conversions.h" -#include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/3gpp_requirements_24.301.h" #include "lte/gateway/c/core/oai/include/TrackingAreaIdentity.h" #include "lte/gateway/c/core/oai/include/mme_app_state.hpp" @@ -35,24 +43,24 @@ #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.007.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" -#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/AttachRequest.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/DetachRequest.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_cause.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_msg.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_msgDef.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.hpp" #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" /****************************************************************************/ @@ -79,15 +87,17 @@ static const char* emm_as_primitive_str[] = { Functions executed to process EMM procedures upon receiving data from the network */ -static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, - ecgi_t const* originating_ecgi, bstring msg, size_t len, - int* emm_cause, - nas_message_decode_status_t* decode_status); - -static int emm_as_establish_req(emm_as_establish_t* msg, int* emm_cause); -static int emm_as_data_ind(emm_as_data_t* msg, int* emm_cause); -static int emm_as_release_ind(const emm_as_release_t* const release, - int* emm_cause); +static status_code_e emm_as_recv(mme_ue_s1ap_id_t ue_id, + tai_t const* originating_tai, + ecgi_t const* originating_ecgi, bstring msg, + size_t len, int* emm_cause, + nas_message_decode_status_t* decode_status); + +static status_code_e emm_as_establish_req(emm_as_establish_t* msg, + int* emm_cause); +static status_code_e emm_as_data_ind(emm_as_data_t* msg, int* emm_cause); +static status_code_e emm_as_release_ind(const emm_as_release_t* const release, + int* emm_cause); /* Functions executed to send data to the network when requested @@ -104,7 +114,7 @@ static int emm_as_encrypt(bstring* info, const unsigned char* buffer, size_t length, emm_security_context_t* emm_security_context); -static int emm_as_send_a(const emm_as_t* msg); +static status_code_e emm_as_send_a(const emm_as_t* msg); static int emm_as_security_req(const emm_as_security_t*, dl_info_transfer_req_t*); static int emm_as_security_rej(const emm_as_security_t*, @@ -282,17 +292,16 @@ status_code_e emm_as_send(emm_as_t* msg) { ** Others: None ** ** ** ***************************************************************************/ -static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, - ecgi_t const* originating_ecgi, bstring msg, size_t len, - int* emm_cause, - nas_message_decode_status_t* decode_status) { +static status_code_e emm_as_recv(mme_ue_s1ap_id_t ue_id, + tai_t const* originating_tai, + ecgi_t const* originating_ecgi, bstring msg, + size_t len, int* emm_cause, + nas_message_decode_status_t* decode_status) { OAILOG_FUNC_IN(LOG_NAS_EMM); nas_message_decode_status_t local_decode_status = {0}; - int decoder_rc = RETURNok; - int rc = RETURNerror; - nas_message_t nas_msg = {.security_protected.header = {0}, - .security_protected.plain.emm.header = {0}, - .security_protected.plain.esm.header = {0}}; + int decoder_rc = 0; + status_code_e rc = RETURNerror; + nas_message_t nas_msg = {}; emm_security_context_t* emm_security_context = NULL; /* Current EPS NAS security context */ @@ -348,7 +357,7 @@ static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, "(err=%d)\n", ue_id, decoder_rc); *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); + OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } /* @@ -365,7 +374,7 @@ static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, ((1 == decode_status->security_context_available) && (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); + OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } rc = emm_recv_status(ue_id, &emm_msg->emm_status, emm_cause, decode_status); @@ -428,7 +437,7 @@ static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, ((1 == decode_status->security_context_available) && (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); + OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } rc = emm_recv_security_mode_complete( @@ -454,7 +463,7 @@ static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, ((1 == decode_status->security_context_available) && (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); + OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } rc = emm_recv_attach_complete(ue_id, &emm_msg->attach_complete, emm_cause, @@ -470,7 +479,7 @@ static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, ((1 == decode_status->security_context_available) && (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); + OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } rc = emm_recv_tau_complete(ue_id, &emm_msg->tracking_area_update_complete); @@ -497,7 +506,7 @@ static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, ((1 == decode_status->security_context_available) && (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); + OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } break; case UPLINK_NAS_TRANSPORT: @@ -508,7 +517,7 @@ static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, ((1 == decode_status->security_context_available) && (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); + OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } rc = emm_recv_uplink_nas_transport(ue_id, &emm_msg->uplink_nas_transport, emm_cause, decode_status); @@ -522,7 +531,7 @@ static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, ((0 == decode_status->integrity_protected_message) || (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); + OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } rc = emm_recv_detach_request(ue_id, &emm_msg->detach_request, false, @@ -536,7 +545,7 @@ static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, ((0 == decode_status->integrity_protected_message) || (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); + OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } rc = emm_recv_detach_accept(ue_id, emm_cause); @@ -616,9 +625,9 @@ static int emm_as_recv(mme_ue_s1ap_id_t ue_id, tai_t const* originating_tai, ** Others: None ** ** ** ***************************************************************************/ -static int emm_as_data_ind(emm_as_data_t* msg, int* emm_cause) { +static status_code_e emm_as_data_ind(emm_as_data_t* msg, int* emm_cause) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNerror; + status_code_e rc = RETURNerror; OAILOG_INFO(LOG_NAS_EMM, "EMMAS-SAP - Received AS data transfer indication " @@ -676,7 +685,7 @@ static int emm_as_data_ind(emm_as_data_t* msg, int* emm_cause) { * Failed to decrypt the message */ *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - OAILOG_FUNC_RETURN(LOG_NAS_EMM, bytes); + OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } else if (header.protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { /* @@ -737,20 +746,19 @@ static int emm_as_data_ind(emm_as_data_t* msg, int* emm_cause) { ** Others: None ** ** ** ***************************************************************************/ -static int emm_as_establish_req(emm_as_establish_t* msg, int* emm_cause) { +static status_code_e emm_as_establish_req(emm_as_establish_t* msg, + int* emm_cause) { OAILOG_FUNC_IN(LOG_NAS_EMM); struct emm_context_s* emm_ctx = NULL; emm_security_context_t* emm_security_context = NULL; nas_message_decode_status_t decode_status = {0}; int decoder_rc = 0; - int rc = RETURNerror; + status_code_e rc = RETURNerror; tai_t originating_tai = {0}; OAILOG_INFO(LOG_NAS_EMM, "EMMAS-SAP - Received AS connection establish request\n"); - nas_message_t nas_msg = {.security_protected.header = {0}, - .security_protected.plain.emm.header = {0}, - .security_protected.plain.esm.header = {0}}; + nas_message_t nas_msg = {}; ue_mm_context_t* ue_mm_context = mme_ue_context_exists_mme_ue_s1ap_id(msg->ue_id); @@ -786,7 +794,7 @@ static int emm_as_establish_req(emm_as_establish_t* msg, int* emm_cause) { if (decoder_rc < 0) { if (decoder_rc < TLV_FATAL_ERROR) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); + OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } else if (decoder_rc == TLV_MANDATORY_FIELD_NOT_PRESENT) { *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO; REQUIREMENT_3GPP_24_301(R10_5_5_1_2_7_b__1); @@ -948,10 +956,10 @@ static int emm_as_establish_req(emm_as_establish_t* msg, int* emm_cause) { } //------------------------------------------------------------------------------ -static int emm_as_release_ind(const emm_as_release_t* const release, - int* emm_cause) { +static status_code_e emm_as_release_ind(const emm_as_release_t* const release, + int* emm_cause) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = lowerlayer_release(release->ue_id, release->cause); + status_code_e rc = lowerlayer_release(release->ue_id, release->cause); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1176,7 +1184,7 @@ static int emm_as_encrypt(bstring* info, ** Others: None ** ** ** ***************************************************************************/ -static int emm_as_send_a(const emm_as_t* msg) { +static status_code_e emm_as_send_a(const emm_as_t* msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); as_message_t as_msg = {0}; @@ -1338,9 +1346,7 @@ static int emm_as_data_req(const emm_as_data_t* msg, int is_encoded = false; OAILOG_INFO(LOG_NAS_EMM, "EMMAS-SAP - Send AS data transfer request\n"); - nas_message_t nas_msg = {.security_protected.header = {0}, - .security_protected.plain.emm.header = {0}, - .security_protected.plain.esm.header = {0}}; + nas_message_t nas_msg = {}; /* * Setup the AS message @@ -1512,9 +1518,7 @@ static int emm_as_status_ind(const emm_as_status_t* msg, OAILOG_INFO(LOG_NAS_EMM, "EMMAS-SAP - Send AS status indication (cause=%d)\n", msg->emm_cause); - nas_message_t nas_msg = {.security_protected.header = {0}, - .security_protected.plain.emm.header = {0}, - .security_protected.plain.esm.header = {0}}; + nas_message_t nas_msg = {}; /* * Setup the AS message @@ -1637,9 +1641,7 @@ static int emm_as_security_req(const emm_as_security_t* msg, int size = 0; OAILOG_INFO(LOG_NAS_EMM, "EMMAS-SAP - Send AS security request\n"); - nas_message_t nas_msg = {.security_protected.header = {0}, - .security_protected.plain.emm.header = {0}, - .security_protected.plain.esm.header = {0}}; + nas_message_t nas_msg = {}; /* * Setup the AS message @@ -1751,9 +1753,7 @@ static int emm_as_security_rej(const emm_as_security_t* msg, int size = 0; OAILOG_INFO(LOG_NAS_EMM, "EMMAS-SAP - Send AS security reject\n"); - nas_message_t nas_msg = {.security_protected.header = {0}, - .security_protected.plain.emm.header = {0}, - .security_protected.plain.esm.header = {0}}; + nas_message_t nas_msg = {}; /* * Setup the AS message @@ -1839,9 +1839,7 @@ static int emm_as_erab_setup_req( int is_encoded = false; OAILOG_INFO(LOG_NAS_EMM, "EMMAS-SAP - Send AS data transfer request\n"); - nas_message_t nas_msg = {.security_protected.header = {0}, - .security_protected.plain.emm.header = {0}, - .security_protected.plain.esm.header = {0}}; + nas_message_t nas_msg = {}; /* * Setup the AS message @@ -1919,9 +1917,7 @@ static int emm_as_erab_rel_cmd( int is_encoded = false; OAILOG_INFO(LOG_NAS_EMM, "EMMAS-SAP - Send AS data transfer request\n"); - nas_message_t nas_msg = {.security_protected.header = {0}, - .security_protected.plain.emm.header = {0}, - .security_protected.plain.esm.header = {0}}; + nas_message_t nas_msg = {}; /* * Setup the AS message @@ -2015,9 +2011,7 @@ static int emm_as_establish_cnf(const emm_as_establish_t* msg, "EMMAS-SAP - Send AS connection establish confirmation for (ue_id " "= " MME_UE_S1AP_ID_FMT ")\n", msg->ue_id); - nas_message_t nas_msg = {.security_protected.header = {0}, - .security_protected.plain.emm.header = {0}, - .security_protected.plain.esm.header = {0}}; + nas_message_t nas_msg = {}; /* * Setup the AS message */ @@ -2154,9 +2148,7 @@ static int emm_as_establish_rej(const emm_as_establish_t* msg, nas_establish_rsp_t* as_msg) { EMM_msg* emm_msg = NULL; int size = 0; - nas_message_t nas_msg = {.security_protected.header = {0}, - .security_protected.plain.emm.header = {0}, - .security_protected.plain.esm.header = {0}}; + nas_message_t nas_msg = {}; OAILOG_FUNC_IN(LOG_NAS_EMM); OAILOG_INFO(LOG_NAS_EMM, "EMMAS-SAP - Send AS connection establish reject\n"); diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.hpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.hpp index af07917121a0..ea0f23111a34 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source emm_as.h +Source emm_as.hpp Version 0.1 @@ -37,7 +37,7 @@ Description Defines the EMMAS Service Access Point that provides #define FILE_EMM_AS_SEEN #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp similarity index 99% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp index a78c8640e617..d59567a6679c 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp @@ -17,7 +17,7 @@ /***************************************************************************** -Source emm_asDef.h +Source emm_asDef.hpp Version 0.1 diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.cpp similarity index 93% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.cpp index c678a0db40b4..bb1175243645 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.cpp @@ -17,7 +17,7 @@ /***************************************************************************** - Source emm_cn.c + Source emm_cn.cpp Version 0.1 @@ -38,11 +38,20 @@ #include #include -#include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/common/dynamic_memory_check.h" + +#ifdef __cplusplus +extern "C" { +#endif +#include "lte/gateway/c/core/common/common_defs.h" +#include "lte/gateway/c/core/oai/common/log.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/conversions.h" -#include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/common/security_types.h" #include "lte/gateway/c/core/oai/include/EpsQualityOfService.h" #include "lte/gateway/c/core/oai/include/mme_app_messages_types.h" @@ -56,17 +65,17 @@ #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_29.274.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_apn_selection.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_sgs_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/msg/esm_cause.hpp" @@ -77,10 +86,10 @@ #include "lte/gateway/c/core/oai/tasks/nas/ies/EpsUpdateType.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/EsmCause.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/MobileIdentity.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" -extern int emm_proc_tracking_area_update_accept( +extern status_code_e emm_proc_tracking_area_update_accept( nas_emm_tau_proc_t* const tau_proc); #ifdef __cplusplus @@ -101,12 +110,13 @@ typedef struct { * the Attach Accept message */ } attach_data_t; -extern int emm_cn_wrapper_attach_accept(emm_context_t* emm_context); +extern status_code_e emm_cn_wrapper_attach_accept(emm_context_t* emm_context); -static int emm_cn_authentication_res(emm_cn_auth_res_t* const msg); -static int emm_cn_authentication_fail(const emm_cn_auth_fail_t* msg); -static int emm_cn_ula_success(emm_cn_ula_success_t* msg_pP); -static int emm_cn_cs_response_success(emm_cn_cs_response_success_t* msg_pP); +static status_code_e emm_cn_authentication_res(emm_cn_auth_res_t* const msg); +static status_code_e emm_cn_authentication_fail(const emm_cn_auth_fail_t* msg); +static status_code_e emm_cn_ula_success(emm_cn_ula_success_t* msg_pP); +static status_code_e emm_cn_cs_response_success( + emm_cn_cs_response_success_t* msg_pP); /* String representation of EMMCN-SAP primitives @@ -129,10 +139,10 @@ static const char* emm_cn_primitive_str[] = { }; //------------------------------------------------------------------------------ -static int emm_cn_authentication_res(emm_cn_auth_res_t* const msg) { +static status_code_e emm_cn_authentication_res(emm_cn_auth_res_t* const msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); emm_context_t* emm_ctx = NULL; - int rc = RETURNerror; + status_code_e rc = RETURNerror; /* * We received security vector from HSS. Try to setup security with UE @@ -164,10 +174,10 @@ static int emm_cn_authentication_res(emm_cn_auth_res_t* const msg) { } //------------------------------------------------------------------------------ -static int emm_cn_authentication_fail(const emm_cn_auth_fail_t* msg) { +static status_code_e emm_cn_authentication_fail(const emm_cn_auth_fail_t* msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); emm_context_t* emm_ctx = NULL; - int rc = RETURNerror; + status_code_e rc = RETURNerror; /* * We received security vector from HSS. Try to setup security with UE @@ -195,8 +205,8 @@ static int emm_cn_authentication_fail(const emm_cn_auth_fail_t* msg) { } //------------------------------------------------------------------------------ -static int emm_cn_smc_fail(const emm_cn_smc_fail_t* msg) { - int rc = RETURNerror; +static status_code_e emm_cn_smc_fail(const emm_cn_smc_fail_t* msg) { + status_code_e rc = RETURNerror; OAILOG_FUNC_IN(LOG_NAS_EMM); rc = emm_proc_attach_reject(msg->ue_id, msg->emm_cause); @@ -238,9 +248,9 @@ void handle_apn_mismatch(ue_mm_context_t* const ue_context, int esm_cause) { } //------------------------------------------------------------------------------ -static int emm_cn_ula_success(emm_cn_ula_success_t* msg_pP) { +static status_code_e emm_cn_ula_success(emm_cn_ula_success_t* msg_pP) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNerror; + status_code_e rc = RETURNerror; struct emm_context_s* emm_ctx = NULL; esm_cause_t esm_cause = ESM_CAUSE_SUCCESS; pdn_cid_t pdn_cid = 0; @@ -338,7 +348,7 @@ static int emm_cn_ula_success(emm_cn_ula_success_t* msg_pP) { rc = esm_proc_pdn_connectivity_request( emm_ctx, emm_ctx->esm_ctx.esm_proc_data->pti, emm_ctx->esm_ctx.esm_proc_data->pdn_cid, apn_config->context_identifier, - emm_ctx->esm_ctx.esm_proc_data->request_type, + (esm_proc_pdn_request_t)emm_ctx->esm_ctx.esm_proc_data->request_type, emm_ctx->esm_ctx.esm_proc_data->apn, apn_config->pdn_type, emm_ctx->esm_ctx.esm_proc_data->pdn_addr, &emm_ctx->esm_ctx.esm_proc_data->bearer_qos, @@ -392,8 +402,8 @@ static int emm_cn_ula_success(emm_cn_ula_success_t* msg_pP) { } //------------------------------------------------------------------------------ -static int emm_cn_implicit_detach_ue(const uint32_t ue_id) { - int rc = RETURNok; +static status_code_e emm_cn_implicit_detach_ue(const uint32_t ue_id) { + status_code_e rc = RETURNok; struct emm_context_s* emm_ctx_p = NULL; OAILOG_FUNC_IN(LOG_NAS_EMM); @@ -401,7 +411,7 @@ static int emm_cn_implicit_detach_ue(const uint32_t ue_id) { OAILOG_DEBUG(LOG_NAS_EMM, "EMM-PROC Implicit Detach UE" MME_UE_S1AP_ID_FMT "\n", ue_id); - emm_detach_request_ies_t params = {0}; + emm_detach_request_ies_t params = {}; // params.decode_status // params.guti = NULL; // params.imei = NULL; @@ -426,9 +436,9 @@ static int emm_cn_implicit_detach_ue(const uint32_t ue_id) { } //------------------------------------------------------------------------------ -static int emm_cn_nw_initiated_detach_ue(const uint32_t ue_id, - uint8_t detach_type) { - int rc = RETURNok; +static status_code_e emm_cn_nw_initiated_detach_ue(const uint32_t ue_id, + uint8_t detach_type) { + status_code_e rc = RETURNok; OAILOG_FUNC_IN(LOG_NAS_EMM); OAILOG_DEBUG(LOG_NAS_EMM, @@ -488,9 +498,10 @@ static int emm_proc_combined_attach_req(struct emm_context_s* emm_ctx_p, OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } //------------------------------------------------------------------------------ -static int emm_cn_cs_response_success(emm_cn_cs_response_success_t* msg_pP) { +static status_code_e emm_cn_cs_response_success( + emm_cn_cs_response_success_t* msg_pP) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNerror; + status_code_e rc = RETURNerror; struct emm_context_s* emm_ctx = NULL; esm_proc_pdn_type_t esm_pdn_type = ESM_PDN_TYPE_IPV4; ESM_msg esm_msg = {.header = {0}}; @@ -654,7 +665,7 @@ static int emm_cn_cs_response_success(emm_cn_cs_response_success_t* msg_pP) { * Notify EMM that common procedure has been initiated * LG: TODO check this, seems very suspicious */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REQ; emm_sap.u.emm_reg.ue_id = msg_pP->ue_id; @@ -668,9 +679,10 @@ static int emm_cn_cs_response_success(emm_cn_cs_response_success_t* msg_pP) { } //------------------------------------------------------------------------------ -static int emm_cn_ula_or_csrsp_fail(const emm_cn_ula_or_csrsp_fail_t* msg) { +static status_code_e emm_cn_ula_or_csrsp_fail( + const emm_cn_ula_or_csrsp_fail_t* msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNok; + status_code_e rc = RETURNok; struct emm_context_s* emm_ctx_p = NULL; ESM_msg esm_msg = {.header = {0}}; int esm_cause; @@ -741,12 +753,12 @@ static int emm_cn_ula_or_csrsp_fail(const emm_cn_ula_or_csrsp_fail_t* msg) { } //------------------------------------------------------------------------------ -static int emm_cn_activate_dedicated_bearer_req( +static status_code_e emm_cn_activate_dedicated_bearer_req( emm_cn_activate_dedicated_bearer_req_t* msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNok; + status_code_e rc = RETURNok; // forward to ESM - esm_sap_t esm_sap = {0}; + esm_sap_t esm_sap = {}; ue_mm_context_t* ue_mm_context = mme_ue_context_exists_mme_ue_s1ap_id(msg->ue_id); @@ -778,12 +790,12 @@ static int emm_cn_activate_dedicated_bearer_req( } //------------------------------------------------------------------------------ -static int emm_cn_deactivate_dedicated_bearer_req( +static status_code_e emm_cn_deactivate_dedicated_bearer_req( emm_cn_deactivate_dedicated_bearer_req_t* msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNok; + status_code_e rc = RETURNok; // forward to ESM - esm_sap_t esm_sap = {0}; + esm_sap_t esm_sap = {}; ue_mm_context_t* ue_mm_context = mme_ue_context_exists_mme_ue_s1ap_id(msg->ue_id); @@ -833,7 +845,7 @@ static int send_attach_accept(struct emm_context_s* emm_ctx_p) { * Implicit GUTI reallocation; * * * * Notify EMM that common procedure has been initiated */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REQ; emm_sap.u.emm_reg.ue_id = attach_proc->ue_id; @@ -848,7 +860,7 @@ static int send_attach_accept(struct emm_context_s* emm_ctx_p) { //------------------------------------------------------------------------------ status_code_e emm_send_cs_domain_attach_or_tau_accept( struct ue_mm_context_s* ue_context_p) { - int rc = RETURNok; + status_code_e rc = RETURNok; emm_fsm_state_t fsm_state = EMM_DEREGISTERED; OAILOG_FUNC_IN(LOG_NAS_EMM); @@ -893,9 +905,9 @@ status_code_e emm_send_cs_domain_attach_or_tau_accept( OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } //------------------------------------------------------------------------------ -static int emm_cn_cs_domain_loc_updt_fail( +static status_code_e emm_cn_cs_domain_loc_updt_fail( emm_cn_cs_domain_location_updt_fail_t emm_cn_sgs_location_updt_fail) { - int rc = RETURNok; + status_code_e rc = RETURNok; OAILOG_FUNC_IN(LOG_NAS_EMM); OAILOG_DEBUG(LOG_NAS_EMM, @@ -959,7 +971,7 @@ static int emm_cn_cs_domain_loc_updt_fail( * Implicit GUTI reallocation; * * * * Notify EMM that common procedure has been initiated */ - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMREG_COMMON_PROC_REQ; emm_sap.u.emm_reg.ue_id = emm_cn_sgs_location_updt_fail.ue_id; emm_sap.u.emm_reg.ctx = emm_ctx_p; @@ -987,9 +999,9 @@ static int emm_cn_cs_domain_loc_updt_fail( } // handle CS-Domain MM-Information Request from SGS task -static int emm_cn_cs_domain_mm_information_req( +static status_code_e emm_cn_cs_domain_mm_information_req( emm_cn_cs_domain_mm_information_req_t* mm_information_req_pP) { - int rc = RETURNerror; + status_code_e rc = RETURNerror; imsi64_t imsi64 = INVALID_IMSI64; emm_context_t* ctxt = NULL; ue_mm_context_t* ue_context_p = NULL; @@ -1047,9 +1059,10 @@ static int emm_cn_cs_domain_mm_information_req( OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } -static int emm_cn_pdn_disconnect_rsp(emm_cn_pdn_disconnect_rsp_t* msg) { +static status_code_e emm_cn_pdn_disconnect_rsp( + emm_cn_pdn_disconnect_rsp_t* msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); - int rc = RETURNok; + status_code_e rc = RETURNok; proc_tid_t pti; #define ESM_SAP_BUFFER_SIZE 4096 uint8_t esm_sap_buffer[ESM_SAP_BUFFER_SIZE]; @@ -1143,7 +1156,7 @@ static int emm_cn_pdn_disconnect_rsp(emm_cn_pdn_disconnect_rsp_t* msg) { //------------------------------------------------------------------------------ status_code_e emm_cn_send(const emm_cn_t* msg) { - int rc = RETURNerror; + status_code_e rc = RETURNerror; emm_cn_primitive_t primitive = msg->primitive; OAILOG_FUNC_IN(LOG_NAS_EMM); diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.hpp similarity index 93% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.hpp index 14c7d75ed10f..c9613dcf19b0 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.hpp @@ -17,7 +17,7 @@ /***************************************************************************** -Source emm_cn.h +Source emm_cn.hpp Version 0.1 @@ -37,7 +37,7 @@ Description #define FILE_EMM_CN_SEEN #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp" status_code_e emm_cn_send(const emm_cn_t* msg); #endif /* FILE_EMM_CN_SEEN */ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp similarity index 99% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp index c092031adda0..7eb73fd24e25 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp @@ -17,7 +17,7 @@ /***************************************************************************** -Source emm_cnDef.h +Source emm_cnDef.hpp Version 0.1 diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.cpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.cpp index c0249c39bcae..0923da4e3d28 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.cpp @@ -15,10 +15,16 @@ * contact@openairinterface.org */ +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.h" +#ifdef __cplusplus +} +#endif +#include "lte/gateway/c/core/oai/tasks/nas/emm/LowerLayer.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.hpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.hpp index 69717598a9a5..65c7e94cef07 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.hpp @@ -17,7 +17,7 @@ /***************************************************************************** -Source emm_esm.h +Source emm_esm.hpp Version 0.1 @@ -38,7 +38,7 @@ Description Defines the EMMESM Service Access Point that provides #define FILE_EMM_ESM_SEEN #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp similarity index 98% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp index dfa305bc7e69..bf5a40d98f8a 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source emm_esmDef.h +Source emm_esmDef.hpp Version 0.1 @@ -38,7 +38,7 @@ Description Defines the EMMESM Service Access Point that provides #define FILE_EMM_ESMDEF_SEEN #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.cpp similarity index 92% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.cpp index 4d6e8c816b78..ce3027a51e35 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.cpp @@ -18,15 +18,24 @@ #include #include +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" + +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/log.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -81,7 +90,7 @@ static const char* const emm_fsm_status_str[EMM_STATE_MAX] = { */ /* Type of the EPS Mobility Management state machine handler */ -typedef int (*emm_fsm_handler_t)(emm_reg_t* const); +typedef status_code_e (*emm_fsm_handler_t)(emm_reg_t* const); status_code_e EmmDeregistered(emm_reg_t* const); status_code_e EmmRegistered(emm_reg_t* const); @@ -155,14 +164,14 @@ status_code_e emm_fsm_set_state(const mme_ue_s1ap_id_t ue_id, ue_id, emm_fsm_status_str[emm_context->_emm_fsm_state], emm_fsm_status_str[state]); emm_context->_emm_fsm_state = state; - emm_fsm_state_t new_emm_state = UE_UNREGISTERED; - if (state == EMM_REGISTERED) { - new_emm_state = UE_REGISTERED; - } else if (state == EMM_DEREGISTERED) { - new_emm_state = UE_UNREGISTERED; + emm_fsm_state_t new_emm_state = (emm_fsm_state_t)UE_UNREGISTERED; + if (state == (emm_fsm_state_t)EMM_REGISTERED) { + new_emm_state = (emm_fsm_state_t)UE_REGISTERED; + } else if (state == (emm_fsm_state_t)EMM_DEREGISTERED) { + new_emm_state = (emm_fsm_state_t)UE_UNREGISTERED; } // Update mme_ue_context's emm_state and overall stats - mme_ue_context_update_ue_emm_state(ue_id, new_emm_state); + mme_ue_context_update_ue_emm_state(ue_id, (mm_state_t)new_emm_state); } OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp similarity index 88% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp index 024dcd9547ad..b9bf1abf3551 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp @@ -17,7 +17,7 @@ /***************************************************************************** -Source emm_fsm.h +Source emm_fsm.hpp Version 0.1 @@ -62,7 +62,7 @@ typedef enum { #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" struct emm_context_s; struct emm_reg_s; @@ -82,10 +82,15 @@ struct emm_reg_s; status_code_e emm_fsm_set_state(const mme_ue_s1ap_id_t ueid, struct emm_context_s* const emm_context, const emm_fsm_state_t status); -emm_fsm_state_t emm_fsm_get_state( - const struct emm_context_s* const emm_context); +/* TODO:These declarations are temporarily moved to emm_headers.hpp file to + * resolve undefined references. Uncomment these functions and delete + * emm_headers.hpp after moving all the files to c++ + * GH issue: https://github.com/magma/magma/issues/13096 + */ + +/*emm_fsm_state_t emm_fsm_get_state( + const struct emm_context_s* const emm_context);*/ const char* emm_fsm_get_state_str( const struct emm_context_s* const emm_context); status_code_e emm_fsm_process(struct emm_reg_s* const evt); - #endif /* FILE_EMM_FSM_SEEN*/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.cpp similarity index 94% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.cpp index 1a7372d40811..3ccc50c2be25 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.cpp @@ -20,25 +20,32 @@ #include #include -#include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/common/dynamic_memory_check.h" +#ifdef __cplusplus +extern "C" { +#endif +#include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/conversions.h" #include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" +#ifdef __cplusplus +} +#endif #include "lte/gateway/c/core/oai/include/3gpp_requirements_24.301.h" #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.008.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" -#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/AttachRequest.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/NASSecurityModeCommand.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_cause.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/AdditionalUpdateType.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/DetachType.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/EmmCause.h" @@ -50,7 +57,7 @@ #include "lte/gateway/c/core/oai/tasks/nas/ies/MobileStationClassmark2.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/NasKeySetIdentifier.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/ServiceType.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" /****************************************************************************/ @@ -72,7 +79,8 @@ extern mme_congestion_params_t mme_congestion_params; /****************************************************************************/ /********************* L O C A L F U N C T I O N S *********************/ /****************************************************************************/ -static int emm_initiate_default_bearer_re_establishment(emm_context_t* emm_ctx); +static status_code_e emm_initiate_default_bearer_re_establishment( + emm_context_t* emm_ctx); /* -------------------------------------------------------------------------- Functions executed by both the UE and the MME upon receiving EMM messages @@ -240,7 +248,8 @@ status_code_e emm_recv_attach_request( // Dynamic memory allocation, if attach procedure is to be created // it should be freed when attach proc is freed. Otherwise, it should // be cleaned up properly - emm_attach_request_ies_t* params = calloc(1, sizeof(*params)); + emm_attach_request_ies_t* params = + reinterpret_cast(calloc(1, sizeof(*params))); /* * Message processing */ @@ -277,7 +286,7 @@ status_code_e emm_recv_attach_request( OAILOG_DEBUG(LOG_NAS_EMM, "Type of identity is EPS_MOBILE_IDENTITY_GUTI (%d)\n", msg->oldgutiorimsi.guti.typeofidentity); - params->guti = calloc(1, sizeof(guti_t)); + params->guti = reinterpret_cast(calloc(1, sizeof(guti_t))); params->guti->gummei.plmn.mcc_digit1 = msg->oldgutiorimsi.guti.mcc_digit1; params->guti->gummei.plmn.mcc_digit2 = msg->oldgutiorimsi.guti.mcc_digit2; params->guti->gummei.plmn.mcc_digit3 = msg->oldgutiorimsi.guti.mcc_digit3; @@ -295,7 +304,7 @@ status_code_e emm_recv_attach_request( OAILOG_DEBUG(LOG_NAS_EMM, "Type of identity is EPS_MOBILE_IDENTITY_IMSI (%d)\n", msg->oldgutiorimsi.imsi.typeofidentity); - params->imsi = calloc(1, sizeof(imsi_t)); + params->imsi = reinterpret_cast(calloc(1, sizeof(imsi_t))); params->imsi->u.num.digit1 = msg->oldgutiorimsi.imsi.identity_digit1; params->imsi->u.num.digit2 = msg->oldgutiorimsi.imsi.identity_digit2; params->imsi->u.num.digit3 = msg->oldgutiorimsi.imsi.identity_digit3; @@ -340,7 +349,7 @@ status_code_e emm_recv_attach_request( OAILOG_DEBUG(LOG_NAS_EMM, "Type of identity is EPS_MOBILE_IDENTITY_IMEI (%d)\n", msg->oldgutiorimsi.imei.typeofidentity); - params->imei = calloc(1, sizeof(imei_t)); + params->imei = reinterpret_cast(calloc(1, sizeof(imei_t))); params->imei->u.num.tac1 = msg->oldgutiorimsi.imei.identity_digit1; params->imei->u.num.tac2 = msg->oldgutiorimsi.imei.identity_digit2; params->imei->u.num.tac3 = msg->oldgutiorimsi.imei.identity_digit3; @@ -367,13 +376,15 @@ status_code_e emm_recv_attach_request( */ if (msg->presencemask & ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) { - params->last_visited_registered_tai = calloc(1, sizeof(tai_t)); + params->last_visited_registered_tai = + reinterpret_cast(calloc(1, sizeof(tai_t))); COPY_TAI((*(params->last_visited_registered_tai)), msg->lastvisitedregisteredtai); } if (msg->presencemask & ATTACH_REQUEST_DRX_PARAMETER_PRESENT) { - params->drx_parameter = calloc(1, sizeof(drx_parameter_t)); + params->drx_parameter = + reinterpret_cast(calloc(1, sizeof(drx_parameter_t))); memcpy(params->drx_parameter, &msg->drxparameter, sizeof(drx_parameter_t)); } @@ -387,18 +398,21 @@ status_code_e emm_recv_attach_request( params->is_native_sc, params->ksi); if (originating_tai) { - params->originating_tai = calloc(1, sizeof(tai_t)); + params->originating_tai = + reinterpret_cast(calloc(1, sizeof(tai_t))); memcpy(params->originating_tai, originating_tai, sizeof(tai_t)); } if (originating_ecgi) { - params->originating_ecgi = calloc(1, sizeof(ecgi_t)); + params->originating_ecgi = + reinterpret_cast(calloc(1, sizeof(ecgi_t))); memcpy(params->originating_ecgi, originating_ecgi, sizeof(ecgi_t)); } memcpy(¶ms->ue_network_capability, &msg->uenetworkcapability, sizeof(ue_network_capability_t)); if (msg->presencemask & ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) { - params->ms_network_capability = calloc(1, sizeof(ms_network_capability_t)); + params->ms_network_capability = reinterpret_cast( + calloc(1, sizeof(ms_network_capability_t))); memcpy(params->ms_network_capability, &msg->msnetworkcapability, sizeof(ms_network_capability_t)); } @@ -445,7 +459,8 @@ status_code_e emm_recv_attach_request( mob_stsn_clsMark2.a53 = msg->mobilestationclassmark2.a53; mob_stsn_clsMark2.a52 = msg->mobilestationclassmark2.a52; - params->mob_st_clsMark2 = calloc(1, sizeof(MobileStationClassmark2)); + params->mob_st_clsMark2 = reinterpret_cast( + calloc(1, sizeof(MobileStationClassmark2))); memcpy(params->mob_st_clsMark2, &mob_stsn_clsMark2, sizeof(MobileStationClassmark2)); } @@ -453,7 +468,8 @@ status_code_e emm_recv_attach_request( if (msg->presencemask & ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT) { params->voicedomainpreferenceandueusagesetting = - calloc(1, sizeof(voice_domain_preference_and_ue_usage_setting_t)); + reinterpret_cast( + calloc(1, sizeof(voice_domain_preference_and_ue_usage_setting_t))); memcpy(params->voicedomainpreferenceandueusagesetting, &msg->voicedomainpreferenceandueusagesetting, sizeof(voice_domain_preference_and_ue_usage_setting_t)); @@ -462,7 +478,8 @@ status_code_e emm_recv_attach_request( if (msg->presencemask & ATTACH_REQUEST_UE_ADDITIONAL_SECURITY_CAPABILITY_PRESENT) { params->ueadditionalsecuritycapability = - calloc(1, sizeof(ue_additional_security_capability_t)); + reinterpret_cast( + calloc(1, sizeof(ue_additional_security_capability_t))); memcpy(params->ueadditionalsecuritycapability, &msg->ueadditionalsecuritycapability, sizeof(ue_additional_security_capability_t)); @@ -537,7 +554,7 @@ status_code_e emm_recv_detach_request( /* * Message processing */ - emm_detach_request_ies_t params = {0}; + emm_detach_request_ies_t params = {}; /* * Get the detach type */ @@ -558,7 +575,7 @@ status_code_e emm_recv_detach_request( * All other values are interpreted as "combined EPS/IMSI detach" */ REQUIREMENT_3GPP_24_301(R10_9_9_3_7_1__1); - params.type = DETACH_TYPE_EPS_IMSI; + params.type = (emm_proc_detach_type_t)DETACH_TYPE_EPS_IMSI; } params.switch_off = (msg->detachtype.switchoff != DETACH_TYPE_NORMAL_DETACH); params.is_native_sc = @@ -569,7 +586,8 @@ status_code_e emm_recv_detach_request( */ increment_counter("ue_detach", 1, 1, "cause", "ue_initiated"); // Send the SGS Detach indication towards MME App - rc = emm_proc_sgs_detach_request(ue_id, params.type); + rc = emm_proc_sgs_detach_request(ue_id, + (emm_proc_sgs_detach_type_t)params.type); if (rc != RETURNerror) { rc = emm_proc_detach_request(ue_id, ¶ms); *emm_cause = RETURNok == rc ? EMM_CAUSE_SUCCESS : EMM_CAUSE_PROTOCOL_ERROR; @@ -615,7 +633,8 @@ status_code_e emm_recv_tracking_area_update_request( * TAU Complete, TAU due to change in TAs, optional IEs */ - emm_tau_request_ies_t* ies = calloc(1, sizeof(emm_tau_request_ies_t)); + emm_tau_request_ies_t* ies = reinterpret_cast( + calloc(1, sizeof(emm_tau_request_ies_t))); ies->is_initial = is_initial; // Mandatory fields ies->eps_update_type = msg->epsupdatetype; @@ -646,19 +665,21 @@ status_code_e emm_recv_tracking_area_update_request( // NOT TODO additional_guti, useless if (msg->presencemask & TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT) { - ies->ue_network_capability = calloc(1, sizeof(*ies->ue_network_capability)); + ies->ue_network_capability = reinterpret_cast( + calloc(1, sizeof(*ies->ue_network_capability))); memcpy(ies->ue_network_capability, &msg->uenetworkcapability, sizeof(*ies->ue_network_capability)); } if (msg->presencemask & TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) { - ies->last_visited_registered_tai = - calloc(1, sizeof(*ies->last_visited_registered_tai)); + ies->last_visited_registered_tai = reinterpret_cast( + calloc(1, sizeof(*ies->last_visited_registered_tai))); memcpy(ies->last_visited_registered_tai, &msg->lastvisitedregisteredtai, sizeof(*ies->last_visited_registered_tai)); } if (msg->presencemask & TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_PRESENT) { - ies->drx_parameter = calloc(1, sizeof(*ies->drx_parameter)); + ies->drx_parameter = reinterpret_cast( + calloc(1, sizeof(*ies->drx_parameter))); memcpy(ies->drx_parameter, &msg->drxparameter, sizeof(*ies->drx_parameter)); } if (msg->presencemask & @@ -669,48 +690,56 @@ status_code_e emm_recv_tracking_area_update_request( if (msg->presencemask & TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT) { ies->eps_bearer_context_status = - calloc(1, sizeof(*ies->eps_bearer_context_status)); + reinterpret_cast( + calloc(1, sizeof(*ies->eps_bearer_context_status))); memcpy(ies->eps_bearer_context_status, &msg->epsbearercontextstatus, sizeof(*ies->eps_bearer_context_status)); } if (msg->presencemask & TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) { - ies->ms_network_capability = calloc(1, sizeof(*ies->ms_network_capability)); + ies->ms_network_capability = reinterpret_cast( + calloc(1, sizeof(*ies->ms_network_capability))); memcpy(ies->ms_network_capability, &msg->msnetworkcapability, sizeof(*ies->ms_network_capability)); } if (msg->presencemask & TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_PRESENT) { - ies->tmsi_status = calloc(1, sizeof(*ies->tmsi_status)); + ies->tmsi_status = + reinterpret_cast(calloc(1, sizeof(*ies->tmsi_status))); memcpy(ies->tmsi_status, &msg->tmsistatus, sizeof(*ies->tmsi_status)); } if (msg->presencemask & TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT) { ies->mobile_station_classmark2 = - calloc(1, sizeof(*ies->mobile_station_classmark2)); + reinterpret_cast( + calloc(1, sizeof(*ies->mobile_station_classmark2))); memcpy(ies->mobile_station_classmark2, &msg->mobilestationclassmark2, sizeof(*ies->mobile_station_classmark2)); } if (msg->presencemask & TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT) { ies->mobile_station_classmark3 = - calloc(1, sizeof(*ies->mobile_station_classmark3)); + reinterpret_cast( + calloc(1, sizeof(*ies->mobile_station_classmark3))); memcpy(ies->mobile_station_classmark3, &msg->mobilestationclassmark3, sizeof(*ies->mobile_station_classmark3)); } if (msg->presencemask & TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_PRESENT) { - ies->supported_codecs = calloc(1, sizeof(*ies->supported_codecs)); + ies->supported_codecs = reinterpret_cast( + calloc(1, sizeof(*ies->supported_codecs))); memcpy(ies->supported_codecs, &msg->supportedcodecs, sizeof(*ies->supported_codecs)); } if (msg->presencemask & TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT) { - ies->additional_updatetype = calloc(1, sizeof(*ies->additional_updatetype)); + ies->additional_updatetype = reinterpret_cast( + calloc(1, sizeof(*ies->additional_updatetype))); memcpy(ies->additional_updatetype, &msg->additionalupdatetype, sizeof(*ies->additional_updatetype)); } if (msg->presencemask & TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_PRESENT) { - ies->old_guti_type = calloc(1, sizeof(*ies->old_guti_type)); + ies->old_guti_type = + reinterpret_cast(calloc(1, sizeof(*ies->old_guti_type))); memcpy(ies->old_guti_type, &msg->oldgutitype, sizeof(*ies->old_guti_type)); } @@ -788,7 +817,7 @@ status_code_e emm_recv_service_request( } // If PCRF has initiated default bearer deact, send detach if (emm_ctx->nw_init_bearer_deactv) { - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMCN_NW_INITIATED_DETACH_UE; emm_sap.u.emm_cn.u.emm_cn_nw_initiated_detach.ue_id = ue_id; emm_sap.u.emm_cn.u.emm_cn_nw_initiated_detach.detach_type = @@ -1247,7 +1276,7 @@ status_code_e emm_recv_detach_accept(mme_ue_s1ap_id_t ue_id, int* emm_cause) { } //------------------------------------------------------------------------------------- -static int emm_initiate_default_bearer_re_establishment( +static status_code_e emm_initiate_default_bearer_re_establishment( emm_context_t* emm_ctx) { /* * This function is used to trigger initial context setup request towards eNB @@ -1257,8 +1286,8 @@ static int emm_initiate_default_bearer_re_establishment( */ OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_sap_t emm_sap = {0}; - int rc = RETURNerror; + emm_sap_t emm_sap = {}; + status_code_e rc = RETURNerror; if (emm_ctx) { emm_sap.primitive = EMMAS_ESTABLISH_CNF; emm_sap.u.emm_as.u.establish.ue_id = diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.hpp similarity index 99% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.hpp index a7ae08a09364..efcb298d2fef 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_recv.hpp @@ -17,7 +17,7 @@ /***************************************************************************** -Source emm_recv.h +Source emm_recv.hpp Version 0.1 @@ -43,7 +43,7 @@ Description Defines functions executed at the EMMAS Service Access #include "lte/gateway/c/core/oai/include/TrackingAreaIdentity.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_23.003.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/AttachComplete.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/AttachRequest.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/AuthenticationFailure.hpp" diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.cpp similarity index 95% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.cpp index 3e6138e92c29..0728a7066f24 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.cpp @@ -17,10 +17,16 @@ #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.h" +#ifdef __cplusplus +} +#endif +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.hpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.hpp index b6a346d6d06f..5fae8f28d53a 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.hpp @@ -17,7 +17,7 @@ /***************************************************************************** -Source emm_reg.h +Source emm_reg.hpp Version 0.1 @@ -38,7 +38,7 @@ Description Defines the EMMREG Service Access Point that provides #define FILE_EMM_REG_SEEN #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp similarity index 98% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp index b4f22753ac99..38d3b566dee5 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp @@ -17,7 +17,7 @@ /***************************************************************************** -Source emm_regDef.h +Source emm_regDef.hpp Version 0.1 @@ -40,7 +40,7 @@ Description Defines the EMMREG Service Access Point that provides #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/include/nas/commonDef.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" #include /****************************************************************************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.cpp similarity index 89% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.cpp index ebe3980a2330..c1a9048b9ae5 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.cpp @@ -15,13 +15,19 @@ * contact@openairinterface.org */ +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#ifdef __cplusplus +} +#endif +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_as.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cn.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_reg.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -85,28 +91,28 @@ status_code_e emm_sap_send(emm_sap_t* msg) { /* * Forward to the EMMREG-SAP */ - msg->u.emm_reg.primitive = primitive; + msg->u.emm_reg.primitive = (emm_reg_primitive_t)primitive; rc = emm_reg_send(&msg->u.emm_reg); } else if ((primitive > (emm_primitive_t)EMMESM_PRIMITIVE_MIN) && (primitive < (emm_primitive_t)EMMESM_PRIMITIVE_MAX)) { /* * Forward to the EMMESM-SAP */ - msg->u.emm_esm.primitive = primitive; + msg->u.emm_esm.primitive = (emm_esm_primitive_t)primitive; rc = emm_esm_send(&msg->u.emm_esm); } else if ((primitive > (emm_primitive_t)EMMAS_PRIMITIVE_MIN) && (primitive < (emm_primitive_t)EMMAS_PRIMITIVE_MAX)) { /* * Forward to the EMMAS-SAP */ - msg->u.emm_as.primitive = primitive; + msg->u.emm_as.primitive = (emm_as_primitive_t)primitive; rc = emm_as_send(&msg->u.emm_as); } else if ((primitive > (emm_primitive_t)EMMCN_PRIMITIVE_MIN) && (primitive < (emm_primitive_t)EMMCN_PRIMITIVE_MAX)) { /* * Forward to the EMMCN-SAP */ - msg->u.emm_cn.primitive = primitive; + msg->u.emm_cn.primitive = (emm_cn_primitive_t)primitive; rc = emm_cn_send(&msg->u.emm_cn); } else { OAILOG_WARNING(LOG_NAS_EMM, "EMM-SAP - Out of range primitive (%d)\n", diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp similarity index 95% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp index 2638d42c8962..025f288accc6 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp @@ -17,7 +17,7 @@ /***************************************************************************** -Source emm_sap.h +Source emm_sap.hpp Version 0.1 @@ -39,11 +39,11 @@ Description Defines the EMM Service Access Points at which the EPS #define FILE_EMM_SAP_SEEN #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_regDef.hpp" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.c b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.cpp similarity index 99% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.c rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.cpp index 603ee37fd78e..4b4fb1fb6c62 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.c +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.cpp @@ -20,23 +20,31 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/conversions.h" #include "lte/gateway/c/core/oai/common/log.h" #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" +#include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" +#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/mme_config.h" #include "lte/gateway/c/core/oai/include/nas/securityDef.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_23.003.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.008.h" -#include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/emm_msgDef.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/AdditionalUpdateResult.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/AdditionalUpdateType.h" @@ -98,7 +106,7 @@ int emm_send_status(const emm_as_status_t* msg, emm_status_msg* emm_msg) { OAILOG_WARNING(LOG_NAS_EMM, "EMMAS-SAP - Send EMM Status message (cause=%s)\n", - emm_cause_str[msg->emm_cause]); + emm_cause_str(msg->emm_cause)); /* * Mandatory - Message type */ @@ -764,7 +772,7 @@ int emm_send_attach_reject(const emm_as_establish_t* msg, OAILOG_INFO(LOG_NAS_EMM, "EMMAS-SAP - Send Attach Reject message (cause=%s)\n", - emm_cause_str[msg->emm_cause]); + emm_cause_str(msg->emm_cause)); /* * Mandatory - Message type */ @@ -818,7 +826,7 @@ int emm_send_tracking_area_update_accept( OAILOG_INFO( LOG_NAS_EMM, "EMMAS-SAP - Send Tracking Area Update Accept message (cause=%s)\n", - emm_cause_str[msg->emm_cause]); + emm_cause_str(msg->emm_cause)); /* * Mandatory - Message type */ @@ -1225,7 +1233,7 @@ int emm_send_tracking_area_update_reject( OAILOG_INFO( LOG_NAS_EMM, "EMMAS-SAP - Send Tracking Area Update Reject message (cause=%s)\n", - emm_cause_str[msg->emm_cause]); + emm_cause_str(msg->emm_cause)); /* * Mandatory - Message type */ @@ -1263,7 +1271,7 @@ int emm_send_service_reject(const uint8_t emm_cause, OAILOG_INFO(LOG_NAS_EMM, "EMMAS-SAP - Send Service Reject message (cause=%s)\n", - emm_cause_str[emm_cause]); + emm_cause_str(emm_cause)); /* * Mandatory - Message type */ diff --git a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.h b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.hpp similarity index 98% rename from lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.h rename to lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.hpp index 77e20a24414f..a31862c6c027 100644 --- a/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.h +++ b/lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_send.hpp @@ -17,7 +17,7 @@ /***************************************************************************** -Source emm_send.h +Source emm_send.hpp Version 0.1 @@ -56,7 +56,7 @@ Description Defines functions executed at the EMMAS Service Access #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/ServiceReject.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/TrackingAreaUpdateAccept.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/TrackingAreaUpdateReject.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/DedicatedEpsBearerContextActivation.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/DedicatedEpsBearerContextActivation.cpp index ca9e3f1bc21d..d211e8a54665 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/DedicatedEpsBearerContextActivation.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/DedicatedEpsBearerContextActivation.cpp @@ -37,9 +37,9 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.hpp" diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/DefaultEpsBearerContextActivation.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/DefaultEpsBearerContextActivation.cpp index 36738fb7e3ad..739474587684 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/DefaultEpsBearerContextActivation.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/DefaultEpsBearerContextActivation.cpp @@ -37,9 +37,9 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.hpp" diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/EpsBearerContextDeactivation.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/EpsBearerContextDeactivation.cpp index 0d054ab90dd6..14b1220b48c6 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/EpsBearerContextDeactivation.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/EpsBearerContextDeactivation.cpp @@ -38,9 +38,9 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.hpp" diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/EsmStatusHdl.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/EsmStatusHdl.cpp index 9473d5a4d0f2..d2a1aac0f8d8 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/EsmStatusHdl.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/EsmStatusHdl.cpp @@ -32,9 +32,9 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/EsmCause.h" diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/PdnConnectivity.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/PdnConnectivity.cpp index 90ae1d0e22b2..75b91844c971 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/PdnConnectivity.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/PdnConnectivity.cpp @@ -40,10 +40,10 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_pdn_context.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_pt.hpp" diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/PdnDisconnect.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/PdnDisconnect.cpp index 198774056724..e094f4c4ddd4 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/PdnDisconnect.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/PdnDisconnect.cpp @@ -32,10 +32,10 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_pt.hpp" diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp b/lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp index a714a6366e84..a45f00031a39 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp @@ -36,11 +36,11 @@ Description Defines internal private data handled by EPS Session #ifndef __ESMDATA_H__ #define __ESMDATA_H__ -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" #include "lte/gateway/c/core/oai/include/nas/networkDef.h" #include "lte/gateway/c/core/oai/lib/gtpv2-c/nwgtpv2c-0.11/include/tree.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.007.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/EsmCause.h" /****************************************************************************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/esm_data_context.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/esm_data_context.cpp index 2b6d0822a78d..0448adde1268 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/esm_data_context.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/esm_data_context.cpp @@ -35,11 +35,11 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" // free allocated structs //------------------------------------------------------------------------------ diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.cpp index 44081519da5d..2dcc2f05f668 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.cpp @@ -35,8 +35,8 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.007.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.hpp" /****************************************************************************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.hpp b/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.hpp index 5f66191fc65f..94b369d5d732 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.hpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.hpp @@ -40,9 +40,9 @@ Description Defines functions used to handle state of EPS bearer contexts #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.007.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ /****************************************************************************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.cpp index 07468fd6d46b..f3a0c67ee6a2 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.cpp @@ -37,11 +37,11 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.007.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.008.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_bearer_context.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/msg/esm_cause.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.hpp b/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.hpp index c0fdbd4f0d1f..fe53ca78e655 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.hpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr_context.hpp @@ -40,7 +40,7 @@ Description Defines functions used to handle EPS bearer contexts. #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.008.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_29.274.h" #include "lte/gateway/c/core/oai/common/common_types.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include /****************************************************************************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/esm_information.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/esm_information.cpp index 84d9e21c7044..8fd563422772 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/esm_information.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/esm_information.cpp @@ -35,16 +35,16 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_esmDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/msg/esm_cause.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/msg/esm_msg.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_send.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/EsmCause.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/esm_main.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/esm_main.cpp index b91387df0ecb..a62d64c39a4e 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/esm_main.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/esm_main.cpp @@ -26,7 +26,7 @@ extern "C" { #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_main.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.hpp" diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/esm_main.hpp b/lte/gateway/c/core/oai/tasks/nas/esm/esm_main.hpp index 35b8a72ddecd..ac9fe82712bf 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/esm_main.hpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/esm_main.hpp @@ -37,7 +37,7 @@ Description Defines the EPS Session Management procedure call manager, #define __ESM_MAIN_H__ #include "lte/gateway/c/core/oai/include/nas/networkDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" /****************************************************************************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp b/lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp index a6d81349c3d1..86251053580b 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp @@ -38,7 +38,7 @@ Description Defines the EPS Session Management procedures executed at #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/include/nas/networkDef.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_29.274.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/EsmCause.h" #include "lte/gateway/c/core/oai/tasks/nas/ies/NasRequestType.h" diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_recv.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_recv.cpp index 340ab49d230c..a45d01f2e1fe 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_recv.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_recv.cpp @@ -42,7 +42,7 @@ extern "C" { #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_apn_selection.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_itti_messaging.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_ebr.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_recv.hpp b/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_recv.hpp index bacbc5cef81d..9cfd9a9d6bf9 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_recv.hpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_recv.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source esm_recv.h +Source esm_recv.hpp Version 0.1 @@ -37,7 +37,7 @@ Description Defines functions executed at the ESM Service Access #define __ESM_RECV_H__ #include "lte/gateway/c/core/oai/tasks/nas/esm/msg/EsmStatus.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/msg/PdnConnectivityRequest.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/msg/PdnDisconnectRequest.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/msg/BearerResourceAllocationRequest.hpp" diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sap.cpp b/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sap.cpp index e9d276dd2beb..018068887c88 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sap.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sap.cpp @@ -39,7 +39,7 @@ extern "C" { #include "lte/gateway/c/core/oai/include/mme_config.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.007.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.301.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/msg/PdnConnectivityReject.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/msg/esm_cause.hpp" diff --git a/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sapDef.hpp b/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sapDef.hpp index dac08438bc5f..a9ba97b6c7d0 100644 --- a/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sapDef.hpp +++ b/lte/gateway/c/core/oai/tasks/nas/esm/sap/esm_sapDef.hpp @@ -37,7 +37,7 @@ Description Defines the ESM Service Access Point that provides EPS #define __ESM_SAPDEF_H__ #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_29.274.h" /****************************************************************************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/nas_network.c b/lte/gateway/c/core/oai/tasks/nas/nas_network.cpp similarity index 94% rename from lte/gateway/c/core/oai/tasks/nas/nas_network.c rename to lte/gateway/c/core/oai/tasks/nas/nas_network.cpp index 5d8448a1fea0..9514139c70ec 100644 --- a/lte/gateway/c/core/oai/tasks/nas/nas_network.c +++ b/lte/gateway/c/core/oai/tasks/nas/nas_network.cpp @@ -15,11 +15,19 @@ * contact@openairinterface.org */ +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/oai/common/log.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/mme_config.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_network.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/nas_network.hpp" #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/nas_network.h b/lte/gateway/c/core/oai/tasks/nas/nas_network.hpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/nas_network.h rename to lte/gateway/c/core/oai/tasks/nas/nas_network.hpp index 39bad05f30de..e1c8a558a75b 100644 --- a/lte/gateway/c/core/oai/tasks/nas/nas_network.h +++ b/lte/gateway/c/core/oai/tasks/nas/nas_network.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source nas_network.h +Source nas_network.hpp Version 0.1 @@ -52,9 +52,15 @@ Description NAS procedure functions triggered by the network /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif void nas_network_initialize(const mme_config_t* mme_config_p); void nas_network_cleanup(void); +#ifdef __cplusplus +} +#endif int nas_network_process_data(int command_id, const void* data); diff --git a/lte/gateway/c/core/oai/tasks/nas/nas_proc.c b/lte/gateway/c/core/oai/tasks/nas/nas_proc.cpp similarity index 96% rename from lte/gateway/c/core/oai/tasks/nas/nas_proc.c rename to lte/gateway/c/core/oai/tasks/nas/nas_proc.cpp index 247a3a6450d6..a13fcded5a45 100644 --- a/lte/gateway/c/core/oai/tasks/nas/nas_proc.c +++ b/lte/gateway/c/core/oai/tasks/nas/nas_proc.cpp @@ -16,7 +16,7 @@ */ /***************************************************************************** - Source nas_proc.c + Source nas_proc.cpp Version 0.1 @@ -35,35 +35,42 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/conversions.h" #include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#include "lte/gateway/c/core/oai/lib/hashtable/hashtable.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/mme_app_state.hpp" #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" #include "lte/gateway/c/core/oai/include/sgs_messages_types.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.008.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_33.401.h" -#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/lib/hashtable/hashtable.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_main.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_main.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/emm/msg/DetachRequest.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_asDef.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_sap.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_main.hpp" #include "lte/gateway/c/core/oai/tasks/nas/ies/MobileIdentity.h" #include "lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" #include "lte/gateway/c/core/oai/tasks/s6a/s6a_defs.h" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ /****************************************************************************/ - /****************************************************************************/ /******************* L O C A L D E F I N I T I O N S *******************/ /****************************************************************************/ @@ -162,7 +169,7 @@ status_code_e nas_proc_establish_ind( status_code_e rc = RETURNerror; if (msg) { - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; /* * Notify the EMM procedure call manager that NAS signalling @@ -208,7 +215,7 @@ status_code_e nas_proc_dl_transfer_cnf(const uint32_t ue_id, const nas_error_code_t status, bstring* STOLEN_REF nas_msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; status_code_e rc = RETURNok; /* @@ -252,7 +259,7 @@ status_code_e nas_proc_dl_transfer_rej(const uint32_t ue_id, const nas_error_code_t status, bstring* STOLEN_REF nas_msg) { OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; status_code_e rc = RETURNok; /* @@ -311,7 +318,7 @@ status_code_e nas_proc_ul_transfer_ind(const mme_ue_s1ap_id_t ue_id, "\n", ue_id); if (msg) { - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; /* * Notify the EMM procedure call manager that data transfer @@ -420,8 +427,8 @@ status_code_e nas_proc_auth_param_res(mme_ue_s1ap_id_t ue_id, eutran_vector_t* vectors) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; - emm_cn_auth_res_t emm_cn_auth_res = {0}; + emm_sap_t emm_sap = {}; + emm_cn_auth_res_t emm_cn_auth_res = {}; emm_cn_auth_res.ue_id = ue_id; emm_cn_auth_res.nb_vectors = nb_vectors; @@ -440,7 +447,7 @@ status_code_e nas_proc_auth_param_fail(mme_ue_s1ap_id_t ue_id, nas_cause_t cause) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_cn_auth_fail_t emm_cn_auth_fail = {0}; emm_cn_auth_fail.cause = cause; @@ -456,7 +463,7 @@ status_code_e nas_proc_auth_param_fail(mme_ue_s1ap_id_t ue_id, status_code_e nas_proc_ula_success(mme_ue_s1ap_id_t ue_id) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_cn_ula_success_t emm_cn_ula_success = {0}; emm_cn_ula_success.ue_id = ue_id; emm_sap.primitive = EMMCN_ULA_SUCCESS; @@ -474,7 +481,7 @@ status_code_e nas_proc_cs_respose_success( emm_cn_cs_response_success_t* cs_response_success) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMCN_CS_RESPONSE_SUCCESS; emm_sap.u.emm_cn.u.emm_cn_cs_response_success = cs_response_success; @@ -491,7 +498,7 @@ status_code_e nas_proc_ula_or_csrsp_fail( emm_cn_ula_or_csrsp_fail_t* ula_or_csrsp_fail) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMCN_ULA_OR_CSRSP_FAIL; emm_sap.u.emm_cn.u.emm_cn_ula_or_csrsp_fail = ula_or_csrsp_fail; @@ -504,8 +511,8 @@ status_code_e nas_proc_create_dedicated_bearer( emm_cn_activate_dedicated_bearer_req_t* emm_cn_activate) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; - emm_sap.primitive = _EMMCN_ACTIVATE_DEDICATED_BEARER_REQ; + emm_sap_t emm_sap = {}; + emm_sap.primitive = (emm_primitive_t)_EMMCN_ACTIVATE_DEDICATED_BEARER_REQ; emm_sap.u.emm_cn.u.activate_dedicated_bearer_req = emm_cn_activate; rc = emm_sap_send(&emm_sap); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); @@ -516,8 +523,8 @@ status_code_e nas_proc_delete_dedicated_bearer( emm_cn_deactivate_dedicated_bearer_req_t* emm_cn_deactivate) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; - emm_sap.primitive = _EMMCN_DEACTIVATE_BEARER_REQ; + emm_sap_t emm_sap = {}; + emm_sap.primitive = (emm_primitive_t)_EMMCN_DEACTIVATE_BEARER_REQ; emm_sap.u.emm_cn.u.deactivate_dedicated_bearer_req = emm_cn_deactivate; rc = emm_sap_send(&emm_sap); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); @@ -526,7 +533,7 @@ status_code_e nas_proc_delete_dedicated_bearer( //------------------------------------------------------------------------------ status_code_e nas_proc_implicit_detach_ue_ind(mme_ue_s1ap_id_t ue_id) { status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; OAILOG_FUNC_IN(LOG_NAS_EMM); emm_sap.primitive = EMMCN_IMPLICIT_DETACH_UE; @@ -539,7 +546,7 @@ status_code_e nas_proc_implicit_detach_ue_ind(mme_ue_s1ap_id_t ue_id) { status_code_e nas_proc_nw_initiated_detach_ue_request( emm_cn_nw_initiated_detach_ue_t* const nw_initiated_detach_p) { status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; OAILOG_FUNC_IN(LOG_NAS_EMM); emm_sap.primitive = EMMCN_NW_INITIATED_DETACH_UE; @@ -564,7 +571,7 @@ status_code_e nas_proc_downlink_unitdata( imsi64_t imsi64 = INVALID_IMSI64; status_code_e rc = RETURNerror; emm_context_t* ctxt = NULL; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_as_data_t* emm_as = &emm_sap.u.emm_as.u.data; OAILOG_FUNC_IN(LOG_NAS_EMM); @@ -651,8 +658,8 @@ status_code_e encode_mobileid_imsi_tmsi(MobileIdentity* out, MobileIdentity in, status_code_e nas_proc_cs_domain_location_updt_fail( SgsRejectCause_t cause, lai_t* lai, mme_ue_s1ap_id_t mme_ue_s1ap_id) { status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; - emm_cn_cs_domain_location_updt_fail_t cs_location_updt_fail = {0}; + emm_sap_t emm_sap = {}; + emm_cn_cs_domain_location_updt_fail_t cs_location_updt_fail = {}; OAILOG_FUNC_IN(LOG_NAS_EMM); emm_sap.primitive = EMMCN_CS_DOMAIN_LOCATION_UPDT_FAIL; @@ -710,7 +717,7 @@ status_code_e nas_proc_sgs_release_req( ->mme_ue_s1ap_id; // update the ue context vlr_reliable flag to false mme_ue_context_update_ue_sgs_vlr_reliable(ue_id, false); - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; emm_sap.primitive = EMMCN_NW_INITIATED_DETACH_UE; emm_sap.u.emm_cn.u.emm_cn_nw_initiated_detach.ue_id = ue_id; emm_sap.u.emm_cn.u.emm_cn_nw_initiated_detach.detach_type = @@ -739,7 +746,7 @@ status_code_e nas_proc_sgs_release_req( status_code_e nas_proc_cs_service_notification(mme_ue_s1ap_id_t ue_id, uint8_t paging_id, bstring cli) { status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; OAILOG_FUNC_IN(LOG_NAS_EMM); emm_sap.primitive = EMMAS_DATA_REQ; @@ -857,7 +864,7 @@ static nas_cause_t s6a_error_2_nas_cause(uint32_t s6a_error, int experimental) { status_code_e nas_proc_cs_domain_mm_information_request( itti_sgsap_mm_information_req_t* const mm_information_req_pP) { status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; OAILOG_FUNC_IN(LOG_NAS_EMM); emm_sap.primitive = EMMCN_CS_DOMAIN_MM_INFORMATION_REQ; emm_sap.u.emm_cn.u.emm_cn_cs_domain_mm_information_req = @@ -883,7 +890,7 @@ status_code_e nas_proc_pdn_disconnect_rsp( emm_cn_pdn_disconnect_rsp_t* emm_cn_pdn_disconnect_rsp) { OAILOG_FUNC_IN(LOG_NAS_EMM); status_code_e rc = RETURNerror; - emm_sap_t emm_sap = {0}; + emm_sap_t emm_sap = {}; OAILOG_DEBUG(LOG_NAS_EMM, "Received pdn_disconnect_rsp for ue id %u\n", emm_cn_pdn_disconnect_rsp->ue_id); diff --git a/lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp b/lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp index 13e80d0f6f54..18d4795abc70 100644 --- a/lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp +++ b/lte/gateway/c/core/oai/tasks/nas/nas_proc.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source nas_proc.h +Source nas_proc.hpp Version 0.1 @@ -50,7 +50,7 @@ Description NAS procedure call manager #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_defs.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_cnDef.hpp" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ @@ -84,6 +84,9 @@ void nas_proc_cleanup(void); * -------------------------------------------------------------------------- */ +#ifdef __cplusplus +extern "C" { +#endif status_code_e nas_proc_establish_ind( const mme_ue_s1ap_id_t ue_id, const bool is_mm_ctx_new, const tai_t originating_tai, const ecgi_t ecgi, const as_cause_t as_cause, @@ -107,34 +110,37 @@ status_code_e nas_proc_ul_transfer_ind(const mme_ue_s1ap_id_t ueid, */ status_code_e nas_proc_authentication_info_answer( mme_app_desc_t* mme_app_desc_p, s6a_auth_info_ans_t* ans); -status_code_e nas_proc_auth_param_res(mme_ue_s1ap_id_t ue_id, - uint8_t nb_vectors, - eutran_vector_t* vectors); -status_code_e nas_proc_auth_param_fail(mme_ue_s1ap_id_t ue_id, - nas_cause_t cause); -status_code_e nas_proc_ula_success(mme_ue_s1ap_id_t ue_id); +status_code_e nas_proc_downlink_unitdata( + itti_sgsap_downlink_unitdata_t* dl_unitdata); +status_code_e nas_proc_sgs_release_req(itti_sgsap_release_req_t* sgs_rel); +status_code_e nas_proc_cs_domain_mm_information_request( + itti_sgsap_mm_information_req_t* const mm_information_req_pP); status_code_e nas_proc_cs_respose_success( emm_cn_cs_response_success_t* nas_cs_response_success); +status_code_e nas_proc_pdn_disconnect_rsp( + emm_cn_pdn_disconnect_rsp_t* emm_cn_pdn_disconnect_rsp); status_code_e nas_proc_ula_or_csrsp_fail( emm_cn_ula_or_csrsp_fail_t* ula_or_csrsp_fail); status_code_e nas_proc_create_dedicated_bearer( emm_cn_activate_dedicated_bearer_req_t* emm_cn_activate); -int nas_proc_signalling_connection_rel_ind(mme_ue_s1ap_id_t ue_id); status_code_e nas_proc_implicit_detach_ue_ind(mme_ue_s1ap_id_t ue_id); -int nas_proc_smc_fail(emm_cn_smc_fail_t* emm_cn_smc_fail); +status_code_e nas_proc_delete_dedicated_bearer( + emm_cn_deactivate_dedicated_bearer_req_t* emm_cn_deactivate); status_code_e nas_proc_nw_initiated_detach_ue_request( emm_cn_nw_initiated_detach_ue_t* const nw_initiated_detach_p); +status_code_e nas_proc_ula_success(mme_ue_s1ap_id_t ue_id); status_code_e nas_proc_cs_domain_location_updt_fail( SgsRejectCause_t cause, lai_t* lai, mme_ue_s1ap_id_t mme_ue_s1ap_id); -status_code_e nas_proc_downlink_unitdata( - itti_sgsap_downlink_unitdata_t* dl_unitdata); -status_code_e nas_proc_sgs_release_req(itti_sgsap_release_req_t* sgs_rel); -status_code_e nas_proc_cs_domain_mm_information_request( - itti_sgsap_mm_information_req_t* const mm_information_req_pP); status_code_e nas_proc_cs_service_notification(mme_ue_s1ap_id_t ue_id, uint8_t paging_id, bstring cli); -status_code_e nas_proc_delete_dedicated_bearer( - emm_cn_deactivate_dedicated_bearer_req_t* emm_cn_deactivate); -status_code_e nas_proc_pdn_disconnect_rsp( - emm_cn_pdn_disconnect_rsp_t* emm_cn_pdn_disconnect_rsp); +#ifdef __cplusplus +} +#endif +status_code_e nas_proc_auth_param_res(mme_ue_s1ap_id_t ue_id, + uint8_t nb_vectors, + eutran_vector_t* vectors); +status_code_e nas_proc_auth_param_fail(mme_ue_s1ap_id_t ue_id, + nas_cause_t cause); +int nas_proc_signalling_connection_rel_ind(mme_ue_s1ap_id_t ue_id); +int nas_proc_smc_fail(emm_cn_smc_fail_t* emm_cn_smc_fail); #endif /* FILE_NAS_PROC_SEEN*/ diff --git a/lte/gateway/c/core/oai/tasks/nas/nas_procedures.c b/lte/gateway/c/core/oai/tasks/nas/nas_procedures.cpp similarity index 92% rename from lte/gateway/c/core/oai/tasks/nas/nas_procedures.c rename to lte/gateway/c/core/oai/tasks/nas/nas_procedures.cpp index c03c63a02056..5a4d82014f7e 100644 --- a/lte/gateway/c/core/oai/tasks/nas/nas_procedures.c +++ b/lte/gateway/c/core/oai/tasks/nas/nas_procedures.cpp @@ -15,7 +15,7 @@ * contact@openairinterface.org */ -/*! \file nas_procedures.c +/*! \file nas_procedures.cpp \brief \author Lionel GAUTHIER \date 2017 @@ -30,21 +30,29 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/common/assertions.h" #include "lte/gateway/c/core/common/common_defs.h" -#include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/common/common_types.h" #include "lte/gateway/c/core/oai/common/digest.h" #include "lte/gateway/c/core/oai/common/log.h" +#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#ifdef __cplusplus +} +#endif + #include "lte/gateway/c/core/oai/include/mme_app_ue_context.h" +#include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/include/mme_config.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" -#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" // TODO: Add unit tests for common procedure functions static nas_emm_common_proc_t* get_nas_common_procedure( @@ -110,21 +118,21 @@ inline bool is_nas_common_procedure_guti_realloc_running( } //------------------------------------------------------------------------------ -inline bool is_nas_common_procedure_authentication_running( +bool is_nas_common_procedure_authentication_running( const struct emm_context_s* const ctxt) { if (get_nas_common_procedure_authentication(ctxt)) return true; return false; } //------------------------------------------------------------------------------ -inline bool is_nas_common_procedure_smc_running( +bool is_nas_common_procedure_smc_running( const struct emm_context_s* const ctxt) { if (get_nas_common_procedure_smc(ctxt)) return true; return false; } //------------------------------------------------------------------------------ -inline bool is_nas_common_procedure_identification_running( +bool is_nas_common_procedure_identification_running( const struct emm_context_s* const ctxt) { if (get_nas_common_procedure_identification(ctxt)) return true; return false; @@ -164,7 +172,7 @@ nas_emm_ident_proc_t* get_nas_common_procedure_identification( } //------------------------------------------------------------------------------ -inline bool is_nas_specific_procedure_attach_running( +bool is_nas_specific_procedure_attach_running( const struct emm_context_s* const ctxt) { if ((ctxt) && (ctxt->emm_procedures) && (ctxt->emm_procedures->emm_specific_proc) && @@ -175,7 +183,7 @@ inline bool is_nas_specific_procedure_attach_running( } //----------------------------------------------------------------------------- -inline bool is_nas_specific_procedure_detach_running( +bool is_nas_specific_procedure_detach_running( const struct emm_context_s* const ctxt) { if ((ctxt) && (ctxt->emm_procedures) && (ctxt->emm_procedures->emm_specific_proc) && @@ -186,7 +194,7 @@ inline bool is_nas_specific_procedure_detach_running( } //----------------------------------------------------------------------------- -inline bool is_nas_specific_procedure_tau_running( +bool is_nas_specific_procedure_tau_running( const struct emm_context_s* const ctxt) { if ((ctxt) && (ctxt->emm_procedures) && (ctxt->emm_procedures->emm_specific_proc) && @@ -241,21 +249,25 @@ nas_sr_proc_t* get_nas_con_mngt_procedure_service_request( } //----------------------------------------------------------------------------- -inline bool is_nas_attach_accept_sent( - const nas_emm_attach_proc_t* const attach_proc) { +#ifdef __cplusplus +extern "C" { +#endif +bool is_nas_attach_accept_sent(const nas_emm_attach_proc_t* const attach_proc) { if (attach_proc->attach_accept_sent) { return true; } else { return false; } } +#ifdef __cplusplus +} +#endif //----------------------------------------------------------------------------- -inline bool is_nas_attach_reject_sent( - const nas_emm_attach_proc_t* const attach_proc) { +bool is_nas_attach_reject_sent(const nas_emm_attach_proc_t* const attach_proc) { return attach_proc->attach_reject_sent; } //----------------------------------------------------------------------------- -inline bool is_nas_attach_complete_received( +bool is_nas_attach_complete_received( const nas_emm_attach_proc_t* const attach_proc) { return attach_proc->attach_complete_received; } @@ -581,8 +593,8 @@ void nas_delete_all_emm_procedures(struct emm_context_s* const emm_context) { //----------------------------------------------------------------------------- static emm_procedures_t* nas_new_emm_procedures( struct emm_context_s* const emm_context) { - emm_procedures_t* emm_procedures = - calloc(1, sizeof(*emm_context->emm_procedures)); + emm_procedures_t* emm_procedures = reinterpret_cast( + calloc(1, sizeof(*emm_context->emm_procedures))); LIST_INIT(&emm_procedures->emm_common_procs); return emm_procedures; } @@ -602,10 +614,11 @@ nas_emm_attach_proc_t* nas_new_attach_procedure( ->mme_ue_s1ap_id); return NULL; } - emm_context->emm_procedures->emm_specific_proc = calloc( + emm_context->emm_procedures + ->emm_specific_proc = reinterpret_cast(calloc( 1, sizeof( - nas_emm_attach_proc_t)); // NOLINT(clang-analyzer-unix.MallocSizeof) + nas_emm_attach_proc_t))); // NOLINT(clang-analyzer-unix.MallocSizeof) emm_context->emm_procedures->emm_specific_proc->emm_proc.base_proc.nas_puid = __sync_fetch_and_add(&nas_puid, 1); emm_context->emm_procedures->emm_specific_proc->emm_proc.base_proc.type = @@ -640,9 +653,10 @@ nas_emm_tau_proc_t* nas_new_tau_procedure( ->mme_ue_s1ap_id); return NULL; } - emm_context->emm_procedures->emm_specific_proc = calloc( + emm_context->emm_procedures + ->emm_specific_proc = reinterpret_cast(calloc( 1, - sizeof(nas_emm_tau_proc_t)); // NOLINT(clang-analyzer-unix.MallocSizeof) + sizeof(nas_emm_tau_proc_t))); // NOLINT(clang-analyzer-unix.MallocSizeof) emm_context->emm_procedures->emm_specific_proc->emm_proc.base_proc.nas_puid = __sync_fetch_and_add(&nas_puid, 1); emm_context->emm_procedures->emm_specific_proc->emm_proc.base_proc.type = @@ -675,8 +689,10 @@ nas_sr_proc_t* nas_new_service_request_procedure( ->mme_ue_s1ap_id); return NULL; } - emm_context->emm_procedures->emm_con_mngt_proc = calloc( - 1, sizeof(nas_sr_proc_t)); // NOLINT(clang-analyzer-unix.MallocSizeof) + emm_context->emm_procedures->emm_con_mngt_proc = + reinterpret_cast(calloc( + 1, + sizeof(nas_sr_proc_t))); // NOLINT(clang-analyzer-unix.MallocSizeof) emm_context->emm_procedures->emm_con_mngt_proc->emm_proc.base_proc.nas_puid = __sync_fetch_and_add(&nas_puid, 1); emm_context->emm_procedures->emm_con_mngt_proc->emm_proc.base_proc.type = @@ -699,7 +715,8 @@ nas_emm_ident_proc_t* nas_new_identification_procedure( emm_context->emm_procedures = nas_new_emm_procedures(emm_context); } - nas_emm_ident_proc_t* ident_proc = calloc(1, sizeof(nas_emm_ident_proc_t)); + nas_emm_ident_proc_t* ident_proc = reinterpret_cast( + calloc(1, sizeof(nas_emm_ident_proc_t))); ident_proc->emm_com_proc.emm_proc.base_proc.nas_puid = __sync_fetch_and_add(&nas_puid, 1); @@ -710,7 +727,9 @@ nas_emm_ident_proc_t* nas_new_identification_procedure( ident_proc->T3470.msec = mme_config.nas_config.t3470_msec; ident_proc->T3470.id = NAS_TIMER_INACTIVE_ID; - nas_emm_common_procedure_t* wrapper = calloc(1, sizeof(*wrapper)); + nas_emm_common_procedure_t* wrapper = + reinterpret_cast( + calloc(1, sizeof(*wrapper))); if (wrapper) { wrapper->proc = &ident_proc->emm_com_proc; LIST_INSERT_HEAD(&emm_context->emm_procedures->emm_common_procs, wrapper, @@ -730,7 +749,8 @@ nas_emm_auth_proc_t* nas_new_authentication_procedure( emm_context->emm_procedures = nas_new_emm_procedures(emm_context); } - nas_emm_auth_proc_t* auth_proc = calloc(1, sizeof(nas_emm_auth_proc_t)); + nas_emm_auth_proc_t* auth_proc = reinterpret_cast( + calloc(1, sizeof(nas_emm_auth_proc_t))); auth_proc->emm_com_proc.emm_proc.base_proc.nas_puid = __sync_fetch_and_add(&nas_puid, 1); @@ -741,7 +761,9 @@ nas_emm_auth_proc_t* nas_new_authentication_procedure( auth_proc->T3460.msec = mme_config.nas_config.t3460_msec; auth_proc->T3460.id = NAS_TIMER_INACTIVE_ID; - nas_emm_common_procedure_t* wrapper = calloc(1, sizeof(*wrapper)); + nas_emm_common_procedure_t* wrapper = + reinterpret_cast( + calloc(1, sizeof(*wrapper))); if (wrapper) { wrapper->proc = &auth_proc->emm_com_proc; LIST_INSERT_HEAD(&emm_context->emm_procedures->emm_common_procs, wrapper, @@ -761,7 +783,8 @@ nas_emm_smc_proc_t* nas_new_smc_procedure( emm_context->emm_procedures = nas_new_emm_procedures(emm_context); } - nas_emm_smc_proc_t* smc_proc = calloc(1, sizeof(nas_emm_smc_proc_t)); + nas_emm_smc_proc_t* smc_proc = reinterpret_cast( + calloc(1, sizeof(nas_emm_smc_proc_t))); smc_proc->emm_com_proc.emm_proc.base_proc.nas_puid = __sync_fetch_and_add(&nas_puid, 1); @@ -772,7 +795,9 @@ nas_emm_smc_proc_t* nas_new_smc_procedure( smc_proc->T3460.msec = mme_config.nas_config.t3460_msec; smc_proc->T3460.id = NAS_TIMER_INACTIVE_ID; - nas_emm_common_procedure_t* wrapper = calloc(1, sizeof(*wrapper)); + nas_emm_common_procedure_t* wrapper = + reinterpret_cast( + calloc(1, sizeof(*wrapper))); if (wrapper) { wrapper->proc = &smc_proc->emm_com_proc; LIST_INSERT_HEAD(&emm_context->emm_procedures->emm_common_procs, wrapper, @@ -793,7 +818,8 @@ nas_auth_info_proc_t* nas_new_cn_auth_info_procedure( } nas_auth_info_proc_t* auth_info_proc = - calloc(1, sizeof(nas_auth_info_proc_t)); + reinterpret_cast( + calloc(1, sizeof(nas_auth_info_proc_t))); auth_info_proc->cn_proc.base_proc.nas_puid = __sync_fetch_and_add(&nas_puid, 1); auth_info_proc->cn_proc.base_proc.type = NAS_PROC_TYPE_CN; @@ -801,7 +827,8 @@ nas_auth_info_proc_t* nas_new_cn_auth_info_procedure( auth_info_proc->timer_s6a.msec = mme_config.nas_config.ts6a_msec; auth_info_proc->timer_s6a.id = NAS_TIMER_INACTIVE_ID; - nas_cn_procedure_t* wrapper = calloc(1, sizeof(*wrapper)); + nas_cn_procedure_t* wrapper = + reinterpret_cast(calloc(1, sizeof(*wrapper))); if (wrapper) { wrapper->proc = &auth_info_proc->cn_proc; LIST_INSERT_HEAD(&emm_context->emm_procedures->cn_procs, wrapper, entries); diff --git a/lte/gateway/c/core/oai/tasks/nas/nas_procedures.h b/lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp similarity index 92% rename from lte/gateway/c/core/oai/tasks/nas/nas_procedures.h rename to lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp index f9d9dc38cc71..d48ea74bfcdf 100644 --- a/lte/gateway/c/core/oai/tasks/nas/nas_procedures.h +++ b/lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp @@ -38,8 +38,8 @@ #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" #include "lte/gateway/c/core/oai/lib/gtpv2-c/nwgtpv2c-0.11/include/queue.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/sap/emm_fsm.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" struct emm_context_s; struct nas_base_proc_s; @@ -49,22 +49,24 @@ struct emm_context_s; struct nas_base_proc_s; struct nas_emm_proc_s; -typedef int (*success_cb_t)(struct emm_context_s*); -typedef int (*failure_cb_t)(struct emm_context_s*); -typedef int (*proc_abort_t)(struct emm_context_s*, struct nas_base_proc_s*); +typedef status_code_e (*success_cb_t)(struct emm_context_s*); +typedef status_code_e (*failure_cb_t)(struct emm_context_s*); +typedef status_code_e (*proc_abort_t)(struct emm_context_s*, + struct nas_base_proc_s*); typedef int (*pdu_in_resp_t)(struct emm_context_s*, void* arg); // can be RESPONSE, COMPLETE, ACCEPT -typedef int (*pdu_in_rej_t)(struct emm_context_s*, void* arg); // REJECT. -typedef int (*pdu_out_rej_t)(struct emm_context_s*, - struct nas_base_proc_s*); // REJECT. - -typedef int (*sdu_out_delivered_t)(struct emm_context_s*, - struct nas_emm_proc_s*); -typedef int (*sdu_out_not_delivered_t)(struct emm_context_s*, - struct nas_emm_proc_s*); -typedef int (*sdu_out_not_delivered_ho_t)(struct emm_context_s*, - struct nas_emm_proc_s*); +typedef status_code_e (*pdu_in_rej_t)(struct emm_context_s*, + void* arg); // REJECT. +typedef status_code_e (*pdu_out_rej_t)(struct emm_context_s*, + struct nas_base_proc_s*); // REJECT. + +typedef status_code_e (*sdu_out_delivered_t)(struct emm_context_s*, + struct nas_emm_proc_s*); +typedef status_code_e (*sdu_out_not_delivered_t)(struct emm_context_s*, + struct nas_emm_proc_s*); +typedef status_code_e (*sdu_out_not_delivered_ho_t)(struct emm_context_s*, + struct nas_emm_proc_s*); typedef enum { NAS_PROC_TYPE_NONE = 0, @@ -394,30 +396,50 @@ typedef struct emm_procedures_s { bool is_nas_common_procedure_guti_realloc_running( const struct emm_context_s* const ctxt); -bool is_nas_common_procedure_authentication_running( - const struct emm_context_s* const ctxt); bool is_nas_common_procedure_smc_running( const struct emm_context_s* const ctxt); -bool is_nas_common_procedure_identification_running( - const struct emm_context_s* const ctxt); -nas_emm_guti_proc_t* get_nas_common_procedure_guti_realloc( +/* TODO:These declarations are temporarily moved to emm_headers.hpp file to + * resolve undefined references. Uncomment these functions and delete + * emm_headers.hpp after moving all the files to c++ + */ + +/*bool is_nas_common_procedure_authentication_running( + const struct emm_context_s* const ctxt); +bool is_nas_common_procedure_identification_running( const struct emm_context_s* const ctxt); nas_emm_ident_proc_t* get_nas_common_procedure_identification( const struct emm_context_s* const ctxt); +bool is_nas_attach_accept_sent(const nas_emm_attach_proc_t* const attach_proc); +bool is_nas_attach_reject_sent(const nas_emm_attach_proc_t* const attach_proc); +bool is_nas_specific_procedure_attach_running( + const struct emm_context_s* const ctxt); +nas_emm_attach_proc_t* nas_new_attach_procedure( + struct emm_context_s* const emm_context); +nas_emm_ident_proc_t* nas_new_identification_procedure( + struct emm_context_s* const emm_context); nas_emm_smc_proc_t* get_nas_common_procedure_smc( const struct emm_context_s* const ctxt); -nas_emm_auth_proc_t* get_nas_common_procedure_authentication( +nas_emm_smc_proc_t* nas_new_smc_procedure( + struct emm_context_s* const emm_context); +nas_emm_tau_proc_t* get_nas_specific_procedure_tau( const struct emm_context_s* const ctxt); - +nas_emm_tau_proc_t* nas_new_tau_procedure( + struct emm_context_s* const emm_context); nas_auth_info_proc_t* get_nas_cn_procedure_auth_info( const struct emm_context_s* const ctxt); +void nas_emm_procedure_register_emm_message(mme_ue_s1ap_id_t ue_id, + const uint64_t puid, + bstring nas_msg);*/ -nas_sr_proc_t* get_nas_con_mngt_procedure_service_request( +nas_emm_guti_proc_t* get_nas_common_procedure_guti_realloc( + const struct emm_context_s* const ctxt); +nas_emm_auth_proc_t* get_nas_common_procedure_authentication( const struct emm_context_s* const ctxt); -bool is_nas_specific_procedure_attach_running( +nas_sr_proc_t* get_nas_con_mngt_procedure_service_request( const struct emm_context_s* const ctxt); + bool is_nas_specific_procedure_detach_running( const struct emm_context_s* const ctxt); bool is_nas_specific_procedure_tau_running( @@ -428,19 +450,9 @@ extern "C" { #endif nas_emm_attach_proc_t* get_nas_specific_procedure_attach( const struct emm_context_s* const ctxt); -#ifdef __cplusplus -} -#endif - -nas_emm_detach_proc_t* get_nas_specific_procedure_detach( - const struct emm_context_s* const ctxt); -nas_emm_tau_proc_t* get_nas_specific_procedure_tau( - const struct emm_context_s* const ctxt); - -bool is_nas_attach_accept_sent(const nas_emm_attach_proc_t* const attach_proc); -bool is_nas_attach_reject_sent(const nas_emm_attach_proc_t* const attach_proc); -bool is_nas_attach_complete_received( - const nas_emm_attach_proc_t* const attach_proc); +nas_emm_proc_t* nas_emm_find_procedure_by_msg_digest( + struct emm_context_s* const emm_context, const char* const digest, + const size_t digest_bytes, const size_t msg_size); status_code_e nas_unlink_procedures(nas_base_proc_t* const parent_proc, nas_base_proc_t* const child_proc); @@ -451,33 +463,28 @@ void nas_delete_common_procedure(struct emm_context_s* const emm_context, void nas_delete_attach_procedure(struct emm_context_s* const emm_context); void nas_delete_tau_procedure(struct emm_context_s* emm_context); void nas_delete_detach_procedure(struct emm_context_s* emm_context); +#ifdef __cplusplus +} +#endif + +nas_emm_detach_proc_t* get_nas_specific_procedure_detach( + const struct emm_context_s* const ctxt); + +bool is_nas_attach_complete_received( + const nas_emm_attach_proc_t* const attach_proc); void nas_delete_cn_procedure(struct emm_context_s* emm_context, nas_cn_proc_t* cn_proc); -nas_emm_attach_proc_t* nas_new_attach_procedure( - struct emm_context_s* const emm_context); -nas_emm_tau_proc_t* nas_new_tau_procedure( - struct emm_context_s* const emm_context); nas_sr_proc_t* nas_new_service_request_procedure( struct emm_context_s* const emm_context); -nas_emm_ident_proc_t* nas_new_identification_procedure( - struct emm_context_s* const emm_context); nas_emm_auth_proc_t* nas_new_authentication_procedure( struct emm_context_s* const emm_context); -nas_emm_smc_proc_t* nas_new_smc_procedure( - struct emm_context_s* const emm_context); nas_auth_info_proc_t* nas_new_cn_auth_info_procedure( struct emm_context_s* const emm_context); void nas_digest_msg(const unsigned char* const msg, const size_t msg_len, char* const digest, /*INOUT*/ size_t* const digest_length); -void nas_emm_procedure_register_emm_message(mme_ue_s1ap_id_t ue_id, - const uint64_t puid, - bstring nas_msg); -nas_emm_proc_t* nas_emm_find_procedure_by_msg_digest( - struct emm_context_s* const emm_context, const char* const digest, - const size_t digest_bytes, const size_t msg_size); #endif diff --git a/lte/gateway/c/core/oai/tasks/nas/nas_state_converter.cpp b/lte/gateway/c/core/oai/tasks/nas/nas_state_converter.cpp index 12c9a022ded1..83e6e03791e9 100644 --- a/lte/gateway/c/core/oai/tasks/nas/nas_state_converter.cpp +++ b/lte/gateway/c/core/oai/tasks/nas/nas_state_converter.cpp @@ -14,13 +14,15 @@ * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ + +#include "lte/gateway/c/core/oai/tasks/nas/nas_state_converter.hpp" + extern "C" { #include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" } -#include "lte/gateway/c/core/oai/tasks/nas/nas_state_converter.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" namespace magma { namespace lte { diff --git a/lte/gateway/c/core/oai/tasks/nas/nas_state_converter.hpp b/lte/gateway/c/core/oai/tasks/nas/nas_state_converter.hpp index 0c4de3bb0b75..8f1daaf7dc09 100644 --- a/lte/gateway/c/core/oai/tasks/nas/nas_state_converter.hpp +++ b/lte/gateway/c/core/oai/tasks/nas/nas_state_converter.hpp @@ -17,18 +17,18 @@ #pragma once -extern "C" { -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" +#include "lte/gateway/c/core/oai/include/state_converter.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.hpp" + +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/esm/esm_proc.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" -} +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" #include #include "lte/protos/oai/nas_state.pb.h" #include "lte/protos/oai/spgw_state.pb.h" -#include "lte/gateway/c/core/oai/include/state_converter.hpp" using magma::lte::oai::TrafficFlowTemplate; /****************************************************************************** diff --git a/lte/gateway/c/core/oai/tasks/nas/util/nas_timer.c b/lte/gateway/c/core/oai/tasks/nas/util/nas_timer.cpp similarity index 94% rename from lte/gateway/c/core/oai/tasks/nas/util/nas_timer.c rename to lte/gateway/c/core/oai/tasks/nas/util/nas_timer.cpp index f0b0a1b387a1..2659b85a9787 100644 --- a/lte/gateway/c/core/oai/tasks/nas/util/nas_timer.c +++ b/lte/gateway/c/core/oai/tasks/nas/util/nas_timer.cpp @@ -16,7 +16,7 @@ */ /***************************************************************************** - Source nas_timer.c + Source nas_timer.cpp Version 0.1 @@ -37,11 +37,17 @@ #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/common/dynamic_memory_check.h" +#ifdef __cplusplus +extern "C" { +#endif #include "lte/gateway/c/core/oai/common/log.h" +#ifdef __cplusplus +} +#endif #include "lte/gateway/c/core/oai/lib/itti/intertask_interface_types.h" #include "lte/gateway/c/core/oai/lib/itti/itti_types.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_timer.h" -#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h" +#include "lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp" //------------------------------------------------------------------------------ status_code_e nas_timer_init(void) { return (RETURNok); } diff --git a/lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h b/lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp similarity index 92% rename from lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h rename to lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp index 3b95c39f4cd0..a1c21e7f4634 100644 --- a/lte/gateway/c/core/oai/tasks/nas/util/nas_timer.h +++ b/lte/gateway/c/core/oai/tasks/nas/util/nas_timer.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source nas_timer.h +Source nas_timer.hpp Version 0.1 @@ -82,8 +82,13 @@ typedef struct nas_itti_timer_arg_s { /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ -status_code_e nas_timer_init(void); -void nas_timer_cleanup(void); +/*TODO: These declarations are temporarily moved to emm_headers.hpp file to + * resolve undefined references. Uncomment these functions and delete + * emm_headers.hpp after moving all the files to c++ + */ +/*status_code_e nas_timer_init(void); +void nas_timer_cleanup(void);*/ + #ifdef __cplusplus extern "C" { #endif diff --git a/lte/gateway/c/core/oai/tasks/nas/util/parser.c b/lte/gateway/c/core/oai/tasks/nas/util/parser.cpp similarity index 98% rename from lte/gateway/c/core/oai/tasks/nas/util/parser.c rename to lte/gateway/c/core/oai/tasks/nas/util/parser.cpp index ffb31d6c9c0f..16980b67a8de 100644 --- a/lte/gateway/c/core/oai/tasks/nas/util/parser.c +++ b/lte/gateway/c/core/oai/tasks/nas/util/parser.cpp @@ -16,7 +16,7 @@ */ /***************************************************************************** - Source parser.c + Source parser.cpp Version 0.1 @@ -32,7 +32,7 @@ *****************************************************************************/ -#include "lte/gateway/c/core/oai/tasks/nas/util/parser.h" +#include "lte/gateway/c/core/oai/tasks/nas/util/parser.hpp" #include "lte/gateway/c/core/oai/include/nas/commonDef.h" #include // fprintf diff --git a/lte/gateway/c/core/oai/tasks/nas/util/parser.h b/lte/gateway/c/core/oai/tasks/nas/util/parser.hpp similarity index 99% rename from lte/gateway/c/core/oai/tasks/nas/util/parser.h rename to lte/gateway/c/core/oai/tasks/nas/util/parser.hpp index 324f22ee4847..54bd213f7dd8 100644 --- a/lte/gateway/c/core/oai/tasks/nas/util/parser.h +++ b/lte/gateway/c/core/oai/tasks/nas/util/parser.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source parser.h +Source parser.hpp Version 0.1 diff --git a/lte/gateway/c/core/oai/tasks/nas/util/socket.c b/lte/gateway/c/core/oai/tasks/nas/util/socket.cpp similarity index 98% rename from lte/gateway/c/core/oai/tasks/nas/util/socket.c rename to lte/gateway/c/core/oai/tasks/nas/util/socket.cpp index 8e34b3740288..5c5ce2c03b7b 100644 --- a/lte/gateway/c/core/oai/tasks/nas/util/socket.c +++ b/lte/gateway/c/core/oai/tasks/nas/util/socket.cpp @@ -16,7 +16,7 @@ */ /***************************************************************************** - Source socket.c + Source socket.cpp Version 0.1 @@ -32,8 +32,7 @@ *****************************************************************************/ -#include "lte/gateway/c/core/oai/tasks/nas/util/socket.h" -#include "lte/gateway/c/core/oai/include/nas/commonDef.h" +#include "lte/gateway/c/core/oai/tasks/nas/util/socket.hpp" #include // malloc, free, atoi #include // memset @@ -43,6 +42,10 @@ #include // socket, setsockopt, connect, bind, recv, send #include // getaddrinfo #include // true, false + +#include + +#include "lte/gateway/c/core/oai/include/nas/commonDef.h" #include "lte/gateway/c/core/common/dynamic_memory_check.h" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -387,12 +390,13 @@ ssize_t socket_send(const void* id, const char* buffer, size_t length) { ***************************************************************************/ status_code_e socket_get_fd(const void* id) { if (id) { - return ((socket_id_t*)id)->fd; + int socket_file_descriptor = + const_cast(reinterpret_cast(id))->fd; + return static_cast(socket_file_descriptor); } return RETURNerror; } - /****************************************************************************/ /********************* L O C A L F U N C T I O N S *********************/ /****************************************************************************/ diff --git a/lte/gateway/c/core/oai/tasks/nas/util/socket.h b/lte/gateway/c/core/oai/tasks/nas/util/socket.hpp similarity index 99% rename from lte/gateway/c/core/oai/tasks/nas/util/socket.h rename to lte/gateway/c/core/oai/tasks/nas/util/socket.hpp index 51095e4db465..e942cda40fb0 100644 --- a/lte/gateway/c/core/oai/tasks/nas/util/socket.h +++ b/lte/gateway/c/core/oai/tasks/nas/util/socket.hpp @@ -16,7 +16,7 @@ */ /***************************************************************************** -Source socket.h +Source socket.hpp Version 0.1 diff --git a/lte/gateway/c/core/oai/tasks/ngap/ngap_amf_handlers.c b/lte/gateway/c/core/oai/tasks/ngap/ngap_amf_handlers.c index 2411d04dcee8..1fabf26c0797 100644 --- a/lte/gateway/c/core/oai/tasks/ngap/ngap_amf_handlers.c +++ b/lte/gateway/c/core/oai/tasks/ngap/ngap_amf_handlers.c @@ -2177,9 +2177,13 @@ status_code_e ngap_amf_handle_pduSession_modify_response( .pduSessResourceModRespList.item[index] .PDU_Session_Resource_Mpdify_Response_Transfer .qos_flow_add_or_modify_response_list; - qos_add_or_modify_list->maxNumOfQosFlows = - pDUSessionResourceModifyResponseTransfer - ->qosFlowAddOrModifyResponseList->list.count; + if (pDUSessionResourceModifyResponseTransfer + ->qosFlowAddOrModifyResponseList != NULL) + qos_add_or_modify_list->maxNumOfQosFlows = + pDUSessionResourceModifyResponseTransfer + ->qosFlowAddOrModifyResponseList->list.count; + else + qos_add_or_modify_list->maxNumOfQosFlows = 0; for (int i = 0; i < qos_add_or_modify_list->maxNumOfQosFlows; i++) { qos_add_or_modify_list->item[i].qos_flow_identifier = pDUSessionResourceModifyResponseTransfer @@ -2189,11 +2193,16 @@ status_code_e ngap_amf_handle_pduSession_modify_response( ->qosFlowAddOrModifyResponseList->list.array[index]); } - free(pDUSessionResourceModifyResponseTransfer - ->qosFlowAddOrModifyResponseList->list.array); - free(pDUSessionResourceModifyResponseTransfer - ->qosFlowAddOrModifyResponseList); - free(pDUSessionResourceModifyResponseTransfer); + if (pDUSessionResourceModifyResponseTransfer + ->qosFlowAddOrModifyResponseList != NULL) + free(pDUSessionResourceModifyResponseTransfer + ->qosFlowAddOrModifyResponseList->list.array); + if (pDUSessionResourceModifyResponseTransfer + ->qosFlowAddOrModifyResponseList != NULL) + free(pDUSessionResourceModifyResponseTransfer + ->qosFlowAddOrModifyResponseList); + if (pDUSessionResourceModifyResponseTransfer) + free(pDUSessionResourceModifyResponseTransfer); } } diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme.cpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme.cpp index 75390a90e906..d33d94bd3524 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme.cpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme.cpp @@ -57,12 +57,15 @@ extern "C" { #include "lte/gateway/c/core/oai/tasks/s1ap/s1ap_timer.hpp" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" +bool hss_associated = false; +namespace magma { +namespace lte { + static void start_stats_timer(void); static int handle_stats_timer(zloop_t* loop, int id, void* arg); static long epc_stats_timer_id; static size_t epc_stats_timer_sec = 60; -bool hss_associated = false; static int indent = 0; task_zmq_ctx_t s1ap_task_zmq_ctx; @@ -70,6 +73,7 @@ bool s1ap_congestion_control_enabled = true; long s1ap_last_msg_latency = 0; long s1ap_zmq_th = LONG_MAX; +static void s1ap_mme_exit(void); //------------------------------------------------------------------------------ static int s1ap_send_init_sctp(void) { // Create and alloc new message @@ -356,7 +360,7 @@ extern "C" status_code_e s1ap_mme_init(const mme_config_t* mme_config_p) { } //------------------------------------------------------------------------------ -void s1ap_mme_exit(void) { +static void s1ap_mme_exit(void) { OAILOG_DEBUG(LOG_S1AP, "Cleaning S1AP\n"); stop_timer(&s1ap_task_zmq_ctx, epc_stats_timer_id); @@ -373,104 +377,109 @@ void s1ap_mme_exit(void) { } //------------------------------------------------------------------------------ -enb_description_t* s1ap_new_enb(void) { - enb_description_t* enb_ref = NULL; +oai::EnbDescription* s1ap_new_enb(void) { + oai::EnbDescription* enb_ref = nullptr; + magma::proto_map_uint32_uint64_t ue_id_coll; - enb_ref = new enb_description_t(); + enb_ref = new oai::EnbDescription(); /* * Something bad happened during new * * * * May be we are running out of memory. * * * * TODO: Notify eNB with a cause like Hardware Failure. */ - if (enb_ref == NULL) { + if (enb_ref == nullptr) { OAILOG_CRITICAL( LOG_S1AP, - "Failed to allocate memory for structure, enb_description_t \n"); + "Failed to allocate memory for structure, oai::EnbDescription \n"); return enb_ref; } - enb_ref->ue_id_coll.map = new google::protobuf::Map(); - enb_ref->ue_id_coll.set_name("s1ap_ue_coll"); - enb_ref->nb_ue_associated = 0; + ue_id_coll.map = enb_ref->mutable_ue_id_map(); + ue_id_coll.set_name("s1ap_ue_coll"); + enb_ref->set_nb_ue_associated(0); return enb_ref; } //------------------------------------------------------------------------------ -ue_description_t* s1ap_new_ue(s1ap_state_t* state, - const sctp_assoc_id_t sctp_assoc_id, - enb_ue_s1ap_id_t enb_ue_s1ap_id) { - enb_description_t* enb_ref = NULL; - ue_description_t* ue_ref = NULL; +oai::UeDescription* s1ap_new_ue(s1ap_state_t* state, + const sctp_assoc_id_t sctp_assoc_id, + enb_ue_s1ap_id_t enb_ue_s1ap_id) { + oai::EnbDescription* enb_ref = nullptr; + oai::UeDescription* ue_ref = nullptr; enb_ref = s1ap_state_get_enb(state, sctp_assoc_id); DevAssert(enb_ref != NULL); - ue_ref = new ue_description_t(); + ue_ref = new oai::UeDescription(); /* - * Something bad happened during malloc... + * Something bad happened during memory allocation... * * * * May be we are running out of memory. * * * * TODO: Notify eNB with a cause like Hardware Failure. */ - if (ue_ref == NULL) { - OAILOG_ERROR(LOG_S1AP, "Failed to allocate memory for ue context"); - return NULL; + if (ue_ref == nullptr) { + OAILOG_ERROR(LOG_S1AP, + "Failed to allocate memory for protobuf object UeDescription"); + return nullptr; } - ue_ref->sctp_assoc_id = sctp_assoc_id; - ue_ref->enb_ue_s1ap_id = enb_ue_s1ap_id; - ue_ref->comp_s1ap_id = - S1AP_GENERATE_COMP_S1AP_ID(sctp_assoc_id, enb_ue_s1ap_id); + ue_ref->set_sctp_assoc_id(sctp_assoc_id); + ue_ref->set_enb_ue_s1ap_id(enb_ue_s1ap_id); + ue_ref->set_comp_s1ap_id( + S1AP_GENERATE_COMP_S1AP_ID(sctp_assoc_id, enb_ue_s1ap_id)); map_uint64_ue_description_t* s1ap_ue_state = get_s1ap_ue_state(); - if (!s1ap_ue_state) { + if (s1ap_ue_state == nullptr) { OAILOG_ERROR(LOG_S1AP, "Failed to get s1ap_ue_state"); - return NULL; + return nullptr; } magma::proto_map_rc_t rc = - s1ap_ue_state->insert(ue_ref->comp_s1ap_id, ue_ref); + s1ap_ue_state->insert(ue_ref->comp_s1ap_id(), ue_ref); if (rc != magma::PROTO_MAP_OK) { OAILOG_ERROR(LOG_S1AP, "Could not insert UE descr in ue_coll: %s\n", magma::map_rc_code2string(rc)); free_cpp_wrapper(reinterpret_cast(&ue_ref)); - return NULL; + return nullptr; } // Increment number of UE - enb_ref->nb_ue_associated++; + enb_ref->set_nb_ue_associated((enb_ref->nb_ue_associated() + 1)); OAILOG_DEBUG(LOG_S1AP, "Num ue associated: %d on assoc id:%d", - enb_ref->nb_ue_associated, sctp_assoc_id); + enb_ref->nb_ue_associated(), sctp_assoc_id); return ue_ref; } //------------------------------------------------------------------------------ -void s1ap_remove_ue(s1ap_state_t* state, ue_description_t* ue_ref) { - enb_description_t* enb_ref = NULL; +void s1ap_remove_ue(s1ap_state_t* state, oai::UeDescription* ue_ref) { + oai::EnbDescription* enb_ref = nullptr; // NULL reference... - if (ue_ref == NULL) return; + if (ue_ref == nullptr) return; - mme_ue_s1ap_id_t mme_ue_s1ap_id = ue_ref->mme_ue_s1ap_id; - enb_ref = s1ap_state_get_enb(state, ue_ref->sctp_assoc_id); - DevAssert(enb_ref->nb_ue_associated > 0); + mme_ue_s1ap_id_t mme_ue_s1ap_id = ue_ref->mme_ue_s1ap_id(); + enb_ref = s1ap_state_get_enb(state, ue_ref->sctp_assoc_id()); + DevAssert(enb_ref->nb_ue_associated() > 0); // Updating number of UE - enb_ref->nb_ue_associated--; + enb_ref->set_nb_ue_associated((enb_ref->nb_ue_associated() - 1)); OAILOG_TRACE(LOG_S1AP, "Removing UE enb_ue_s1ap_id: " ENB_UE_S1AP_ID_FMT " mme_ue_s1ap_id:" MME_UE_S1AP_ID_FMT " in eNB id : %d\n", - ue_ref->enb_ue_s1ap_id, ue_ref->mme_ue_s1ap_id, enb_ref->enb_id); + ue_ref->enb_ue_s1ap_id(), ue_ref->mme_ue_s1ap_id(), + enb_ref->enb_id); - ue_ref->s1_ue_state = S1AP_UE_INVALID_STATE; - if (ue_ref->s1ap_ue_context_rel_timer.id != S1AP_TIMER_INACTIVE_ID) { - s1ap_stop_timer(ue_ref->s1ap_ue_context_rel_timer.id); - ue_ref->s1ap_ue_context_rel_timer.id = S1AP_TIMER_INACTIVE_ID; + ue_ref->set_s1ap_ue_state(oai::S1AP_UE_INVALID_STATE); + if (ue_ref->s1ap_ue_context_rel_timer().id() != S1AP_TIMER_INACTIVE_ID) { + s1ap_stop_timer(ue_ref->s1ap_ue_context_rel_timer().id()); + ue_ref->mutable_s1ap_ue_context_rel_timer()->set_id(S1AP_TIMER_INACTIVE_ID); } map_uint64_ue_description_t* s1ap_ue_state = get_s1ap_ue_state(); - if (!s1ap_ue_state) { + if (s1ap_ue_state == nullptr) { OAILOG_ERROR(LOG_S1AP, "Failed to get s1ap_ue_state"); return; } - s1ap_ue_state->remove(ue_ref->comp_s1ap_id); + s1ap_ue_state->remove(ue_ref->comp_s1ap_id()); state->mmeid2associd.remove(mme_ue_s1ap_id); - enb_ref->ue_id_coll.remove(mme_ue_s1ap_id); + magma::proto_map_uint32_uint64_t ue_id_coll; + ue_id_coll.map = enb_ref->mutable_ue_id_map(); + ue_id_coll.remove(mme_ue_s1ap_id); imsi64_t imsi64 = INVALID_IMSI64; s1ap_imsi_map_t* s1ap_imsi_map = get_s1ap_imsi_map(); @@ -479,31 +488,34 @@ void s1ap_remove_ue(s1ap_state_t* state, ue_description_t* ue_ref) { s1ap_imsi_map->mme_ueid2imsi_map.remove(mme_ue_s1ap_id); OAILOG_DEBUG(LOG_S1AP, "Num UEs associated %u num elements in ue_id_coll %lu", - enb_ref->nb_ue_associated, enb_ref->ue_id_coll.size()); - if (!enb_ref->nb_ue_associated) { - if (enb_ref->s1_state == S1AP_RESETING) { + enb_ref->nb_ue_associated(), ue_id_coll.size()); + if (!enb_ref->nb_ue_associated()) { + if (enb_ref->s1_enb_state() == oai::S1AP_RESETING) { OAILOG_INFO(LOG_S1AP, "Moving eNB state to S1AP_INIT \n"); - enb_ref->s1_state = S1AP_INIT; - set_gauge("s1_connection", 0, 1, "enb_name", enb_ref->enb_name); + enb_ref->set_s1_state(oai::S1AP_INIT); + set_gauge("s1_connection", 0, 1, "enb_name", enb_ref->enb_name()); state->num_enbs--; - } else if (enb_ref->s1_state == S1AP_SHUTDOWN) { + } else if (enb_ref->s1_enb_state() == oai::S1AP_SHUTDOWN) { OAILOG_INFO(LOG_S1AP, "Deleting eNB \n"); - set_gauge("s1_connection", 0, 1, "enb_name", enb_ref->enb_name); + set_gauge("s1_connection", 0, 1, "enb_name", enb_ref->enb_name()); s1ap_remove_enb(state, enb_ref); } } } //------------------------------------------------------------------------------ -void s1ap_remove_enb(s1ap_state_t* state, enb_description_t* enb_ref) { - if (enb_ref == NULL) { +void s1ap_remove_enb(s1ap_state_t* state, oai::EnbDescription* enb_ref) { + if (enb_ref == nullptr) { return; } - enb_ref->s1_state = S1AP_INIT; - enb_ref->ue_id_coll.destroy_map(); + magma::proto_map_uint32_uint64_t ue_id_coll; + enb_ref->set_s1_state(oai::S1AP_INIT); + + ue_id_coll.map = enb_ref->mutable_ue_id_map(); + ue_id_coll.clear(); OAILOG_INFO(LOG_S1AP, "Deleting eNB on assoc_id :%u\n", - enb_ref->sctp_assoc_id); - state->enbs.remove(enb_ref->sctp_assoc_id); + enb_ref->sctp_assoc_id()); + state->enbs.remove(enb_ref->sctp_assoc_id()); state->num_enbs--; } @@ -521,3 +533,6 @@ static void start_stats_timer(void) { start_timer(&s1ap_task_zmq_ctx, 1000 * epc_stats_timer_sec, TIMER_REPEAT_FOREVER, handle_stats_timer, NULL); } + +} // namespace lte +} // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme.hpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme.hpp index e1268b916b21..7df3eb2251fa 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme.hpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme.hpp @@ -23,8 +23,9 @@ */ #pragma once -#include "lte/gateway/c/core/oai/include/s1ap_state.hpp" -#include "lte/gateway/c/core/oai/include/s1ap_types.hpp" + +#include "lte/protos/oai/s1ap_state.pb.h" + #ifdef __cplusplus extern "C" { #endif @@ -37,31 +38,45 @@ extern "C" { #define S1AP_ZMQ_LATENCY_TH \ s1ap_zmq_th // absolute threshold to be used for initial UE messages +#ifdef __cplusplus +} +#endif + +#include "lte/gateway/c/core/oai/include/s1ap_state.hpp" +#include "lte/gateway/c/core/oai/include/s1ap_types.hpp" + extern bool hss_associated; +namespace magma { +namespace lte { + /** \brief Allocate and add to the list a new eNB descriptor * @returns Reference to the new eNB element in list **/ -enb_description_t* s1ap_new_enb(void); +oai::EnbDescription* s1ap_new_enb(void); /** \brief Allocate and add to the right eNB list a new UE descriptor * \param sctp_assoc_id association ID over SCTP * \param enb_ue_s1ap_id ue ID over S1AP * @returns Reference to the new UE element in list **/ -ue_description_t* s1ap_new_ue(s1ap_state_t* state, - sctp_assoc_id_t sctp_assoc_id, - enb_ue_s1ap_id_t enb_ue_s1ap_id); +oai::UeDescription* s1ap_new_ue(s1ap_state_t* state, + sctp_assoc_id_t sctp_assoc_id, + enb_ue_s1ap_id_t enb_ue_s1ap_id); /** \brief Remove target UE from the list * \param ue_ref UE structure reference to remove **/ -void s1ap_remove_ue(s1ap_state_t* state, ue_description_t* ue_ref); +void s1ap_remove_ue(s1ap_state_t* state, oai::UeDescription* ue_ref); /** \brief Remove target eNB from the list and remove any UE associated * \param enb_ref eNB structure reference to remove **/ -void s1ap_remove_enb(s1ap_state_t* state, enb_description_t* enb_ref); -#ifdef __cplusplus -} -#endif +void s1ap_remove_enb(s1ap_state_t* state, oai::EnbDescription* enb_ref); + +void free_enb_description(void** ptr); + +void free_ue_description(void** ptr); + +} // namespace lte +} // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_handlers.cpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_handlers.cpp index 586ae8e4debe..602b98bc3341 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_handlers.cpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_handlers.cpp @@ -15,7 +15,7 @@ * contact@openairinterface.org */ -/*! \file s1ap_mme_handlers.c +/*! \file s1ap_mme_handlers.cpp \brief \author Sebastien ROUX, Lionel Gauthier \company Eurecom @@ -38,6 +38,7 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/itti/intertask_interface.h" #include "lte/gateway/c/core/oai/lib/itti/intertask_interface_types.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" #ifdef __cplusplus } #endif @@ -103,6 +104,9 @@ extern "C" { #include "lte/gateway/c/core/oai/tasks/s1ap/s1ap_timer.hpp" #include "orc8r/gateway/c/common/service303/MetricsHelpers.hpp" +namespace magma { +namespace lte { + typedef struct arg_s1ap_send_enb_dereg_ind_s { uint8_t current_ue_index; uint32_t handled_ues; @@ -117,7 +121,7 @@ struct S1ap_E_RABSetupItemCtxtSURes_s; struct S1ap_IE; status_code_e s1ap_generate_s1_setup_response( - s1ap_state_t* state, enb_description_t* enb_association); + s1ap_state_t* state, oai::EnbDescription* enb_association); bool is_all_erabId_same(S1ap_PathSwitchRequest_t* container); static int handle_ue_context_rel_timer_expiry(zloop_t* loop, int id, void* arg); @@ -381,10 +385,12 @@ status_code_e s1ap_mme_generate_s1_setup_failure(const sctp_assoc_id_t assoc_id, //------------------------------------------------------------------------------ bool get_stale_enb_connection_with_enb_id(__attribute__((unused)) const uint32_t keyP, - enb_description_t* const elementP, + oai::EnbDescription* const elementP, void* parameterP, void** resultP) { - enb_description_t* new_enb_association = (enb_description_t*)parameterP; - enb_description_t* ht_enb_association = (enb_description_t*)elementP; + oai::EnbDescription* new_enb_association = + reinterpret_cast(parameterP); + oai::EnbDescription* ht_enb_association = + reinterpret_cast(elementP); // No need to clean the newly created eNB association if (ht_enb_association == new_enb_association) { @@ -392,7 +398,7 @@ bool get_stale_enb_connection_with_enb_id(__attribute__((unused)) } // Match old and new association with respect to eNB id - if (ht_enb_association->enb_id == new_enb_association->enb_id) { + if (ht_enb_association->enb_id() == new_enb_association->enb_id()) { *resultP = elementP; return true; } @@ -401,25 +407,28 @@ bool get_stale_enb_connection_with_enb_id(__attribute__((unused)) } void clean_stale_enb_state(s1ap_state_t* state, - enb_description_t* new_enb_association) { - enb_description_t* stale_enb_association = NULL; + oai::EnbDescription* new_enb_association) { + oai::EnbDescription* stale_enb_association = nullptr; state->enbs.map_apply_callback_on_all_elements( get_stale_enb_connection_with_enb_id, reinterpret_cast(new_enb_association), (void**)&stale_enb_association); - if (stale_enb_association == NULL) { + if (stale_enb_association == nullptr) { // No stale eNB connection found; return; } OAILOG_INFO(LOG_S1AP, "Found stale eNB at association id %d", - stale_enb_association->sctp_assoc_id); + stale_enb_association->sctp_assoc_id()); + + magma::proto_map_uint32_uint64_t ue_id_coll; + ue_id_coll.map = stale_enb_association->mutable_ue_id_map(); // Remove the S1 context for UEs associated with old eNB association - if (stale_enb_association->ue_id_coll.size()) { - ue_description_t* ue_ref = NULL; - for (auto itr_map = stale_enb_association->ue_id_coll.map->begin(); - itr_map != stale_enb_association->ue_id_coll.map->end(); ++itr_map) { + if (ue_id_coll.size()) { + oai::UeDescription* ue_ref = nullptr; + for (auto itr_map = ue_id_coll.map->begin(); + itr_map != ue_id_coll.map->end(); ++itr_map) { ue_ref = s1ap_state_get_ue_mmeid((mme_ue_s1ap_id_t)itr_map->first); /* The function s1ap_remove_ue will take care of removing the enb also, * when the last UE is removed @@ -429,8 +438,8 @@ void clean_stale_enb_state(s1ap_state_t* state, } else { // Remove the old eNB association OAILOG_INFO(LOG_S1AP, "Deleting eNB: %s (Sctp_assoc_id = %u)", - stale_enb_association->enb_name, - stale_enb_association->sctp_assoc_id); + stale_enb_association->enb_name().c_str(), + stale_enb_association->sctp_assoc_id()); s1ap_remove_enb(state, stale_enb_association); } @@ -451,8 +460,8 @@ static status_code_e s1ap_clear_ue_ctxt_for_unknown_mme_ue_s1ap_id( for (auto itr = s1ap_ue_state->map->begin(); itr != s1ap_ue_state->map->end(); itr++) { - if ((itr->second) && (sctp_assoc_id == itr->second->sctp_assoc_id)) { - s1ap_remove_ue(state, reinterpret_cast(itr->second)); + if ((itr->second) && (sctp_assoc_id == itr->second->sctp_assoc_id())) { + s1ap_remove_ue(state, reinterpret_cast(itr->second)); } } OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); @@ -470,7 +479,7 @@ status_code_e s1ap_mme_handle_s1_setup_request(s1ap_state_t* state, S1ap_S1SetupRequestIEs_t* ie_supported_tas = NULL; S1ap_S1SetupRequestIEs_t* ie_default_paging_drx = NULL; - enb_description_t* enb_association = NULL; + oai::EnbDescription* enb_association = nullptr; uint32_t enb_id = 0; char* enb_name = NULL; int ta_ret = 0; @@ -528,7 +537,7 @@ status_code_e s1ap_mme_handle_s1_setup_request(s1ap_state_t* state, * this message when the s1 interface of the MME is in RESETTING stage then we * return S1ap_TimeToWait_v20s. */ - if ((enb_association = s1ap_state_get_enb(state, assoc_id)) == NULL) { + if ((enb_association = s1ap_state_get_enb(state, assoc_id)) == nullptr) { /* * * This should not happen as the thread processing new associations is the @@ -539,14 +548,16 @@ status_code_e s1ap_mme_handle_s1_setup_request(s1ap_state_t* state, OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } - if (enb_association->s1_state == S1AP_RESETING || - enb_association->s1_state == S1AP_SHUTDOWN) { + magma::proto_map_uint32_uint64_t ue_id_coll; + ue_id_coll.map = enb_association->mutable_ue_id_map(); + if (enb_association->s1_enb_state() == oai::S1AP_RESETING || + enb_association->s1_enb_state() == oai::S1AP_SHUTDOWN) { OAILOG_WARNING(LOG_S1AP, "Ignoring s1setup from eNB in state %s on assoc id %u", - s1_enb_state2str(enb_association->s1_state), assoc_id); - OAILOG_DEBUG( - LOG_S1AP, "Num UEs associated %u num elements in ue_id_coll %zu", - enb_association->nb_ue_associated, enb_association->ue_id_coll.size()); + s1_enb_state2str(enb_association->s1_enb_state()), assoc_id); + OAILOG_DEBUG(LOG_S1AP, + "Num UEs associated %u num elements in ue_id_coll %zu", + enb_association->nb_ue_associated(), ue_id_coll.size()); rc = s1ap_mme_generate_s1_setup_failure( assoc_id, S1ap_Cause_PR_transport, S1ap_CauseTransport_transport_resource_unavailable, @@ -559,17 +570,17 @@ status_code_e s1ap_mme_handle_s1_setup_request(s1ap_state_t* state, * s1ap task shall clear this UE state if mme_app task has not yet provided * mme_ue_s1ap_id */ - if (enb_association->ue_id_coll.size() == 0) { + if (ue_id_coll.size() == 0) { OAILOG_FUNC_RETURN(LOG_S1AP, s1ap_clear_ue_ctxt_for_unknown_mme_ue_s1ap_id( - state, enb_association->sctp_assoc_id)); + state, enb_association->sctp_assoc_id())); } arg_s1ap_send_enb_dereg_ind_t arg = {0}; MessageDef* message_p = NULL; - arg.associated_enb_id = enb_association->enb_id; - arg.deregister_ue_count = enb_association->ue_id_coll.size(); - enb_association->ue_id_coll.map_apply_callback_on_all_elements( + arg.associated_enb_id = enb_association->enb_id(); + arg.deregister_ue_count = ue_id_coll.size(); + ue_id_coll.map_apply_callback_on_all_elements( s1ap_send_enb_deregistered_ind, reinterpret_cast(&arg), reinterpret_cast(&message_p)); @@ -651,47 +662,51 @@ status_code_e s1ap_mme_handle_s1_setup_request(s1ap_state_t* state, } S1ap_SupportedTAs_t* ta_list = &ie_supported_tas->value.choice.SupportedTAs; - supported_ta_list_t* supp_ta_list = &enb_association->supported_ta_list; - supp_ta_list->list_count = ta_list->list.count; + oai::SupportedTaList* supported_ta_list_proto = + enb_association->mutable_supported_ta_list(); + supported_ta_list_proto->set_list_count(ta_list->list.count); /* Storing supported TAI lists received in S1 SETUP REQUEST message */ - for (int tai_idx = 0; tai_idx < supp_ta_list->list_count; tai_idx++) { + for (int tai_idx = 0; tai_idx < supported_ta_list_proto->list_count(); + tai_idx++) { S1ap_SupportedTAs_Item_t* tai = NULL; + uint32_t tac; + oai::SupportedTaiItems* supported_tai_item = + supported_ta_list_proto->add_supported_tai_items(); tai = ta_list->list.array[tai_idx]; - OCTET_STRING_TO_TAC(&tai->tAC, - supp_ta_list->supported_tai_items[tai_idx].tac); - + OCTET_STRING_TO_TAC(&tai->tAC, tac); + supported_tai_item->set_tac(tac); bplmn_list_count = tai->broadcastPLMNs.list.count; if (bplmn_list_count > S1AP_MAX_BROADCAST_PLMNS) { OAILOG_ERROR(LOG_S1AP, "Maximum Broadcast PLMN list count exceeded, count = %d\n", bplmn_list_count); } - supp_ta_list->supported_tai_items[tai_idx].bplmnlist_count = - bplmn_list_count; + supported_tai_item->set_bplmnlist_count(bplmn_list_count); for (int plmn_idx = 0; plmn_idx < bplmn_list_count; plmn_idx++) { - TBCD_TO_PLMN_T( - tai->broadcastPLMNs.list.array[plmn_idx], - &supp_ta_list->supported_tai_items[tai_idx].bplmns[plmn_idx]); + char plmn_array[PLMN_BYTES] = {0}; + plmn_t plmn = {}; + TBCD_TO_PLMN_T(tai->broadcastPLMNs.list.array[plmn_idx], &plmn); + COPY_PLMN_IN_CHAR_ARRAY_FMT(plmn_array, plmn); + supported_tai_item->add_bplmns(plmn_array); } } OAILOG_DEBUG(LOG_S1AP, "Adding eNB with enb_id :%d to the list of served eNBs \n", enb_id); - enb_association->enb_id = enb_id; + enb_association->set_enb_id(enb_id); S1AP_FIND_PROTOCOLIE_BY_ID(S1ap_S1SetupRequestIEs_t, ie_default_paging_drx, container, S1ap_ProtocolIE_ID_id_DefaultPagingDRX, true); - enb_association->default_paging_drx = - ie_default_paging_drx->value.choice.PagingDRX; + enb_association->set_default_paging_drx( + ie_default_paging_drx->value.choice.PagingDRX); if (enb_name != NULL) { - memcpy(enb_association->enb_name, ie_enb_name->value.choice.ENBname.buf, - ie_enb_name->value.choice.ENBname.size); - enb_association->enb_name[ie_enb_name->value.choice.ENBname.size] = '\0'; + enb_association->set_enb_name(ie_enb_name->value.choice.ENBname.buf, + ie_enb_name->value.choice.ENBname.size); } // Clean any stale eNB association (from Redis) for this enb_id @@ -700,7 +715,7 @@ status_code_e s1ap_mme_handle_s1_setup_request(s1ap_state_t* state, rc = s1ap_generate_s1_setup_response(state, enb_association); if (rc == RETURNok) { state->num_enbs++; - set_gauge("s1_connection", 1, 1, "enb_name", enb_association->enb_name); + set_gauge("s1_connection", 1, 1, "enb_name", enb_association->enb_name()); increment_counter("s1_setup", 1, 1, "result", "success"); s1_setup_success_event(enb_name, enb_id); } @@ -709,7 +724,7 @@ status_code_e s1ap_mme_handle_s1_setup_request(s1ap_state_t* state, //------------------------------------------------------------------------------ status_code_e s1ap_generate_s1_setup_response( - s1ap_state_t* state, enb_description_t* enb_association) { + s1ap_state_t* state, oai::EnbDescription* enb_association) { S1ap_S1AP_PDU_t pdu = {S1ap_S1AP_PDU_PR_NOTHING, {0}}; S1ap_S1SetupResponse_t* out; S1ap_S1SetupResponseIEs_t* ie = NULL; @@ -721,8 +736,8 @@ status_code_e s1ap_generate_s1_setup_response( status_code_e rc = RETURNok; OAILOG_FUNC_IN(LOG_S1AP); - if (enb_association == NULL) { - OAILOG_ERROR(LOG_S1AP, "enb_association is NULL\n"); + if (enb_association == nullptr) { + OAILOG_ERROR(LOG_S1AP, "enb_association is nullptr\n"); return RETURNerror; } memset(&pdu, 0, sizeof(pdu)); @@ -804,13 +819,14 @@ status_code_e s1ap_generate_s1_setup_response( * Failed to encode s1 setup response... */ if (enc_rval < 0) { - OAILOG_DEBUG(LOG_S1AP, "Removed eNB %d\n", enb_association->sctp_assoc_id); + OAILOG_DEBUG(LOG_S1AP, "Removed eNB %d\n", + enb_association->sctp_assoc_id()); s1ap_remove_enb(state, enb_association); } else { /* * Consider the response as sent. S1AP is ready to accept UE contexts */ - enb_association->s1_state = S1AP_READY; + enb_association->set_s1_enb_state(oai::S1AP_READY); } /* @@ -818,7 +834,7 @@ status_code_e s1ap_generate_s1_setup_response( */ bstring b = blk2bstr(buffer, length); free(buffer); - rc = s1ap_mme_itti_send_sctp_request(&b, enb_association->sctp_assoc_id, 0, + rc = s1ap_mme_itti_send_sctp_request(&b, enb_association->sctp_assoc_id(), 0, INVALID_MME_UE_S1AP_ID); OAILOG_FUNC_RETURN(LOG_S1AP, rc); @@ -830,7 +846,7 @@ status_code_e s1ap_mme_handle_ue_cap_indication(s1ap_state_t* state, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, S1ap_S1AP_PDU_t* pdu) { - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; S1ap_UECapabilityInfoIndication_t* container; S1ap_UECapabilityInfoIndicationIEs_t* ie = NULL; status_code_e rc = RETURNok; @@ -853,7 +869,7 @@ status_code_e s1ap_mme_handle_ue_cap_indication(s1ap_state_t* state, if (ie) { mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; - if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { OAILOG_DEBUG( LOG_S1AP, "No UE is attached to this mme UE s1ap id: " MME_UE_S1AP_ID_FMT "\n", @@ -878,26 +894,26 @@ status_code_e s1ap_mme_handle_ue_cap_indication(s1ap_state_t* state, OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if (ue_ref_p->enb_ue_s1ap_id != enb_ue_s1ap_id) { + if (ue_ref_p->enb_ue_s1ap_id() != enb_ue_s1ap_id) { OAILOG_DEBUG_UE(LOG_S1AP, imsi64, "Mismatch in eNB UE S1AP ID, known: " ENB_UE_S1AP_ID_FMT ", received: " ENB_UE_S1AP_ID_FMT "\n", - ue_ref_p->enb_ue_s1ap_id, (uint32_t)enb_ue_s1ap_id); + ue_ref_p->enb_ue_s1ap_id(), (uint32_t)enb_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } /* * Just display a warning when message received over wrong stream */ - if (ue_ref_p->sctp_stream_recv != stream) { + if (ue_ref_p->sctp_stream_recv() != stream) { OAILOG_ERROR_UE(LOG_S1AP, imsi64, "Received ue capability indication for " "(MME UE S1AP ID/eNB UE S1AP ID) (" MME_UE_S1AP_ID_FMT "/" ENB_UE_S1AP_ID_FMT ") over wrong stream " "expecting %u, received on %u\n", - (uint32_t)mme_ue_s1ap_id, ue_ref_p->enb_ue_s1ap_id, - ue_ref_p->sctp_stream_recv, stream); + (uint32_t)mme_ue_s1ap_id, ue_ref_p->enb_ue_s1ap_id(), + ue_ref_p->sctp_stream_recv(), stream); } /* @@ -918,8 +934,8 @@ status_code_e s1ap_mme_handle_ue_cap_indication(s1ap_state_t* state, return RETURNerror; } ue_cap_ind_p = &message_p->ittiMsg.s1ap_ue_cap_ind; - ue_cap_ind_p->enb_ue_s1ap_id = ue_ref_p->enb_ue_s1ap_id; - ue_cap_ind_p->mme_ue_s1ap_id = ue_ref_p->mme_ue_s1ap_id; + ue_cap_ind_p->enb_ue_s1ap_id = ue_ref_p->enb_ue_s1ap_id(); + ue_cap_ind_p->mme_ue_s1ap_id = ue_ref_p->mme_ue_s1ap_id(); ue_cap_ind_p->radio_capabilities_length = ie->value.choice.UERadioCapability.size; ue_cap_ind_p->radio_capabilities = reinterpret_cast( @@ -950,7 +966,7 @@ status_code_e s1ap_mme_handle_initial_context_setup_response( S1ap_InitialContextSetupResponse_t* container; S1ap_InitialContextSetupResponseIEs_t* ie = NULL; S1ap_E_RABSetupItemCtxtSUResIEs_t* eRABSetupItemCtxtSURes_p = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; MessageDef* message_p = NULL; status_code_e rc = RETURNok; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; @@ -967,7 +983,7 @@ status_code_e s1ap_mme_handle_initial_context_setup_response( if (ie) { mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; if ((ue_ref_p = s1ap_state_get_ue_mmeid((uint32_t)mme_ue_s1ap_id)) == - NULL) { + nullptr) { OAILOG_DEBUG( LOG_S1AP, "No UE is attached to this mme UE s1ap id: " MME_UE_S1AP_ID_FMT @@ -991,11 +1007,11 @@ status_code_e s1ap_mme_handle_initial_context_setup_response( OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if (ue_ref_p->enb_ue_s1ap_id != enb_ue_s1ap_id) { + if (ue_ref_p->enb_ue_s1ap_id() != enb_ue_s1ap_id) { OAILOG_DEBUG_UE(LOG_S1AP, imsi64, "Mismatch in eNB UE S1AP ID, known: " ENB_UE_S1AP_ID_FMT " %u(10), received: 0x%06x %u(10)\n", - ue_ref_p->enb_ue_s1ap_id, ue_ref_p->enb_ue_s1ap_id, + ue_ref_p->enb_ue_s1ap_id(), ue_ref_p->enb_ue_s1ap_id(), (uint32_t)enb_ue_s1ap_id, (uint32_t)enb_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } @@ -1012,10 +1028,11 @@ status_code_e s1ap_mme_handle_initial_context_setup_response( } else { OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - ue_ref_p->s1_ue_state = S1AP_UE_CONNECTED; + ue_ref_p->set_s1ap_ue_state(oai::S1AP_UE_CONNECTED); message_p = DEPRECATEDitti_alloc_new_message_fatal( TASK_S1AP, MME_APP_INITIAL_CONTEXT_SETUP_RSP); - MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).ue_id = ue_ref_p->mme_ue_s1ap_id; + MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).ue_id = + ue_ref_p->mme_ue_s1ap_id(); MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).e_rab_setup_list.no_of_items = ie->value.choice.E_RABSetupListCtxtSURes.list.count; for (int item = 0; item < ie->value.choice.E_RABSetupListCtxtSURes.list.count; @@ -1044,20 +1061,21 @@ status_code_e s1ap_mme_handle_initial_context_setup_response( // information. This feature can be safely used only when NAT uses the same // public IP address for both the CP and UP communication to/from the eNB, // which typically is the situation. - enb_description_t* enb_association = s1ap_state_get_enb(state, assoc_id); + oai::EnbDescription* enb_association = s1ap_state_get_enb(state, assoc_id); if (mme_config.enable_gtpu_private_ip_correction) { OAILOG_INFO(LOG_S1AP, "Overwriting eNB GTP-U IP ADDRESS with SCTP eNB IP address"); MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p) .e_rab_setup_list.item[item] - .transport_layer_address = blk2bstr( - enb_association->ran_cp_ipaddr, enb_association->ran_cp_ipaddr_sz); + .transport_layer_address = + blk2bstr(enb_association->ran_cp_ipaddr().c_str(), + enb_association->ran_cp_ipaddr_sz()); } else { // Print a warning message if CP and UP plane eNB IPs are different - if (memcmp(enb_association->ran_cp_ipaddr, + if (memcmp(enb_association->ran_cp_ipaddr().c_str(), eRABSetupItemCtxtSURes_p->value.choice.E_RABSetupItemCtxtSURes .transportLayerAddress.buf, - enb_association->ran_cp_ipaddr_sz)) { + enb_association->ran_cp_ipaddr_sz())) { OAILOG_WARNING( LOG_S1AP, "GTP-U eNB IP addr is different than SCTP eNB IP addr. " @@ -1106,8 +1124,8 @@ status_code_e s1ap_mme_handle_ue_context_release_request( S1ap_S1AP_PDU_t* pdu) { S1ap_UEContextReleaseRequest_t* container; S1ap_UEContextReleaseRequest_IEs_t* ie = NULL; - ue_description_t* ue_ref_p = NULL; - enb_description_t* enb_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; + oai::EnbDescription* enb_ref_p = nullptr; S1ap_Cause_PR cause_type; long cause_value; enum s1cause s1_release_cause = S1AP_RADIO_EUTRAN_GENERATED_REASON; @@ -1227,7 +1245,7 @@ status_code_e s1ap_mme_handle_ue_context_release_request( don't care scenario till we add support for dedicated bearers. */ - if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { /* * MME doesn't know the MME UE S1AP ID provided. * No need to do anything. Ignore the message @@ -1242,8 +1260,8 @@ status_code_e s1ap_mme_handle_ue_context_release_request( } else { s1ap_imsi_map_t* imsi_map = get_s1ap_imsi_map(); imsi_map->mme_ueid2imsi_map.get(mme_ue_s1ap_id, &imsi64); - if (ue_ref_p->sctp_assoc_id == assoc_id && - ue_ref_p->enb_ue_s1ap_id == enb_ue_s1ap_id) { + if (ue_ref_p->sctp_assoc_id() == assoc_id && + ue_ref_p->enb_ue_s1ap_id() == enb_ue_s1ap_id) { /* * Both eNB UE S1AP ID and MME UE S1AP ID match. * Send a UE context Release Command to eNB after releasing S1-U bearer @@ -1253,9 +1271,9 @@ status_code_e s1ap_mme_handle_ue_context_release_request( ie->value.choice.Cause, imsi64); OAILOG_FUNC_RETURN(LOG_S1AP, rc); - } else if (enb_ref_p->enb_id == - ue_ref_p->s1ap_handover_state.source_enb_id && - ue_ref_p->s1ap_handover_state.source_enb_ue_s1ap_id == + } else if (enb_ref_p->enb_id() == + ue_ref_p->s1ap_handover_state().source_enb_id() && + ue_ref_p->s1ap_handover_state().source_enb_ue_s1ap_id() == enb_ue_s1ap_id) { /* * We just handed over from this eNB. @@ -1263,8 +1281,8 @@ status_code_e s1ap_mme_handle_ue_context_release_request( */ rc = s1ap_mme_generate_ue_context_release_command( state, ue_ref_p, S1AP_RADIO_EUTRAN_GENERATED_REASON, imsi64, assoc_id, - ue_ref_p->s1ap_handover_state.source_sctp_stream_send, mme_ue_s1ap_id, - enb_ue_s1ap_id); + ue_ref_p->s1ap_handover_state().source_sctp_stream_send(), + mme_ue_s1ap_id, enb_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, rc); } else { // abnormal case. No need to do anything. Ignore the message @@ -1272,7 +1290,7 @@ status_code_e s1ap_mme_handle_ue_context_release_request( LOG_S1AP, imsi64, "UE_CONTEXT_RELEASE_REQUEST ignored, cause mismatch enb_ue_s1ap_id: " "ctxt " ENB_UE_S1AP_ID_FMT " != request " ENB_UE_S1AP_ID_FMT " ", - (uint32_t)ue_ref_p->enb_ue_s1ap_id, (uint32_t)enb_ue_s1ap_id); + (uint32_t)ue_ref_p->enb_ue_s1ap_id(), (uint32_t)enb_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } } @@ -1281,7 +1299,7 @@ status_code_e s1ap_mme_handle_ue_context_release_request( //------------------------------------------------------------------------------ status_code_e s1ap_mme_generate_ue_context_release_command( - s1ap_state_t* state, ue_description_t* ue_ref_p, enum s1cause cause, + s1ap_state_t* state, oai::UeDescription* ue_ref_p, enum s1cause cause, imsi64_t imsi64, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, mme_ue_s1ap_id_t mme_ue_s1ap_id, enb_ue_s1ap_id_t enb_ue_s1ap_id) { @@ -1397,15 +1415,15 @@ status_code_e s1ap_mme_generate_ue_context_release_command( } // If cause is S1AP_INVALID_MME_UE_S1AP_ID, then it indicates that s1ap doen't // have valid UE context - if (cause == S1AP_INVALID_MME_UE_S1AP_ID && ue_ref_p == NULL) { + if (cause == S1AP_INVALID_MME_UE_S1AP_ID && ue_ref_p == nullptr) { OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } if (rc == RETURNok) { // Start timer to track UE context release complete from eNB - ue_ref_p->s1_ue_state = S1AP_UE_WAITING_CRR; - ue_ref_p->s1ap_ue_context_rel_timer.id = s1ap_start_timer( - ue_ref_p->s1ap_ue_context_rel_timer.msec, TIMER_REPEAT_ONCE, - handle_ue_context_rel_timer_expiry, mme_ue_s1ap_id); + ue_ref_p->set_s1ap_ue_state(oai::S1AP_UE_WAITING_CRC); + ue_ref_p->mutable_s1ap_ue_context_rel_timer()->set_id(s1ap_start_timer( + ue_ref_p->s1ap_ue_context_rel_timer().msec(), TIMER_REPEAT_ONCE, + handle_ue_context_rel_timer_expiry, mme_ue_s1ap_id)); } else { // Remove UE context and inform MME_APP. s1ap_mme_release_ue_context(state, ue_ref_p, imsi64); @@ -1417,7 +1435,7 @@ status_code_e s1ap_mme_generate_ue_context_release_command( //------------------------------------------------------------------------------ status_code_e s1ap_mme_generate_ue_context_modification( - ue_description_t* ue_ref_p, + oai::UeDescription* ue_ref_p, const itti_s1ap_ue_context_mod_req_t* const ue_context_mod_req_pP, imsi64_t imsi64) { uint8_t* buffer = NULL; @@ -1428,7 +1446,7 @@ status_code_e s1ap_mme_generate_ue_context_modification( status_code_e rc = RETURNok; OAILOG_FUNC_IN(LOG_S1AP); - if (ue_ref_p == NULL) { + if (ue_ref_p == nullptr) { OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } pdu.present = S1ap_S1AP_PDU_PR_initiatingMessage; @@ -1449,7 +1467,7 @@ status_code_e s1ap_mme_generate_ue_context_modification( ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_UEContextModificationRequestIEs__value_PR_MME_UE_S1AP_ID; - ie->value.choice.MME_UE_S1AP_ID = ue_ref_p->mme_ue_s1ap_id; + ie->value.choice.MME_UE_S1AP_ID = ue_ref_p->mme_ue_s1ap_id(); ASN_SEQUENCE_ADD(&container->protocolIEs.list, ie); ie = (S1ap_UEContextModificationRequestIEs_t*)calloc( @@ -1458,7 +1476,7 @@ status_code_e s1ap_mme_generate_ue_context_modification( ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_UEContextModificationRequestIEs__value_PR_ENB_UE_S1AP_ID; - ie->value.choice.ENB_UE_S1AP_ID = ue_ref_p->enb_ue_s1ap_id; + ie->value.choice.ENB_UE_S1AP_ID = ue_ref_p->enb_ue_s1ap_id(); ASN_SEQUENCE_ADD(&container->protocolIEs.list, ie); if ((ue_context_mod_req_pP->presencemask & S1AP_UE_CONTEXT_MOD_LAI_PRESENT) == @@ -1532,9 +1550,9 @@ status_code_e s1ap_mme_generate_ue_context_modification( bstring b = blk2bstr(buffer, length); free(buffer); - rc = s1ap_mme_itti_send_sctp_request(&b, ue_ref_p->sctp_assoc_id, - ue_ref_p->sctp_stream_send, - ue_ref_p->mme_ue_s1ap_id); + rc = s1ap_mme_itti_send_sctp_request(&b, ue_ref_p->sctp_assoc_id(), + ue_ref_p->sctp_stream_send(), + ue_ref_p->mme_ue_s1ap_id()); OAILOG_FUNC_RETURN(LOG_S1AP, rc); } @@ -1545,12 +1563,12 @@ status_code_e s1ap_handle_ue_context_release_command( const itti_s1ap_ue_context_release_command_t* const ue_context_release_command_pP, imsi64_t imsi64) { - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; status_code_e rc = RETURNok; OAILOG_FUNC_IN(LOG_S1AP); if ((ue_ref_p = s1ap_state_get_ue_mmeid( - ue_context_release_command_pP->mme_ue_s1ap_id)) == NULL) { + ue_context_release_command_pP->mme_ue_s1ap_id)) == nullptr) { OAILOG_DEBUG_UE(LOG_S1AP, imsi64, "Ignoring UE with mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT " enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT "\n", @@ -1569,8 +1587,8 @@ status_code_e s1ap_handle_ue_context_release_command( } else { rc = s1ap_mme_generate_ue_context_release_command( state, ue_ref_p, ue_context_release_command_pP->cause, imsi64, - ue_ref_p->sctp_assoc_id, ue_ref_p->sctp_stream_send, - ue_ref_p->mme_ue_s1ap_id, ue_ref_p->enb_ue_s1ap_id); + ue_ref_p->sctp_assoc_id(), ue_ref_p->sctp_stream_send(), + ue_ref_p->mme_ue_s1ap_id(), ue_ref_p->enb_ue_s1ap_id()); } } @@ -1584,7 +1602,7 @@ status_code_e s1ap_handle_ue_context_mod_req( s1ap_state_t* state, const itti_s1ap_ue_context_mod_req_t* const ue_context_mod_req_pP, imsi64_t imsi64) { - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; status_code_e rc = RETURNok; OAILOG_FUNC_IN(LOG_S1AP); @@ -1593,7 +1611,7 @@ status_code_e s1ap_handle_ue_context_mod_req( return RETURNerror; } if ((ue_ref_p = s1ap_state_get_ue_mmeid( - ue_context_mod_req_pP->mme_ue_s1ap_id)) == NULL) { + ue_context_mod_req_pP->mme_ue_s1ap_id)) == nullptr) { OAILOG_DEBUG_UE(LOG_S1AP, imsi64, "Ignoring UE with mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT " %u(10)\n", @@ -1615,7 +1633,7 @@ status_code_e s1ap_mme_handle_ue_context_release_complete( S1ap_S1AP_PDU_t* pdu) { S1ap_UEContextReleaseComplete_t* container; S1ap_UEContextReleaseComplete_IEs_t* ie = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; mme_ue_s1ap_id_t mme_ue_s1ap_id = 0; OAILOG_FUNC_IN(LOG_S1AP); @@ -1631,7 +1649,7 @@ status_code_e s1ap_mme_handle_ue_context_release_complete( OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } - if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { OAILOG_DEBUG( LOG_S1AP, " UE Context Release commplete: S1 context cleared. Ignore message for " @@ -1639,7 +1657,7 @@ status_code_e s1ap_mme_handle_ue_context_release_complete( (uint32_t)mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } else { - if (ue_ref_p->sctp_assoc_id == assoc_id) { + if (ue_ref_p->sctp_assoc_id() == assoc_id) { OAILOG_INFO(LOG_S1AP, "UE Context Release complete: clearing S1 context for " "ueid " MME_UE_S1AP_ID_FMT "\n", @@ -1649,7 +1667,7 @@ status_code_e s1ap_mme_handle_ue_context_release_complete( s1ap_imsi_map_t* imsi_map = get_s1ap_imsi_map(); imsi_map->mme_ueid2imsi_map.get(mme_ue_s1ap_id, &imsi64); - ue_ref_p->s1_ue_state = S1AP_UE_WAITING_CRR; + ue_ref_p->set_s1ap_ue_state(oai::S1AP_UE_WAITING_CRC); // We can safely remove UE context now and stop timer s1ap_mme_release_ue_context(state, ue_ref_p, imsi64); @@ -1676,7 +1694,7 @@ status_code_e s1ap_mme_handle_initial_context_setup_failure( S1ap_S1AP_PDU_t* pdu) { S1ap_InitialContextSetupFailure_t* container; S1ap_InitialContextSetupFailureIEs_t* ie = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; MessageDef* message_p = NULL; S1ap_Cause_PR cause_type; long cause_value; @@ -1707,7 +1725,7 @@ status_code_e s1ap_mme_handle_initial_context_setup_failure( enb_ue_s1ap_id = (enb_ue_s1ap_id_t)(ie->value.choice.ENB_UE_S1AP_ID & ENB_UE_S1AP_ID_MASK); - if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { /* * MME doesn't know the MME UE S1AP ID provided. */ @@ -1719,13 +1737,13 @@ status_code_e s1ap_mme_handle_initial_context_setup_failure( OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if (ue_ref_p->enb_ue_s1ap_id != enb_ue_s1ap_id) { + if (ue_ref_p->enb_ue_s1ap_id() != enb_ue_s1ap_id) { // abnormal case. No need to do anything. Ignore the message OAILOG_DEBUG( LOG_S1AP, "INITIAL_CONTEXT_SETUP_FAILURE ignored, mismatch enb_ue_s1ap_id: " "ctxt " ENB_UE_S1AP_ID_FMT " != received " ENB_UE_S1AP_ID_FMT " ", - (uint32_t)ue_ref_p->enb_ue_s1ap_id, (uint32_t)enb_ue_s1ap_id); + (uint32_t)ue_ref_p->enb_ue_s1ap_id(), (uint32_t)enb_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } @@ -1802,7 +1820,7 @@ status_code_e s1ap_mme_handle_initial_context_setup_failure( memset((void*)&message_p->ittiMsg.mme_app_initial_context_setup_failure, 0, sizeof(itti_mme_app_initial_context_setup_failure_t)); MME_APP_INITIAL_CONTEXT_SETUP_FAILURE(message_p).mme_ue_s1ap_id = - ue_ref_p->mme_ue_s1ap_id; + ue_ref_p->mme_ue_s1ap_id(); message_p->ittiMsgHeader.imsi = imsi64; rc = send_msg_to_task(&s1ap_task_zmq_ctx, TASK_MME_APP, message_p); @@ -1815,7 +1833,7 @@ status_code_e s1ap_mme_handle_ue_context_modification_response( S1ap_S1AP_PDU_t* pdu) { S1ap_UEContextModificationResponseIEs_t *ie, *ie_enb = NULL; S1ap_UEContextModificationResponse_t* container = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; MessageDef* message_p = NULL; status_code_e rc = RETURNok; imsi64_t imsi64 = INVALID_IMSI64; @@ -1840,7 +1858,7 @@ status_code_e s1ap_mme_handle_ue_context_modification_response( return RETURNerror; } if ((ie) && (ue_ref_p = s1ap_state_get_ue_mmeid( - ie->value.choice.MME_UE_S1AP_ID)) == NULL) { + ie->value.choice.MME_UE_S1AP_ID)) == nullptr) { /* * MME doesn't know the MME UE S1AP ID provided. * No need to do anything. Ignore the message @@ -1855,7 +1873,7 @@ status_code_e s1ap_mme_handle_ue_context_modification_response( OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } else { if ((ie_enb) && - (ue_ref_p->enb_ue_s1ap_id == + (ue_ref_p->enb_ue_s1ap_id() == (ie_enb->value.choice.ENB_UE_S1AP_ID & ENB_UE_S1AP_ID_MASK))) { /* * Both eNB UE S1AP ID and MME UE S1AP ID match. @@ -1871,9 +1889,9 @@ status_code_e s1ap_mme_handle_ue_context_modification_response( memset((void*)&message_p->ittiMsg.s1ap_ue_context_mod_response, 0, sizeof(itti_s1ap_ue_context_mod_resp_t)); S1AP_UE_CONTEXT_MODIFICATION_RESPONSE(message_p).mme_ue_s1ap_id = - ue_ref_p->mme_ue_s1ap_id; + ue_ref_p->mme_ue_s1ap_id(); S1AP_UE_CONTEXT_MODIFICATION_RESPONSE(message_p).enb_ue_s1ap_id = - ue_ref_p->enb_ue_s1ap_id; + ue_ref_p->enb_ue_s1ap_id(); message_p->ittiMsgHeader.imsi = imsi64; rc = send_msg_to_task(&s1ap_task_zmq_ctx, TASK_MME_APP, message_p); @@ -1885,7 +1903,7 @@ status_code_e s1ap_mme_handle_ue_context_modification_response( "S1AP_UE_CONTEXT_MODIFICATION_RESPONSE ignored, cause mismatch " "enb_ue_s1ap_id: ctxt" ENB_UE_S1AP_ID_FMT " != request " ENB_UE_S1AP_ID_FMT " ", - (uint32_t)ue_ref_p->enb_ue_s1ap_id, + (uint32_t)ue_ref_p->enb_ue_s1ap_id(), (uint32_t)ie_enb->value.choice.ENB_UE_S1AP_ID); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } @@ -1900,7 +1918,7 @@ status_code_e s1ap_mme_handle_ue_context_modification_failure( S1ap_S1AP_PDU_t* pdu) { S1ap_UEContextModificationFailureIEs_t *ie, *ie_enb = NULL; S1ap_UEContextModificationFailure_t* container = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; MessageDef* message_p = NULL; status_code_e rc = RETURNok; S1ap_Cause_PR cause_type = {S1ap_Cause_PR_NOTHING}; @@ -1928,7 +1946,7 @@ status_code_e s1ap_mme_handle_ue_context_modification_failure( } if ((ie) && (ue_ref_p = s1ap_state_get_ue_mmeid( - ie->value.choice.MME_UE_S1AP_ID)) == NULL) { + ie->value.choice.MME_UE_S1AP_ID)) == nullptr) { /* * MME doesn't know the MME UE S1AP ID provided. * No need to do anything. Ignore the message @@ -1943,7 +1961,7 @@ status_code_e s1ap_mme_handle_ue_context_modification_failure( OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } else { if ((ie_enb) && - (ue_ref_p->enb_ue_s1ap_id == + (ue_ref_p->enb_ue_s1ap_id() == (ie_enb->value.choice.ENB_UE_S1AP_ID & ENB_UE_S1AP_ID_MASK))) { s1ap_imsi_map_t* imsi_map = get_s1ap_imsi_map(); imsi_map->mme_ueid2imsi_map.get(ie->value.choice.MME_UE_S1AP_ID, &imsi64); @@ -2016,9 +2034,9 @@ status_code_e s1ap_mme_handle_ue_context_modification_failure( memset((void*)&message_p->ittiMsg.s1ap_ue_context_mod_response, 0, sizeof(itti_s1ap_ue_context_mod_resp_fail_t)); S1AP_UE_CONTEXT_MODIFICATION_FAILURE(message_p).mme_ue_s1ap_id = - ue_ref_p->mme_ue_s1ap_id; + ue_ref_p->mme_ue_s1ap_id(); S1AP_UE_CONTEXT_MODIFICATION_FAILURE(message_p).enb_ue_s1ap_id = - ue_ref_p->enb_ue_s1ap_id; + ue_ref_p->enb_ue_s1ap_id(); S1AP_UE_CONTEXT_MODIFICATION_FAILURE(message_p).cause = cause_value; message_p->ittiMsgHeader.imsi = imsi64; @@ -2031,7 +2049,7 @@ status_code_e s1ap_mme_handle_ue_context_modification_failure( "S1AP_UE_CONTEXT_MODIFICATION_FAILURE ignored, cause mismatch " "enb_ue_s1ap_id: ctxt " ENB_UE_S1AP_ID_FMT " != request " ENB_UE_S1AP_ID_FMT " ", - (uint32_t)ue_ref_p->enb_ue_s1ap_id, + (uint32_t)ue_ref_p->enb_ue_s1ap_id(), (uint32_t)ie_enb->value.choice.ENB_UE_S1AP_ID); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } @@ -2051,10 +2069,9 @@ status_code_e s1ap_mme_handle_handover_request_ack( S1ap_S1AP_PDU_t* pdu) { S1ap_HandoverRequestAcknowledge_t* container = NULL; S1ap_HandoverRequestAcknowledgeIEs_t* ie = NULL; - enb_description_t* source_enb = NULL; - enb_description_t* target_enb = NULL; - uint32_t idx = 0; - ue_description_t* ue_ref_p = NULL; + oai::EnbDescription* source_enb = nullptr; + oai::EnbDescription* target_enb = nullptr; + oai::UeDescription* ue_ref_p = nullptr; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; enb_ue_s1ap_id_t tgt_enb_ue_s1ap_id = INVALID_ENB_UE_S1AP_ID; S1ap_HandoverType_t handover_type = -1; @@ -2140,7 +2157,7 @@ status_code_e s1ap_mme_handle_handover_request_ack( // Retrieve the association ID for the eNB that UE is currently connected // (i.e., Source eNB) and pull the Source eNB record from s1ap state using // this association - if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { OAILOG_ERROR(LOG_S1AP, "MME_UE_S1AP_ID (" MME_UE_S1AP_ID_FMT ") does not point to any valid UE\n", @@ -2154,18 +2171,18 @@ status_code_e s1ap_mme_handle_handover_request_ack( if (!source_enb) { continue; } - if (source_enb->sctp_assoc_id == ue_ref_p->sctp_assoc_id) { + if (source_enb->sctp_assoc_id() == ue_ref_p->sctp_assoc_id()) { break; } } - if (source_enb->sctp_assoc_id != ue_ref_p->sctp_assoc_id) { + if (source_enb->sctp_assoc_id() != ue_ref_p->sctp_assoc_id()) { OAILOG_ERROR_UE(LOG_S1AP, imsi64, "No source eNB found for UE\n"); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } } OAILOG_INFO_UE(LOG_S1AP, imsi64, "Source enb is %u (association id %u)\n", - source_enb->enb_id, source_enb->sctp_assoc_id); + source_enb->enb_id(), source_enb->sctp_assoc_id()); // get the target eNB -- the one that sent this message, target of the // handover @@ -2180,13 +2197,26 @@ status_code_e s1ap_mme_handle_handover_request_ack( // if and when we receive the HANDOVER NOTIFY later in the procedure, so we // need to keep track of this. if (e_rab_list.no_of_items) { - ue_ref_p->s1ap_handover_state.e_rab_admitted_list = e_rab_list; + oai::S1apHandoverState* handover_state = + ue_ref_p->mutable_s1ap_handover_state(); + handover_state->mutable_e_rab_admitted_list()->set_no_of_items( + e_rab_list.no_of_items); + for (uint8_t idx = 0; idx < e_rab_list.no_of_items; idx++) { + oai::ERabAdmittedItem* e_rab_admitted_item = + handover_state->mutable_e_rab_admitted_list()->add_item(); + e_rab_admitted_item->set_e_rab_id(e_rab_list.item[idx].e_rab_id); + e_rab_admitted_item->set_transport_layer_address( + bdata(e_rab_list.item[idx].transport_layer_address), + blength(e_rab_list.item[idx].transport_layer_address)); + e_rab_admitted_item->set_gtp_teid(e_rab_list.item[idx].gtp_teid); + + bdestroy_wrapper(&e_rab_list.item[idx].transport_layer_address); + } } - s1ap_mme_itti_s1ap_handover_request_ack( - mme_ue_s1ap_id, ue_ref_p->enb_ue_s1ap_id, tgt_enb_ue_s1ap_id, - handover_type, source_enb->sctp_assoc_id, tgt_src_container, - source_enb->enb_id, target_enb->enb_id, imsi64); + mme_ue_s1ap_id, ue_ref_p->enb_ue_s1ap_id(), tgt_enb_ue_s1ap_id, + handover_type, source_enb->sctp_assoc_id(), tgt_src_container, + source_enb->enb_id(), target_enb->enb_id(), imsi64); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } @@ -2200,7 +2230,7 @@ status_code_e s1ap_mme_handle_handover_failure(s1ap_state_t* state, S1ap_S1AP_PDU_t out_pdu = {S1ap_S1AP_PDU_PR_NOTHING, {0}}; S1ap_HandoverPreparationFailure_t* out; S1ap_HandoverPreparationFailureIEs_t* hpf_ie = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; S1ap_Cause_PR cause_type; long cause_value; @@ -2242,7 +2272,7 @@ status_code_e s1ap_mme_handle_handover_failure(s1ap_state_t* state, // to the source eNB. // get UE context - if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { OAILOG_ERROR( LOG_S1AP, "could not get ue context for mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT @@ -2251,12 +2281,12 @@ status_code_e s1ap_mme_handle_handover_failure(s1ap_state_t* state, OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if (ue_ref_p->s1_ue_state == S1AP_UE_HANDOVER) { + if (ue_ref_p->s1ap_ue_state() == oai::S1AP_UE_HANDOVER) { // this effectively cancels the HandoverPreparation proecedure as we // only send a HandoverCommand if the UE is in the S1AP_UE_HANDOVER // state. - ue_ref_p->s1_ue_state = S1AP_UE_CONNECTED; - ue_ref_p->s1ap_handover_state = (struct s1ap_handover_state_s){0}; + ue_ref_p->set_s1ap_ue_state(oai::S1AP_UE_CONNECTED); + ue_ref_p->mutable_s1ap_handover_state()->Clear(); } else { // Not a failure, but nothing for us to do. OAILOG_INFO( @@ -2293,7 +2323,7 @@ status_code_e s1ap_mme_handle_handover_failure(s1ap_state_t* state, hpf_ie->criticality = S1ap_Criticality_ignore; hpf_ie->value.present = S1ap_HandoverPreparationFailureIEs__value_PR_ENB_UE_S1AP_ID; - hpf_ie->value.choice.ENB_UE_S1AP_ID = ue_ref_p->enb_ue_s1ap_id; + hpf_ie->value.choice.ENB_UE_S1AP_ID = ue_ref_p->enb_ue_s1ap_id(); ASN_SEQUENCE_ADD(&out->protocolIEs.list, hpf_ie); // cause (mandatory) @@ -2322,8 +2352,8 @@ status_code_e s1ap_mme_handle_handover_failure(s1ap_state_t* state, "\n", (uint32_t)mme_ue_s1ap_id); - s1ap_mme_itti_send_sctp_request(&b, ue_ref_p->sctp_assoc_id, - ue_ref_p->sctp_stream_send, mme_ue_s1ap_id); + s1ap_mme_itti_send_sctp_request(&b, ue_ref_p->sctp_assoc_id(), + ue_ref_p->sctp_stream_send(), mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } @@ -2337,7 +2367,7 @@ status_code_e s1ap_mme_handle_handover_cancel(s1ap_state_t* state, S1ap_S1AP_PDU_t out_pdu = {S1ap_S1AP_PDU_PR_NOTHING, {0}}; S1ap_HandoverCancelAcknowledge_t* out; S1ap_HandoverCancelAcknowledgeIEs_t* hca_ie = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; e_rab_admitted_list_t e_rab_admitted_list = {0}; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; enb_ue_s1ap_id_t enb_ue_s1ap_id = INVALID_ENB_UE_S1AP_ID; @@ -2396,7 +2426,7 @@ status_code_e s1ap_mme_handle_handover_cancel(s1ap_state_t* state, // connected state, and generate a cancel acknowledgement (immediately). // get UE context - if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { OAILOG_ERROR( LOG_S1AP, "could not get ue context for mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT @@ -2405,19 +2435,15 @@ status_code_e s1ap_mme_handle_handover_cancel(s1ap_state_t* state, OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if (ue_ref_p->s1_ue_state == S1AP_UE_HANDOVER) { + if (ue_ref_p->s1ap_ue_state() == oai::S1AP_UE_HANDOVER) { // this effectively cancels the HandoverPreparation proecedure as we // only send a HandoverCommand if the UE is in the S1AP_UE_HANDOVER // state. - ue_ref_p->s1_ue_state = S1AP_UE_CONNECTED; + ue_ref_p->set_s1ap_ue_state(oai::S1AP_UE_CONNECTED); /* Free all the transport layer address pointers in ERAB admitted list * before actually resetting the S1AP handover state */ - e_rab_admitted_list = ue_ref_p->s1ap_handover_state.e_rab_admitted_list; - for (int i = 0; i < e_rab_admitted_list.no_of_items; i++) { - bdestroy_wrapper(&e_rab_admitted_list.item[i].transport_layer_address); - } - ue_ref_p->s1ap_handover_state = (struct s1ap_handover_state_s){0}; + ue_ref_p->mutable_s1ap_handover_state()->Clear(); } else { // Not a failure, but nothing for us to do. OAILOG_INFO( @@ -2481,9 +2507,9 @@ status_code_e s1ap_mme_handle_handover_request( S1ap_S1AP_PDU_t pdu = {S1ap_S1AP_PDU_PR_NOTHING, {0}}; S1ap_HandoverRequest_t* out; S1ap_HandoverRequestIEs_t* ie = NULL; - enb_description_t* target_enb = NULL; + oai::EnbDescription* target_enb = nullptr; sctp_stream_id_t stream = 0x0; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; OAILOG_FUNC_IN(LOG_S1AP); if (ho_request_p == NULL) { @@ -2495,7 +2521,7 @@ status_code_e s1ap_mme_handle_handover_request( // get the ue description if ((ue_ref_p = s1ap_state_get_ue_mmeid(ho_request_p->mme_ue_s1ap_id)) == - NULL) { + nullptr) { OAILOG_ERROR( LOG_S1AP, "could not get ue context for mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT @@ -2505,25 +2531,25 @@ status_code_e s1ap_mme_handle_handover_request( } if ((target_enb = s1ap_state_get_enb( - state, ho_request_p->target_sctp_assoc_id)) == NULL) { + state, ho_request_p->target_sctp_assoc_id)) == nullptr) { OAILOG_ERROR(LOG_S1AP, "Could not get enb description for assoc_id %u\n", ho_request_p->target_sctp_assoc_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } // set the recv and send streams for UE on the target. - stream = target_enb->next_sctp_stream; - ue_ref_p->s1ap_handover_state.target_sctp_stream_recv = stream; - ue_ref_p->s1ap_handover_state.source_sctp_stream_recv = - ue_ref_p->sctp_stream_recv; - target_enb->next_sctp_stream += 1; - if (target_enb->next_sctp_stream >= target_enb->instreams) { - target_enb->next_sctp_stream = 1; - } - ue_ref_p->s1ap_handover_state.target_sctp_stream_send = - target_enb->next_sctp_stream; - ue_ref_p->s1ap_handover_state.source_sctp_stream_send = - ue_ref_p->sctp_stream_send; + stream = target_enb->next_sctp_stream(); + ue_ref_p->mutable_s1ap_handover_state()->set_target_sctp_stream_recv(stream); + ue_ref_p->mutable_s1ap_handover_state()->set_source_sctp_stream_recv( + ue_ref_p->sctp_stream_recv()); + target_enb->set_next_sctp_stream(target_enb->next_sctp_stream() + 1); + if (target_enb->next_sctp_stream() >= target_enb->instreams()) { + target_enb->set_next_sctp_stream(1); + } + ue_ref_p->mutable_s1ap_handover_state()->set_target_sctp_stream_send( + target_enb->next_sctp_stream()); + ue_ref_p->mutable_s1ap_handover_state()->set_source_sctp_stream_send( + ue_ref_p->sctp_stream_send()); // Build and send PDU pdu.present = S1ap_S1AP_PDU_PR_initiatingMessage; @@ -2738,7 +2764,7 @@ status_code_e s1ap_mme_handle_handover_required(s1ap_state_t* state, S1ap_S1AP_PDU_t* pdu) { S1ap_HandoverRequired_t* container = NULL; S1ap_HandoverRequiredIEs_t* ie = NULL; - enb_description_t* enb_association = NULL; + oai::EnbDescription* enb_association = nullptr; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; enb_ue_s1ap_id_t enb_ue_s1ap_id = INVALID_ENB_UE_S1AP_ID; S1ap_HandoverType_t handover_type = -1; @@ -2748,16 +2774,15 @@ status_code_e s1ap_mme_handle_handover_required(s1ap_state_t* state, S1ap_TargeteNB_ID_t* targeteNB_ID = NULL; bstring src_tgt_container = {0}; uint8_t* enb_id_buf = NULL; - enb_description_t* target_enb_association = NULL; + oai::EnbDescription* target_enb_association = nullptr; uint32_t target_enb_id = 0; - uint32_t idx = 0; imsi64_t imsi64 = INVALID_IMSI64; s1ap_imsi_map_t* imsi_map = get_s1ap_imsi_map(); OAILOG_FUNC_IN(LOG_S1AP); enb_association = s1ap_state_get_enb(state, assoc_id); - if (enb_association == NULL) { + if (enb_association == nullptr) { OAILOG_ERROR(LOG_S1AP, "Ignore Handover Required from unknown assoc " "%u\n", @@ -2767,9 +2792,9 @@ status_code_e s1ap_mme_handle_handover_required(s1ap_state_t* state, OAILOG_INFO(LOG_S1AP, "Handover Required from association id %u, " - "Connected UEs = %u Num elements = %zu\n", - assoc_id, enb_association->nb_ue_associated, - enb_association->ue_id_coll.size()); + "Connected UEs = %u Num elements = %u\n", + assoc_id, enb_association->nb_ue_associated(), + enb_association->ue_id_map_size()); container = &pdu->choice.initiatingMessage.value.choice.HandoverRequired; @@ -2914,11 +2939,11 @@ status_code_e s1ap_mme_handle_handover_required(s1ap_state_t* state, if (!target_enb_association) { continue; } - if (target_enb_association->enb_id == target_enb_id) { + if (target_enb_association->enb_id() == target_enb_id) { break; } } - if (target_enb_association->enb_id != target_enb_id) { + if (target_enb_association->enb_id() != target_enb_id) { bdestroy_wrapper(&src_tgt_container); OAILOG_ERROR(LOG_S1AP, "No eNB for enb_id %d\n", target_enb_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); @@ -2927,10 +2952,10 @@ status_code_e s1ap_mme_handle_handover_required(s1ap_state_t* state, OAILOG_INFO_UE(LOG_S1AP, imsi64, "Handing over to enb_id %d (sctp assoc %d)\n", target_enb_id, - target_enb_association->sctp_assoc_id); + target_enb_association->sctp_assoc_id()); s1ap_mme_itti_s1ap_handover_required( - target_enb_association->sctp_assoc_id, target_enb_id, cause, + target_enb_association->sctp_assoc_id(), target_enb_id, cause, handover_type, mme_ue_s1ap_id, src_tgt_container, imsi64); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); @@ -2944,7 +2969,7 @@ status_code_e s1ap_mme_handle_handover_command( S1ap_S1AP_PDU_t pdu = {S1ap_S1AP_PDU_PR_NOTHING, {0}}; S1ap_HandoverCommand_t* out; S1ap_HandoverCommandIEs_t* ie = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; sctp_stream_id_t stream = 0x0; OAILOG_FUNC_IN(LOG_S1AP); @@ -2954,7 +2979,7 @@ status_code_e s1ap_mme_handle_handover_command( } if ((ue_ref_p = s1ap_state_get_ue_mmeid(ho_command_p->mme_ue_s1ap_id)) == - NULL) { + nullptr) { OAILOG_ERROR( LOG_S1AP, "could not get ue context for mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT @@ -2962,18 +2987,21 @@ status_code_e s1ap_mme_handle_handover_command( (uint32_t)ho_command_p->mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } else { - stream = ue_ref_p->sctp_stream_send; + stream = ue_ref_p->sctp_stream_send(); } // we're doing handover, update the ue state - ue_ref_p->s1_ue_state = S1AP_UE_HANDOVER; - ue_ref_p->s1ap_handover_state.mme_ue_s1ap_id = ho_command_p->mme_ue_s1ap_id; - ue_ref_p->s1ap_handover_state.source_enb_id = ho_command_p->source_enb_id; - ue_ref_p->s1ap_handover_state.target_enb_id = ho_command_p->target_enb_id; - ue_ref_p->s1ap_handover_state.target_enb_ue_s1ap_id = - ho_command_p->tgt_enb_ue_s1ap_id; - ue_ref_p->s1ap_handover_state.source_enb_ue_s1ap_id = - ue_ref_p->enb_ue_s1ap_id; + ue_ref_p->set_s1ap_ue_state(oai::S1AP_UE_HANDOVER); + ue_ref_p->mutable_s1ap_handover_state()->set_mme_ue_s1ap_id( + ho_command_p->mme_ue_s1ap_id); + ue_ref_p->mutable_s1ap_handover_state()->set_source_enb_id( + ho_command_p->source_enb_id); + ue_ref_p->mutable_s1ap_handover_state()->set_target_enb_id( + ho_command_p->target_enb_id); + ue_ref_p->mutable_s1ap_handover_state()->set_target_enb_ue_s1ap_id( + ho_command_p->tgt_enb_ue_s1ap_id); + ue_ref_p->mutable_s1ap_handover_state()->set_source_enb_ue_s1ap_id( + ue_ref_p->enb_ue_s1ap_id()); OAILOG_INFO(LOG_S1AP, "Handover Command received"); pdu.present = S1ap_S1AP_PDU_PR_successfulOutcome; @@ -3042,9 +3070,9 @@ status_code_e s1ap_mme_handle_handover_notify(s1ap_state_t* state, S1ap_S1AP_PDU_t* pdu) { S1ap_HandoverNotify_t* container = NULL; S1ap_HandoverNotifyIEs_t* ie = NULL; - enb_description_t* target_enb = NULL; - ue_description_t* src_ue_ref_p = NULL; - ue_description_t* new_ue_ref_p = NULL; + oai::EnbDescription* target_enb = nullptr; + oai::UeDescription* src_ue_ref_p = nullptr; + oai::UeDescription* new_ue_ref_p = nullptr; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; enb_ue_s1ap_id_t tgt_enb_ue_s1ap_id = INVALID_ENB_UE_S1AP_ID; ecgi_t ecgi = {.plmn = {0}, .cell_identity = {0}}; @@ -3055,7 +3083,7 @@ status_code_e s1ap_mme_handle_handover_notify(s1ap_state_t* state, OAILOG_FUNC_IN(LOG_S1AP); target_enb = s1ap_state_get_enb(state, assoc_id); - if (target_enb == NULL) { + if (target_enb == nullptr) { OAILOG_ERROR(LOG_S1AP, "Ignore HandoverNotify from unknown assoc %u\n", assoc_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); @@ -3125,7 +3153,7 @@ status_code_e s1ap_mme_handle_handover_notify(s1ap_state_t* state, imsi_map->mme_ueid2imsi_map.get(mme_ue_s1ap_id, &imsi64); // get existing UE context - if ((src_ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((src_ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { OAILOG_ERROR_UE(LOG_S1AP, imsi64, "source MME_UE_S1AP_ID (" MME_UE_S1AP_ID_FMT ") does not point to any valid UE\n", @@ -3133,9 +3161,9 @@ status_code_e s1ap_mme_handle_handover_notify(s1ap_state_t* state, OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } else { // create new UE context, remove the old one. - new_ue_ref_p = - s1ap_state_get_ue_enbid(target_enb->sctp_assoc_id, tgt_enb_ue_s1ap_id); - if (new_ue_ref_p != NULL) { + new_ue_ref_p = s1ap_state_get_ue_enbid(target_enb->sctp_assoc_id(), + tgt_enb_ue_s1ap_id); + if (new_ue_ref_p != nullptr) { OAILOG_ERROR_UE( LOG_S1AP, imsi64, "S1AP:Handover Notify- Received ENB_UE_S1AP_ID is not Unique " @@ -3144,7 +3172,7 @@ status_code_e s1ap_mme_handle_handover_notify(s1ap_state_t* state, OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } if ((new_ue_ref_p = s1ap_new_ue(state, assoc_id, tgt_enb_ue_s1ap_id)) == - NULL) { + nullptr) { // If we failed to allocate a new UE return -1 OAILOG_ERROR_UE( LOG_S1AP, imsi64, @@ -3153,50 +3181,55 @@ status_code_e s1ap_mme_handle_handover_notify(s1ap_state_t* state, tgt_enb_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - new_ue_ref_p->s1_ue_state = S1AP_UE_CONNECTED; // handover has completed - new_ue_ref_p->enb_ue_s1ap_id = tgt_enb_ue_s1ap_id; + new_ue_ref_p->set_s1ap_ue_state( + oai::S1AP_UE_CONNECTED); // handover has completed + new_ue_ref_p->set_enb_ue_s1ap_id(tgt_enb_ue_s1ap_id); // Will be allocated by NAS - new_ue_ref_p->mme_ue_s1ap_id = mme_ue_s1ap_id; - - new_ue_ref_p->s1ap_ue_context_rel_timer.id = - src_ue_ref_p->s1ap_ue_context_rel_timer.id; - new_ue_ref_p->s1ap_ue_context_rel_timer.msec = - src_ue_ref_p->s1ap_ue_context_rel_timer.msec; - new_ue_ref_p->sctp_stream_recv = - src_ue_ref_p->s1ap_handover_state.target_sctp_stream_recv; - new_ue_ref_p->sctp_stream_send = - src_ue_ref_p->s1ap_handover_state.target_sctp_stream_send; - new_ue_ref_p->s1ap_handover_state = src_ue_ref_p->s1ap_handover_state; + new_ue_ref_p->set_mme_ue_s1ap_id(mme_ue_s1ap_id); + + new_ue_ref_p->mutable_s1ap_ue_context_rel_timer()->set_id( + src_ue_ref_p->s1ap_ue_context_rel_timer().id()); + new_ue_ref_p->mutable_s1ap_ue_context_rel_timer()->set_msec( + src_ue_ref_p->s1ap_ue_context_rel_timer().msec()); + new_ue_ref_p->set_sctp_stream_recv( + src_ue_ref_p->mutable_s1ap_handover_state()->target_sctp_stream_recv()); + new_ue_ref_p->set_sctp_stream_send( + src_ue_ref_p->mutable_s1ap_handover_state()->target_sctp_stream_send()); + + new_ue_ref_p->mutable_s1ap_handover_state()->MergeFrom( + src_ue_ref_p->s1ap_handover_state()); // generate a message to update bearers s1ap_mme_itti_s1ap_handover_notify( - mme_ue_s1ap_id, src_ue_ref_p->s1ap_handover_state, tgt_enb_ue_s1ap_id, + mme_ue_s1ap_id, src_ue_ref_p->s1ap_handover_state(), tgt_enb_ue_s1ap_id, assoc_id, ecgi, imsi64); // Send context release command to source eNB s1ap_mme_generate_ue_context_release_command( state, src_ue_ref_p, S1AP_SUCCESSFUL_HANDOVER, imsi64, - src_ue_ref_p->sctp_assoc_id, - src_ue_ref_p->s1ap_handover_state.source_sctp_stream_send, + src_ue_ref_p->sctp_assoc_id(), + src_ue_ref_p->s1ap_handover_state().source_sctp_stream_send(), mme_ue_s1ap_id, - src_ue_ref_p->s1ap_handover_state.source_enb_ue_s1ap_id); + src_ue_ref_p->s1ap_handover_state().source_enb_ue_s1ap_id()); /* Remove ue description from source eNB */ s1ap_remove_ue(state, src_ue_ref_p); /* Mapping between mme_ue_s1ap_id, assoc_id and enb_ue_s1ap_id */ magma::proto_map_rc_t rc = - state->mmeid2associd.insert(new_ue_ref_p->mme_ue_s1ap_id, assoc_id); + state->mmeid2associd.insert(new_ue_ref_p->mme_ue_s1ap_id(), assoc_id); - target_enb->ue_id_coll.insert(new_ue_ref_p->mme_ue_s1ap_id, - new_ue_ref_p->comp_s1ap_id); + magma::proto_map_uint32_uint64_t ue_id_coll; + ue_id_coll.map = target_enb->mutable_ue_id_map(); + ue_id_coll.insert(new_ue_ref_p->mme_ue_s1ap_id(), + new_ue_ref_p->comp_s1ap_id()); OAILOG_DEBUG_UE( LOG_S1AP, imsi64, "Associated sctp_assoc_id %d, enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT ", mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT ":%s \n", - assoc_id, new_ue_ref_p->enb_ue_s1ap_id, new_ue_ref_p->mme_ue_s1ap_id, - magma::map_rc_code2string(rc)); + assoc_id, new_ue_ref_p->enb_ue_s1ap_id(), + new_ue_ref_p->mme_ue_s1ap_id(), magma::map_rc_code2string(rc)); } OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); @@ -3207,12 +3240,11 @@ status_code_e s1ap_mme_handle_enb_status_transfer( const sctp_stream_id_t stream, S1ap_S1AP_PDU_t* pdu) { S1ap_ENBStatusTransfer_t* container = NULL; S1ap_ENBStatusTransferIEs_t* ie = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; - enb_description_t* target_enb_association = NULL; + oai::EnbDescription* target_enb_association = nullptr; uint8_t* buffer = NULL; uint32_t length = 0; - uint32_t idx = 0; OAILOG_FUNC_IN(LOG_S1AP); container = &pdu->choice.initiatingMessage.value.choice.ENBStatusTransfer; @@ -3231,7 +3263,7 @@ status_code_e s1ap_mme_handle_enb_status_transfer( } // get the UE and handover state - if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { OAILOG_ERROR( LOG_S1AP, "could not get ue context for mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT @@ -3244,14 +3276,14 @@ status_code_e s1ap_mme_handle_enb_status_transfer( "Received eNBStatusTransfer from source enb_id assoc %u for " "ue " MME_UE_S1AP_ID_FMT " to target enb_id %u\n", assoc_id, mme_ue_s1ap_id, - ue_ref_p->s1ap_handover_state.target_enb_ue_s1ap_id); + ue_ref_p->s1ap_handover_state().target_enb_ue_s1ap_id()); // set the target eNB_UE_S1AP_ID S1AP_FIND_PROTOCOLIE_BY_ID(S1ap_ENBStatusTransferIEs_t, ie, container, S1ap_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true); if (ie) { ie->value.choice.ENB_UE_S1AP_ID = - ue_ref_p->s1ap_handover_state.target_enb_ue_s1ap_id; + ue_ref_p->s1ap_handover_state().target_enb_ue_s1ap_id(); } else { OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } @@ -3265,15 +3297,15 @@ status_code_e s1ap_mme_handle_enb_status_transfer( if (!target_enb_association) { continue; } - if (target_enb_association->enb_id == - ue_ref_p->s1ap_handover_state.target_enb_id) { + if (target_enb_association->enb_id() == + ue_ref_p->s1ap_handover_state().target_enb_id()) { break; } } - if (target_enb_association->enb_id != - ue_ref_p->s1ap_handover_state.target_enb_id) { + if (target_enb_association->enb_id() != + ue_ref_p->s1ap_handover_state().target_enb_id()) { OAILOG_ERROR(LOG_S1AP, "No eNB for enb_id %d\n", - ue_ref_p->s1ap_handover_state.target_enb_id); + ue_ref_p->s1ap_handover_state().target_enb_id()); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } } @@ -3288,7 +3320,7 @@ status_code_e s1ap_mme_handle_enb_status_transfer( OAILOG_ERROR( LOG_S1AP, "Failed to encode MME Configuration Transfer message for enb_id %u\n", - ue_ref_p->s1ap_handover_state.target_enb_id); + ue_ref_p->s1ap_handover_state().target_enb_id()); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } @@ -3296,9 +3328,9 @@ status_code_e s1ap_mme_handle_enb_status_transfer( free(buffer); s1ap_mme_itti_send_sctp_request( - &b, target_enb_association->sctp_assoc_id, - ue_ref_p->s1ap_handover_state.target_sctp_stream_recv, - ue_ref_p->mme_ue_s1ap_id); + &b, target_enb_association->sctp_assoc_id(), + ue_ref_p->s1ap_handover_state().target_sctp_stream_recv(), + ue_ref_p->mme_ue_s1ap_id()); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } @@ -3310,9 +3342,9 @@ status_code_e s1ap_mme_handle_path_switch_request( S1ap_PathSwitchRequest_t* container = NULL; S1ap_PathSwitchRequestIEs_t* ie = NULL; S1ap_E_RABToBeSwitchedDLItemIEs_t* eRABToBeSwitchedDlItemIEs_p = NULL; - enb_description_t* enb_association = NULL; - ue_description_t* ue_ref_p = NULL; - ue_description_t* new_ue_ref_p = NULL; + oai::EnbDescription* enb_association = nullptr; + oai::UeDescription* ue_ref_p = nullptr; + oai::UeDescription* new_ue_ref_p = nullptr; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; enb_ue_s1ap_id_t enb_ue_s1ap_id = INVALID_ENB_UE_S1AP_ID; ecgi_t ecgi = {.plmn = {0}, .cell_identity = {0}}; @@ -3329,7 +3361,7 @@ status_code_e s1ap_mme_handle_path_switch_request( OAILOG_FUNC_IN(LOG_S1AP); enb_association = s1ap_state_get_enb(state, assoc_id); - if (enb_association == NULL) { + if (enb_association == nullptr) { OAILOG_ERROR(LOG_S1AP, "Ignore Path Switch Request from unknown assoc " "%u\n", @@ -3375,7 +3407,7 @@ status_code_e s1ap_mme_handle_path_switch_request( OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { /* * The MME UE S1AP ID provided by eNB doesn't point to any valid UE. * MME ignore this PATH SWITCH REQUEST. @@ -3386,9 +3418,9 @@ status_code_e s1ap_mme_handle_path_switch_request( mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } else { - new_ue_ref_p = - s1ap_state_get_ue_enbid(enb_association->sctp_assoc_id, enb_ue_s1ap_id); - if (new_ue_ref_p != NULL) { + new_ue_ref_p = s1ap_state_get_ue_enbid(enb_association->sctp_assoc_id(), + enb_ue_s1ap_id); + if (new_ue_ref_p != nullptr) { OAILOG_ERROR_UE( LOG_S1AP, imsi64, "S1AP:Path Switch Request- Received ENB_UE_S1AP_ID is not Unique " @@ -3400,7 +3432,8 @@ status_code_e s1ap_mme_handle_path_switch_request( * Creat New UE Context with target eNB and delete Old UE Context * from source eNB. */ - if ((new_ue_ref_p = s1ap_new_ue(state, assoc_id, enb_ue_s1ap_id)) == NULL) { + if ((new_ue_ref_p = s1ap_new_ue(state, assoc_id, enb_ue_s1ap_id)) == + nullptr) { // If we failed to allocate a new UE return -1 OAILOG_ERROR_UE( LOG_S1AP, imsi64, @@ -3409,38 +3442,41 @@ status_code_e s1ap_mme_handle_path_switch_request( enb_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - new_ue_ref_p->s1_ue_state = ue_ref_p->s1_ue_state; - new_ue_ref_p->enb_ue_s1ap_id = enb_ue_s1ap_id; + new_ue_ref_p->set_s1ap_ue_state(ue_ref_p->s1ap_ue_state()); + new_ue_ref_p->set_enb_ue_s1ap_id(enb_ue_s1ap_id); // Will be allocated by NAS - new_ue_ref_p->mme_ue_s1ap_id = mme_ue_s1ap_id; + new_ue_ref_p->set_mme_ue_s1ap_id(mme_ue_s1ap_id); - new_ue_ref_p->s1ap_ue_context_rel_timer.id = - ue_ref_p->s1ap_ue_context_rel_timer.id; - new_ue_ref_p->s1ap_ue_context_rel_timer.msec = - ue_ref_p->s1ap_ue_context_rel_timer.msec; + new_ue_ref_p->mutable_s1ap_ue_context_rel_timer()->set_id( + ue_ref_p->s1ap_ue_context_rel_timer().id()); + new_ue_ref_p->mutable_s1ap_ue_context_rel_timer()->set_msec( + ue_ref_p->s1ap_ue_context_rel_timer().msec()); // On which stream we received the message - new_ue_ref_p->sctp_stream_recv = stream; - new_ue_ref_p->sctp_stream_send = enb_association->next_sctp_stream; - enb_association->next_sctp_stream += 1; - if (enb_association->next_sctp_stream >= enb_association->instreams) { - enb_association->next_sctp_stream = 1; + new_ue_ref_p->set_sctp_stream_recv(stream); + new_ue_ref_p->set_sctp_stream_send(enb_association->next_sctp_stream()); + enb_association->set_next_sctp_stream(enb_association->next_sctp_stream() + + 1); + if (enb_association->next_sctp_stream() >= enb_association->instreams()) { + enb_association->set_next_sctp_stream(1); } /* Remove ue description from source eNB */ s1ap_remove_ue(state, ue_ref_p); /* Mapping between mme_ue_s1ap_id, assoc_id and enb_ue_s1ap_id */ magma::proto_map_rc_t rc = - state->mmeid2associd.insert(new_ue_ref_p->mme_ue_s1ap_id, assoc_id); + state->mmeid2associd.insert(new_ue_ref_p->mme_ue_s1ap_id(), assoc_id); - enb_association->ue_id_coll.insert(new_ue_ref_p->mme_ue_s1ap_id, - new_ue_ref_p->comp_s1ap_id); + magma::proto_map_uint32_uint64_t ue_id_coll; + ue_id_coll.map = enb_association->mutable_ue_id_map(); + ue_id_coll.insert(new_ue_ref_p->mme_ue_s1ap_id(), + new_ue_ref_p->comp_s1ap_id()); OAILOG_DEBUG_UE( LOG_S1AP, imsi64, "Associated sctp_assoc_id %d, enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT ", mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT ":%s \n", - assoc_id, new_ue_ref_p->enb_ue_s1ap_id, new_ue_ref_p->mme_ue_s1ap_id, - magma::map_rc_code2string(rc)); + assoc_id, new_ue_ref_p->enb_ue_s1ap_id(), + new_ue_ref_p->mme_ue_s1ap_id(), magma::map_rc_code2string(rc)); S1AP_FIND_PROTOCOLIE_BY_ID(S1ap_PathSwitchRequestIEs_t, ie, container, S1ap_ProtocolIE_ID_id_E_RABToBeSwitchedDLList, @@ -3517,9 +3553,9 @@ status_code_e s1ap_mme_handle_path_switch_request( } s1ap_mme_itti_s1ap_path_switch_request( - assoc_id, enb_association->enb_id, new_ue_ref_p->enb_ue_s1ap_id, - &e_rab_to_be_switched_dl_list, new_ue_ref_p->mme_ue_s1ap_id, &ecgi, &tai, - encryption_algorithm_capabilities, integrity_algorithm_capabilities, + assoc_id, enb_association->enb_id(), new_ue_ref_p->enb_ue_s1ap_id(), + &e_rab_to_be_switched_dl_list, new_ue_ref_p->mme_ue_s1ap_id(), &ecgi, + &tai, encryption_algorithm_capabilities, integrity_algorithm_capabilities, imsi64); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); @@ -3532,7 +3568,7 @@ static bool s1ap_send_enb_deregistered_ind(__attribute__((unused)) uint64_t const dataP, void* argP, void** resultP) { arg_s1ap_send_enb_dereg_ind_t* arg = (arg_s1ap_send_enb_dereg_ind_t*)argP; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; // Ask for the release of each UE context associated to the eNB map_uint64_ue_description_t* s1ap_ue_state = get_s1ap_ue_state(); @@ -3547,7 +3583,7 @@ static bool s1ap_send_enb_deregistered_ind(__attribute__((unused)) TASK_S1AP, S1AP_ENB_DEREGISTERED_IND); OAILOG_DEBUG(LOG_S1AP, "eNB Deregesteration"); } - if (ue_ref_p->mme_ue_s1ap_id == INVALID_MME_UE_S1AP_ID) { + if (ue_ref_p->mme_ue_s1ap_id() == INVALID_MME_UE_S1AP_ID) { /* * Send deregistered ind for this also and let MMEAPP find the context * using enb_ue_s1ap_id_key @@ -3560,9 +3596,9 @@ static bool s1ap_send_enb_deregistered_ind(__attribute__((unused)) "Too many deregistered UEs reported in S1AP_ENB_DEREGISTERED_IND " "message "); S1AP_ENB_DEREGISTERED_IND(arg->message_p) - .mme_ue_s1ap_id[arg->current_ue_index] = ue_ref_p->mme_ue_s1ap_id; + .mme_ue_s1ap_id[arg->current_ue_index] = ue_ref_p->mme_ue_s1ap_id(); S1AP_ENB_DEREGISTERED_IND(arg->message_p) - .enb_ue_s1ap_id[arg->current_ue_index] = ue_ref_p->enb_ue_s1ap_id; + .enb_ue_s1ap_id[arg->current_ue_index] = ue_ref_p->enb_ue_s1ap_id(); arg->handled_ues++; arg->current_ue_index++; @@ -3605,7 +3641,7 @@ bool construct_s1ap_mme_full_reset_req(uint32_t keyP, const uint64_t dataP, void* argP, void** resultP) { arg_s1ap_construct_enb_reset_req_t* arg = reinterpret_cast(argP); - ue_description_t* ue_ref = reinterpret_cast(dataP); + oai::UeDescription* ue_ref = reinterpret_cast(dataP); map_uint64_ue_description_t* s1ap_ue_state = get_s1ap_ue_state(); if (!s1ap_ue_state) { @@ -3616,9 +3652,9 @@ bool construct_s1ap_mme_full_reset_req(uint32_t keyP, const uint64_t dataP, uint32_t i = arg->current_ue_index; if (ue_ref) { S1AP_ENB_INITIATED_RESET_REQ(arg->msg).ue_to_reset_list[i].mme_ue_s1ap_id = - ue_ref->mme_ue_s1ap_id; + ue_ref->mme_ue_s1ap_id(); S1AP_ENB_INITIATED_RESET_REQ(arg->msg).ue_to_reset_list[i].enb_ue_s1ap_id = - ue_ref->enb_ue_s1ap_id; + ue_ref->enb_ue_s1ap_id(); } else { OAILOG_TRACE(LOG_S1AP, "No valid UE provided in callback: %p\n", ue_ref); S1AP_ENB_INITIATED_RESET_REQ(arg->msg).ue_to_reset_list[i].mme_ue_s1ap_id = @@ -3635,25 +3671,27 @@ status_code_e s1ap_handle_sctp_disconnection(s1ap_state_t* state, bool reset) { arg_s1ap_send_enb_dereg_ind_t arg = {0}; MessageDef* message_p = NULL; - enb_description_t* enb_association = NULL; + oai::EnbDescription* enb_association = nullptr; OAILOG_FUNC_IN(LOG_S1AP); // Checking if the assoc id has a valid eNB attached to it enb_association = s1ap_state_get_enb(state, assoc_id); - if (enb_association == NULL) { + if (enb_association == nullptr) { OAILOG_ERROR(LOG_S1AP, "No eNB attached to this assoc_id: %d\n", assoc_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } + magma::proto_map_uint32_uint64_t ue_id_coll; + ue_id_coll.map = enb_association->mutable_ue_id_map(); OAILOG_INFO(LOG_S1AP, "SCTP disconnection request for association id %u, Reset Flag = " "%u. Connected UEs = %u Num elements = %zu\n", - assoc_id, reset, enb_association->nb_ue_associated, - enb_association->ue_id_coll.size()); + assoc_id, reset, enb_association->nb_ue_associated(), + ue_id_coll.size()); // First check if we can just reset the eNB state if there are no UEs - if (!enb_association->nb_ue_associated) { + if (!enb_association->nb_ue_associated()) { if (reset) { OAILOG_INFO(LOG_S1AP, "SCTP reset request for association id %u. No Connected UEs. " @@ -3662,7 +3700,7 @@ status_code_e s1ap_handle_sctp_disconnection(s1ap_state_t* state, OAILOG_INFO(LOG_S1AP, "Moving eNB with assoc_id %u to INIT state\n", assoc_id); - enb_association->s1_state = S1AP_INIT; + enb_association->set_s1_enb_state(oai::S1AP_INIT); state->num_enbs--; } else { OAILOG_INFO( @@ -3684,10 +3722,10 @@ status_code_e s1ap_handle_sctp_disconnection(s1ap_state_t* state, * s1ap task shall clear this UE state if mme_app task has not yet provided * mme_ue_s1ap_id */ - if (enb_association->ue_id_coll.size() == 0) { + if (ue_id_coll.size() == 0) { OAILOG_FUNC_RETURN(LOG_S1AP, s1ap_clear_ue_ctxt_for_unknown_mme_ue_s1ap_id( - state, enb_association->sctp_assoc_id)); + state, enb_association->sctp_assoc_id())); } } /* @@ -3695,9 +3733,9 @@ status_code_e s1ap_handle_sctp_disconnection(s1ap_state_t* state, * UE count in each batch <= S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE */ - arg.associated_enb_id = enb_association->enb_id; - arg.deregister_ue_count = enb_association->ue_id_coll.size(); - enb_association->ue_id_coll.map_apply_callback_on_all_elements( + arg.associated_enb_id = enb_association->enb_id(); + arg.deregister_ue_count = ue_id_coll.size(); + ue_id_coll.map_apply_callback_on_all_elements( s1ap_send_enb_deregistered_ind, reinterpret_cast(&arg), reinterpret_cast(&message_p)); @@ -3705,7 +3743,9 @@ status_code_e s1ap_handle_sctp_disconnection(s1ap_state_t* state, * Mark the eNB's s1 state as appropriate, the eNB will be deleted or * moved to init state when the last UE's s1 state is cleaned up */ - enb_association->s1_state = reset ? S1AP_RESETING : S1AP_SHUTDOWN; + oai::S1apEnbState s1ap_state = + reset ? oai::S1AP_RESETING : oai::S1AP_SHUTDOWN; + enb_association->set_s1_enb_state(s1ap_state); OAILOG_INFO(LOG_S1AP, "Marked enb s1 status to %s, attached to assoc_id: %d\n", reset ? "Reset" : "Shutdown", assoc_id); @@ -3716,7 +3756,7 @@ status_code_e s1ap_handle_sctp_disconnection(s1ap_state_t* state, //------------------------------------------------------------------------------ status_code_e s1ap_handle_new_association(s1ap_state_t* state, sctp_new_peer_t* sctp_new_peer_p) { - enb_description_t* enb_association = NULL; + oai::EnbDescription* enb_association = nullptr; OAILOG_FUNC_IN(LOG_S1AP); @@ -3729,7 +3769,7 @@ status_code_e s1ap_handle_new_association(s1ap_state_t* state, * Checking that the assoc id has a valid eNB attached to. */ enb_association = s1ap_state_get_enb(state, sctp_new_peer_p->assoc_id); - if (enb_association == NULL) { + if (enb_association == nullptr) { OAILOG_DEBUG(LOG_S1AP, "Create eNB context for assoc_id: %d\n", sctp_new_peer_p->assoc_id); /* @@ -3737,7 +3777,7 @@ status_code_e s1ap_handle_new_association(s1ap_state_t* state, */ enb_association = s1ap_new_enb(); - if (enb_association == NULL) { + if (enb_association == nullptr) { /* * We failed to allocate memory */ @@ -3749,20 +3789,21 @@ status_code_e s1ap_handle_new_association(s1ap_state_t* state, sctp_new_peer_p->assoc_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } - enb_association->sctp_assoc_id = sctp_new_peer_p->assoc_id; - enb_association->enb_id = 0xFFFFFFFF; // home or macro eNB is 28 or 20bits. + enb_association->set_sctp_assoc_id(sctp_new_peer_p->assoc_id); + enb_association->set_enb_id( + 0xFFFFFFFF); // home or macro eNB is 28 or 20bits. magma::proto_map_rc_t rc = - state->enbs.insert(enb_association->sctp_assoc_id, enb_association); + state->enbs.insert(enb_association->sctp_assoc_id(), enb_association); if (rc != magma::PROTO_MAP_OK) { OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - } else if ((enb_association->s1_state == S1AP_SHUTDOWN) || - (enb_association->s1_state == S1AP_RESETING)) { + } else if ((enb_association->s1_enb_state() == oai::S1AP_SHUTDOWN) || + (enb_association->s1_enb_state() == oai::S1AP_RESETING)) { OAILOG_WARNING( LOG_S1AP, "Received new association request on an association that is being %s, " "ignoring", - s1_enb_state2str(enb_association->s1_state)); + s1_enb_state2str(enb_association->s1_enb_state())); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } else { OAILOG_DEBUG(LOG_S1AP, @@ -3770,43 +3811,45 @@ status_code_e s1ap_handle_new_association(s1ap_state_t* state, sctp_new_peer_p->assoc_id); } - enb_association->sctp_assoc_id = sctp_new_peer_p->assoc_id; + enb_association->set_sctp_assoc_id(sctp_new_peer_p->assoc_id); /* * Fill in in and out number of streams available on SCTP connection. */ - enb_association->instreams = (sctp_stream_id_t)sctp_new_peer_p->instreams; - enb_association->outstreams = (sctp_stream_id_t)sctp_new_peer_p->outstreams; + enb_association->set_instreams((sctp_stream_id_t)sctp_new_peer_p->instreams); + enb_association->set_outstreams( + (sctp_stream_id_t)sctp_new_peer_p->outstreams); /* * Fill in control plane IP address of RAN end point for this association */ if (sctp_new_peer_p->ran_cp_ipaddr) { - memcpy(enb_association->ran_cp_ipaddr, sctp_new_peer_p->ran_cp_ipaddr->data, - sctp_new_peer_p->ran_cp_ipaddr->slen); - enb_association->ran_cp_ipaddr_sz = sctp_new_peer_p->ran_cp_ipaddr->slen; + enb_association->set_ran_cp_ipaddr(sctp_new_peer_p->ran_cp_ipaddr->data, + sctp_new_peer_p->ran_cp_ipaddr->slen); + enb_association->set_ran_cp_ipaddr_sz(sctp_new_peer_p->ran_cp_ipaddr->slen); } /* * initialize the next sctp stream to 1 as 0 is reserved for non * * * * ue associated signalling. */ - enb_association->next_sctp_stream = 1; - enb_association->s1_state = S1AP_INIT; + enb_association->set_next_sctp_stream(1); + enb_association->set_s1_enb_state(oai::S1AP_INIT); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } //------------------------------------------------------------------------------ void s1ap_mme_release_ue_context(s1ap_state_t* state, - ue_description_t* ue_ref_p, imsi64_t imsi64) { + oai::UeDescription* ue_ref_p, + imsi64_t imsi64) { MessageDef* message_p = NULL; OAILOG_FUNC_IN(LOG_S1AP); - if (ue_ref_p == NULL) { - OAILOG_ERROR(LOG_S1AP, "ue_ref_p is NULL\n"); + if (ue_ref_p == nullptr) { + OAILOG_ERROR(LOG_S1AP, "ue_ref_p is nullptr\n"); } // Stop the ue context release timer - s1ap_stop_timer(ue_ref_p->s1ap_ue_context_rel_timer.id); - ue_ref_p->s1ap_ue_context_rel_timer.id = S1AP_TIMER_INACTIVE_ID; + s1ap_stop_timer(ue_ref_p->s1ap_ue_context_rel_timer().id()); + ue_ref_p->mutable_s1ap_ue_context_rel_timer()->set_id(S1AP_TIMER_INACTIVE_ID); OAILOG_DEBUG_UE(LOG_S1AP, imsi64, "Releasing UE Context for UE id %d \n", - ue_ref_p->mme_ue_s1ap_id); + ue_ref_p->mme_ue_s1ap_id()); /* * Remove UE context and inform MME_APP. @@ -3816,16 +3859,16 @@ void s1ap_mme_release_ue_context(s1ap_state_t* state, memset((void*)&message_p->ittiMsg.s1ap_ue_context_release_complete, 0, sizeof(itti_s1ap_ue_context_release_complete_t)); S1AP_UE_CONTEXT_RELEASE_COMPLETE(message_p).mme_ue_s1ap_id = - ue_ref_p->mme_ue_s1ap_id; + ue_ref_p->mme_ue_s1ap_id(); message_p->ittiMsgHeader.imsi = imsi64; send_msg_to_task(&s1ap_task_zmq_ctx, TASK_MME_APP, message_p); - if (!(ue_ref_p->s1_ue_state == S1AP_UE_WAITING_CRR)) { + if (!(ue_ref_p->s1ap_ue_state() == oai::S1AP_UE_WAITING_CRC)) { OAILOG_ERROR(LOG_S1AP, "Incorrect S1AP UE state\n"); } OAILOG_DEBUG_UE(LOG_S1AP, imsi64, "Removed S1AP UE " MME_UE_S1AP_ID_FMT "\n", - (uint32_t)ue_ref_p->mme_ue_s1ap_id); + (uint32_t)ue_ref_p->mme_ue_s1ap_id()); s1ap_remove_ue(state, ue_ref_p); OAILOG_FUNC_OUT(LOG_S1AP); @@ -3841,7 +3884,7 @@ status_code_e s1ap_mme_handle_error_ind_message(s1ap_state_t* state, increment_counter("s1ap_error_ind_rcvd", 1, NO_LABELS); S1ap_ErrorIndication_t* container = NULL; S1ap_ErrorIndicationIEs_t* ie = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; enb_ue_s1ap_id_t enb_ue_s1ap_id = INVALID_ENB_UE_S1AP_ID; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; S1ap_Cause_PR cause_type; @@ -3878,7 +3921,8 @@ status_code_e s1ap_mme_handle_error_ind_message(s1ap_state_t* state, OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if ((ue_ref_p = s1ap_state_get_ue_mmeid((uint32_t)mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid((uint32_t)mme_ue_s1ap_id)) == + nullptr) { OAILOG_WARNING( LOG_S1AP, "No UE is attached to this mme UE s1ap id: " MME_UE_S1AP_ID_FMT @@ -3952,7 +3996,7 @@ status_code_e s1ap_mme_handle_erab_setup_response( OAILOG_FUNC_IN(LOG_S1AP); S1ap_E_RABSetupResponse_t* container = NULL; S1ap_E_RABSetupResponseIEs_t* ie = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; MessageDef* message_p = NULL; enb_ue_s1ap_id_t enb_ue_s1ap_id = INVALID_ENB_UE_S1AP_ID; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; @@ -3977,7 +4021,8 @@ status_code_e s1ap_mme_handle_erab_setup_response( } else { OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if ((ue_ref_p = s1ap_state_get_ue_mmeid((uint32_t)mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid((uint32_t)mme_ue_s1ap_id)) == + nullptr) { OAILOG_DEBUG(LOG_S1AP, "No UE is attached to this mme UE s1ap id: " MME_UE_S1AP_ID_FMT "\n", @@ -3985,21 +4030,21 @@ status_code_e s1ap_mme_handle_erab_setup_response( OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if (ue_ref_p->enb_ue_s1ap_id != enb_ue_s1ap_id) { + if (ue_ref_p->enb_ue_s1ap_id() != enb_ue_s1ap_id) { OAILOG_DEBUG(LOG_S1AP, "Mismatch in eNB UE S1AP ID, known: " ENB_UE_S1AP_ID_FMT ", received: " ENB_UE_S1AP_ID_FMT "\n", - ue_ref_p->enb_ue_s1ap_id, enb_ue_s1ap_id); + ue_ref_p->enb_ue_s1ap_id(), enb_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } s1ap_imsi_map_t* imsi_map = get_s1ap_imsi_map(); - imsi_map->mme_ueid2imsi_map.get(ue_ref_p->mme_ue_s1ap_id, &imsi64); + imsi_map->mme_ueid2imsi_map.get(ue_ref_p->mme_ue_s1ap_id(), &imsi64); message_p = DEPRECATEDitti_alloc_new_message_fatal(TASK_S1AP, S1AP_E_RAB_SETUP_RSP); - S1AP_E_RAB_SETUP_RSP(message_p).mme_ue_s1ap_id = ue_ref_p->mme_ue_s1ap_id; - S1AP_E_RAB_SETUP_RSP(message_p).enb_ue_s1ap_id = ue_ref_p->enb_ue_s1ap_id; + S1AP_E_RAB_SETUP_RSP(message_p).mme_ue_s1ap_id = ue_ref_p->mme_ue_s1ap_id(); + S1AP_E_RAB_SETUP_RSP(message_p).enb_ue_s1ap_id = ue_ref_p->enb_ue_s1ap_id(); S1AP_E_RAB_SETUP_RSP(message_p).e_rab_setup_list.no_of_items = 0; S1AP_E_RAB_SETUP_RSP(message_p).e_rab_failed_to_setup_list.no_of_items = 0; @@ -4071,8 +4116,8 @@ status_code_e s1ap_mme_handle_enb_reset(s1ap_state_t* state, S1ap_S1AP_PDU_t* pdu) { MessageDef* msg = NULL; itti_s1ap_enb_initiated_reset_req_t* reset_req = NULL; - ue_description_t* ue_ref_p = NULL; - enb_description_t* enb_association = NULL; + oai::UeDescription* ue_ref_p = nullptr; + oai::EnbDescription* enb_association = nullptr; s1ap_reset_type_t s1ap_reset_type; S1ap_Reset_t* container = NULL; S1ap_ResetIEs_t* ie = NULL; @@ -4083,35 +4128,36 @@ status_code_e s1ap_mme_handle_enb_reset(s1ap_state_t* state, arg_s1ap_construct_enb_reset_req_t arg = {0}; uint32_t i = 0; status_code_e rc = RETURNok; + magma::proto_map_uint32_uint64_t ue_id_coll; OAILOG_FUNC_IN(LOG_S1AP); enb_association = s1ap_state_get_enb(state, assoc_id); - if (enb_association == NULL) { + if (enb_association == nullptr) { OAILOG_ERROR(LOG_S1AP, "No eNB attached to this assoc_id: %d\n", assoc_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if (enb_association->s1_state != S1AP_READY) { + if (enb_association->s1_enb_state() != oai::S1AP_READY) { // ignore the message if s1 not ready OAILOG_INFO( LOG_S1AP, "S1 setup is not done.Invalid state.Ignoring ENB Initiated Reset.eNB " "Id " "= %d , S1AP state = %d \n", - enb_association->enb_id, enb_association->s1_state); + enb_association->enb_id(), enb_association->s1_enb_state()); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } - if (enb_association->nb_ue_associated == 0) { + if (enb_association->nb_ue_associated() == 0) { // Even if there are no UEs connected, we proceed -- this can happen if we // receive a reset during a handover procedure, for example. OAILOG_INFO( LOG_S1AP, "No UEs connected, still proceeding with ENB Initiated Reset. eNB Id = " "%d\n", - enb_association->enb_id); + enb_association->enb_id()); } // Check the reset type - partial_reset OR reset_all @@ -4147,7 +4193,7 @@ status_code_e s1ap_mme_handle_enb_reset(s1ap_state_t* state, // TBD - Here MME should send Error Indication as it is abnormal scenario. OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if (reset_count > enb_association->nb_ue_associated) { + if (reset_count > enb_association->nb_ue_associated()) { // We proceed here since we could encounter this situation when we // receive a reset from the target eNB during a handover procedure. OAILOG_WARNING( @@ -4155,7 +4201,7 @@ status_code_e s1ap_mme_handle_enb_reset(s1ap_state_t* state, "Partial Reset Request. Requested number of UEs %d to be reset is " "more " "than connected UEs %d \n", - reset_count, enb_association->nb_ue_associated); + reset_count, enb_association->nb_ue_associated()); } } msg = DEPRECATEDitti_alloc_new_message_fatal(TASK_S1AP, @@ -4163,7 +4209,7 @@ status_code_e s1ap_mme_handle_enb_reset(s1ap_state_t* state, reset_req = &S1AP_ENB_INITIATED_RESET_REQ(msg); reset_req->s1ap_reset_type = s1ap_reset_type; - reset_req->enb_id = enb_association->enb_id; + reset_req->enb_id = enb_association->enb_id(); reset_req->sctp_assoc_id = assoc_id; reset_req->sctp_stream_id = stream; @@ -4171,10 +4217,10 @@ status_code_e s1ap_mme_handle_enb_reset(s1ap_state_t* state, case RESET_ALL: increment_counter("s1_reset_from_enb", 1, 1, "type", "reset_all"); - reset_req->num_ue = enb_association->nb_ue_associated; + reset_req->num_ue = enb_association->nb_ue_associated(); reset_req->ue_to_reset_list = reinterpret_cast( - calloc(enb_association->nb_ue_associated, + calloc(enb_association->nb_ue_associated(), sizeof(*reset_req->ue_to_reset_list))); if (reset_req->ue_to_reset_list == NULL) { @@ -4183,7 +4229,9 @@ status_code_e s1ap_mme_handle_enb_reset(s1ap_state_t* state, } arg.msg = msg; arg.current_ue_index = 0; - enb_association->ue_id_coll.map_apply_callback_on_all_elements( + + ue_id_coll.map = enb_association->mutable_ue_id_map(); + ue_id_coll.map_apply_callback_on_all_elements( construct_s1ap_mme_full_reset_req, &arg, NULL); // EURECOM LG 2020-07-16 added break here break; @@ -4229,17 +4277,17 @@ status_code_e s1ap_mme_handle_enb_reset(s1ap_state_t* state, if (s1_sig_conn_id_p->eNB_UE_S1AP_ID != NULL) { enb_ue_s1ap_id_t enb_ue_s1ap_id = (enb_ue_s1ap_id_t) * (s1_sig_conn_id_p->eNB_UE_S1AP_ID); - if (ue_ref_p->enb_ue_s1ap_id == + if (ue_ref_p->enb_ue_s1ap_id() == (enb_ue_s1ap_id & ENB_UE_S1AP_ID_MASK)) { reset_req->ue_to_reset_list[i].mme_ue_s1ap_id = - ue_ref_p->mme_ue_s1ap_id; + ue_ref_p->mme_ue_s1ap_id(); enb_ue_s1ap_id &= ENB_UE_S1AP_ID_MASK; reset_req->ue_to_reset_list[i].enb_ue_s1ap_id = enb_ue_s1ap_id; } else { // mismatch in enb_ue_s1ap_id sent by eNB and stored in S1AP ue // context in EPC. Abnormal case. reset_req->ue_to_reset_list[i].mme_ue_s1ap_id = - ue_ref_p->mme_ue_s1ap_id; + ue_ref_p->mme_ue_s1ap_id(); reset_req->ue_to_reset_list[i].enb_ue_s1ap_id = (enb_ue_s1ap_id_t) * (s1_sig_conn_id_p->eNB_UE_S1AP_ID); OAILOG_ERROR_UE( @@ -4248,11 +4296,11 @@ status_code_e s1ap_mme_handle_enb_reset(s1ap_state_t* state, "%d " "sent by eNB and id %d stored in epc for mme_ue_s1ap_id %d " "\n", - enb_ue_s1ap_id, ue_ref_p->enb_ue_s1ap_id, mme_ue_s1ap_id); + enb_ue_s1ap_id, ue_ref_p->enb_ue_s1ap_id(), mme_ue_s1ap_id); } } else { reset_req->ue_to_reset_list[i].mme_ue_s1ap_id = - ue_ref_p->mme_ue_s1ap_id; + ue_ref_p->mme_ue_s1ap_id(); reset_req->ue_to_reset_list[i].enb_ue_s1ap_id = INVALID_ENB_UE_S1AP_ID; } @@ -4282,7 +4330,8 @@ status_code_e s1ap_mme_handle_enb_reset(s1ap_state_t* state, enb_ue_s1ap_id = (enb_ue_s1ap_id_t) * (s1_sig_conn_id_p->eNB_UE_S1AP_ID); if ((ue_ref_p = s1ap_state_get_ue_enbid( - enb_association->sctp_assoc_id, enb_ue_s1ap_id)) != NULL) { + enb_association->sctp_assoc_id(), enb_ue_s1ap_id)) != + NULL) { enb_ue_s1ap_id &= ENB_UE_S1AP_ID_MASK; reset_req->ue_to_reset_list[i].enb_ue_s1ap_id = enb_ue_s1ap_id; } else { @@ -4527,7 +4576,7 @@ status_code_e s1ap_handle_paging_request( } /*Fetching eNB list to send paging request message*/ - enb_description_t* enb_ref_p = NULL; + oai::EnbDescription* enb_ref_p = nullptr; if (state == NULL) { OAILOG_ERROR(LOG_S1AP, "eNB Information is NULL!\n"); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); @@ -4539,18 +4588,17 @@ status_code_e s1ap_handle_paging_request( const paging_tai_list_t* p_tai_list = paging_request->paging_tai_list; for (auto itr = state->enbs.map->begin(); itr != state->enbs.map->end(); itr++) { - enb_ref_p = reinterpret_cast(itr->second); + enb_ref_p = reinterpret_cast(itr->second); if (!enb_ref_p) { continue; } - if (enb_ref_p->s1_state == S1AP_READY) { - supported_ta_list_t* enb_ta_list = &enb_ref_p->supported_ta_list; - + if (enb_ref_p->s1_enb_state() == oai::S1AP_READY) { + oai::SupportedTaList enb_ta_list = enb_ref_p->supported_ta_list(); if ((is_tai_found = s1ap_paging_compare_ta_lists( enb_ta_list, p_tai_list, paging_request->tai_list_count))) { bstring paging_msg_buffer = blk2bstr(buffer_p, length); rc = s1ap_mme_itti_send_sctp_request( - &paging_msg_buffer, enb_ref_p->sctp_assoc_id, + &paging_msg_buffer, enb_ref_p->sctp_assoc_id(), 0, // Stream id 0 for non UE related // S1AP message 0); // mme_ue_s1ap_id 0 because UE in idle @@ -4580,7 +4628,7 @@ status_code_e s1ap_mme_handle_erab_modification_indication( status_code_e rc = RETURNok; S1ap_E_RABModificationIndication_t* container = NULL; S1ap_E_RABModificationIndicationIEs_t* ie = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; MessageDef* message_p = NULL; container = @@ -4598,28 +4646,29 @@ status_code_e s1ap_mme_handle_erab_modification_indication( enb_ue_s1ap_id = (enb_ue_s1ap_id_t)(ie->value.choice.ENB_UE_S1AP_ID & ENB_UE_S1AP_ID_MASK); - if ((ue_ref_p = s1ap_state_get_ue_mmeid((uint32_t)mme_ue_s1ap_id)) == NULL) { - OAILOG_DEBUG(LOG_S1AP, + if ((ue_ref_p = s1ap_state_get_ue_mmeid((uint32_t)mme_ue_s1ap_id)) == + nullptr) { + OAILOG_ERROR(LOG_S1AP, "No UE is attached to this mme UE s1ap id: " MME_UE_S1AP_ID_FMT " %u(10)\n", (uint32_t)mme_ue_s1ap_id, (uint32_t)mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if (ue_ref_p->enb_ue_s1ap_id != enb_ue_s1ap_id) { + if (ue_ref_p->enb_ue_s1ap_id() != enb_ue_s1ap_id) { OAILOG_DEBUG(LOG_S1AP, "Mismatch in eNB UE S1AP ID, known: " ENB_UE_S1AP_ID_FMT ", received: " ENB_UE_S1AP_ID_FMT "\n", - ue_ref_p->enb_ue_s1ap_id, enb_ue_s1ap_id); + ue_ref_p->enb_ue_s1ap_id(), enb_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } message_p = DEPRECATEDitti_alloc_new_message_fatal( TASK_S1AP, S1AP_E_RAB_MODIFICATION_IND); S1AP_E_RAB_MODIFICATION_IND(message_p).mme_ue_s1ap_id = - ue_ref_p->mme_ue_s1ap_id; + ue_ref_p->mme_ue_s1ap_id(); S1AP_E_RAB_MODIFICATION_IND(message_p).enb_ue_s1ap_id = - ue_ref_p->enb_ue_s1ap_id; + ue_ref_p->enb_ue_s1ap_id(); /** Get the bearers to be modified. */ S1AP_FIND_PROTOCOLIE_BY_ID( @@ -4736,7 +4785,7 @@ void s1ap_mme_generate_erab_modification_confirm( s1ap_state_t* state, const itti_s1ap_e_rab_modification_cnf_t* const conf) { uint8_t* buffer_p = NULL; uint32_t length = 0; - ue_description_t* ue_ref = NULL; + oai::UeDescription* ue_ref = nullptr; S1ap_S1AP_PDU_t pdu = {S1ap_S1AP_PDU_PR_NOTHING, {0}}; S1ap_E_RABModificationConfirm_t* out; S1ap_E_RABModificationConfirmIEs_t* ie = NULL; @@ -4744,7 +4793,7 @@ void s1ap_mme_generate_erab_modification_confirm( OAILOG_FUNC_IN(LOG_S1AP); DevAssert(conf != NULL); - if ((ue_ref = s1ap_state_get_ue_mmeid(conf->mme_ue_s1ap_id)) == NULL) { + if ((ue_ref = s1ap_state_get_ue_mmeid(conf->mme_ue_s1ap_id)) == nullptr) { OAILOG_ERROR(LOG_S1AP, "This mme ue s1ap id (" MME_UE_S1AP_ID_FMT ") is not attached to any UE context\n", @@ -4819,13 +4868,13 @@ void s1ap_mme_generate_erab_modification_confirm( LOG_S1AP, "Send S1AP E_RAB_MODIFICATION_CONFIRM Command message MME_UE_S1AP_ID " "= " MME_UE_S1AP_ID_FMT " eNB_UE_S1AP_ID = " ENB_UE_S1AP_ID_FMT "\n", - (mme_ue_s1ap_id_t)ue_ref->mme_ue_s1ap_id, - (enb_ue_s1ap_id_t)ue_ref->enb_ue_s1ap_id); + (mme_ue_s1ap_id_t)ue_ref->mme_ue_s1ap_id(), + (enb_ue_s1ap_id_t)ue_ref->enb_ue_s1ap_id()); bstring b = blk2bstr(buffer_p, length); free(buffer_p); - s1ap_mme_itti_send_sctp_request(&b, ue_ref->sctp_assoc_id, - ue_ref->sctp_stream_send, - ue_ref->mme_ue_s1ap_id); + s1ap_mme_itti_send_sctp_request(&b, ue_ref->sctp_assoc_id(), + ue_ref->sctp_stream_send(), + ue_ref->mme_ue_s1ap_id()); OAILOG_FUNC_OUT(LOG_S1AP); } @@ -4837,8 +4886,8 @@ status_code_e s1ap_mme_handle_enb_configuration_transfer( S1ap_ENBConfigurationTransferIEs_t* ie = NULL; S1ap_TargeteNB_ID_t* targeteNB_ID = NULL; uint8_t* enb_id_buf = NULL; - enb_description_t* enb_association = NULL; - enb_description_t* target_enb_association = NULL; + oai::EnbDescription* enb_association = nullptr; + oai::EnbDescription* target_enb_association = nullptr; uint32_t target_enb_id = 0; uint8_t* buffer = NULL; uint32_t length = 0; @@ -4857,20 +4906,20 @@ status_code_e s1ap_mme_handle_enb_configuration_transfer( OAILOG_DEBUG(LOG_S1AP, "Received eNB Confiuration Request from assoc_id %u\n", assoc_id); enb_association = s1ap_state_get_enb(state, assoc_id); - if (enb_association == NULL) { + if (enb_association == nullptr) { OAILOG_ERROR(LOG_S1AP, "Ignoring eNB Confiuration Request from unknown assoc %u\n", assoc_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if (enb_association->s1_state != S1AP_READY) { + if (enb_association->s1_enb_state() != oai::S1AP_READY) { // ignore the message if s1 not ready OAILOG_INFO( LOG_S1AP, "S1 setup is not done.Invalid state.Ignoring eNB Configuration Request " "eNB Id = %d , S1AP state = %d \n", - enb_association->enb_id, enb_association->s1_state); + enb_association->enb_id(), enb_association->s1_enb_state()); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } @@ -4900,11 +4949,11 @@ status_code_e s1ap_mme_handle_enb_configuration_transfer( if (!target_enb_association) { continue; } - if (target_enb_association->enb_id == target_enb_id) { + if (target_enb_association->enb_id() == target_enb_id) { break; } } - if (target_enb_association->enb_id != target_enb_id) { + if (target_enb_association->enb_id() != target_enb_id) { OAILOG_ERROR(LOG_S1AP, "No eNB for enb_id %d\n", target_enb_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } @@ -4931,7 +4980,7 @@ status_code_e s1ap_mme_handle_enb_configuration_transfer( // Send message rc = s1ap_mme_itti_send_sctp_request( - &b, target_enb_association->sctp_assoc_id, + &b, target_enb_association->sctp_assoc_id(), 0, // Stream id 0 for non UE related S1AP message 0); // mme_ue_s1ap_id 0 because UE in idle @@ -5001,15 +5050,15 @@ status_code_e s1ap_handle_path_switch_req_ack( uint8_t* buffer = NULL; uint32_t length = 0; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; S1ap_S1AP_PDU_t pdu = {S1ap_S1AP_PDU_PR_NOTHING, {0}}; S1ap_PathSwitchRequestAcknowledge_t* out = NULL; S1ap_PathSwitchRequestAcknowledgeIEs_t* ie = NULL; status_code_e rc = RETURNok; if ((ue_ref_p = s1ap_state_get_ue_mmeid( - path_switch_req_ack_p->mme_ue_s1ap_id)) == NULL) { - OAILOG_DEBUG_UE( + path_switch_req_ack_p->mme_ue_s1ap_id)) == nullptr) { + OAILOG_ERROR_UE( LOG_S1AP, imsi64, "could not get ue context for mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT "\n", (uint32_t)path_switch_req_ack_p->mme_ue_s1ap_id); @@ -5031,7 +5080,7 @@ status_code_e s1ap_handle_path_switch_req_ack( ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_PathSwitchRequestAcknowledgeIEs__value_PR_MME_UE_S1AP_ID; - ie->value.choice.MME_UE_S1AP_ID = ue_ref_p->mme_ue_s1ap_id; + ie->value.choice.MME_UE_S1AP_ID = ue_ref_p->mme_ue_s1ap_id(); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -5041,7 +5090,7 @@ status_code_e s1ap_handle_path_switch_req_ack( ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_PathSwitchRequestAcknowledgeIEs__value_PR_ENB_UE_S1AP_ID; - ie->value.choice.ENB_UE_S1AP_ID = ue_ref_p->enb_ue_s1ap_id; + ie->value.choice.ENB_UE_S1AP_ID = ue_ref_p->enb_ue_s1ap_id(); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /** Add the security context. */ @@ -5080,7 +5129,7 @@ status_code_e s1ap_handle_path_switch_req_ack( (uint32_t)path_switch_req_ack_p->mme_ue_s1ap_id); rc = s1ap_mme_itti_send_sctp_request(&b, path_switch_req_ack_p->sctp_assoc_id, - ue_ref_p->sctp_stream_send, + ue_ref_p->sctp_stream_send(), path_switch_req_ack_p->mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, rc); @@ -5092,7 +5141,7 @@ status_code_e s1ap_handle_path_switch_req_failure( S1ap_PathSwitchRequestFailure_t* container = NULL; uint8_t* buffer = NULL; uint32_t length = 0; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; S1ap_S1AP_PDU_t pdu = {S1ap_S1AP_PDU_PR_NOTHING, {0}}; S1ap_PathSwitchRequestFailureIEs_t* ie = NULL; status_code_e rc = RETURNok; @@ -5101,8 +5150,8 @@ status_code_e s1ap_handle_path_switch_req_failure( mme_ue_s1ap_id = path_switch_req_failure_p->mme_ue_s1ap_id; ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id); - if (ue_ref_p == NULL) { - OAILOG_DEBUG_UE( + if (ue_ref_p == nullptr) { + OAILOG_ERROR_UE( LOG_S1AP, imsi64, "could not get ue context for mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT "\n", mme_ue_s1ap_id); @@ -5154,21 +5203,21 @@ status_code_e s1ap_handle_path_switch_req_failure( (uint32_t)path_switch_req_failure_p->mme_ue_s1ap_id); rc = s1ap_mme_itti_send_sctp_request( - &b, path_switch_req_failure_p->sctp_assoc_id, ue_ref_p->sctp_stream_send, - path_switch_req_failure_p->mme_ue_s1ap_id); + &b, path_switch_req_failure_p->sctp_assoc_id, + ue_ref_p->sctp_stream_send(), path_switch_req_failure_p->mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, rc); } -const char* s1_enb_state2str(enum mme_s1_enb_state_s state) { +const char* s1_enb_state2str(oai::S1apEnbState state) { switch (state) { - case S1AP_INIT: + case oai::S1AP_INIT: return "S1AP_INIT"; - case S1AP_RESETING: + case oai::S1AP_RESETING: return "S1AP_RESETING"; - case S1AP_READY: + case oai::S1AP_READY: return "S1AP_READY"; - case S1AP_SHUTDOWN: + case oai::S1AP_SHUTDOWN: return "S1AP_SHUTDOWN"; default: return "unknown s1ap_enb_state"; @@ -5198,7 +5247,7 @@ status_code_e s1ap_mme_handle_erab_rel_response(s1ap_state_t* state, OAILOG_FUNC_IN(LOG_S1AP); S1ap_E_RABReleaseResponseIEs_t* ie = NULL; S1ap_E_RABReleaseResponse_t* container = NULL; - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; MessageDef* message_p = NULL; status_code_e rc = RETURNok; imsi64_t imsi64 = INVALID_IMSI64; @@ -5211,8 +5260,8 @@ status_code_e s1ap_mme_handle_erab_rel_response(s1ap_state_t* state, S1ap_ProtocolIE_ID_id_MME_UE_S1AP_ID, true); mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; - if ((ie) && - (ue_ref_p = s1ap_state_get_ue_mmeid((uint32_t)mme_ue_s1ap_id)) == NULL) { + if ((ie) && (ue_ref_p = s1ap_state_get_ue_mmeid((uint32_t)mme_ue_s1ap_id)) == + nullptr) { OAILOG_ERROR(LOG_S1AP, "No UE is attached to this mme UE s1ap id: " MME_UE_S1AP_ID_FMT "\n", @@ -5226,11 +5275,11 @@ status_code_e s1ap_mme_handle_erab_rel_response(s1ap_state_t* state, enb_ue_s1ap_id = (enb_ue_s1ap_id_t)(ie->value.choice.ENB_UE_S1AP_ID & ENB_UE_S1AP_ID_MASK); - if ((ie) && ue_ref_p->enb_ue_s1ap_id != enb_ue_s1ap_id) { + if ((ie) && ue_ref_p->enb_ue_s1ap_id() != enb_ue_s1ap_id) { OAILOG_ERROR(LOG_S1AP, "Mismatch in eNB UE S1AP ID, known: " ENB_UE_S1AP_ID_FMT ", received: " ENB_UE_S1AP_ID_FMT "\n", - ue_ref_p->enb_ue_s1ap_id, (enb_ue_s1ap_id_t)enb_ue_s1ap_id); + ue_ref_p->enb_ue_s1ap_id(), (enb_ue_s1ap_id_t)enb_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } @@ -5242,8 +5291,8 @@ status_code_e s1ap_mme_handle_erab_rel_response(s1ap_state_t* state, OAILOG_ERROR(LOG_S1AP, "itti_alloc_new_message Failed\n"); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - S1AP_E_RAB_REL_RSP(message_p).mme_ue_s1ap_id = ue_ref_p->mme_ue_s1ap_id; - S1AP_E_RAB_REL_RSP(message_p).enb_ue_s1ap_id = ue_ref_p->enb_ue_s1ap_id; + S1AP_E_RAB_REL_RSP(message_p).mme_ue_s1ap_id = ue_ref_p->mme_ue_s1ap_id(); + S1AP_E_RAB_REL_RSP(message_p).enb_ue_s1ap_id = ue_ref_p->enb_ue_s1ap_id(); S1AP_E_RAB_REL_RSP(message_p).e_rab_rel_list.no_of_items = 0; S1AP_E_RAB_REL_RSP(message_p).e_rab_failed_to_rel_list.no_of_items = 0; @@ -5304,7 +5353,7 @@ status_code_e s1ap_mme_remove_stale_ue_context(enb_ue_s1ap_id_t enb_ue_s1ap_id, } status_code_e s1ap_send_mme_ue_context_release(s1ap_state_t* state, - ue_description_t* ue_ref_p, + oai::UeDescription* ue_ref_p, enum s1cause s1_release_cause, S1ap_Cause_t ie_cause, imsi64_t imsi64) { @@ -5317,14 +5366,14 @@ status_code_e s1ap_send_mme_ue_context_release(s1ap_state_t* state, OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - enb_description_t* enb_ref_p = - s1ap_state_get_enb(state, ue_ref_p->sctp_assoc_id); + oai::EnbDescription* enb_ref_p = + s1ap_state_get_enb(state, ue_ref_p->sctp_assoc_id()); S1AP_UE_CONTEXT_RELEASE_REQ(message_p).mme_ue_s1ap_id = - ue_ref_p->mme_ue_s1ap_id; + ue_ref_p->mme_ue_s1ap_id(); S1AP_UE_CONTEXT_RELEASE_REQ(message_p).enb_ue_s1ap_id = - ue_ref_p->enb_ue_s1ap_id; - S1AP_UE_CONTEXT_RELEASE_REQ(message_p).enb_id = enb_ref_p->enb_id; + ue_ref_p->enb_ue_s1ap_id(); + S1AP_UE_CONTEXT_RELEASE_REQ(message_p).enb_id = enb_ref_p->enb_id(); S1AP_UE_CONTEXT_RELEASE_REQ(message_p).relCause = s1_release_cause; S1AP_UE_CONTEXT_RELEASE_REQ(message_p).cause = ie_cause; @@ -5336,7 +5385,7 @@ status_code_e s1ap_send_mme_ue_context_release(s1ap_state_t* state, static int handle_ue_context_rel_timer_expiry(zloop_t* loop, int timer_id, void* arg) { OAILOG_FUNC_IN(LOG_S1AP); - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; mme_ue_s1ap_id_t mme_ue_s1ap_id = 0; imsi64_t imsi64 = INVALID_IMSI64; s1ap_state_t* state = NULL; @@ -5346,7 +5395,7 @@ static int handle_ue_context_rel_timer_expiry(zloop_t* loop, int timer_id, // Timer handlers need to return 0 to avoid triggering ZMQ thread exit OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } - if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((ue_ref_p = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { OAILOG_ERROR( LOG_S1AP, "Failed to find UE context for mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT, @@ -5356,15 +5405,79 @@ static int handle_ue_context_rel_timer_expiry(zloop_t* loop, int timer_id, } state = get_s1ap_state(false); - ue_ref_p->s1ap_ue_context_rel_timer.id = S1AP_TIMER_INACTIVE_ID; + ue_ref_p->mutable_s1ap_ue_context_rel_timer()->set_id(S1AP_TIMER_INACTIVE_ID); s1ap_imsi_map_t* imsi_map = get_s1ap_imsi_map(); imsi_map->mme_ueid2imsi_map.get(mme_ue_s1ap_id, &imsi64); OAILOG_DEBUG_UE(LOG_S1AP, imsi64, "Expired- UE Context Release Timer for " "mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT, - ue_ref_p->mme_ue_s1ap_id); + ue_ref_p->mme_ue_s1ap_id()); // Remove UE context and inform MME_APP. s1ap_mme_release_ue_context(state, ue_ref_p, imsi64); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } + +// Frees the contents of pointer, called while freeing an entry from protobuf +// map +void free_enb_description(void** ptr) { + OAILOG_FUNC_IN(LOG_S1AP); + if (!ptr) { + OAILOG_ERROR(LOG_S1AP, "Received null pointer"); + OAILOG_FUNC_OUT(LOG_S1AP); + } + oai::EnbDescription* enb_context_p = + reinterpret_cast(*ptr); + if (!enb_context_p) { + OAILOG_ERROR(LOG_S1AP, "Received nullptr for enb context"); + OAILOG_FUNC_OUT(LOG_S1AP); + } + if (enb_context_p->ue_id_map_size()) { + enb_context_p->clear_ue_id_map(); + } + if (enb_context_p->has_supported_ta_list()) { + if (enb_context_p->supported_ta_list().supported_tai_items_size()) { + for (int idx = 0; + idx < enb_context_p->supported_ta_list().supported_tai_items_size(); + idx++) { + if (enb_context_p->supported_ta_list() + .supported_tai_items(idx) + .bplmns_size()) { + enb_context_p->mutable_supported_ta_list() + ->mutable_supported_tai_items(idx) + ->clear_bplmns(); + } + } + enb_context_p->mutable_supported_ta_list()->clear_supported_tai_items(); + } + enb_context_p->clear_supported_ta_list(); + } + delete enb_context_p; + *ptr = nullptr; + OAILOG_FUNC_IN(LOG_S1AP); +} + +// Frees the contents of UE context, called while freeing an entry from protobuf +// map +void free_ue_description(void** ptr) { + if (ptr) { + oai::UeDescription* ue_context_p = + reinterpret_cast(*ptr); + if ((ue_context_p)->has_s1ap_ue_context_rel_timer()) { + ue_context_p->clear_s1ap_ue_context_rel_timer(); + } + if ((ue_context_p)->has_s1ap_handover_state()) { + if ((ue_context_p)->s1ap_handover_state().has_e_rab_admitted_list()) { + (ue_context_p) + ->mutable_s1ap_handover_state() + ->clear_e_rab_admitted_list(); + } + ue_context_p->clear_s1ap_handover_state(); + } + delete ue_context_p; + *ptr = nullptr; + } +} + +} // namespace lte +} // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_handlers.hpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_handlers.hpp index 158971d7ca4e..a221cbe42c86 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_handlers.hpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_handlers.hpp @@ -15,8 +15,8 @@ * contact@openairinterface.org */ -#ifndef FILE_S1AP_MME_HANDLERS_SEEN -#define FILE_S1AP_MME_HANDLERS_SEEN +#pragma once + #include #include "S1ap_Cause.h" @@ -27,9 +27,12 @@ #include "lte/gateway/c/core/oai/lib/itti/intertask_interface.h" #include "lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme.hpp" +namespace magma { +namespace lte { + #define MAX_NUM_PARTIAL_S1_CONN_RESET 256 -const char* s1_enb_state2str(enum mme_s1_enb_state_s state); +const char* s1_enb_state2str(enum magma::lte::oai::S1apEnbState state); const char* s1ap_direction2str(uint8_t dir); /** \brief Handle decoded incoming messages from SCTP @@ -155,7 +158,7 @@ status_code_e s1ap_mme_handle_erab_setup_failure(s1ap_state_t* state, S1ap_S1AP_PDU_t* message); void s1ap_mme_release_ue_context(s1ap_state_t* state, - ue_description_t* ue_ref_p, imsi64_t imsi64); + oai::UeDescription* ue_ref_p, imsi64_t imsi64); status_code_e s1ap_mme_handle_error_ind_message(s1ap_state_t* state, const sctp_assoc_id_t assoc_id, @@ -209,12 +212,12 @@ void s1ap_mme_generate_erab_modification_confirm( s1ap_state_t* state, const itti_s1ap_e_rab_modification_cnf_t* const conf); status_code_e s1ap_mme_generate_ue_context_release_command( - s1ap_state_t* state, ue_description_t* ue_ref_p, enum s1cause, + s1ap_state_t* state, oai::UeDescription* ue_ref_p, enum s1cause, imsi64_t imsi64, sctp_assoc_id_t assoc_id, sctp_stream_id_t stream, mme_ue_s1ap_id_t mme_ue_s1ap_id, enb_ue_s1ap_id_t enb_ue_s1ap_id); status_code_e s1ap_mme_generate_ue_context_modification( - ue_description_t* ue_ref_p, + oai::UeDescription* ue_ref_p, const itti_s1ap_ue_context_mod_req_t* const ue_context_mod_req_pP, imsi64_t imsi64); @@ -222,8 +225,10 @@ status_code_e s1ap_mme_remove_stale_ue_context(enb_ue_s1ap_id_t enb_ue_s1ap_id, uint32_t enb_id); status_code_e s1ap_send_mme_ue_context_release(s1ap_state_t* state, - ue_description_t* ue_ref_p, + oai::UeDescription* ue_ref_p, enum s1cause s1_release_cause, S1ap_Cause_t ie_cause, imsi64_t imsi64); -#endif /* FILE_S1AP_MME_HANDLERS_SEEN */ + +} // namespace lte +} // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_itti_messaging.cpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_itti_messaging.cpp index 625f9a6f0e71..dfe7bb429d2c 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_itti_messaging.cpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_itti_messaging.cpp @@ -40,6 +40,9 @@ extern "C" { #include "lte/gateway/c/core/oai/include/s1ap_messages_types.h" #include "lte/gateway/c/core/oai/include/sctp_messages_types.h" +namespace magma { +namespace lte { + //------------------------------------------------------------------------------ status_code_e s1ap_mme_itti_send_sctp_request(STOLEN_REF bstring* payload, const sctp_assoc_id_t assoc_id, @@ -368,7 +371,7 @@ status_code_e s1ap_mme_itti_s1ap_handover_request_ack( status_code_e s1ap_mme_itti_s1ap_handover_notify( const mme_ue_s1ap_id_t mme_ue_s1ap_id, - const s1ap_handover_state_t handover_state, + const oai::S1apHandoverState handover_state, const enb_ue_s1ap_id_t target_enb_ue_s1ap_id, const sctp_assoc_id_t target_sctp_assoc_id, const ecgi_t ecgi, imsi64_t imsi64) { @@ -380,14 +383,29 @@ status_code_e s1ap_mme_itti_s1ap_handover_notify( } S1AP_HANDOVER_NOTIFY(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id; - S1AP_HANDOVER_NOTIFY(message_p).target_enb_id = handover_state.target_enb_id; + S1AP_HANDOVER_NOTIFY(message_p).target_enb_id = + handover_state.target_enb_id(); S1AP_HANDOVER_NOTIFY(message_p).target_sctp_assoc_id = target_sctp_assoc_id; S1AP_HANDOVER_NOTIFY(message_p).ecgi = ecgi; S1AP_HANDOVER_NOTIFY(message_p).target_enb_ue_s1ap_id = target_enb_ue_s1ap_id; - S1AP_HANDOVER_NOTIFY(message_p).e_rab_admitted_list = - handover_state.e_rab_admitted_list; + e_rab_admitted_list_t* e_rab_admitted_list = + &S1AP_HANDOVER_NOTIFY(message_p).e_rab_admitted_list; + e_rab_admitted_list->no_of_items = + handover_state.e_rab_admitted_list().no_of_items(); + for (uint8_t idx = 0; idx < e_rab_admitted_list->no_of_items; idx++) { + const oai::ERabAdmittedItem& proto_e_rab_item = + handover_state.e_rab_admitted_list().item(idx); + e_rab_admitted_list->item[idx].e_rab_id = proto_e_rab_item.e_rab_id(); + e_rab_admitted_list->item[idx].transport_layer_address = + blk2bstr(proto_e_rab_item.transport_layer_address().c_str(), + proto_e_rab_item.transport_layer_address().length()); + e_rab_admitted_list->item[idx].gtp_teid = proto_e_rab_item.gtp_teid(); + } message_p->ittiMsgHeader.imsi = imsi64; send_msg_to_task(&s1ap_task_zmq_ctx, TASK_MME_APP, message_p); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } + +} // namespace lte +} // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_itti_messaging.hpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_itti_messaging.hpp index 1b34ef9ccd70..67d130d4c588 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_itti_messaging.hpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_itti_messaging.hpp @@ -22,8 +22,7 @@ \email: lionel.gauthier@eurecom.fr */ -#ifndef FILE_S1AP_MME_ITTI_MESSAGING_SEEN -#define FILE_S1AP_MME_ITTI_MESSAGING_SEEN +#pragma once #include #include @@ -41,6 +40,9 @@ #include "lte/gateway/c/core/oai/include/s1ap_state.hpp" +namespace magma { +namespace lte { + extern task_zmq_ctx_t s1ap_task_zmq_ctx; extern long s1ap_last_msg_latency; @@ -100,8 +102,10 @@ status_code_e s1ap_mme_itti_s1ap_handover_request_ack( status_code_e s1ap_mme_itti_s1ap_handover_notify( const mme_ue_s1ap_id_t mme_ue_s1ap_id, - const s1ap_handover_state_t handover_state, + const oai::S1apHandoverState handover_state, const enb_ue_s1ap_id_t target_ue_s1ap_id, const sctp_assoc_id_t target_sctp_assoc_id, const ecgi_t ecgi, imsi64_t imsi64); -#endif /* FILE_S1AP_MME_ITTI_MESSAGING_SEEN */ + +} // namespace lte +} // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_nas_procedures.cpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_nas_procedures.cpp index d99c323a9831..62ce8cf28c69 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_nas_procedures.cpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_nas_procedures.cpp @@ -83,10 +83,13 @@ extern "C" { #define EXT_UE_AMBR_UL 10000000000 #define EXT_UE_AMBR_DL 10000000000 + +namespace magma { +namespace lte { + extern bool s1ap_congestion_control_enabled; extern long s1ap_last_msg_latency; extern long s1ap_zmq_th; - //------------------------------------------------------------------------------ status_code_e s1ap_mme_handle_initial_ue_message(s1ap_state_t* state, const sctp_assoc_id_t assoc_id, @@ -95,8 +98,8 @@ status_code_e s1ap_mme_handle_initial_ue_message(s1ap_state_t* state, S1ap_InitialUEMessage_t* container = NULL; S1ap_InitialUEMessage_IEs_t *ie = NULL, *ie_e_tmsi = NULL, *ie_csg_id = NULL, *ie_gummei = NULL, *ie_cause = NULL; - ue_description_t* ue_ref = NULL; - enb_description_t* eNB_ref = NULL; + oai::UeDescription* ue_ref = nullptr; + oai::EnbDescription* eNB_ref = nullptr; enb_ue_s1ap_id_t enb_ue_s1ap_id = INVALID_ENB_UE_S1AP_ID; OAILOG_FUNC_IN(LOG_S1AP); @@ -121,7 +124,7 @@ status_code_e s1ap_mme_handle_initial_ue_message(s1ap_state_t* state, OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } - if ((eNB_ref = s1ap_state_get_enb(state, assoc_id)) == NULL) { + if ((eNB_ref = s1ap_state_get_enb(state, assoc_id)) == nullptr) { OAILOG_ERROR(LOG_S1AP, "Unknown eNB on assoc_id %d\n", assoc_id); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } @@ -132,10 +135,10 @@ status_code_e s1ap_mme_handle_initial_ue_message(s1ap_state_t* state, LOG_S1AP, "New Initial UE message received with eNB UE S1AP ID: " ENB_UE_S1AP_ID_FMT " assoc-id :%d \n", - enb_ue_s1ap_id, eNB_ref->sctp_assoc_id); - ue_ref = s1ap_state_get_ue_enbid(eNB_ref->sctp_assoc_id, enb_ue_s1ap_id); + enb_ue_s1ap_id, eNB_ref->sctp_assoc_id()); + ue_ref = s1ap_state_get_ue_enbid(eNB_ref->sctp_assoc_id(), enb_ue_s1ap_id); - if (ue_ref == NULL) { + if (ue_ref == nullptr) { tai_t tai = {0}; gummei_t gummei = {0}; s_tmsi_t s_tmsi = {.mme_code = 0, .m_tmsi = INVALID_M_TMSI}; @@ -148,7 +151,7 @@ status_code_e s1ap_mme_handle_initial_ue_message(s1ap_state_t* state, * * * * Update eNB UE list. * * * * Forward message to NAS. */ - if ((ue_ref = s1ap_new_ue(state, assoc_id, enb_ue_s1ap_id)) == NULL) { + if ((ue_ref = s1ap_new_ue(state, assoc_id, enb_ue_s1ap_id)) == nullptr) { // If we failed to allocate a new UE return -1 OAILOG_ERROR(LOG_S1AP, "Initial UE Message- Failed to allocate S1AP UE Context, " @@ -159,19 +162,19 @@ status_code_e s1ap_mme_handle_initial_ue_message(s1ap_state_t* state, OAILOG_DEBUG(LOG_S1AP, "Creating new UE Ref on S1ap"); - ue_ref->s1_ue_state = S1AP_UE_WAITING_CSR; + ue_ref->set_s1ap_ue_state(oai::S1AP_UE_WAITING_ICSR); - ue_ref->enb_ue_s1ap_id = enb_ue_s1ap_id; + ue_ref->set_enb_ue_s1ap_id(enb_ue_s1ap_id); // Will be allocated by NAS - ue_ref->mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; + ue_ref->set_mme_ue_s1ap_id(INVALID_MME_UE_S1AP_ID); - ue_ref->s1ap_ue_context_rel_timer.id = S1AP_TIMER_INACTIVE_ID; - ue_ref->s1ap_ue_context_rel_timer.msec = - 1000 * S1AP_UE_CONTEXT_REL_COMP_TIMER; + ue_ref->mutable_s1ap_ue_context_rel_timer()->set_id(S1AP_TIMER_INACTIVE_ID); + ue_ref->mutable_s1ap_ue_context_rel_timer()->set_msec( + 1000 * S1AP_UE_CONTEXT_REL_COMP_TIMER); // On which stream we received the message - ue_ref->sctp_stream_recv = stream; - ue_ref->sctp_stream_send = eNB_ref->next_sctp_stream; + ue_ref->set_sctp_stream_recv(stream); + ue_ref->set_sctp_stream_send(eNB_ref->next_sctp_stream()); /* * Increment the sctp stream for the eNB association. @@ -184,9 +187,9 @@ status_code_e s1ap_mme_handle_initial_ue_message(s1ap_state_t* state, * TODO task#15456359. * Below logic seems to be incorrect , revisit it. */ - eNB_ref->next_sctp_stream += 1; - if (eNB_ref->next_sctp_stream >= eNB_ref->instreams) { - eNB_ref->next_sctp_stream = 1; + eNB_ref->set_next_sctp_stream(eNB_ref->next_sctp_stream() + 1); + if (eNB_ref->next_sctp_stream() >= eNB_ref->instreams()) { + eNB_ref->set_next_sctp_stream(1); } // TAI mandatory IE S1AP_FIND_PROTOCOLIE_BY_ID(S1ap_InitialUEMessage_IEs_t, ie, container, @@ -210,7 +213,7 @@ status_code_e s1ap_mme_handle_initial_ue_message(s1ap_state_t* state, ecgi.cell_identity); /** Set the ENB Id. */ - ecgi.cell_identity.enb_id = eNB_ref->enb_id; + ecgi.cell_identity.enb_id = eNB_ref->enb_id(); S1AP_FIND_PROTOCOLIE_BY_ID(S1ap_InitialUEMessage_IEs_t, ie_e_tmsi, container, S1ap_ProtocolIE_ID_id_S_TMSI, false); @@ -247,7 +250,7 @@ status_code_e s1ap_mme_handle_initial_ue_message(s1ap_state_t* state, S1ap_ProtocolIE_ID_id_RRC_Establishment_Cause, true); s1ap_mme_itti_s1ap_initial_ue_message( - assoc_id, eNB_ref->enb_id, ue_ref->enb_ue_s1ap_id, + assoc_id, eNB_ref->enb_id(), ue_ref->enb_ue_s1ap_id(), ie->value.choice.NAS_PDU.buf, ie->value.choice.NAS_PDU.size, &tai, &ecgi, ie_cause->value.choice.RRC_Establishment_Cause, ie_e_tmsi ? &s_tmsi : NULL, ie_csg_id ? &csg_id : NULL, @@ -260,14 +263,14 @@ status_code_e s1ap_mme_handle_initial_ue_message(s1ap_state_t* state, } else { imsi64_t imsi64 = INVALID_IMSI64; s1ap_imsi_map_t* s1ap_imsi_map = get_s1ap_imsi_map(); - s1ap_imsi_map->mme_ueid2imsi_map.get(ue_ref->mme_ue_s1ap_id, &imsi64); + s1ap_imsi_map->mme_ueid2imsi_map.get(ue_ref->mme_ue_s1ap_id(), &imsi64); OAILOG_ERROR_UE( LOG_S1AP, imsi64, "Initial UE Message- Duplicate ENB_UE_S1AP_ID. Ignoring the " "message, eNB UE S1AP ID:" ENB_UE_S1AP_ID_FMT "\n, mme UE s1ap ID: " MME_UE_S1AP_ID_FMT "UE state %u", - enb_ue_s1ap_id, ue_ref->mme_ue_s1ap_id, ue_ref->s1_ue_state); + enb_ue_s1ap_id, ue_ref->mme_ue_s1ap_id(), ue_ref->s1ap_ue_state()); } OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); @@ -280,8 +283,8 @@ status_code_e s1ap_mme_handle_uplink_nas_transport( S1ap_S1AP_PDU_t* pdu) { S1ap_UplinkNASTransport_t* container = NULL; S1ap_UplinkNASTransport_IEs_t *ie, *ie_nas_pdu = NULL; - ue_description_t* ue_ref = NULL; - enb_description_t* enb_ref = NULL; + oai::UeDescription* ue_ref = nullptr; + oai::EnbDescription* enb_ref = nullptr; tai_t tai = {0}; ecgi_t ecgi = {.plmn = {0}, .cell_identity = {0}}; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; @@ -299,7 +302,7 @@ status_code_e s1ap_mme_handle_uplink_nas_transport( mme_ue_s1ap_id = (mme_ue_s1ap_id_t)ie->value.choice.MME_UE_S1AP_ID; enb_ref = s1ap_state_get_enb(state, assoc_id); - if (enb_ref == NULL) { + if (enb_ref == nullptr) { OAILOG_ERROR(LOG_S1AP, "No eNB reference exists for association id %d\n", assoc_id); return RETURNerror; @@ -310,7 +313,7 @@ status_code_e s1ap_mme_handle_uplink_nas_transport( LOG_S1AP, "Received S1AP UPLINK_NAS_TRANSPORT message MME_UE_S1AP_ID unknown\n"); - if (!(ue_ref = s1ap_state_get_ue_enbid(enb_ref->sctp_assoc_id, + if (!(ue_ref = s1ap_state_get_ue_enbid(enb_ref->sctp_assoc_id(), enb_ue_s1ap_id))) { OAILOG_WARNING( LOG_S1AP, @@ -341,12 +344,12 @@ status_code_e s1ap_mme_handle_uplink_nas_transport( /* If UE context doesn't exist for received mme_ue_s1ap_id * remove the corresponding enb_ue_s1ap_id_key entry in mme_app */ - s1ap_mme_remove_stale_ue_context(enb_ue_s1ap_id, enb_ref->enb_id); + s1ap_mme_remove_stale_ue_context(enb_ue_s1ap_id, enb_ref->enb_id()); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } } - if (ue_ref->s1_ue_state != S1AP_UE_CONNECTED) { + if (ue_ref->s1ap_ue_state() != oai::S1AP_UE_CONNECTED) { OAILOG_WARNING(LOG_S1AP, "Received S1AP UPLINK_NAS_TRANSPORT while UE in state != " "S1AP_UE_CONNECTED\n"); @@ -377,7 +380,7 @@ status_code_e s1ap_mme_handle_uplink_nas_transport( BIT_STRING_TO_CELL_IDENTITY(&ie->value.choice.EUTRAN_CGI.cell_ID, ecgi.cell_identity); // set the eNB ID - ecgi.cell_identity.enb_id = enb_ref->enb_id; + ecgi.cell_identity.enb_id = enb_ref->enb_id(); // TODO optional GW Transport Layer Address bstring b = blk2bstr(ie_nas_pdu->value.choice.NAS_PDU.buf, @@ -394,7 +397,7 @@ status_code_e s1ap_mme_handle_nas_non_delivery(s1ap_state_t* state, S1ap_S1AP_PDU_t* pdu) { S1ap_NASNonDeliveryIndication_t* container; S1ap_NASNonDeliveryIndication_IEs_t *ie = NULL, *ie_nas_pdu = NULL; - ue_description_t* ue_ref = NULL; + oai::UeDescription* ue_ref = nullptr; imsi64_t imsi64 = INVALID_IMSI64; mme_ue_s1ap_id_t mme_ue_s1ap_id = INVALID_MME_UE_S1AP_ID; enb_ue_s1ap_id_t enb_ue_s1ap_id = INVALID_ENB_UE_S1AP_ID; @@ -444,7 +447,7 @@ status_code_e s1ap_mme_handle_nas_non_delivery(s1ap_state_t* state, " enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT "\n", mme_ue_s1ap_id, enb_ue_s1ap_id); - if ((ue_ref = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == NULL) { + if ((ue_ref = s1ap_state_get_ue_mmeid(mme_ue_s1ap_id)) == nullptr) { OAILOG_DEBUG(LOG_S1AP, "No UE is attached to this mme UE s1ap id: " MME_UE_S1AP_ID_FMT "\n", @@ -455,7 +458,7 @@ status_code_e s1ap_mme_handle_nas_non_delivery(s1ap_state_t* state, s1ap_imsi_map_t* imsi_map = get_s1ap_imsi_map(); imsi_map->mme_ueid2imsi_map.get(mme_ue_s1ap_id, &imsi64); - if (ue_ref->s1_ue_state != S1AP_UE_CONNECTED) { + if (ue_ref->s1ap_ue_state() != oai::S1AP_UE_CONNECTED) { OAILOG_DEBUG_UE( LOG_S1AP, imsi64, "Received S1AP NAS_NON_DELIVERY_INDICATION while UE in state != " @@ -475,7 +478,7 @@ status_code_e s1ap_generate_downlink_nas_transport( s1ap_state_t* state, const enb_ue_s1ap_id_t enb_ue_s1ap_id, const mme_ue_s1ap_id_t ue_id, STOLEN_REF bstring* payload, const imsi64_t imsi64, bool* is_state_same) { - ue_description_t* ue_ref = NULL; + oai::UeDescription* ue_ref = nullptr; uint8_t* buffer_p = NULL; uint32_t length = 0; uint32_t sctp_assoc_id = 0; @@ -486,9 +489,10 @@ status_code_e s1ap_generate_downlink_nas_transport( // Try to retrieve SCTP association id using mme_ue_s1ap_id if ((state->mmeid2associd.get(ue_id, &sctp_assoc_id)) == magma::PROTO_MAP_OK) { - enb_description_t* enb_ref = s1ap_state_get_enb(state, sctp_assoc_id); + oai::EnbDescription* enb_ref = s1ap_state_get_enb(state, sctp_assoc_id); if (enb_ref) { - ue_ref = s1ap_state_get_ue_enbid(enb_ref->sctp_assoc_id, enb_ue_s1ap_id); + ue_ref = + s1ap_state_get_ue_enbid(enb_ref->sctp_assoc_id(), enb_ue_s1ap_id); } else { OAILOG_ERROR(LOG_S1AP, "No eNB for SCTP association id %d \n", sctp_assoc_id); @@ -535,14 +539,14 @@ status_code_e s1ap_generate_downlink_nas_transport( out = &pdu.choice.initiatingMessage.value.choice.DownlinkNASTransport; - if (ue_ref->s1_ue_state == S1AP_UE_WAITING_CRR) { + if (ue_ref->s1ap_ue_state() == oai::S1AP_UE_WAITING_CRC) { OAILOG_ERROR_UE( LOG_S1AP, imsi64, "Already triggered UE Context Release Command and UE is" - "in S1AP_UE_WAITING_CRR, so dropping the DownlinkNASTransport \n"); + "in S1AP_UE_WAITING_CRC, so dropping the DownlinkNASTransport \n"); OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } else { - ue_ref->s1_ue_state = S1AP_UE_CONNECTED; + ue_ref->set_s1ap_ue_state(oai::S1AP_UE_CONNECTED); } /* * Setting UE informations with the ones found in ue_ref @@ -552,7 +556,7 @@ status_code_e s1ap_generate_downlink_nas_transport( ie->id = S1ap_ProtocolIE_ID_id_MME_UE_S1AP_ID; ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_DownlinkNASTransport_IEs__value_PR_MME_UE_S1AP_ID; - ie->value.choice.MME_UE_S1AP_ID = ue_ref->mme_ue_s1ap_id; + ie->value.choice.MME_UE_S1AP_ID = ue_ref->mme_ue_s1ap_id(); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -561,7 +565,7 @@ status_code_e s1ap_generate_downlink_nas_transport( ie->id = S1ap_ProtocolIE_ID_id_eNB_UE_S1AP_ID; ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_DownlinkNASTransport_IEs__value_PR_ENB_UE_S1AP_ID; - ie->value.choice.ENB_UE_S1AP_ID = ue_ref->enb_ue_s1ap_id; + ie->value.choice.ENB_UE_S1AP_ID = ue_ref->enb_ue_s1ap_id(); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ ie = reinterpret_cast( @@ -589,12 +593,12 @@ status_code_e s1ap_generate_downlink_nas_transport( "Send S1AP DOWNLINK_NAS_TRANSPORT message ue_id = " MME_UE_S1AP_ID_FMT " MME_UE_S1AP_ID = " MME_UE_S1AP_ID_FMT " eNB_UE_S1AP_ID = " ENB_UE_S1AP_ID_FMT "\n", - ue_id, ue_ref->mme_ue_s1ap_id, enb_ue_s1ap_id); + ue_id, ue_ref->mme_ue_s1ap_id(), enb_ue_s1ap_id); bstring b = blk2bstr(buffer_p, length); free(buffer_p); - s1ap_mme_itti_send_sctp_request(&b, ue_ref->sctp_assoc_id, - ue_ref->sctp_stream_send, - ue_ref->mme_ue_s1ap_id); + s1ap_mme_itti_send_sctp_request(&b, ue_ref->sctp_assoc_id(), + ue_ref->sctp_stream_send(), + ue_ref->mme_ue_s1ap_id()); } OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); @@ -604,7 +608,7 @@ status_code_e s1ap_generate_downlink_nas_transport( status_code_e s1ap_generate_s1ap_e_rab_setup_req( s1ap_state_t* state, itti_s1ap_e_rab_setup_req_t* const e_rab_setup_req) { OAILOG_FUNC_IN(LOG_S1AP); - ue_description_t* ue_ref = NULL; + oai::UeDescription* ue_ref = nullptr; uint8_t* buffer_p = NULL; uint32_t length = 0; uint32_t sctp_assoc_id = 0; @@ -613,10 +617,13 @@ status_code_e s1ap_generate_s1ap_e_rab_setup_req( if ((state->mmeid2associd.get(ue_id, &sctp_assoc_id)) == magma::PROTO_MAP_OK) { - enb_description_t* enb_ref = s1ap_state_get_enb(state, sctp_assoc_id); - if (enb_ref) { - ue_ref = s1ap_state_get_ue_enbid(enb_ref->sctp_assoc_id, enb_ue_s1ap_id); + oai::EnbDescription* enb_ref = s1ap_state_get_enb(state, sctp_assoc_id); + if (!enb_ref) { + OAILOG_ERROR(LOG_S1AP, "Failed to get enb context for assoc_id: %u", + sctp_assoc_id); + OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } + ue_ref = s1ap_state_get_ue_enbid(enb_ref->sctp_assoc_id(), enb_ue_s1ap_id); } // TODO remove soon: if (!ue_ref) { @@ -649,7 +656,7 @@ status_code_e s1ap_generate_s1ap_e_rab_setup_req( pdu.choice.initiatingMessage.value.present = S1ap_InitiatingMessage__value_PR_E_RABSetupRequest; out = &pdu.choice.initiatingMessage.value.choice.E_RABSetupRequest; - ue_ref->s1_ue_state = S1AP_UE_CONNECTED; + ue_ref->set_s1ap_ue_state(oai::S1AP_UE_CONNECTED); /* * Setting UE information with the ones found in ue_ref */ @@ -658,7 +665,7 @@ status_code_e s1ap_generate_s1ap_e_rab_setup_req( ie->id = S1ap_ProtocolIE_ID_id_MME_UE_S1AP_ID; ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_E_RABSetupRequestIEs__value_PR_MME_UE_S1AP_ID; - ie->value.choice.MME_UE_S1AP_ID = ue_ref->mme_ue_s1ap_id; + ie->value.choice.MME_UE_S1AP_ID = ue_ref->mme_ue_s1ap_id(); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -667,7 +674,7 @@ status_code_e s1ap_generate_s1ap_e_rab_setup_req( ie->id = S1ap_ProtocolIE_ID_id_eNB_UE_S1AP_ID; ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_E_RABSetupRequestIEs__value_PR_ENB_UE_S1AP_ID; - ie->value.choice.ENB_UE_S1AP_ID = ue_ref->enb_ue_s1ap_id; + ie->value.choice.ENB_UE_S1AP_ID = ue_ref->enb_ue_s1ap_id(); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /*eNB * Fill in the NAS pdu @@ -821,13 +828,13 @@ status_code_e s1ap_generate_s1ap_e_rab_setup_req( LOG_S1AP, "Send S1AP E_RABSetup message MME_UE_S1AP_ID = " MME_UE_S1AP_ID_FMT " eNB_UE_S1AP_ID = " ENB_UE_S1AP_ID_FMT "\n", - (mme_ue_s1ap_id_t)ue_ref->mme_ue_s1ap_id, - (enb_ue_s1ap_id_t)ue_ref->enb_ue_s1ap_id); + (mme_ue_s1ap_id_t)ue_ref->mme_ue_s1ap_id(), + (enb_ue_s1ap_id_t)ue_ref->enb_ue_s1ap_id()); bstring b = blk2bstr(buffer_p, length); free(buffer_p); - s1ap_mme_itti_send_sctp_request(&b, ue_ref->sctp_assoc_id, - ue_ref->sctp_stream_send, - ue_ref->mme_ue_s1ap_id); + s1ap_mme_itti_send_sctp_request(&b, ue_ref->sctp_assoc_id(), + ue_ref->sctp_stream_send(), + ue_ref->mme_ue_s1ap_id()); } OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); @@ -846,7 +853,7 @@ void s1ap_handle_conn_est_cnf( uint8_t* buffer_p = NULL; uint8_t err = 0; uint32_t length = 0; - ue_description_t* ue_ref = NULL; + oai::UeDescription* ue_ref = nullptr; S1ap_InitialContextSetupRequest_t* out; S1ap_InitialContextSetupRequestIEs_t* ie = NULL; S1ap_UEAggregate_MaximumBitrates_ExtIEs_t* ie_ambrext = NULL; @@ -892,7 +899,7 @@ void s1ap_handle_conn_est_cnf( ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_InitialContextSetupRequestIEs__value_PR_MME_UE_S1AP_ID; - ie->value.choice.MME_UE_S1AP_ID = ue_ref->mme_ue_s1ap_id; + ie->value.choice.MME_UE_S1AP_ID = ue_ref->mme_ue_s1ap_id(); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -902,7 +909,7 @@ void s1ap_handle_conn_est_cnf( ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_InitialContextSetupRequestIEs__value_PR_ENB_UE_S1AP_ID; - ie->value.choice.ENB_UE_S1AP_ID = ue_ref->enb_ue_s1ap_id; + ie->value.choice.ENB_UE_S1AP_ID = ue_ref->enb_ue_s1ap_id(); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -1148,13 +1155,13 @@ void s1ap_handle_conn_est_cnf( LOG_S1AP, imsi64, "Send S1AP_INITIAL_CONTEXT_SETUP_REQUEST message MME_UE_S1AP_ID " "= " MME_UE_S1AP_ID_FMT " eNB_UE_S1AP_ID = " ENB_UE_S1AP_ID_FMT "\n", - (mme_ue_s1ap_id_t)ue_ref->mme_ue_s1ap_id, - (enb_ue_s1ap_id_t)ue_ref->enb_ue_s1ap_id); + (mme_ue_s1ap_id_t)ue_ref->mme_ue_s1ap_id(), + (enb_ue_s1ap_id_t)ue_ref->enb_ue_s1ap_id()); bstring b = blk2bstr(buffer_p, length); free(buffer_p); - s1ap_mme_itti_send_sctp_request(&b, ue_ref->sctp_assoc_id, - ue_ref->sctp_stream_send, - ue_ref->mme_ue_s1ap_id); + s1ap_mme_itti_send_sctp_request(&b, ue_ref->sctp_assoc_id(), + ue_ref->sctp_stream_send(), + ue_ref->mme_ue_s1ap_id()); OAILOG_FUNC_OUT(LOG_S1AP); } @@ -1186,44 +1193,49 @@ void s1ap_handle_mme_ue_id_notification( enb_ue_s1ap_id_t enb_ue_s1ap_id = notification_p->enb_ue_s1ap_id; mme_ue_s1ap_id_t mme_ue_s1ap_id = notification_p->mme_ue_s1ap_id; - enb_description_t* enb_ref = s1ap_state_get_enb(state, sctp_assoc_id); - if (enb_ref) { - ue_description_t* ue_ref = - s1ap_state_get_ue_enbid(enb_ref->sctp_assoc_id, enb_ue_s1ap_id); - if (ue_ref) { - if (enb_ref->s1_state == S1AP_RESETING) { - send_dereg_ind_to_mme_app(enb_ue_s1ap_id, mme_ue_s1ap_id, - enb_ref->enb_id); - return; - } - ue_ref->mme_ue_s1ap_id = mme_ue_s1ap_id; - magma::proto_map_rc_t rc = - state->mmeid2associd.insert(mme_ue_s1ap_id, sctp_assoc_id); - - enb_ref->ue_id_coll.insert((const hash_key_t)mme_ue_s1ap_id, - ue_ref->comp_s1ap_id); - - OAILOG_DEBUG(LOG_S1AP, - "Num elements in ue_id_coll %lu and num ue associated %u", - enb_ref->ue_id_coll.size(), enb_ref->nb_ue_associated); + oai::EnbDescription* enb_ref = s1ap_state_get_enb(state, sctp_assoc_id); + if (!enb_ref) { + OAILOG_ERROR(LOG_S1AP, "Could not find eNB with sctp_assoc_id %u ", + sctp_assoc_id); + OAILOG_FUNC_OUT(LOG_S1AP); + } - OAILOG_DEBUG( - LOG_S1AP, - "Associated sctp_assoc_id %d, enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT - ", mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT ":%s \n", - sctp_assoc_id, enb_ue_s1ap_id, mme_ue_s1ap_id, - magma::map_rc_code2string(rc)); - return; - } - OAILOG_DEBUG(LOG_S1AP, - "Could not find ue with enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT + oai::UeDescription* ue_ref = + s1ap_state_get_ue_enbid(enb_ref->sctp_assoc_id(), enb_ue_s1ap_id); + if (!ue_ref) { + OAILOG_ERROR(LOG_S1AP, + "Could not find ue with enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT "\n", enb_ue_s1ap_id); - return; + OAILOG_FUNC_OUT(LOG_S1AP); + } + + if (enb_ref->s1_enb_state() == oai::S1AP_RESETING) { + send_dereg_ind_to_mme_app(enb_ue_s1ap_id, mme_ue_s1ap_id, + enb_ref->enb_id()); + OAILOG_INFO(LOG_S1AP, + "Received mme_ue_s1ap_id notification while enb is in " + "S1AP_RESETING state"); + OAILOG_FUNC_OUT(LOG_S1AP); } - OAILOG_DEBUG(LOG_S1AP, "Could not find eNB with sctp_assoc_id %d \n", - sctp_assoc_id); + ue_ref->set_mme_ue_s1ap_id(mme_ue_s1ap_id); + magma::proto_map_rc_t rc = + state->mmeid2associd.insert(mme_ue_s1ap_id, sctp_assoc_id); + + magma::proto_map_uint32_uint64_t ue_id_coll; + ue_id_coll.map = enb_ref->mutable_ue_id_map(); + ue_id_coll.insert(mme_ue_s1ap_id, ue_ref->comp_s1ap_id()); + + OAILOG_DEBUG(LOG_S1AP, + "Num elements in ue_id_coll %lu and num ue associated %u", + ue_id_coll.size(), enb_ref->nb_ue_associated()); + + OAILOG_DEBUG(LOG_S1AP, + "Associated sctp_assoc_id %d, enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT + ", mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT ":%s \n", + sctp_assoc_id, enb_ue_s1ap_id, mme_ue_s1ap_id, + magma::map_rc_code2string(rc)); OAILOG_FUNC_OUT(LOG_S1AP); } @@ -1232,7 +1244,7 @@ status_code_e s1ap_generate_s1ap_e_rab_rel_cmd( s1ap_state_t* state, itti_s1ap_e_rab_rel_cmd_t* const e_rab_rel_cmd) { OAILOG_FUNC_IN(LOG_S1AP); - ue_description_t* ue_ref = NULL; + oai::UeDescription* ue_ref = nullptr; uint8_t* buffer_p = NULL; uint32_t length = 0; uint32_t id = 0; @@ -1242,10 +1254,13 @@ status_code_e s1ap_generate_s1ap_e_rab_rel_cmd( state->mmeid2associd.get(ue_id, &id); if (id) { sctp_assoc_id_t sctp_assoc_id = (sctp_assoc_id_t)(uintptr_t)id; - enb_description_t* enb_ref = s1ap_state_get_enb(state, sctp_assoc_id); - if (enb_ref) { - ue_ref = s1ap_state_get_ue_enbid(enb_ref->sctp_assoc_id, enb_ue_s1ap_id); + oai::EnbDescription* enb_ref = s1ap_state_get_enb(state, sctp_assoc_id); + if (!enb_ref) { + OAILOG_ERROR(LOG_S1AP, "Could not find eNB with sctp_assoc_id %u ", + sctp_assoc_id); + OAILOG_FUNC_RETURN(LOG_S1AP, RETURNerror); } + ue_ref = s1ap_state_get_ue_enbid(enb_ref->sctp_assoc_id(), enb_ue_s1ap_id); } if (!ue_ref) { ue_ref = s1ap_state_get_ue_mmeid(ue_id); @@ -1286,7 +1301,7 @@ status_code_e s1ap_generate_s1ap_e_rab_rel_cmd( ie->id = S1ap_ProtocolIE_ID_id_MME_UE_S1AP_ID; ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_E_RABReleaseCommandIEs__value_PR_MME_UE_S1AP_ID; - ie->value.choice.MME_UE_S1AP_ID = ue_ref->mme_ue_s1ap_id; + ie->value.choice.MME_UE_S1AP_ID = ue_ref->mme_ue_s1ap_id(); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ ie = (S1ap_E_RABReleaseCommandIEs_t*)calloc( @@ -1294,9 +1309,9 @@ status_code_e s1ap_generate_s1ap_e_rab_rel_cmd( ie->id = S1ap_ProtocolIE_ID_id_eNB_UE_S1AP_ID; ie->criticality = S1ap_Criticality_reject; ie->value.present = S1ap_E_RABReleaseCommandIEs__value_PR_ENB_UE_S1AP_ID; - ie->value.choice.ENB_UE_S1AP_ID = ue_ref->enb_ue_s1ap_id; + ie->value.choice.ENB_UE_S1AP_ID = ue_ref->enb_ue_s1ap_id(); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - ue_ref->s1_ue_state = S1AP_UE_CONNECTED; + ue_ref->set_s1ap_ue_state(oai::S1AP_UE_CONNECTED); ie = (S1ap_E_RABReleaseCommandIEs_t*)calloc( 1, sizeof(S1ap_E_RABReleaseCommandIEs_t)); @@ -1357,14 +1372,17 @@ status_code_e s1ap_generate_s1ap_e_rab_rel_cmd( "Send S1AP E_RABRelease Command message MME_UE_S1AP_ID " "= " MME_UE_S1AP_ID_FMT " eNB_UE_S1AP_ID = " ENB_UE_S1AP_ID_FMT "\n", - (mme_ue_s1ap_id_t)ue_ref->mme_ue_s1ap_id, - (enb_ue_s1ap_id_t)ue_ref->enb_ue_s1ap_id); + (mme_ue_s1ap_id_t)ue_ref->mme_ue_s1ap_id(), + (enb_ue_s1ap_id_t)ue_ref->enb_ue_s1ap_id()); bstring b = blk2bstr(buffer_p, length); free(buffer_p); - s1ap_mme_itti_send_sctp_request(&b, ue_ref->sctp_assoc_id, - ue_ref->sctp_stream_send, - ue_ref->mme_ue_s1ap_id); + s1ap_mme_itti_send_sctp_request(&b, ue_ref->sctp_assoc_id(), + ue_ref->sctp_stream_send(), + ue_ref->mme_ue_s1ap_id()); } OAILOG_FUNC_RETURN(LOG_S1AP, RETURNok); } + +} // namespace lte +} // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_nas_procedures.hpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_nas_procedures.hpp index 23221429f009..a0e8debc74a7 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_nas_procedures.hpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_nas_procedures.hpp @@ -22,8 +22,7 @@ \email: lionel.gauthier@eurecom.fr */ -#ifndef FILE_S1AP_MME_NAS_PROCEDURES_SEEN -#define FILE_S1AP_MME_NAS_PROCEDURES_SEEN +#pragma once #include "lte/gateway/c/core/common/common_defs.h" #include "lte/gateway/c/core/oai/common/common_types.h" @@ -33,6 +32,9 @@ #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_36.401.h" #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" +namespace magma { +namespace lte { + /** \brief Handle an Initial UE message. * \param assocId lower layer assoc id (SCTP) * \param stream SCTP stream on which data had been received @@ -86,4 +88,5 @@ status_code_e s1ap_generate_s1ap_e_rab_setup_req( status_code_e s1ap_generate_s1ap_e_rab_rel_cmd( s1ap_state_t* state, itti_s1ap_e_rab_rel_cmd_t* const e_rab_rel_cmd); -#endif /* FILE_S1AP_MME_NAS_PROCEDURES_SEEN */ +} // namespace lte +} // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_ta.cpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_ta.cpp index 4d4dad0d6f84..4e6f16b7caf3 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_ta.cpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_ta.cpp @@ -41,7 +41,7 @@ extern "C" { #include "lte/gateway/c/core/oai/include/TrackingAreaIdentity.h" #include "lte/gateway/c/core/oai/include/mme_config.h" #include "lte/gateway/c/core/oai/include/s1ap_types.hpp" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" #include "lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_ta.hpp" static int s1ap_mme_compare_plmn(const S1ap_PLMNidentity_t* const plmn) { @@ -167,26 +167,28 @@ int s1ap_mme_compare_ta_lists(S1ap_SupportedTAs_t* ta_list) { /* @brief compare PLMNs */ -static int s1ap_paging_compare_plmns(plmn_t* enb_bplmns, uint8_t enb_plmn_count, - const paging_tai_list_t* p_tai_list) { +static int s1ap_paging_compare_plmns( + const magma::lte::oai::SupportedTaiItems& enb_tai_item, + uint8_t enb_plmn_count, const paging_tai_list_t* p_tai_list) { int plmn_idx, p_plmn_idx; + if (!(enb_tai_item.bplmns_size())) { + OAILOG_ERROR(LOG_S1AP, "PLMN Information not found in eNB tai list\n"); + return false; + } for (plmn_idx = 0; plmn_idx < enb_plmn_count; plmn_idx++) { - plmn_t* enb_plmn = NULL; - enb_plmn = &enb_bplmns[plmn_idx]; - if (enb_plmn == NULL) { - OAILOG_ERROR(LOG_S1AP, "PLMN Information not found in eNB tai list\n"); - return false; - } + plmn_t enb_plmn; + char plmn_array[6] = {0}; + memcpy(plmn_array, enb_tai_item.bplmns(plmn_idx).c_str(), + sizeof(plmn_array)); + COPY_PLMN_FROM_CHAR_ARRAY_FMT(enb_plmn, plmn_array); for (p_plmn_idx = 0; p_plmn_idx < (p_tai_list->numoftac + 1); p_plmn_idx++) { tai_t p_plmn; p_plmn = p_tai_list->tai_list[p_plmn_idx]; - if (IS_PLMN_EQUAL((*(enb_plmn)), p_plmn.plmn)) - - { + if (IS_PLMN_EQUAL(enb_plmn, p_plmn.plmn)) { return true; } } @@ -213,20 +215,20 @@ static int s1ap_paging_compare_tac(uint8_t enb_tac, ENBs - tai_matching=1 if both TAC and PLMN matches with list of ENBs */ -int s1ap_paging_compare_ta_lists(supported_ta_list_t* enb_ta_list, +int s1ap_paging_compare_ta_lists(magma::lte::oai::SupportedTaList& enb_ta_list, const paging_tai_list_t* p_tai_list, uint8_t p_tai_list_count) { bool tac_ret = false, bplmn_ret = false; int enb_tai_count, p_list_count; - for (enb_tai_count = 0; enb_tai_count < enb_ta_list->list_count; + for (enb_tai_count = 0; enb_tai_count < enb_ta_list.list_count(); enb_tai_count++) { - supported_tai_items_t* enb_tai_item = NULL; - enb_tai_item = &enb_ta_list->supported_tai_items[enb_tai_count]; - if (enb_tai_item == NULL) { + if (!(enb_ta_list.supported_tai_items_size())) { OAILOG_ERROR(LOG_S1AP, "TAI Item not found in eNB TA List\n"); return false; } + magma::lte::oai::SupportedTaiItems enb_tai_item = + enb_ta_list.supported_tai_items(enb_tai_count); for (p_list_count = 0; p_list_count < p_tai_list_count; p_list_count++) { const paging_tai_list_t* tai = NULL; tai = &p_tai_list[p_list_count]; @@ -234,13 +236,12 @@ int s1ap_paging_compare_ta_lists(supported_ta_list_t* enb_ta_list, OAILOG_ERROR(LOG_S1AP, "Paging TAI list not found\n"); return false; } - - tac_ret = s1ap_paging_compare_tac(enb_tai_item->tac, tai); + tac_ret = s1ap_paging_compare_tac(enb_tai_item.tac(), tai); if (tac_ret != true) { return false; } else { - bplmn_ret = s1ap_paging_compare_plmns( - enb_tai_item->bplmns, enb_tai_item->bplmnlist_count, tai); + bplmn_ret = s1ap_paging_compare_plmns(enb_tai_item, + enb_tai_item.bplmns_size(), tai); } // Returns TRUE only if both TAC and PLMN matches if (tac_ret && bplmn_ret) { diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_ta.hpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_ta.hpp index a264812f69e9..ad3bdcea7b53 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_ta.hpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme_ta.hpp @@ -39,7 +39,7 @@ enum { }; int s1ap_mme_compare_ta_lists(S1ap_SupportedTAs_t* ta_list); -int s1ap_paging_compare_ta_lists(supported_ta_list_t* enb_ta_list, +int s1ap_paging_compare_ta_lists(magma::lte::oai::SupportedTaList& enb_ta_list, const paging_tai_list_t* p_tai_list, uint8_t p_tai_list_count); diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state.cpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state.cpp index ba94d711f797..7a37befc6791 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state.cpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state.cpp @@ -32,7 +32,8 @@ extern "C" { #include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_manager.hpp" -using magma::lte::S1apStateManager; +namespace magma { +namespace lte { int s1ap_state_init(uint32_t max_ues, uint32_t max_enbs, bool use_stateless) { S1apStateManager::getInstance().init(max_ues, max_enbs, use_stateless); @@ -49,18 +50,18 @@ void s1ap_state_exit() { S1apStateManager::getInstance().free_state(); } void put_s1ap_state() { S1apStateManager::getInstance().write_state_to_db(); } -enb_description_t* s1ap_state_get_enb(s1ap_state_t* state, - sctp_assoc_id_t assoc_id) { - enb_description_t* enb = nullptr; +oai::EnbDescription* s1ap_state_get_enb(s1ap_state_t* state, + sctp_assoc_id_t assoc_id) { + oai::EnbDescription* enb = nullptr; state->enbs.get(assoc_id, &enb); return enb; } -ue_description_t* s1ap_state_get_ue_enbid(sctp_assoc_id_t sctp_assoc_id, - enb_ue_s1ap_id_t enb_ue_s1ap_id) { - ue_description_t* ue = nullptr; +oai::UeDescription* s1ap_state_get_ue_enbid(sctp_assoc_id_t sctp_assoc_id, + enb_ue_s1ap_id_t enb_ue_s1ap_id) { + oai::UeDescription* ue = nullptr; map_uint64_ue_description_t* state_ue_map = get_s1ap_ue_state(); if (!state_ue_map) { @@ -74,8 +75,8 @@ ue_description_t* s1ap_state_get_ue_enbid(sctp_assoc_id_t sctp_assoc_id, return ue; } -ue_description_t* s1ap_state_get_ue_mmeid(mme_ue_s1ap_id_t mme_ue_s1ap_id) { - ue_description_t* ue = nullptr; +oai::UeDescription* s1ap_state_get_ue_mmeid(mme_ue_s1ap_id_t mme_ue_s1ap_id) { + oai::UeDescription* ue = nullptr; map_uint64_ue_description_t* state_ue_map = get_s1ap_ue_state(); if (!state_ue_map) { @@ -89,8 +90,8 @@ ue_description_t* s1ap_state_get_ue_mmeid(mme_ue_s1ap_id_t mme_ue_s1ap_id) { return ue; } -ue_description_t* s1ap_state_get_ue_imsi(imsi64_t imsi64) { - ue_description_t* ue = nullptr; +oai::UeDescription* s1ap_state_get_ue_imsi(imsi64_t imsi64) { + oai::UeDescription* ue = nullptr; map_uint64_ue_description_t* state_ue_map = get_s1ap_ue_state(); if (!state_ue_map) { @@ -113,29 +114,29 @@ s1ap_imsi_map_t* get_s1ap_imsi_map() { } bool s1ap_ue_compare_by_mme_ue_id_cb(__attribute__((unused)) uint64_t keyP, - struct ue_description_s* elementP, + oai::UeDescription* elementP, void* parameterP, void** resultP) { mme_ue_s1ap_id_t* mme_ue_s1ap_id_p = (mme_ue_s1ap_id_t*)parameterP; - ue_description_t* ue_ref = (ue_description_t*)elementP; - if (*mme_ue_s1ap_id_p == ue_ref->mme_ue_s1ap_id) { + oai::UeDescription* ue_ref = reinterpret_cast(elementP); + if (*mme_ue_s1ap_id_p == ue_ref->mme_ue_s1ap_id()) { *resultP = elementP; OAILOG_TRACE(LOG_S1AP, "Found ue_ref %p mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT "\n", - ue_ref, ue_ref->mme_ue_s1ap_id); + ue_ref, ue_ref->mme_ue_s1ap_id()); return true; } return false; } bool s1ap_ue_compare_by_imsi(__attribute__((unused)) uint64_t keyP, - struct ue_description_s* elementP, - void* parameterP, void** resultP) { + oai::UeDescription* elementP, void* parameterP, + void** resultP) { imsi64_t imsi64 = INVALID_IMSI64; imsi64_t* target_imsi64 = (imsi64_t*)parameterP; - ue_description_t* ue_ref = (ue_description_t*)elementP; + oai::UeDescription* ue_ref = reinterpret_cast(elementP); s1ap_imsi_map_t* imsi_map = get_s1ap_imsi_map(); - imsi_map->mme_ueid2imsi_map.get(ue_ref->mme_ue_s1ap_id, &imsi64); + imsi_map->mme_ueid2imsi_map.get(ue_ref->mme_ue_s1ap_id(), &imsi64); if (*target_imsi64 != INVALID_IMSI64 && *target_imsi64 == imsi64) { *resultP = elementP; @@ -151,10 +152,11 @@ map_uint64_ue_description_t* get_s1ap_ue_state(void) { void put_s1ap_ue_state(imsi64_t imsi64) { if (S1apStateManager::getInstance().is_persist_state_enabled()) { - ue_description_t* ue_ctxt = s1ap_state_get_ue_imsi(imsi64); + oai::UeDescription* ue_ctxt = s1ap_state_get_ue_imsi(imsi64); if (ue_ctxt) { auto imsi_str = S1apStateManager::getInstance().get_imsi_str(imsi64); - S1apStateManager::getInstance().write_ue_state_to_db(ue_ctxt, imsi_str); + S1apStateManager::getInstance().s1ap_write_ue_state_to_db(ue_ctxt, + imsi_str); } } } @@ -177,24 +179,26 @@ void remove_ues_without_imsi_from_ue_id_coll() { return; } s1ap_imsi_map_t* s1ap_imsi_map = get_s1ap_imsi_map(); - ue_description_t* ue_ref_p = NULL; + oai::UeDescription* ue_ref_p = nullptr; // get each eNB in s1ap_state for (auto itr = s1ap_state_p->enbs.map->begin(); itr != s1ap_state_p->enbs.map->end(); itr++) { - struct enb_description_s* enb_association_p = itr->second; + struct oai::EnbDescription* enb_association_p = itr->second; if (!enb_association_p) { continue; } - if (enb_association_p->ue_id_coll.isEmpty()) { + magma::proto_map_uint32_uint64_t ue_id_coll; + ue_id_coll.map = enb_association_p->mutable_ue_id_map(); + if (ue_id_coll.isEmpty()) { continue; } // for each ue comp_s1ap_id in eNB->ue_id_coll, check if it has an S1ap // ue_context, if not delete it - for (auto ue_itr = enb_association_p->ue_id_coll.map->begin(); - ue_itr != enb_association_p->ue_id_coll.map->end(); ue_itr++) { + for (auto ue_itr = ue_id_coll.map->begin(); ue_itr != ue_id_coll.map->end(); + ue_itr++) { // Check if a UE reference exists for this comp_s1ap_id s1ap_ue_state->get(ue_itr->second, &ue_ref_p); if (!ue_ref_p) { @@ -208,15 +212,18 @@ void remove_ues_without_imsi_from_ue_id_coll() { } // remove all the mme_ue_s1ap_ids for (uint32_t i = 0; i < mme_ue_id_no_imsi_list.size(); i++) { - enb_association_p->ue_id_coll.remove(mme_ue_id_no_imsi_list[i]); + ue_id_coll.remove(mme_ue_id_no_imsi_list[i]); s1ap_imsi_map->mme_ueid2imsi_map.remove(mme_ue_id_no_imsi_list[i]); - enb_association_p->nb_ue_associated--; + enb_association_p->set_nb_ue_associated( + (enb_association_p->nb_ue_associated() - 1)); OAILOG_DEBUG(LOG_S1AP, "Num UEs associated %u num elements in ue_id_coll %zu", - enb_association_p->nb_ue_associated, - enb_association_p->ue_id_coll.size()); + enb_association_p->nb_ue_associated(), ue_id_coll.size()); } } } + +} // namespace lte +} // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_converter.cpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_converter.cpp index 92dc1bc02e91..c374d5cf57b5 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_converter.cpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_converter.cpp @@ -17,23 +17,20 @@ */ #include "lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_converter.hpp" -using magma::lte::oai::EnbDescription; -using magma::lte::oai::S1apState; -using magma::lte::oai::UeDescription; - namespace magma { namespace lte { S1apStateConverter::~S1apStateConverter() = default; S1apStateConverter::S1apStateConverter() = default; -void S1apStateConverter::state_to_proto(s1ap_state_t* state, S1apState* proto) { +void S1apStateConverter::state_to_proto(s1ap_state_t* state, + oai::S1apState* proto) { proto->Clear(); // copy over enbs - state_map_to_proto(state->enbs, proto->mutable_enbs(), - enb_to_proto, LOG_S1AP); + state_map_to_proto(state->enbs, proto->mutable_enbs(), + enb_to_proto, LOG_S1AP); // copy over mmeid2associd mme_ue_s1ap_id_t mmeid; @@ -56,11 +53,11 @@ void S1apStateConverter::state_to_proto(s1ap_state_t* state, S1apState* proto) { proto->set_num_enbs(state->num_enbs); } -void S1apStateConverter::proto_to_state(const S1apState& proto, +void S1apStateConverter::proto_to_state(const oai::S1apState& proto, s1ap_state_t* state) { - proto_to_state_map(proto.enbs(), state->enbs, proto_to_enb, - LOG_S1AP); + proto_to_state_map(proto.enbs(), state->enbs, + proto_to_enb, LOG_S1AP); *(state->mmeid2associd.map) = proto.mmeid2associd(); state->num_enbs = proto.num_enbs(); @@ -75,109 +72,30 @@ void S1apStateConverter::proto_to_state(const S1apState& proto, } } -void S1apStateConverter::enb_to_proto(enb_description_t* enb, +// TODO(rsarwad): Shall be removed while handling github issue, 11192 +void S1apStateConverter::enb_to_proto(oai::EnbDescription* enb, oai::EnbDescription* proto) { proto->Clear(); - - proto->set_enb_id(enb->enb_id); - proto->set_s1_state(enb->s1_state); - proto->set_enb_name(enb->enb_name); - proto->set_default_paging_drx(enb->default_paging_drx); - proto->set_nb_ue_associated(enb->nb_ue_associated); - proto->set_sctp_assoc_id(enb->sctp_assoc_id); - proto->set_next_sctp_stream(enb->next_sctp_stream); - proto->set_instreams(enb->instreams); - proto->set_outstreams(enb->outstreams); - proto->set_ran_cp_ipaddr(enb->ran_cp_ipaddr); - proto->set_ran_cp_ipaddr_sz(enb->ran_cp_ipaddr_sz); - - // store ue_ids - *(proto->mutable_ue_id_map()) = *(enb->ue_id_coll.map); - supported_ta_list_to_proto(&enb->supported_ta_list, - proto->mutable_supported_ta_list()); + proto->MergeFrom(*enb); } +// TODO(rsarwad): Shall be removed while handling github issue, 11192 void S1apStateConverter::proto_to_enb(const oai::EnbDescription& proto, - enb_description_t* enb) { - memset(enb, 0, sizeof(*enb)); - - enb->enb_id = proto.enb_id(); - enb->s1_state = (mme_s1_enb_state_s)proto.s1_state(); - strncpy(enb->enb_name, proto.enb_name().c_str(), sizeof(enb->enb_name)); - enb->default_paging_drx = proto.default_paging_drx(); - enb->nb_ue_associated = proto.nb_ue_associated(); - enb->sctp_assoc_id = proto.sctp_assoc_id(); - enb->next_sctp_stream = proto.next_sctp_stream(); - enb->instreams = proto.instreams(); - enb->outstreams = proto.outstreams(); - strncpy(enb->ran_cp_ipaddr, proto.ran_cp_ipaddr().c_str(), - sizeof(enb->ran_cp_ipaddr)); - enb->ran_cp_ipaddr_sz = proto.ran_cp_ipaddr_sz(); - - // load ues - char S1AP_UE_MAP_NAME[] = "s1ap_ue_coll"; - proto_map_rc_t rc = {PROTO_MAP_OK}; - enb->ue_id_coll.map = new google::protobuf::Map(); - enb->ue_id_coll.set_name(S1AP_UE_MAP_NAME); - *(enb->ue_id_coll.map) = proto.ue_id_map(); - - proto_to_supported_ta_list(&enb->supported_ta_list, - proto.supported_ta_list()); + oai::EnbDescription* enb) { + enb->Clear(); + enb->MergeFrom(proto); } -void S1apStateConverter::ue_to_proto(const ue_description_t* ue, + +void S1apStateConverter::ue_to_proto(const oai::UeDescription* ue, oai::UeDescription* proto) { proto->Clear(); - - proto->set_s1_ue_state(ue->s1_ue_state); - proto->set_enb_ue_s1ap_id(ue->enb_ue_s1ap_id); - proto->set_mme_ue_s1ap_id(ue->mme_ue_s1ap_id); - proto->set_sctp_assoc_id(ue->sctp_assoc_id); - proto->set_sctp_stream_recv(ue->sctp_stream_recv); - proto->set_sctp_stream_send(ue->sctp_stream_send); - proto->mutable_s1ap_ue_context_rel_timer()->set_id( - ue->s1ap_ue_context_rel_timer.id); - proto->mutable_s1ap_ue_context_rel_timer()->set_msec( - ue->s1ap_ue_context_rel_timer.msec); - proto->mutable_s1ap_handover_state()->set_mme_ue_s1ap_id( - ue->s1ap_handover_state.mme_ue_s1ap_id); - proto->mutable_s1ap_handover_state()->set_source_enb_id( - ue->s1ap_handover_state.source_enb_id); - proto->mutable_s1ap_handover_state()->set_target_enb_id( - ue->s1ap_handover_state.target_enb_id); - proto->mutable_s1ap_handover_state()->set_target_enb_ue_s1ap_id( - ue->s1ap_handover_state.target_enb_ue_s1ap_id); - proto->mutable_s1ap_handover_state()->set_target_sctp_stream_recv( - ue->s1ap_handover_state.target_sctp_stream_recv); - proto->mutable_s1ap_handover_state()->set_target_sctp_stream_send( - ue->s1ap_handover_state.target_sctp_stream_send); + proto->MergeFrom(*ue); } -void S1apStateConverter::proto_to_ue(const oai::UeDescription& proto, - ue_description_t* ue) { - memset(ue, 0, sizeof(*ue)); - ue->s1_ue_state = (s1_ue_state_s)proto.s1_ue_state(); - ue->enb_ue_s1ap_id = proto.enb_ue_s1ap_id(); - ue->mme_ue_s1ap_id = proto.mme_ue_s1ap_id(); - ue->sctp_assoc_id = proto.sctp_assoc_id(); - ue->sctp_stream_recv = proto.sctp_stream_recv(); - ue->sctp_stream_send = proto.sctp_stream_send(); - ue->s1ap_ue_context_rel_timer.id = proto.s1ap_ue_context_rel_timer().id(); - ue->s1ap_ue_context_rel_timer.msec = proto.s1ap_ue_context_rel_timer().msec(); - ue->s1ap_handover_state.mme_ue_s1ap_id = - proto.s1ap_handover_state().mme_ue_s1ap_id(); - ue->s1ap_handover_state.source_enb_id = - proto.s1ap_handover_state().source_enb_id(); - ue->s1ap_handover_state.target_enb_id = - proto.s1ap_handover_state().target_enb_id(); - ue->s1ap_handover_state.target_enb_ue_s1ap_id = - proto.s1ap_handover_state().target_enb_ue_s1ap_id(); - ue->s1ap_handover_state.target_sctp_stream_recv = - proto.s1ap_handover_state().target_sctp_stream_recv(); - ue->s1ap_handover_state.target_sctp_stream_send = - proto.s1ap_handover_state().target_sctp_stream_send(); - - ue->comp_s1ap_id = - S1AP_GENERATE_COMP_S1AP_ID(ue->sctp_assoc_id, ue->enb_ue_s1ap_id); +void S1apStateConverter::proto_to_ue(const oai::UeDescription& proto, + oai::UeDescription* ue) { + ue->Clear(); + ue->MergeFrom(proto); } void S1apStateConverter::s1ap_imsi_map_to_proto( @@ -192,75 +110,5 @@ void S1apStateConverter::proto_to_s1ap_imsi_map( s1ap_imsi_proto.mme_ue_s1ap_id_imsi_map(); } -void S1apStateConverter::supported_ta_list_to_proto( - const supported_ta_list_t* supported_ta_list, - oai::SupportedTaList* supported_ta_list_proto) { - supported_ta_list_proto->set_list_count(supported_ta_list->list_count); - for (int idx = 0; idx < supported_ta_list->list_count; idx++) { - OAILOG_DEBUG(LOG_S1AP, "Writing Supported TAI list at index %d", idx); - oai::SupportedTaiItems* supported_tai_item = - supported_ta_list_proto->add_supported_tai_items(); - supported_tai_item_to_proto(&supported_ta_list->supported_tai_items[idx], - supported_tai_item); - } -} - -void S1apStateConverter::proto_to_supported_ta_list( - supported_ta_list_t* supported_ta_list_state, - const oai::SupportedTaList& supported_ta_list_proto) { - supported_ta_list_state->list_count = supported_ta_list_proto.list_count(); - for (int idx = 0; idx < supported_ta_list_state->list_count; idx++) { - OAILOG_DEBUG(LOG_MME_APP, "reading supported ta list at index %d", idx); - proto_to_supported_tai_items( - &supported_ta_list_state->supported_tai_items[idx], - supported_ta_list_proto.supported_tai_items(idx)); - } -} - -void S1apStateConverter::supported_tai_item_to_proto( - const supported_tai_items_t* state_supported_tai_item, - oai::SupportedTaiItems* supported_tai_item_proto) { - supported_tai_item_proto->set_tac(state_supported_tai_item->tac); - supported_tai_item_proto->set_bplmnlist_count( - state_supported_tai_item->bplmnlist_count); - char plmn_array[PLMN_BYTES] = {0}; - for (int idx = 0; idx < state_supported_tai_item->bplmnlist_count; idx++) { - plmn_array[0] = - (char)(state_supported_tai_item->bplmns[idx].mcc_digit1 + ASCII_ZERO); - plmn_array[1] = - (char)(state_supported_tai_item->bplmns[idx].mcc_digit2 + ASCII_ZERO); - plmn_array[2] = - (char)(state_supported_tai_item->bplmns[idx].mcc_digit3 + ASCII_ZERO); - plmn_array[3] = - (char)(state_supported_tai_item->bplmns[idx].mnc_digit1 + ASCII_ZERO); - plmn_array[4] = - (char)(state_supported_tai_item->bplmns[idx].mnc_digit2 + ASCII_ZERO); - plmn_array[5] = - (char)(state_supported_tai_item->bplmns[idx].mnc_digit3 + ASCII_ZERO); - supported_tai_item_proto->add_bplmns(plmn_array); - } -} - -void S1apStateConverter::proto_to_supported_tai_items( - supported_tai_items_t* supported_tai_item_state, - const oai::SupportedTaiItems& supported_tai_item_proto) { - supported_tai_item_state->tac = supported_tai_item_proto.tac(); - supported_tai_item_state->bplmnlist_count = - supported_tai_item_proto.bplmnlist_count(); - for (int idx = 0; idx < supported_tai_item_state->bplmnlist_count; idx++) { - supported_tai_item_state->bplmns[idx].mcc_digit1 = - (int)(supported_tai_item_proto.bplmns(idx)[0]) - ASCII_ZERO; - supported_tai_item_state->bplmns[idx].mcc_digit2 = - (int)(supported_tai_item_proto.bplmns(idx)[1]) - ASCII_ZERO; - supported_tai_item_state->bplmns[idx].mcc_digit3 = - (int)(supported_tai_item_proto.bplmns(idx)[2]) - ASCII_ZERO; - supported_tai_item_state->bplmns[idx].mnc_digit1 = - (int)(supported_tai_item_proto.bplmns(idx)[3]) - ASCII_ZERO; - supported_tai_item_state->bplmns[idx].mnc_digit2 = - (int)(supported_tai_item_proto.bplmns(idx)[4]) - ASCII_ZERO; - supported_tai_item_state->bplmns[idx].mnc_digit3 = - (int)(supported_tai_item_proto.bplmns(idx)[5]) - ASCII_ZERO; - } -} } // namespace lte } // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_converter.hpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_converter.hpp index 8cdfe8a21e87..d3461ec0380e 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_converter.hpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_converter.hpp @@ -18,15 +18,12 @@ #pragma once +#include + #ifdef __cplusplus extern "C" { #endif - -#include - #include "lte/gateway/c/core/common/assertions.h" -#include "lte/gateway/c/core/common/dynamic_memory_check.h" - #ifdef __cplusplus } #endif @@ -58,38 +55,17 @@ class S1apStateConverter : StateConverter { static void proto_to_s1ap_imsi_map(const oai::S1apImsiMap& s1ap_imsi_proto, s1ap_imsi_map_t* s1ap_imsi_map); - /** - * Serializes supported_ta_list_t to SupportedTaList proto - */ - static void supported_ta_list_to_proto( - const supported_ta_list_t* supported_ta_list, - oai::SupportedTaList* supported_ta_list_proto); - - static void proto_to_supported_ta_list( - supported_ta_list_t* supported_ta_list_state, - const oai::SupportedTaList& supported_ta_list_proto); - - /** - * Serializes supported_tai_items_t to supported_tai_item proto - */ - static void supported_tai_item_to_proto( - const supported_tai_items_t* state_supported_tai_item, - oai::SupportedTaiItems* supported_tai_item_proto); - - static void proto_to_supported_tai_items( - supported_tai_items_t* supported_tai_item_state, - const oai::SupportedTaiItems& supported_tai_item_proto); - - static void enb_to_proto(enb_description_t* enb, oai::EnbDescription* proto); + static void enb_to_proto(oai::EnbDescription* enb, + oai::EnbDescription* proto); static void proto_to_enb(const oai::EnbDescription& proto, - enb_description_t* enb); + oai::EnbDescription* enb); - static void ue_to_proto(const ue_description_t* ue, + static void ue_to_proto(const oai::UeDescription* ue, oai::UeDescription* proto); static void proto_to_ue(const oai::UeDescription& proto, - ue_description_t* ue); + oai::UeDescription* ue); private: S1apStateConverter(); diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_manager.cpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_manager.cpp index d163882c6fcd..3cf700ae17ca 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_manager.cpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_manager.cpp @@ -30,8 +30,6 @@ constexpr char S1AP_IMSI_MAP_TABLE_NAME[] = "s1ap_imsi_map"; constexpr char S1AP_STATE_UE_MAP[] = "s1ap_state_ue_map"; } // namespace -using magma::lte::oai::UeDescription; - namespace magma { namespace lte { @@ -70,9 +68,9 @@ s1ap_state_t* create_s1ap_state(void) { s1ap_state_t* state_cache_p = new s1ap_state_t(); state_cache_p->enbs.map = - new google::protobuf::Map(); + new google::protobuf::Map(); state_cache_p->enbs.set_name(S1AP_ENB_COLL); - state_cache_p->enbs.bind_callback(free_cpp_wrapper); + state_cache_p->enbs.bind_callback(free_enb_description); state_cache_p->mmeid2associd.map = new google::protobuf::Map(); @@ -89,13 +87,13 @@ void S1apStateManager::create_state() { return; } - state_ue_map.map = new google::protobuf::Map(); + state_ue_map.map = new google::protobuf::Map(); if (!(state_ue_map.map)) { OAILOG_ERROR(LOG_S1AP, "Failed to allocate memory for state_ue_map "); return; } state_ue_map.set_name(S1AP_STATE_UE_MAP); - state_ue_map.bind_callback(free_cpp_wrapper); + state_ue_map.bind_callback(free_ue_description); create_s1ap_imsi_map(); } @@ -104,14 +102,10 @@ void free_s1ap_state(s1ap_state_t* state_cache_p) { AssertFatal(state_cache_p, "s1ap_state_t passed to free_s1ap_state must not be null"); - int i; - hashtable_rc_t ht_rc; - hashtable_key_array_t* keys; - sctp_assoc_id_t assoc_id; - enb_description_t* enb; + oai::EnbDescription* enb; if (state_cache_p->enbs.isEmpty()) { - OAILOG_DEBUG(LOG_S1AP, "No keys in the enb hashtable"); + OAILOG_DEBUG(LOG_S1AP, "No keys in the enb map"); } else { for (auto itr = state_cache_p->enbs.map->begin(); itr != state_cache_p->enbs.map->end(); itr++) { @@ -119,7 +113,7 @@ void free_s1ap_state(s1ap_state_t* state_cache_p) { if (!enb) { OAILOG_ERROR(LOG_S1AP, "eNB entry not found in eNB S1AP state"); } else { - enb->ue_id_coll.destroy_map(); + enb->clear_ue_id_map(); } } } @@ -159,8 +153,8 @@ status_code_e S1apStateManager::read_ue_state_from_db() { for (const auto& key : keys) { OAILOG_DEBUG(log_task, "Reading UE state from db for %s", key.c_str()); - UeDescription ue_proto = UeDescription(); - auto* ue_context = new ue_description_t(); + oai::UeDescription ue_proto = oai::UeDescription(); + auto* ue_context = new oai::UeDescription(); if (!ue_context) { OAILOG_ERROR(log_task, "Failed to allocate memory for ue context"); return RETURNerror; @@ -169,25 +163,25 @@ status_code_e S1apStateManager::read_ue_state_from_db() { return RETURNerror; } - S1apStateConverter::proto_to_ue(ue_proto, ue_context); + ue_context->MergeFrom(ue_proto); proto_map_rc_t rc = - state_ue_map.insert(ue_context->comp_s1ap_id, ue_context); + state_ue_map.insert(ue_context->comp_s1ap_id(), ue_context); if (rc != PROTO_MAP_OK) { OAILOG_ERROR( log_task, "Failed to insert UE state with key comp_s1ap_id " COMP_S1AP_ID_FMT ", ENB UE S1AP Id: " ENB_UE_S1AP_ID_FMT ", MME UE S1AP Id: " MME_UE_S1AP_ID_FMT " (Error Code: %s)\n", - ue_context->comp_s1ap_id, ue_context->enb_ue_s1ap_id, - ue_context->mme_ue_s1ap_id, magma::map_rc_code2string(rc)); + ue_context->comp_s1ap_id(), ue_context->enb_ue_s1ap_id(), + ue_context->mme_ue_s1ap_id(), magma::map_rc_code2string(rc)); } else { OAILOG_DEBUG(log_task, "Inserted UE state with key comp_s1ap_id " COMP_S1AP_ID_FMT ", ENB UE S1AP Id: " ENB_UE_S1AP_ID_FMT ", MME UE S1AP Id: " MME_UE_S1AP_ID_FMT, - ue_context->comp_s1ap_id, ue_context->enb_ue_s1ap_id, - ue_context->mme_ue_s1ap_id); + ue_context->comp_s1ap_id(), ue_context->enb_ue_s1ap_id(), + ue_context->mme_ue_s1ap_id()); } } #endif @@ -242,5 +236,28 @@ map_uint64_ue_description_t* S1apStateManager::get_s1ap_ue_state() { return &state_ue_map; } +void S1apStateManager::s1ap_write_ue_state_to_db( + const oai::UeDescription* ue_context, const std::string& imsi_str) { + AssertFatal( + is_initialized, + "StateManager init() function should be called to initialize state"); + + std::string proto_str; + redis_client->serialize(*ue_context, proto_str); + std::size_t new_hash = std::hash{}(proto_str); + if (new_hash != this->ue_state_hash[imsi_str]) { + std::string key = IMSI_PREFIX + imsi_str + ":" + task_name; + if (redis_client->write_proto_str(key, proto_str, + ue_state_version[imsi_str]) != RETURNok) { + OAILOG_ERROR(log_task, "Failed to write UE state to db for IMSI %s", + imsi_str.c_str()); + return; + } + this->ue_state_version[imsi_str]++; + this->ue_state_hash[imsi_str] = new_hash; + OAILOG_DEBUG(log_task, "Finished writing UE state for IMSI %s", + imsi_str.c_str()); + } +} } // namespace lte } // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_manager.hpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_manager.hpp index 7cf3415dec5e..aa904294be24 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_manager.hpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_manager.hpp @@ -56,9 +56,8 @@ void free_s1ap_state(s1ap_state_t* state_cache_p); * to maintain S1AP task state, allocating and freeing related state structs. */ class S1apStateManager - : public StateManager { + : public StateManager { public: /** * Returns an instance of S1apStateManager, guaranteed to be thread safe and @@ -100,6 +99,8 @@ class S1apStateManager */ s1ap_imsi_map_t* get_s1ap_imsi_map(); map_uint64_ue_description_t* get_s1ap_ue_state(); + void s1ap_write_ue_state_to_db(const oai::UeDescription* ue_context, + const std::string& imsi_str); private: S1apStateManager(); diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_timer.hpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_timer.hpp index daceb628692c..64e9c1c90a03 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_timer.hpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_timer.hpp @@ -15,10 +15,17 @@ limitations under the License. #include #include "lte/gateway/c/core/oai/include/s1ap_types.hpp" + #ifdef __cplusplus extern "C" { #endif #include "lte/gateway/c/core/oai/lib/itti/intertask_interface.h" +#ifdef __cplusplus +} +#endif + +namespace magma { +namespace lte { typedef struct s1ap_timer_arg_s { mme_ue_s1ap_id_t ue_id; @@ -33,6 +40,5 @@ void s1ap_stop_timer(int timer_id); // These functions are supposed to be used only by expired timers. bool s1ap_pop_timer_arg_ue_id(int timer_id, mme_ue_s1ap_id_t* ue_id); -#ifdef __cplusplus -} -#endif +} // namespace lte +} // namespace magma diff --git a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_timer_management.cpp b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_timer_management.cpp index ba669772b15d..78da53e4be53 100644 --- a/lte/gateway/c/core/oai/tasks/s1ap/s1ap_timer_management.cpp +++ b/lte/gateway/c/core/oai/tasks/s1ap/s1ap_timer_management.cpp @@ -26,6 +26,9 @@ extern "C" { // --Other includes // ------------------------------------------------------------- +namespace magma { +namespace lte { + extern task_zmq_ctx_t s1ap_task_zmq_ctx; //------------------------------------------------------------------------------ @@ -33,27 +36,22 @@ int s1ap_start_timer(size_t msec, timer_repeat_t repeat, zloop_timer_fn handler, mme_ue_s1ap_id_t ue_id) { s1ap_timer_arg_t arg; arg.ue_id = ue_id; - return magma::lte::S1apUeContext::Instance().StartTimer(msec, repeat, handler, - arg); + return S1apUeContext::Instance().StartTimer(msec, repeat, handler, arg); } //------------------------------------------------------------------------------ void s1ap_stop_timer(int timer_id) { - magma::lte::S1apUeContext::Instance().StopTimer(timer_id); + S1apUeContext::Instance().StopTimer(timer_id); } //------------------------------------------------------------------------------ bool s1ap_pop_timer_arg_ue_id(int timer_id, mme_ue_s1ap_id_t* ue_id) { s1ap_timer_arg_t arg; - bool result = - magma::lte::S1apUeContext::Instance().PopTimerById(timer_id, &arg); + bool result = S1apUeContext::Instance().PopTimerById(timer_id, &arg); *ue_id = arg.ue_id; return result; } -namespace magma { -namespace lte { - //------------------------------------------------------------------------------ int S1apUeContext::StartTimer(size_t msec, timer_repeat_t repeat, zloop_timer_fn handler, diff --git a/lte/gateway/c/core/oai/test/mme_app_task/mme_procedure_test_fixture.cpp b/lte/gateway/c/core/oai/test/mme_app_task/mme_procedure_test_fixture.cpp index f2c14ea52652..a90a63c5b761 100644 --- a/lte/gateway/c/core/oai/test/mme_app_task/mme_procedure_test_fixture.cpp +++ b/lte/gateway/c/core/oai/test/mme_app_task/mme_procedure_test_fixture.cpp @@ -12,6 +12,7 @@ */ #include "lte/gateway/c/core/oai/test/mme_app_task/mme_procedure_test_fixture.h" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" namespace magma { namespace lte { @@ -127,4 +128,4 @@ void MmeAppProcedureTest ::detach_ue(std::condition_variable& cv, EXPECT_EQ(mme_state_p->nb_ue_idle, 0); } } // namespace lte -} // namespace magma \ No newline at end of file +} // namespace magma diff --git a/lte/gateway/c/core/oai/test/mme_app_task/mme_procedure_test_fixture.h b/lte/gateway/c/core/oai/test/mme_app_task/mme_procedure_test_fixture.h index a593932234ca..7b45d419322d 100644 --- a/lte/gateway/c/core/oai/test/mme_app_task/mme_procedure_test_fixture.h +++ b/lte/gateway/c/core/oai/test/mme_app_task/mme_procedure_test_fixture.h @@ -24,10 +24,11 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.h" #include "lte/gateway/c/core/oai/tasks/mme_app/mme_app_extern.h" } +#include "lte/gateway/c/core/oai/tasks/nas/api/network/nas_message.hpp" + extern bool mme_hss_associated; extern bool mme_sctp_bounded; namespace magma { @@ -255,4 +256,4 @@ class MmeAppProcedureTest : public ::testing::Test { }; } // namespace lte -} // namespace magma \ No newline at end of file +} // namespace magma diff --git a/lte/gateway/c/core/oai/test/nas/test_nas_converter.cpp b/lte/gateway/c/core/oai/test/nas/test_nas_converter.cpp index 13528bed5226..656978eb4c08 100644 --- a/lte/gateway/c/core/oai/test/nas/test_nas_converter.cpp +++ b/lte/gateway/c/core/oai/test/nas/test_nas_converter.cpp @@ -20,12 +20,13 @@ extern "C" { #include "lte/gateway/c/core/common/dynamic_memory_check.h" #include "lte/gateway/c/core/oai/common/log.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.h" -#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.h" -#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.h" } +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_data.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_headers.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/emm/emm_proc.hpp" #include "lte/gateway/c/core/oai/tasks/nas/nas_state_converter.hpp" +#include "lte/gateway/c/core/oai/tasks/nas/nas_procedures.hpp" namespace magma { namespace lte { diff --git a/lte/gateway/c/core/oai/test/s1ap_task/data/s1ap_state_ATTACHED b/lte/gateway/c/core/oai/test/s1ap_task/data/s1ap_state_ATTACHED new file mode 100644 index 000000000000..be3747947e35 --- /dev/null +++ b/lte/gateway/c/core/oai/test/s1ap_task/data/s1ap_state_ATTACHED @@ -0,0 +1,3 @@ + +5%1 +RADISYS(0%8@HZ 001010bÀ¨ #include "lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_converter.hpp" - -using magma::lte::oai::S1apState; -using magma::lte::oai::UeDescription; +#include "lte/gateway/c/core/oai/tasks/s1ap/s1ap_mme.hpp" namespace magma { namespace lte { @@ -59,7 +57,7 @@ status_code_e mock_read_s1ap_ue_state_db( } for (const auto& name_of_sample_file : ue_samples) { - UeDescription ue_proto = UeDescription(); + oai::UeDescription ue_proto = oai::UeDescription(); std::fstream input(name_of_sample_file.c_str(), std::ios::in | std::ios::binary); if (!ue_proto.ParseFromIstream(&input)) { @@ -68,20 +66,21 @@ status_code_e mock_read_s1ap_ue_state_db( return RETURNerror; } - ue_description_t* ue_context_p = new ue_description_t(); + oai::UeDescription* ue_context_p = new oai::UeDescription(); if (!ue_context_p) { std::cerr << "Failed to allocate memory for ue_context_p" << std::endl; return RETURNerror; } S1apStateConverter::proto_to_ue(ue_proto, ue_context_p); - proto_map_rc_t rc = - state_ue_map->insert(ue_context_p->comp_s1ap_id, - reinterpret_cast(ue_context_p)); + proto_map_rc_t rc = state_ue_map->insert( + ue_context_p->comp_s1ap_id(), + reinterpret_cast(ue_context_p)); if (rc != magma::PROTO_MAP_OK) { std::cerr << "Failed to insert UE state :" << name_of_sample_file << std::endl; + free_ue_description(reinterpret_cast(&ue_context_p)); return RETURNerror; } } @@ -94,15 +93,11 @@ status_code_e mock_read_s1ap_state_db( const std::string& file_name_state_sample) { s1ap_state_t* state_cache_p = get_s1ap_state(false); - S1apState state_proto = S1apState(); + oai::S1apState state_proto = oai::S1apState(); std::ifstream input(file_name_state_sample.c_str(), std::ios::in | std::ios::binary); - std::vector data = std::vector( - std::istreambuf_iterator(input), std::istreambuf_iterator()); - std::string decoded_msg = decode_msg(data); - std::istringstream input_stream(decoded_msg); - if (!state_proto.ParseFromIstream(&input_stream)) { + if (!state_proto.ParseFromIstream(&input)) { std::cerr << "Failed to decode and parse the sample: " << file_name_state_sample << std::endl; return RETURNerror; @@ -111,60 +106,5 @@ status_code_e mock_read_s1ap_state_db( return RETURNok; } -// putting data in the buffer to decode and update the size of the buffer -void add_data_to_buffer(unsigned int& buf, int& buf_size, int data, - const std::vector& decode_table) { - buf = buf << ENCODER_BLOCK_SIZE; - buf += data; - buf_size += ENCODER_BLOCK_SIZE; -} - -// getting the last byte from the buffer -int get_last_decoder_block_size_bit(int num) { - return num & ((1 << DECODER_BLOCK_SIZE) - 1); -} - -// decoding each byte and putting it into the buffer of the decoded message -void add_decoded_data_to_output(unsigned int& buf, int& buf_size, - std::string& buf_decoded_msg) { - if (buf_size >= DECODER_BLOCK_SIZE) { - buf_size -= DECODER_BLOCK_SIZE; - char decoded_char = - static_cast(get_last_decoder_block_size_bit(buf >> buf_size)); - buf_decoded_msg.push_back(decoded_char); - } -} - -// decoding an encoded message -std::string decode_msg(const std::vector& encoded_msg) { - if (encoded_msg.size() % 4 != 0) { - std::cerr << " This data is wrongly encoded." << std::endl; - return ""; - } - std::vector decode_table(MAX_ASCII_VAL_OF_DECODE_TABLE, NO_CODE_VAL); - for (int i = 0; i < LENGTH_OF_STR_DECODE_TABLE; i++) - decode_table[STR_DECODE_TABLE[i]] = i; - - int pad_size = 0; - int cur_len_buffer = 0; - unsigned int buffer = 0; - std::string decoded_msg; - for (int i = 0; i < encoded_msg.size(); ++i) { - char ch = encoded_msg[i]; - ch -= SHIFT; - int data = decode_table[ch]; - if (data == NO_CODE_VAL) { - if (ch != PAD_SYMBOL) { - std::cerr << " Invalid char in the encoded message." << std::endl; - return ""; - } - break; - } - add_data_to_buffer(buffer, cur_len_buffer, data, decode_table); - add_decoded_data_to_output(buffer, cur_len_buffer, decoded_msg); - } - return decoded_msg; -} - } // namespace lte } // namespace magma diff --git a/lte/gateway/c/core/oai/test/s1ap_task/mock_s1ap_op.h b/lte/gateway/c/core/oai/test/s1ap_task/mock_s1ap_op.h index b642fc4a0f59..4ec8a9e75435 100644 --- a/lte/gateway/c/core/oai/test/s1ap_task/mock_s1ap_op.h +++ b/lte/gateway/c/core/oai/test/s1ap_task/mock_s1ap_op.h @@ -35,7 +35,7 @@ namespace lte { "lte/gateway/c/core/oai/test/s1ap_task/data/" #define DEFAULT_S1AP_STATE_DATA_PATH \ - "lte/gateway/c/core/oai/test/s1ap_task/data/s1ap_state_ATTACHED_encoded" + "lte/gateway/c/core/oai/test/s1ap_task/data/s1ap_state_ATTACHED" std::vector load_file_into_vector_of_line_content( const std::string& data_folder_path, const std::string& file_name); @@ -43,18 +43,6 @@ status_code_e mock_read_s1ap_ue_state_db( const std::vector& ue_samples); status_code_e mock_read_s1ap_state_db( const std::string& file_name_state_sample); -// putting data in the buffer to be decoded once the size of buffer reach the -// decoder block size, update the size of the buffer -void add_data_to_buffer(unsigned int& buf, int& buf_size, int data, - const std::vector& decode_table); -// getting the last block from the buffer -int get_last_decoder_block_size_bit(int num); -// decoding each block in buffer and putting it into the buffer of the decoded -// message -void add_decoded_data_to_output(unsigned int& buf, int& buf_size, - std::string& buf_decoded_msg); -// decoding an s1ap task state's encoded message -std::string decode_msg(const std::vector& encoded_msg); } // namespace lte } // namespace magma diff --git a/lte/gateway/c/core/oai/test/s1ap_task/s1ap_mme_test_utils.cpp b/lte/gateway/c/core/oai/test/s1ap_task/s1ap_mme_test_utils.cpp index 03e92aff0216..e9f6e20a5e16 100644 --- a/lte/gateway/c/core/oai/test/s1ap_task/s1ap_mme_test_utils.cpp +++ b/lte/gateway/c/core/oai/test/s1ap_task/s1ap_mme_test_utils.cpp @@ -30,6 +30,8 @@ extern "C" { namespace magma { namespace lte { +using oai::S1apUeState; +using oai::UeDescription; task_zmq_ctx_t task_zmq_ctx_main_s1ap; status_code_e setup_new_association(s1ap_state_t* state, @@ -407,12 +409,12 @@ status_code_e send_s1ap_erab_mod_confirm(enb_ue_s1ap_id_t enb_ue_id, } bool is_enb_state_valid(s1ap_state_t* state, sctp_assoc_id_t assoc_id, - mme_s1_enb_state_s expected_state, + oai::S1apEnbState expected_state, uint32_t expected_num_ues) { - enb_description_t* enb_associated = nullptr; + oai::EnbDescription* enb_associated = nullptr; state->enbs.get(assoc_id, &enb_associated); - if (enb_associated->nb_ue_associated == expected_num_ues && - enb_associated->s1_state == expected_state) { + if (enb_associated->nb_ue_associated() == expected_num_ues && + enb_associated->s1_enb_state() == expected_state) { return true; } return false; @@ -428,8 +430,8 @@ bool is_num_enbs_valid(s1ap_state_t* state, uint32_t expected_num_enbs) { } bool is_ue_state_valid(sctp_assoc_id_t assoc_id, enb_ue_s1ap_id_t enb_ue_id, - enum s1_ue_state_s expected_ue_state) { - ue_description_t* ue = nullptr; + enum S1apUeState expected_ue_state) { + UeDescription* ue = nullptr; map_uint64_ue_description_t* state_ue_map = get_s1ap_ue_state(); if (!state_ue_map) { std::cerr << "Failed to get s1ap_ue_state" << std::endl; @@ -441,7 +443,7 @@ bool is_ue_state_valid(sctp_assoc_id_t assoc_id, enb_ue_s1ap_id_t enb_ue_id, if (rc != magma::PROTO_MAP_OK) { return false; } - return ue->s1_ue_state == expected_ue_state ? true : false; + return ue->s1ap_ue_state() == expected_ue_state ? true : false; } status_code_e simulate_pdu_s1_message(uint8_t* bytes, long bytes_len, diff --git a/lte/gateway/c/core/oai/test/s1ap_task/s1ap_mme_test_utils.h b/lte/gateway/c/core/oai/test/s1ap_task/s1ap_mme_test_utils.h index d37eff0929b4..dce2f0c0d32d 100644 --- a/lte/gateway/c/core/oai/test/s1ap_task/s1ap_mme_test_utils.h +++ b/lte/gateway/c/core/oai/test/s1ap_task/s1ap_mme_test_utils.h @@ -24,6 +24,7 @@ extern "C" { namespace magma { namespace lte { +using oai::S1apUeState; status_code_e setup_new_association(s1ap_state_t* state, sctp_assoc_id_t assoc_id); @@ -79,13 +80,13 @@ status_code_e send_s1ap_erab_mod_confirm(enb_ue_s1ap_id_t enb_ue_id, mme_ue_s1ap_id_t ue_id); bool is_enb_state_valid(s1ap_state_t* state, sctp_assoc_id_t assoc_id, - mme_s1_enb_state_s expected_state, + enum oai::S1apEnbState expected_state, uint32_t expected_num_ues); bool is_num_enbs_valid(s1ap_state_t* state, uint32_t expected_num_enbs); bool is_ue_state_valid(sctp_assoc_id_t assoc_id, enb_ue_s1ap_id_t enb_ue_id, - enum s1_ue_state_s expected_ue_state); + enum S1apUeState expected_ue_state); status_code_e simulate_pdu_s1_message(uint8_t* bytes, long bytes_len, s1ap_state_t* state, diff --git a/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_handle_new_association.cpp b/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_handle_new_association.cpp index 035ca6ef0a30..a16d184d59b2 100644 --- a/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_handle_new_association.cpp +++ b/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_handle_new_association.cpp @@ -25,6 +25,7 @@ using ::testing::Test; namespace magma { namespace lte { +using oai::EnbDescription; TEST(test_s1ap_handle_new_association, empty_initial_state) { s1ap_state_t* s = create_s1ap_state(); // 192.168.60.141 as network bytes @@ -39,16 +40,17 @@ TEST(test_s1ap_handle_new_association, empty_initial_state) { EXPECT_EQ(s->enbs.size(), 1); - enb_description_t* enbd = nullptr; + EnbDescription* enbd = nullptr; EXPECT_EQ(s->enbs.get(p.assoc_id, &enbd), magma::PROTO_MAP_OK); - EXPECT_EQ(enbd->sctp_assoc_id, 3); - EXPECT_EQ(enbd->instreams, 1); - EXPECT_EQ(enbd->outstreams, 2); - EXPECT_EQ(enbd->enb_id, 0xFFFFFFFF); - EXPECT_EQ(enbd->s1_state, S1AP_INIT); - EXPECT_EQ(enbd->next_sctp_stream, 1); - EXPECT_STREQ(enbd->ran_cp_ipaddr, "\300\250<\215\0\0\0\0\0\0\0\0\0\0\0\0"); - EXPECT_EQ(enbd->ran_cp_ipaddr_sz, 4); + EXPECT_EQ(enbd->sctp_assoc_id(), 3); + EXPECT_EQ(enbd->instreams(), 1); + EXPECT_EQ(enbd->outstreams(), 2); + EXPECT_EQ(enbd->enb_id(), 0xFFFFFFFF); + EXPECT_EQ(enbd->s1_enb_state(), oai::S1AP_INIT); + EXPECT_EQ(enbd->next_sctp_stream(), 1); + EXPECT_STREQ(enbd->ran_cp_ipaddr().c_str(), + "\300\250<\215\0\0\0\0\0\0\0\0\0\0\0\0"); + EXPECT_EQ(enbd->ran_cp_ipaddr_sz(), 4); // association is created, but S1Setup has not yet occurred EXPECT_EQ(s->num_enbs, 0); @@ -63,9 +65,9 @@ TEST(test_s1ap_handle_new_association, shutdown) { EXPECT_EQ(s1ap_handle_new_association(s, &p), RETURNok); // set enb to shutdown state - enb_description_t* enbd = nullptr; + EnbDescription* enbd = nullptr; EXPECT_EQ(s->enbs.get(p.assoc_id, &enbd), magma::PROTO_MAP_OK); - enbd->s1_state = S1AP_SHUTDOWN; + enbd->set_s1_enb_state(oai::S1AP_SHUTDOWN); // expect error EXPECT_EQ(s1ap_handle_new_association(s, &p), RETURNerror); @@ -79,9 +81,9 @@ TEST(test_s1ap_handle_new_association, resetting) { EXPECT_EQ(s1ap_handle_new_association(s, &p), RETURNok); // set enb to shutdown state - enb_description_t* enbd = nullptr; + EnbDescription* enbd = nullptr; EXPECT_EQ(s->enbs.get(p.assoc_id, &enbd), magma::PROTO_MAP_OK); - enbd->s1_state = S1AP_RESETING; + enbd->set_s1_enb_state(oai::S1AP_RESETING); // expect error EXPECT_EQ(s1ap_handle_new_association(s, &p), RETURNerror); @@ -95,15 +97,15 @@ TEST(test_s1ap_handle_new_association, reassociate) { EXPECT_EQ(s1ap_handle_new_association(s, &p), RETURNok); // make sure first association worked - enb_description_t* enbd = nullptr; + EnbDescription* enbd = nullptr; EXPECT_EQ(s->enbs.get(p.assoc_id, &enbd), magma::PROTO_MAP_OK); - EXPECT_EQ(enbd->sctp_assoc_id, 1); - EXPECT_EQ(enbd->instreams, 0); - EXPECT_EQ(enbd->outstreams, 0); - EXPECT_STREQ(enbd->ran_cp_ipaddr, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); - EXPECT_EQ(enbd->ran_cp_ipaddr_sz, 0); + EXPECT_EQ(enbd->sctp_assoc_id(), 1); + EXPECT_EQ(enbd->instreams(), 0); + EXPECT_EQ(enbd->outstreams(), 0); + EXPECT_STREQ(enbd->ran_cp_ipaddr().c_str(), ""); + EXPECT_EQ(enbd->ran_cp_ipaddr_sz(), 0); // should be OK if enb status is READY - enbd->s1_state = S1AP_READY; + enbd->set_s1_enb_state(oai::S1AP_READY); // new assoc with same id should overwrite bstring ran_cp_ipaddr = bfromcstr("\xc0\xa8\x3c\x8d"); @@ -115,12 +117,12 @@ TEST(test_s1ap_handle_new_association, reassociate) { }; EXPECT_EQ(s1ap_handle_new_association(s, &p2), RETURNok); - EXPECT_EQ(enbd->sctp_assoc_id, 1); - EXPECT_EQ(enbd->instreams, 10); - EXPECT_EQ(enbd->outstreams, 20); - EXPECT_STREQ(enbd->ran_cp_ipaddr, "\300\250<\215\0\0\0\0\0\0\0\0\0\0\0\0"); - EXPECT_EQ(enbd->ran_cp_ipaddr_sz, 4); - EXPECT_EQ(enbd->s1_state, S1AP_INIT); + EXPECT_EQ(enbd->sctp_assoc_id(), 1); + EXPECT_EQ(enbd->instreams(), 10); + EXPECT_EQ(enbd->outstreams(), 20); + EXPECT_STREQ(enbd->ran_cp_ipaddr().c_str(), "\300\250<\215"); + EXPECT_EQ(enbd->ran_cp_ipaddr_sz(), 4); + EXPECT_EQ(enbd->s1_enb_state(), oai::S1AP_INIT); bdestroy(ran_cp_ipaddr); free_s1ap_state(s); @@ -140,18 +142,17 @@ TEST(test_s1ap_handle_new_association, clean_stale_association) { EXPECT_EQ(s->enbs.size(), 1); - enb_description_t* enb_ref = - (enb_description_t*)calloc(1, sizeof(enb_description_t)); + EnbDescription* enb_ref = new EnbDescription(); - enb_description_t* enb_associated = NULL; + EnbDescription* enb_associated = nullptr; s->enbs.get(p.assoc_id, &enb_associated); - enb_ref->enb_id = enb_associated->enb_id; + enb_ref->set_enb_id(enb_associated->enb_id()); clean_stale_enb_state(s, enb_ref); EXPECT_EQ(s->enbs.size(), 0); bdestroy(ran_cp_ipaddr); - free_wrapper((void**)&enb_ref); + free_enb_description(reinterpret_cast(&enb_ref)); free_s1ap_state(s); } diff --git a/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_mme_handlers.cpp b/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_mme_handlers.cpp index afd9294b29ff..1764f9c00d53 100644 --- a/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_mme_handlers.cpp +++ b/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_mme_handlers.cpp @@ -134,9 +134,9 @@ TEST_F(S1apMmeHandlersTest, HandleS1SetupRequestFailureHss) { TEST_F(S1apMmeHandlersTest, HandleS1SetupRequestFailureReseting) { EXPECT_CALL(*sctp_handler, sctpd_send_dl()).Times(1); - enb_description_t* enb_associated = NULL; + oai::EnbDescription* enb_associated = nullptr; state->enbs.get(assoc_id, &enb_associated); - enb_associated->s1_state = S1AP_RESETING; + enb_associated->set_s1_enb_state(oai::S1AP_RESETING); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -170,7 +170,7 @@ TEST_F(S1apMmeHandlersTest, HandleCloseSctpAssociation) { s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); uint8_t initial_ue_bytes[] = { @@ -207,7 +207,7 @@ TEST_F(S1apMmeHandlersTest, HandleICSResponseICSRelease) { EXPECT_CALL(*mme_app_handler, mme_app_handle_initial_context_setup_failure()) .Times(0); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -216,7 +216,7 @@ TEST_F(S1apMmeHandlersTest, HandleICSResponseICSRelease) { s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); uint8_t initial_ue_bytes[] = { @@ -268,7 +268,7 @@ TEST_F(S1apMmeHandlersTest, HandleICSResponseICSRelease) { ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1ap_S1AP_PDU, &pdu_s1); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 1)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 1)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); uint8_t ics_release_bytes[] = {0x00, 0x12, 0x40, 0x15, 0x00, 0x00, 0x03, @@ -297,7 +297,7 @@ TEST_F(S1apMmeHandlersTest, HandleICSFailure) { EXPECT_CALL(*mme_app_handler, mme_app_handle_initial_context_setup_failure()) .Times(1); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -306,7 +306,7 @@ TEST_F(S1apMmeHandlersTest, HandleICSFailure) { s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); uint8_t initial_ue_bytes[] = { @@ -363,7 +363,7 @@ TEST_F(S1apMmeHandlersTest, HandleUECapIndication) { EXPECT_CALL(*sctp_handler, sctpd_send_dl()).Times(1); EXPECT_CALL(*mme_app_handler, mme_app_handle_initial_ue_message()).Times(1); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -372,7 +372,7 @@ TEST_F(S1apMmeHandlersTest, HandleUECapIndication) { s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); uint8_t initial_ue_bytes[] = { @@ -410,7 +410,7 @@ TEST_F(S1apMmeHandlersTest, HandleUECapIndication) { RETURNok); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 1)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 1)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); // Freeing pdu and payload data @@ -420,18 +420,18 @@ TEST_F(S1apMmeHandlersTest, HandleUECapIndication) { } TEST_F(S1apMmeHandlersTest, GenerateUEContextReleaseCommand) { - ue_description_t ue_ref_p = { - .enb_ue_s1ap_id = 1, - .mme_ue_s1ap_id = 1, - .sctp_assoc_id = assoc_id, - .comp_s1ap_id = S1AP_GENERATE_COMP_S1AP_ID(assoc_id, 1)}; - - ue_ref_p.s1ap_ue_context_rel_timer.id = -1; - ue_ref_p.s1ap_ue_context_rel_timer.msec = 1000; + oai::UeDescription ue_ref_p; + ue_ref_p.set_enb_ue_s1ap_id(1); + ue_ref_p.set_mme_ue_s1ap_id(1); + ue_ref_p.set_sctp_assoc_id(assoc_id); + ue_ref_p.set_comp_s1ap_id(S1AP_GENERATE_COMP_S1AP_ID(assoc_id, 1)); + + ue_ref_p.mutable_s1ap_ue_context_rel_timer()->set_id(-1); + ue_ref_p.mutable_s1ap_ue_context_rel_timer()->set_msec(1000); EXPECT_CALL(*sctp_handler, sctpd_send_dl()).Times(2); EXPECT_CALL(*mme_app_handler, mme_app_handle_initial_ue_message()).Times(1); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -440,7 +440,7 @@ TEST_F(S1apMmeHandlersTest, GenerateUEContextReleaseCommand) { s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); uint8_t initial_ue_bytes[] = { @@ -465,7 +465,7 @@ TEST_F(S1apMmeHandlersTest, GenerateUEContextReleaseCommand) { state, &ue_ref_p, S1AP_INITIAL_CONTEXT_SETUP_FAILED, INVALID_IMSI64, assoc_id, stream_id, 1, 1)); - EXPECT_NE(ue_ref_p.s1ap_ue_context_rel_timer.id, S1AP_TIMER_INACTIVE_ID); + EXPECT_NE(ue_ref_p.s1ap_ue_context_rel_timer().id(), S1AP_TIMER_INACTIVE_ID); // Freeing pdu and payload data ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1ap_S1AP_PDU, &pdu_s1); @@ -477,7 +477,7 @@ TEST_F(S1apMmeHandlersTest, HandleUEContextRelease) { EXPECT_CALL(*sctp_handler, sctpd_send_dl()).Times(1); EXPECT_CALL(*mme_app_handler, mme_app_handle_initial_ue_message()).Times(1); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -501,7 +501,7 @@ TEST_F(S1apMmeHandlersTest, HandleUEContextRelease) { handle_mme_ue_id_notification(state, assoc_id); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 1)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 1)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); ASSERT_EQ(state->mmeid2associd.size(), 1); @@ -553,7 +553,7 @@ TEST_F(S1apMmeHandlersTest, HandleConnectionEstCnf) { .Times(0); EXPECT_CALL(*mme_app_handler, nas_proc_dl_transfer_rej()).Times(0); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -561,7 +561,7 @@ TEST_F(S1apMmeHandlersTest, HandleConnectionEstCnf) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -597,7 +597,7 @@ TEST_F(S1apMmeHandlersTest, HandleConnectionEstCnfExtUEAMBR) { .Times(0); EXPECT_CALL(*mme_app_handler, nas_proc_dl_transfer_rej()).Times(0); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -605,7 +605,7 @@ TEST_F(S1apMmeHandlersTest, HandleConnectionEstCnfExtUEAMBR) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -640,7 +640,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apErabRelCmd) { .Times(0); EXPECT_CALL(*mme_app_handler, nas_proc_dl_transfer_rej()).Times(0); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -648,7 +648,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apErabRelCmd) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -680,7 +680,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apErabSetupReq) { EXPECT_CALL(*sctp_handler, sctpd_send_dl()).Times(2); EXPECT_CALL(*mme_app_handler, mme_app_handle_initial_ue_message()).Times(1); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -688,7 +688,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apErabSetupReq) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -721,7 +721,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apErabReleaseComplete) { EXPECT_CALL(*mme_app_handler, mme_app_handle_initial_ue_message()).Times(1); EXPECT_CALL(*mme_app_handler, mme_app_handle_e_rab_setup_rsp()).Times(1); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -729,7 +729,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apErabReleaseComplete) { ASSERT_EQ(s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1), RETURNok); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -790,7 +790,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apErabResetReq) { .Times(0); EXPECT_CALL(*mme_app_handler, nas_proc_dl_transfer_rej()).Times(0); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -798,7 +798,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apErabResetReq) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -833,7 +833,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apUeCtxtModification) { .Times(0); EXPECT_CALL(*mme_app_handler, nas_proc_dl_transfer_rej()).Times(0); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -841,7 +841,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apUeCtxtModification) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -859,7 +859,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apUeCtxtModification) { handle_mme_ue_id_notification(state, assoc_id); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 1)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 1)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); ASSERT_EQ(state->mmeid2associd.size(), 1); @@ -879,7 +879,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apPathSwitchRequest) { .Times(0); EXPECT_CALL(*mme_app_handler, nas_proc_dl_transfer_rej()).Times(0); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -887,7 +887,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apPathSwitchRequest) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -905,7 +905,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apPathSwitchRequest) { handle_mme_ue_id_notification(state, assoc_id); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 1)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 1)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); ASSERT_EQ(state->mmeid2associd.size(), 1); @@ -925,7 +925,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apPathSwitchFailure) { .Times(0); EXPECT_CALL(*mme_app_handler, nas_proc_dl_transfer_rej()).Times(0); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -933,7 +933,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apPathSwitchFailure) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -966,7 +966,7 @@ TEST_F(S1apMmeHandlersTest, HandleMmeHandoverRequest) { .Times(0); EXPECT_CALL(*mme_app_handler, nas_proc_dl_transfer_rej()).Times(0); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -974,7 +974,7 @@ TEST_F(S1apMmeHandlersTest, HandleMmeHandoverRequest) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -1005,7 +1005,7 @@ TEST_F(S1apMmeHandlersTest, HandleMmeHandoverRequest) { TEST_F(S1apMmeHandlersTest, HandleS1apHandoverCommand) { ASSERT_EQ(task_zmq_ctx_main_s1ap.ready, true); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); EXPECT_CALL(*sctp_handler, sctpd_send_dl()).Times(2); EXPECT_CALL(*mme_app_handler, mme_app_handle_initial_ue_message()).Times(1); @@ -1019,7 +1019,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apHandoverCommand) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -1047,7 +1047,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apHandoverCommand) { std::this_thread::sleep_for(std::chrono::milliseconds(200)); // State validation - ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, S1AP_UE_HANDOVER)); + ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, oai::S1AP_UE_HANDOVER)); } TEST_F(S1apMmeHandlersTest, HandleMmeHandover) { @@ -1153,7 +1153,7 @@ TEST_F(S1apMmeHandlersTest, HandleMmeHandover) { assoc_id, stream_id), RETURNok); - ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, S1AP_UE_CONNECTED)); + ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, oai::S1AP_UE_CONNECTED)); // Simulate Attach Complete uint8_t attach_compl_bytes[] = { @@ -1203,9 +1203,9 @@ TEST_F(S1apMmeHandlersTest, HandleMmeHandover) { // Send S1AP_HANDOVER_COMMAND mimicing MME_APP ASSERT_EQ(send_s1ap_mme_handover_command(assoc_id, 7, 1, 2, 10, 2), RETURNok); - ue_description_t* ue_ref_p = s1ap_state_get_ue_mmeid(7); + oai::UeDescription* ue_ref_p = s1ap_state_get_ue_mmeid(7); cv.wait_for(lock, std::chrono::milliseconds(1000)); - ASSERT_EQ(ue_ref_p->s1_ue_state, S1AP_UE_HANDOVER); + ASSERT_EQ(ue_ref_p->s1ap_ue_state(), oai::S1AP_UE_HANDOVER); // Simulate ENB Status Transfer uint8_t enb_transfer[] = {0x00, 0x18, 0x40, 0x24, 0x00, 0x00, 0x03, 0x00, @@ -1231,12 +1231,7 @@ TEST_F(S1apMmeHandlersTest, HandleMmeHandover) { // Free up eRAB data on target eNB ue_ref_p = s1ap_state_get_ue_enbid(target_assoc_id, 2); - ASSERT_EQ(ue_ref_p->s1ap_handover_state.target_enb_id, 2); - for (int i = 0; - i < ue_ref_p->s1ap_handover_state.e_rab_admitted_list.no_of_items; i++) { - bdestroy_wrapper(&ue_ref_p->s1ap_handover_state.e_rab_admitted_list.item[i] - .transport_layer_address); - } + ASSERT_EQ(ue_ref_p->s1ap_handover_state().target_enb_id(), 2); } TEST_F(S1apMmeHandlersTest, HandleMmeHandoverFailure) { @@ -1342,7 +1337,7 @@ TEST_F(S1apMmeHandlersTest, HandleMmeHandoverFailure) { assoc_id, stream_id), RETURNok); - ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, S1AP_UE_CONNECTED)); + ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, oai::S1AP_UE_CONNECTED)); // Simulate Attach Complete uint8_t attach_compl_bytes[] = { @@ -1487,7 +1482,7 @@ TEST_F(S1apMmeHandlersTest, HandleMmeHandoverCancel) { assoc_id, stream_id), RETURNok); - ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, S1AP_UE_CONNECTED)); + ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, oai::S1AP_UE_CONNECTED)); // Simulate Attach Complete uint8_t attach_compl_bytes[] = { @@ -1538,9 +1533,9 @@ TEST_F(S1apMmeHandlersTest, HandleMmeHandoverCancel) { ASSERT_EQ(send_s1ap_mme_handover_command(assoc_id, 7, 1, 2, 10, 11), RETURNok); - ue_description_t* ue_ref_p = s1ap_state_get_ue_mmeid(7); + oai::UeDescription* ue_ref_p = s1ap_state_get_ue_mmeid(7); cv.wait_for(lock, std::chrono::milliseconds(1000)); - ASSERT_EQ(ue_ref_p->s1_ue_state, S1AP_UE_HANDOVER); + ASSERT_EQ(ue_ref_p->s1ap_ue_state(), oai::S1AP_UE_HANDOVER); // Simulate Handover Cancel uint8_t hand_cancel[] = {0x00, 0x04, 0x00, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -1639,7 +1634,7 @@ TEST_F(S1apMmeHandlersTest, HandleErabSetupResponse) { assoc_id, stream_id), RETURNok); - ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, S1AP_UE_CONNECTED)); + ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, oai::S1AP_UE_CONNECTED)); // Simulate Attach Complete uint8_t attach_compl_bytes[] = { @@ -1765,7 +1760,7 @@ TEST_F(S1apMmeHandlersTest, HandleErrorIndicationMessage) { assoc_id, stream_id), RETURNok); - ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, S1AP_UE_CONNECTED)); + ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, oai::S1AP_UE_CONNECTED)); // Simulate Attach Complete uint8_t attach_compl_bytes[] = { @@ -1889,7 +1884,7 @@ TEST_F(S1apMmeHandlersTest, HandleEnbResetPartial) { assoc_id, stream_id), RETURNok); - ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, S1AP_UE_CONNECTED)); + ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, oai::S1AP_UE_CONNECTED)); // Simulate Attach Complete uint8_t attach_compl_bytes[] = { @@ -1917,7 +1912,7 @@ TEST_F(S1apMmeHandlersTest, HandleEnbResetPartial) { TEST_F(S1apMmeHandlersTest, HandleS1apPagingRequest) { ASSERT_EQ(task_zmq_ctx_main_s1ap.ready, true); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); EXPECT_CALL(*sctp_handler, sctpd_send_dl()).Times(1); EXPECT_CALL(*mme_app_handler, mme_app_handle_initial_ue_message()).Times(1); @@ -1931,7 +1926,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apPagingRequest) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -1954,7 +1949,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apPagingRequest) { handle_mme_ue_id_notification(state, assoc_id); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 1)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 1)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); ASSERT_EQ(state->mmeid2associd.size(), 1); @@ -1970,7 +1965,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apPagingRequest) { TEST_F(S1apMmeHandlersTest, HandleS1apErabModificationCnf) { ASSERT_EQ(task_zmq_ctx_main_s1ap.ready, true); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); EXPECT_CALL(*sctp_handler, sctpd_send_dl()).Times(2); EXPECT_CALL(*mme_app_handler, mme_app_handle_initial_ue_message()).Times(1); @@ -1984,7 +1979,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apErabModificationCnf) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -2002,7 +1997,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apErabModificationCnf) { handle_mme_ue_id_notification(state, assoc_id); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 1)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 1)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); ASSERT_EQ(state->mmeid2associd.size(), 1); @@ -2018,7 +2013,7 @@ TEST_F(S1apMmeHandlersTest, HandlePathSwitchRequestSuccess) { bool is_state_same = true; - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); EXPECT_CALL(*sctp_handler, sctpd_send_dl()).Times(5); EXPECT_CALL(*mme_app_handler, mme_app_handle_initial_ue_message()).Times(1); @@ -2114,8 +2109,8 @@ TEST_F(S1apMmeHandlersTest, HandlePathSwitchRequestSuccess) { RETURNok); // State validation - ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, S1AP_UE_CONNECTED)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 1)); + ASSERT_TRUE(is_ue_state_valid(assoc_id, 1, oai::S1AP_UE_CONNECTED)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 1)); // Simulate Attach Complete uint8_t attach_compl_bytes[] = { @@ -2170,7 +2165,7 @@ TEST_F(S1apMmeHandlersTest, HandlePathSwitchRequestSuccess) { RETURNok); // Confirm UE state update (assoc_id, enb_ue_s1ap_id) - ASSERT_TRUE(is_ue_state_valid(switch_assoc_id, 2, S1AP_UE_CONNECTED)); + ASSERT_TRUE(is_ue_state_valid(switch_assoc_id, 2, oai::S1AP_UE_CONNECTED)); // Simulate Detach request PDU payload uint8_t detach_req_bytes[] = { @@ -2196,7 +2191,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apNasNonDelivery) { bool is_state_same = false; - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_INIT, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_INIT, 0)); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -2204,7 +2199,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apNasNonDelivery) { ASSERT_EQ(RETURNok, s1ap_mme_handle_message(state, assoc_id, stream_id, &pdu_s1)); - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 0)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 0)); uint8_t initial_ue_bytes[] = { 0x00, 0x0c, 0x40, 0x48, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x02, @@ -2264,7 +2259,7 @@ TEST_F(S1apMmeHandlersTest, HandleS1apNasNonDelivery) { RETURNok); // State validation - ASSERT_TRUE(is_enb_state_valid(state, assoc_id, S1AP_READY, 1)); + ASSERT_TRUE(is_enb_state_valid(state, assoc_id, oai::S1AP_READY, 1)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); ASSERT_EQ(state->mmeid2associd.size(), 1); diff --git a/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_mme_handlers_with_injected_state.cpp b/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_mme_handlers_with_injected_state.cpp index 849afcb9ff16..1899118ff9d0 100644 --- a/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_mme_handlers_with_injected_state.cpp +++ b/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_mme_handlers_with_injected_state.cpp @@ -122,13 +122,14 @@ class S1apMmeHandlersWithInjectedStatesTest : public ::testing::Test { }; TEST_F(S1apMmeHandlersWithInjectedStatesTest, GenerateUEContextReleaseCommand) { - ue_description_t ue_ref_p = { - .enb_ue_s1ap_id = 1, - .mme_ue_s1ap_id = 99, - .sctp_assoc_id = assoc_id, - .comp_s1ap_id = S1AP_GENERATE_COMP_S1AP_ID(assoc_id, 1)}; - ue_ref_p.s1ap_ue_context_rel_timer.id = -1; - ue_ref_p.s1ap_ue_context_rel_timer.msec = 1000; + oai::UeDescription ue_ref_p; + ue_ref_p.Clear(); + ue_ref_p.set_enb_ue_s1ap_id(1); + ue_ref_p.set_mme_ue_s1ap_id(99); + ue_ref_p.set_sctp_assoc_id(assoc_id); + ue_ref_p.set_comp_s1ap_id(S1AP_GENERATE_COMP_S1AP_ID(assoc_id, 1)); + ue_ref_p.mutable_s1ap_ue_context_rel_timer()->set_id(-1); + ue_ref_p.mutable_s1ap_ue_context_rel_timer()->set_msec(1000); S1ap_S1AP_PDU_t pdu_s1; memset(&pdu_s1, 0, sizeof(pdu_s1)); @@ -136,7 +137,7 @@ TEST_F(S1apMmeHandlersWithInjectedStatesTest, GenerateUEContextReleaseCommand) { // State validation ASSERT_TRUE( - is_enb_state_valid(state, assoc_id, S1AP_READY, number_attached_ue)); + is_enb_state_valid(state, assoc_id, oai::S1AP_READY, number_attached_ue)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); // Invalid S1 Cause returns error @@ -148,11 +149,11 @@ TEST_F(S1apMmeHandlersWithInjectedStatesTest, GenerateUEContextReleaseCommand) { state, &ue_ref_p, S1AP_INITIAL_CONTEXT_SETUP_FAILED, INVALID_IMSI64, assoc_id, stream_id, 99, 1)); - EXPECT_NE(ue_ref_p.s1ap_ue_context_rel_timer.id, S1AP_TIMER_INACTIVE_ID); + EXPECT_NE(ue_ref_p.s1ap_ue_context_rel_timer().id(), S1AP_TIMER_INACTIVE_ID); // State validation ASSERT_TRUE( - is_enb_state_valid(state, assoc_id, S1AP_READY, number_attached_ue)); + is_enb_state_valid(state, assoc_id, oai::S1AP_READY, number_attached_ue)); // Freeing pdu and payload data ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1ap_S1AP_PDU, &pdu_s1); @@ -163,7 +164,7 @@ TEST_F(S1apMmeHandlersWithInjectedStatesTest, HandleS1apPathSwitchRequest) { // State validation ASSERT_TRUE( - is_enb_state_valid(state, assoc_id, S1AP_READY, number_attached_ue)); + is_enb_state_valid(state, assoc_id, oai::S1AP_READY, number_attached_ue)); ASSERT_TRUE(is_num_enbs_valid(state, 1)); ASSERT_EQ(state->mmeid2associd.size(), number_attached_ue); @@ -172,7 +173,7 @@ TEST_F(S1apMmeHandlersWithInjectedStatesTest, HandleS1apPathSwitchRequest) { // verify number of ues after sending S1AP_PATH_SWITCH_REQUEST_ACK ASSERT_TRUE( - is_enb_state_valid(state, assoc_id, S1AP_READY, number_attached_ue)); + is_enb_state_valid(state, assoc_id, oai::S1AP_READY, number_attached_ue)); } } // namespace lte diff --git a/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_state_converter.cpp b/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_state_converter.cpp index 6b02caf67104..6fc73c8f8d15 100644 --- a/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_state_converter.cpp +++ b/lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_state_converter.cpp @@ -50,29 +50,37 @@ TEST_F(S1APStateConverterTest, S1apStateConversionSuccess) { s1ap_state_t* init_state = create_s1ap_state(); s1ap_state_t* final_state = create_s1ap_state(); - enb_description_t* enb_association = s1ap_new_enb(); - enb_association->sctp_assoc_id = assoc_id; - enb_association->enb_id = 0xFFFFFFFF; - enb_association->s1_state = S1AP_READY; + oai::EnbDescription* enb_association = s1ap_new_enb(); + enb_association->set_sctp_assoc_id(assoc_id); + enb_association->set_enb_id(0xFFFFFFFF); + enb_association->set_s1_enb_state(oai::S1AP_READY); // filling ue_id_coll - enb_association->ue_id_coll.insert(1, 17); - enb_association->ue_id_coll.insert(2, 25); + magma::proto_map_uint32_uint64_t ue_id_coll; + ue_id_coll.map = enb_association->mutable_ue_id_map(); + ue_id_coll.insert(1, 17); + ue_id_coll.insert(2, 25); // filling supported_tai_items - supported_ta_list_t* enb_ta_list = &enb_association->supported_ta_list; - enb_ta_list->list_count = 1; - enb_ta_list->supported_tai_items[0].tac = 1; - enb_ta_list->supported_tai_items[0].bplmnlist_count = 1; - enb_ta_list->supported_tai_items[0].bplmns[0].mcc_digit1 = 1; - enb_ta_list->supported_tai_items[0].bplmns[0].mcc_digit2 = 1; - enb_ta_list->supported_tai_items[0].bplmns[0].mcc_digit3 = 1; - enb_ta_list->supported_tai_items[0].bplmns[0].mnc_digit1 = 1; - enb_ta_list->supported_tai_items[0].bplmns[0].mnc_digit2 = 1; - enb_ta_list->supported_tai_items[0].bplmns[0].mnc_digit3 = 1; + oai::SupportedTaList* enb_ta_list = + enb_association->mutable_supported_ta_list(); + enb_ta_list->set_list_count(1); + + for (int tai_idx = 0; tai_idx < enb_ta_list->list_count(); tai_idx++) { + oai::SupportedTaiItems* supported_tai_items = + enb_ta_list->add_supported_tai_items(); + supported_tai_items->set_tac(1); + + supported_tai_items->set_bplmnlist_count(1); + char plmn_array[PLMN_BYTES] = {1, 2, 3, 4, 5, 6}; + for (int plmn_idx = 0; plmn_idx < supported_tai_items->bplmnlist_count(); + plmn_idx++) { + supported_tai_items->add_bplmns(plmn_array); + } + } // Inserting 1 enb association - init_state->enbs.insert(enb_association->sctp_assoc_id, enb_association); + init_state->enbs.insert(enb_association->sctp_assoc_id(), enb_association); init_state->num_enbs = 1; init_state->mmeid2associd.insert(1, assoc_id); @@ -82,19 +90,19 @@ TEST_F(S1APStateConverterTest, S1apStateConversionSuccess) { S1apStateConverter::proto_to_state(state_proto, final_state); EXPECT_EQ(init_state->num_enbs, final_state->num_enbs); - enb_description_t* enbd = nullptr; - enb_description_t* enbd_final = nullptr; + oai::EnbDescription* enbd = nullptr; + oai::EnbDescription* enbd_final = nullptr; EXPECT_EQ(init_state->enbs.get(assoc_id, &enbd), magma::PROTO_MAP_OK); EXPECT_EQ(final_state->enbs.get(assoc_id, &enbd_final), magma::PROTO_MAP_OK); - EXPECT_EQ(enbd->sctp_assoc_id, enbd_final->sctp_assoc_id); - EXPECT_EQ(enbd->enb_id, enbd_final->enb_id); - EXPECT_EQ(enbd->s1_state, enbd_final->s1_state); + EXPECT_EQ(enbd->sctp_assoc_id(), enbd_final->sctp_assoc_id()); + EXPECT_EQ(enbd->enb_id(), enbd_final->enb_id()); + EXPECT_EQ(enbd->s1_enb_state(), enbd_final->s1_enb_state()); - EXPECT_EQ(enbd->supported_ta_list.list_count, - enbd_final->supported_ta_list.list_count); - EXPECT_EQ(enbd->supported_ta_list.supported_tai_items[0].tac, - enbd_final->supported_ta_list.supported_tai_items[0].tac); + EXPECT_EQ(enbd->supported_ta_list().list_count(), + enbd_final->supported_ta_list().list_count()); + EXPECT_EQ(enbd->supported_ta_list().supported_tai_items(0).tac(), + enbd_final->supported_ta_list().supported_tai_items(0).tac()); free_s1ap_state(init_state); free_s1ap_state(final_state); @@ -105,12 +113,12 @@ TEST_F(S1APStateConverterTest, S1apStateConversionExpectedEnbCount) { s1ap_state_t* init_state = create_s1ap_state(); s1ap_state_t* final_state = create_s1ap_state(); - enb_description_t* enb_association = s1ap_new_enb(); - enb_association->sctp_assoc_id = assoc_id; - enb_association->enb_id = 0xFFFFFFFF; - enb_association->s1_state = S1AP_READY; + oai::EnbDescription* enb_association = s1ap_new_enb(); + enb_association->set_sctp_assoc_id(assoc_id); + enb_association->set_enb_id(0xFFFFFFFF); + enb_association->set_s1_enb_state(oai::S1AP_READY); // Inserting 1 enb association - init_state->enbs.insert(enb_association->sctp_assoc_id, enb_association); + init_state->enbs.insert(enb_association->sctp_assoc_id(), enb_association); // state_to_proto should update num_enbs to match expected eNB count on the // map init_state->num_enbs = 5; @@ -127,27 +135,27 @@ TEST_F(S1APStateConverterTest, S1apStateConversionExpectedEnbCount) { } TEST_F(S1APStateConverterTest, S1apStateConversionUeContext) { - ue_description_t* ue = new ue_description_t(); - ue_description_t* final_ue = new ue_description_t(); + oai::UeDescription* ue = new oai::UeDescription(); + oai::UeDescription* final_ue = new oai::UeDescription(); // filling with test values - ue->mme_ue_s1ap_id = 1; - ue->enb_ue_s1ap_id = 1; - ue->sctp_assoc_id = 1; - ue->comp_s1ap_id = S1AP_GENERATE_COMP_S1AP_ID(1, 1); - ue->s1ap_handover_state.mme_ue_s1ap_id = 1; - ue->s1ap_handover_state.source_enb_id = 1; - ue->s1ap_ue_context_rel_timer.id = 1; - ue->s1ap_ue_context_rel_timer.msec = 1000; + ue->set_mme_ue_s1ap_id(1); + ue->set_enb_ue_s1ap_id(1); + ue->set_sctp_assoc_id(1); + ue->set_comp_s1ap_id(S1AP_GENERATE_COMP_S1AP_ID(1, 1)); + ue->mutable_s1ap_handover_state()->set_mme_ue_s1ap_id(1); + ue->mutable_s1ap_handover_state()->set_source_enb_id(1); + ue->mutable_s1ap_ue_context_rel_timer()->set_id(1); + ue->mutable_s1ap_ue_context_rel_timer()->set_msec(1000); oai::UeDescription ue_proto; S1apStateConverter::ue_to_proto(ue, &ue_proto); S1apStateConverter::proto_to_ue(ue_proto, final_ue); - EXPECT_EQ(ue->comp_s1ap_id, final_ue->comp_s1ap_id); - EXPECT_EQ(ue->mme_ue_s1ap_id, final_ue->mme_ue_s1ap_id); - EXPECT_EQ(ue->s1ap_ue_context_rel_timer.id, - final_ue->s1ap_ue_context_rel_timer.id); + EXPECT_EQ(ue->comp_s1ap_id(), final_ue->comp_s1ap_id()); + EXPECT_EQ(ue->mme_ue_s1ap_id(), final_ue->mme_ue_s1ap_id()); + EXPECT_EQ(ue->s1ap_ue_context_rel_timer().id(), + final_ue->s1ap_ue_context_rel_timer().id()); delete ue; delete final_ue; diff --git a/lte/gateway/c/core/oai/test/spgw_task/spgw_test_util.cpp b/lte/gateway/c/core/oai/test/spgw_task/spgw_test_util.cpp index edc747a5ed04..3790730a1c7c 100644 --- a/lte/gateway/c/core/oai/test/spgw_task/spgw_test_util.cpp +++ b/lte/gateway/c/core/oai/test/spgw_task/spgw_test_util.cpp @@ -23,12 +23,13 @@ extern "C" { #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_24.008.h" #include "lte/gateway/c/core/oai/lib/3gpp/3gpp_29.274.h" #include "lte/gateway/c/core/oai/include/gx_messages_types.h" -#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.h" #include "lte/gateway/c/core/oai/include/s11_messages_types.h" #include "lte/gateway/c/core/oai/common/itti_free_defined_msg.h" #include "lte/gateway/c/core/oai/common/common_types.h" } +#include "lte/gateway/c/core/oai/tasks/nas/api/mme/mme_api.hpp" + namespace magma { namespace lte { diff --git a/lte/gateway/configs/templates/mme.conf.template b/lte/gateway/configs/templates/mme.conf.template index fd3b36a91dfe..991a5ed379c7 100644 --- a/lte/gateway/configs/templates/mme.conf.template +++ b/lte/gateway/configs/templates/mme.conf.template @@ -355,4 +355,7 @@ AMF : GUAMFI_LIST = ( { MCC="{{ mcc }}" ; MNC="{{ mnc }}"; AMF_REGION_ID="{{ amf_region_id }}" ; AMF_SET_ID="{{ amf_set_id }}"; AMF_POINTER="{{ amf_pointer }}"} ); + + # IMP VoPS FEATURE + ENABLE_IMS_VoPS_3GPP = "{{ enable_IMS_VoPS_3GPP }}"; }; diff --git a/lte/gateway/deploy/agw_install_ubuntu.sh b/lte/gateway/deploy/agw_install_ubuntu.sh index cbd0f0cc2906..26c6e0862ffd 100755 --- a/lte/gateway/deploy/agw_install_ubuntu.sh +++ b/lte/gateway/deploy/agw_install_ubuntu.sh @@ -24,7 +24,7 @@ DEPLOY_PATH="/home/$MAGMA_USER/magma/lte/gateway/deploy" SUCCESS_MESSAGE="ok" NEED_REBOOT=0 WHOAMI=$(whoami) -MAGMA_VERSION="${MAGMA_VERSION:-v1.7}" +MAGMA_VERSION="${MAGMA_VERSION:-v1.8}" CLOUD_INSTALL="cloud" GIT_URL="${GIT_URL:-https://github.com/magma/magma.git}" INTERFACE_DIR="/etc/network/interfaces.d" diff --git a/lte/gateway/deploy/roles/dev_common/tasks/main.yml b/lte/gateway/deploy/roles/dev_common/tasks/main.yml index aef39ab651e5..9af61f729f54 100644 --- a/lte/gateway/deploy/roles/dev_common/tasks/main.yml +++ b/lte/gateway/deploy/roles/dev_common/tasks/main.yml @@ -70,7 +70,17 @@ - XDG_CACHE_HOME="{{magma_root}}/.cache" - SWAGGER_CODEGEN_JAR={{ swagger_codegen_jar }} - CODEGEN_ROOT={{ codegen_root }} - - ASAN_OPTIONS=abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1 + - ASAN_OPTIONS=abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1:fast_unwind_on_malloc=0 + - LSAN_OPTIONS=suppressions=/usr/local/suppressions.txt + when: full_provision + +- name: Create LSAN suppressions file + copy: + dest: "/usr/local/suppressions.txt" + content: | + leak:libczmq.so.4 + leak:libzmq.so.5 + leak:fluid_base::BaseOFConnection::OFReadBuffer::read_notify when: full_provision - name: "Go export" diff --git a/lte/gateway/deploy/roles/magma/tasks/main.yml b/lte/gateway/deploy/roles/magma/tasks/main.yml index 3dd8e14ea7f6..7599c925454b 100644 --- a/lte/gateway/deploy/roles/magma/tasks/main.yml +++ b/lte/gateway/deploy/roles/magma/tasks/main.yml @@ -130,6 +130,7 @@ - create_oai_certs.py - generate_oai_config.py - generate_dnsd_config.py + - icmpv6.py when: full_provision - name: Copy Envoy config diff --git a/lte/gateway/deploy/roles/magma_deb/tasks/main.yml b/lte/gateway/deploy/roles/magma_deb/tasks/main.yml index f147faeb0b38..69474a0d4837 100644 --- a/lte/gateway/deploy/roles/magma_deb/tasks/main.yml +++ b/lte/gateway/deploy/roles/magma_deb/tasks/main.yml @@ -156,3 +156,10 @@ - { src: 'lte/gateway/deploy/roles/magma/files/systemd/magma_sessiond.service', dest: 'magma@sessiond.service' } - { src: 'orc8r/tools/ansible/roles/fluent_bit/files/magma_td-agent-bit.service', dest: 'magma@td-agent-bit.service' } - { src: 'lte/gateway/deploy/roles/magma/files/systemd/magma_dp_envoy.service', dest: 'magma_dp@envoy.service' } + +- name: link python ipv6 config script that is only used for tests and not deployed + file: + src: /home/vagrant/magma/lte/gateway/python/scripts/config_iface_for_ipv6.py + dest: /usr/local/bin/config_iface_for_ipv6.py + state: link + force: yes diff --git a/lte/gateway/docker/.env b/lte/gateway/docker/.env index 44c62d932d7f..5027b2bbef2f 100644 --- a/lte/gateway/docker/.env +++ b/lte/gateway/docker/.env @@ -18,7 +18,6 @@ OPTIONAL_ARCH_POSTFIX= BUILD_CONTEXT=../../.. -ROOTCA_PATH=../../../.cache/test_certs/rootCA.pem CONTROL_PROXY_PATH=../configs/control_proxy.yml SNOWFLAKE_PATH=/etc/snowflake diff --git a/lte/gateway/docker/README.md b/lte/gateway/docker/README.md index a434d004faa0..ba1105c49fbf 100644 --- a/lte/gateway/docker/README.md +++ b/lte/gateway/docker/README.md @@ -40,8 +40,14 @@ containerized AGW by running the following steps inside the VM: ``` cd $MAGMA_ROOT/lte/gateway && make run # You can skip this if you have built the AGW with make before for component in redis nghttpx td-agent-bit; do cp "${MAGMA_ROOT}"/{orc8r,lte}/gateway/configs/templates/${component}.conf.template; done +sed -i 's/init_system: systemd/init_system: docker/' "${MAGMA_ROOT}"/lte/gateway/configs/magmad.yml sudo systemctl stop 'magma@*' 'sctpd' # We don't want the systemd-based AGW to run when we start the containerized AGW sudo systemctl start magma_dp@envoy + +# Optional: If you want to connect to an orc8r, copy the `rootCA.pem` from the orc8r +# to `/var/opt/magma/certs/rootCA.pem`. For example in a typical magma-dev VM: +cp ${MAGMA_ROOT}/.cache/test_certs/rootCA.pem /var/opt/magma/certs/ + cd $MAGMA_ROOT/lte/gateway/docker docker-compose build docker-compose up diff --git a/lte/gateway/docker/docker-compose.override.yaml b/lte/gateway/docker/docker-compose.override.yaml index 548de6579875..6ca3a0cc6d04 100644 --- a/lte/gateway/docker/docker-compose.override.yaml +++ b/lte/gateway/docker/docker-compose.override.yaml @@ -16,3 +16,4 @@ services: build: context: ${BUILD_CONTEXT} dockerfile: feg/gateway/docker/go/Dockerfile + image: gateway_go diff --git a/lte/gateway/docker/docker-compose.yaml b/lte/gateway/docker/docker-compose.yaml index c89598b7051d..56f67d874d4f 100644 --- a/lte/gateway/docker/docker-compose.yaml +++ b/lte/gateway/docker/docker-compose.yaml @@ -6,6 +6,21 @@ x-logging: &logging_anchor # Standard volumes mounted x-standard-volumes: &volumes_anchor + - ${CERTS_VOLUME}:/var/opt/magma/certs + - ${CONFIGS_TEMPLATES_PATH}:/etc/magma/templates + - ${CONFIGS_DEFAULT_VOLUME}:/etc/magma + - ${CONFIGS_OVERRIDE_VOLUME}:/var/opt/magma/configs + - ${CONFIGS_OVERRIDE_TMP_VOLUME}:/var/opt/magma/tmp + - /etc/snowflake:/etc/snowflake + - /var/opt/magma/fluent-bit:/var/opt/magma/fluent-bit + - ./:/var/opt/magma/docker + - /var/run:/var/run + - /tmp:/tmp + - /var/log:/var/log + - /etc/openvswitch:/etc/openvswitch + +# Magmad volumes mounted +x-magmad-volumes: &magmad_volumes_anchor - ${CERTS_VOLUME}:/var/opt/magma/certs - ${CONFIGS_TEMPLATES_PATH}:/etc/magma/templates - ${CONFIGS_DEFAULT_VOLUME}:/etc/magma @@ -19,6 +34,7 @@ x-standard-volumes: &volumes_anchor - /tmp:/tmp - /var/log:/var/log - /etc/openvswitch:/etc/openvswitch + - /var/run/docker.sock:/var/run/docker.sock x-generic-service: &service volumes: *volumes_anchor @@ -45,6 +61,7 @@ services: interval: "4s" timeout: "4s" retries: 3 + volumes: *magmad_volumes_anchor environment: DOCKER_REGISTRY: ${DOCKER_REGISTRY} DOCKER_USERNAME: ${DOCKER_USERNAME} diff --git a/lte/gateway/docker/mme/Dockerfile.rhel8 b/lte/gateway/docker/mme/Dockerfile.rhel8 index 2892f4b76c35..0ff51e0ad9d9 100644 --- a/lte/gateway/docker/mme/Dockerfile.rhel8 +++ b/lte/gateway/docker/mme/Dockerfile.rhel8 @@ -10,8 +10,10 @@ ENV BUILD_TYPE=RelWithDebInfo ENV C_BUILD=/build/c ENV TZ=Europe/Paris # Copy RHEL certificates for builder image -COPY tmp/entitlement/*.pem /etc/pki/entitlement -COPY tmp/ca/redhat-uep.pem /etc/rhsm/ca +COPY ./etc-pki-entitlement /etc/pki/entitlement +# Copy the subscription manager configurations +COPY ./rhsm-conf /etc/rhsm +COPY ./rhsm-ca /etc/rhsm/ca RUN mkdir -p $C_BUILD diff --git a/lte/gateway/docker/services/python/Dockerfile b/lte/gateway/docker/services/python/Dockerfile index acb2f45080ed..47a99fd84ed9 100644 --- a/lte/gateway/docker/services/python/Dockerfile +++ b/lte/gateway/docker/services/python/Dockerfile @@ -63,10 +63,10 @@ RUN gem install fpm COPY . $MAGMA_ROOT/ WORKDIR /var/tmp/ RUN /magma/third_party/build/bin/aioeventlet_build.sh && \ - dpkg -i python3-aioeventlet* + dpkg -i python3-aioeventlet* RUN mkdir -p ${SWAGGER_CODEGEN_DIR}; \ - wget --no-verbose https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${CODEGEN_VERSION}/swagger-codegen-cli-${CODEGEN_VERSION}.jar -O ${SWAGGER_CODEGEN_JAR} + wget --no-verbose https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${CODEGEN_VERSION}/swagger-codegen-cli-${CODEGEN_VERSION}.jar -O ${SWAGGER_CODEGEN_JAR} WORKDIR /magma/lte/gateway/python RUN make buildenv @@ -89,6 +89,7 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ apt-transport-https \ ca-certificates \ + docker.io \ ethtool \ inetutils-ping \ iproute2 \ diff --git a/lte/gateway/fabfile.py b/lte/gateway/fabfile.py index 3e7c8c05d87e..1dcce456cabc 100644 --- a/lte/gateway/fabfile.py +++ b/lte/gateway/fabfile.py @@ -536,23 +536,45 @@ def run_integ_tests(tests=None, federated_mode=False): if tests: tests = "TESTS=" + tests - execute(_run_integ_tests, gateway_ip, tests, federated_mode) + execute(_run_integ_tests, gateway_ip, tests, _to_boolean(federated_mode)) + + +def _to_boolean(value): + """Fabric function arguments passed by calling fab from external are strings. + This is, boolean arguments set to "True" and "False" must be interpreted. + """ + if isinstance(value, bool): + return value + + if not isinstance(value, str): + raise ValueError('Input can not be parsed to boolean - not a string or a boolean.') + + return bool(strtobool(value)) def get_test_summaries( gateway_host=None, test_host=None, dst_path="/tmp", + integration_tests=True, + sudo_tests=True, + dev_vm_name="magma", ): local('mkdir -p ' + dst_path) - # TODO we may want to zip up all these files - _switch_to_vm_no_provision(gateway_host, "magma", "magma_dev.yml") - with settings(warn_only=True): - get(remote_path=TEST_SUMMARY_GLOB, local_path=dst_path) - _switch_to_vm_no_provision(test_host, "magma_test", "magma_test.yml") - with settings(warn_only=True): - get(remote_path=TEST_SUMMARY_GLOB, local_path=dst_path) + vm_name_to_yaml = { + "magma": "magma_dev.yml", + "magma_deb": "magma_deb.yml", + } + + if _to_boolean(sudo_tests): + _switch_to_vm_no_provision(gateway_host, dev_vm_name, vm_name_to_yaml[dev_vm_name]) + with settings(warn_only=True): + get(remote_path=TEST_SUMMARY_GLOB, local_path=dst_path) + if _to_boolean(integration_tests): + _switch_to_vm_no_provision(test_host, "magma_test", "magma_test.yml") + with settings(warn_only=True): + get(remote_path=TEST_SUMMARY_GLOB, local_path=dst_path) def get_test_logs( @@ -592,7 +614,7 @@ def get_test_logs( '/var/log/openvswitch/ovs*.log', ] test_files = ['/var/log/syslog', '/tmp/fw/'] - trf_files = ['/home/admin/nohup.out'] + trf_files = ['/home/vagrant/trfserver.log'] # Set up to enter the gateway host env.host_string = gateway_host @@ -668,7 +690,7 @@ def load_test(gateway_host=None, destroy_vm=True): ansible_setup(gateway_host, 'dev', 'magma_dev.yml') gateway_ip = gateway_host.split('@')[1].split(':')[0] else: - gateway_host = vagrant_setup('magma', destroy_vm) + gateway_host = vagrant_setup('magma', _to_boolean(destroy_vm)) gateway_ip = '192.168.60.142' execute(_build_magma) @@ -801,33 +823,18 @@ def _set_service_config_var(service, var_name, value): def _start_trfserver(): """ Starts the traffic gen server""" - # disable-tcp-checksumming - # trfgen-server non daemon host = env.hosts[0].split(':')[0] port = env.hosts[0].split(':')[1] key = env.key_filename - # set tty on cbreak mode as background ssh process breaks indentation - local( - 'ssh -f -i %s -o UserKnownHostsFile=/dev/null' - ' -o StrictHostKeyChecking=no -tt %s -p %s' - ' sh -c "sudo ethtool --offload eth1 rx off tx off; ' - '";' - % (key, host, port), - ) - local( - 'ssh -f -i %s -o UserKnownHostsFile=/dev/null' - ' -o StrictHostKeyChecking=no -tt %s -p %s' - ' sh -c "sudo ethtool --offload eth2 rx off tx off; ' - 'nohup sudo /usr/local/bin/traffic_server.py 192.168.60.144 62462 > /dev/null 2>&1";' - % (key, host, port), - ) - local( - 'ssh -f -i %s -o UserKnownHostsFile=/dev/null' - ' -o StrictHostKeyChecking=no -tt %s -p %s' - ' sh -c "' - 'nohup sudo /usr/local/bin/traffic_server.py 192.168.60.144 62462 > /dev/null 2>&1";' - % (key, host, port), - ) + + def _call_trfserver_ssh_command(cmd): + local( + f'ssh -f -i {key} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -tt {host} -p {port} "{cmd}"', + ) + + _call_trfserver_ssh_command('sudo ethtool --offload eth1 rx off tx off') + _call_trfserver_ssh_command('sudo ethtool --offload eth2 rx off tx off') + _call_trfserver_ssh_command('nohup sudo /usr/local/bin/traffic_server.py 192.168.60.144 62462 > trfserver.log 2>&1') def _make_integ_tests(): diff --git a/lte/gateway/python/integ_tests/defs.mk b/lte/gateway/python/integ_tests/defs.mk index 2f46877a1e0f..39fbd2b130ed 100644 --- a/lte/gateway/python/integ_tests/defs.mk +++ b/lte/gateway/python/integ_tests/defs.mk @@ -13,7 +13,8 @@ PROTO_LIST:=orc8r_protos lte_protos feg_protos # Add the s1aptester integration tests -PRECOMMIT_TESTS = s1aptests/test_attach_detach.py \ +PRECOMMIT_TESTS = s1aptests/test_services_are_running.py \ +s1aptests/test_attach_detach.py \ s1aptests/test_attach_detach_static_ip.py \ s1aptests/test_gateway_metrics_attach_detach.py \ s1aptests/test_attach_detach_looped.py \ diff --git a/lte/gateway/python/integ_tests/s1aptests/BUILD.bazel b/lte/gateway/python/integ_tests/s1aptests/BUILD.bazel index d80219814da2..ba796909f9f3 100644 --- a/lte/gateway/python/integ_tests/s1aptests/BUILD.bazel +++ b/lte/gateway/python/integ_tests/s1aptests/BUILD.bazel @@ -67,6 +67,15 @@ py_library( ], ) +pytest_test( + name = "test_services_are_running", + size = "small", + srcs = ["test_services_are_running.py"], + imports = [LTE_ROOT], + tags = TAG_PRECOMMIT_TEST, + deps = [":s1ap_wrapper"], +) + pytest_test( name = "test_attach_detach", size = "small", diff --git a/lte/gateway/python/integ_tests/s1aptests/ovs/rest_api.py b/lte/gateway/python/integ_tests/s1aptests/ovs/rest_api.py index 80a29eefc4bd..698f0b794fa9 100644 --- a/lte/gateway/python/integ_tests/s1aptests/ovs/rest_api.py +++ b/lte/gateway/python/integ_tests/s1aptests/ovs/rest_api.py @@ -14,6 +14,7 @@ import json import logging import time +from typing import Tuple import requests from integ_tests.s1aptests.ovs import DEV_VM_URL, MAX_RETRIES, OF_REST_PORT @@ -59,6 +60,28 @@ def get_datapath(ip=DEV_VM_URL): return str(_ovs_api_request('GET', url)[0]) +def get_datapath_state(ip=DEV_VM_URL) -> Tuple[bool, bool]: + """ + Test if pipelined is started and a datapath is initialized. + This means, endpoint is reachable and a list containing at least + one datapath id is returned (for tests it's actually exactly one entry). + Input: ip address of pipelined + Output: (pipelined is running, datapath is initialized) + """ + url = "http://%s:%d/stats/switches" % (ip, OF_REST_PORT) + try: + datapath_list = _ovs_api_request('GET', url) + except requests.ConnectionError: + # Check if datapath is initialized failed: pipelined not reachable. + return False, False + + if len(datapath_list) == 0: + # Check if datapath is initialized failed: datapath not initialized. + return True, False + + return True, True + + def _ovs_api_request( method, url, data=None, max_retries=MAX_RETRIES, return_json=True, diff --git a/lte/gateway/python/integ_tests/s1aptests/s1ap_utils.py b/lte/gateway/python/integ_tests/s1aptests/s1ap_utils.py index 1bc276523a96..74977eb6c310 100644 --- a/lte/gateway/python/integ_tests/s1aptests/s1ap_utils.py +++ b/lte/gateway/python/integ_tests/s1aptests/s1ap_utils.py @@ -27,7 +27,11 @@ import grpc import s1ap_types from integ_tests.gateway.rpc import get_rpc_channel -from integ_tests.s1aptests.ovs.rest_api import get_datapath, get_flows +from integ_tests.s1aptests.ovs.rest_api import ( + get_datapath, + get_datapath_state, + get_flows, +) from lte.protos.abort_session_pb2 import AbortSessionRequest, AbortSessionResult from lte.protos.abort_session_pb2_grpc import AbortSessionResponderStub from lte.protos.ha_service_pb2 import StartAgwOffloadRequest @@ -60,6 +64,8 @@ from orc8r.protos.directoryd_pb2_grpc import GatewayDirectoryServiceStub DEFAULT_GRPC_TIMEOUT = 10 +MAGTIVATE_CMD = "source /home/vagrant/build/python/bin/activate" +VENVSUDO_CMD = "sudo -E PATH=$PATH PYTHONPATH=$PYTHONPATH env" class S1ApUtil(object): @@ -175,7 +181,7 @@ def issue_cmd(self, cmd_type, req): with self._cond: rc = self._test_api(cmd_type.value, c_req) if rc: - print("Error executing command %s" % repr(cmd_type)) + print(f"Error executing command {repr(cmd_type)}") return rc return 0 @@ -384,9 +390,8 @@ def attach( ) logging.debug( - "s1ap response expected, received: %d, %d", - resp_type.value, - response.msg_type, + f"s1ap response expected, received: " + f"{resp_type.value}, {response.msg_type}", ) assert resp_type.value == response.msg_type @@ -425,7 +430,9 @@ def receive_initial_ctxt_setup_and_attach_accept(self) -> Msg: context_setup.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value ) - assert s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND.value == response.msg_type + assert ( + s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND.value == response.msg_type + ) # Return attach accept response for parsing ue details wherever needed return response @@ -454,9 +461,9 @@ def receive_emm_info(self): """Receive EMM Info message from TFW""" response = self.get_response() logging.debug( - "s1ap message expected, received: %d, %d", - s1ap_types.tfwCmd.UE_EMM_INFORMATION.value, - response.msg_type, + f"s1ap message expected, received: " + f"{s1ap_types.tfwCmd.UE_EMM_INFORMATION.value}, " + f"{response.msg_type}", ) assert response.msg_type == s1ap_types.tfwCmd.UE_EMM_INFORMATION.value @@ -504,7 +511,10 @@ def _verify_dl_flow(self, dl_flow_rules=None, ipv6_non_nat=False): dst_addr = "nw_dst" if key.version == 4 else "ipv6_dst" key_to_be_matched = "ipv4_src" if key.version == 4 else "ipv6_src" eth_typ = 2048 if key.version == 4 else 34525 - in_port = self.LOCAL_PORT_NON_NAT_IPV6 if ipv6_non_nat else self.LOCAL_PORT + in_port = ( + self.LOCAL_PORT_NON_NAT_IPV6 if ipv6_non_nat + else self.LOCAL_PORT + ) # Set to 1 for the default bearer total_num_dl_flows_to_be_verified = 1 @@ -590,7 +600,12 @@ def _verify_dl_flow(self, dl_flow_rules=None, ipv6_non_nat=False): ) assert bool(has_tunnel_action) - def verify_flow_rules(self, num_ul_flows, dl_flow_rules=None, ipv6_non_nat=False): + def verify_flow_rules( + self, + num_ul_flows, + dl_flow_rules=None, + ipv6_non_nat=False, + ): """Verify if UL/DL OVS flow rules are created""" gtp_port = self.gtpBridgeUtil.get_gtp_port_no() print("************ Verifying flow rules") @@ -614,10 +629,7 @@ def verify_flow_rules(self, num_ul_flows, dl_flow_rules=None, ipv6_non_nat=False time.sleep(5) # sleep for 5 seconds before retrying assert ( len(uplink_flows) == num_ul_flows - ), "Uplink flow missing for UE: %d != %d" % ( - len(uplink_flows), - num_ul_flows, - ) + ), f"Uplink flow missing for UE: {len(uplink_flows)} != {num_ul_flows}" assert uplink_flows[0]["match"]["tunnel_id"] is not None @@ -698,7 +710,7 @@ def generate_imsi(self, prefix=None): imsi = prefix + "0" * padding + idx assert len(imsi[4:]) == self.IMSI_LEN, "Invalid IMSI length" self._imsi_idx += 1 - print("Using subscriber IMSI %s" % imsi) + print(f"Using subscriber IMSI {imsi}") return imsi def update_ipv6_address(self, ue_id, ipv6_addr): @@ -710,11 +722,17 @@ def update_ipv6_address(self, ue_id, ipv6_addr): def run_ipv6_data(self, ipv6_addr): """Run ipv6 data""" self.magma_utils = MagmadUtil(None) + icmpv6_script = "/usr/local/bin/icmpv6.py" execute_icmpv6_cmd = ( - "sudo /home/vagrant/build/python/bin/python3 " - + "/home/vagrant/magma/lte/gateway/python/scripts/icmpv6.py " + MAGTIVATE_CMD + + " && " + + VENVSUDO_CMD + + " python3 " + + icmpv6_script + + " " + str(ipv6_addr) ) + print("Running data for ipv6 address", str(ipv6_addr)) self.magma_utils.exec_command_output(execute_icmpv6_cmd) @@ -754,7 +772,7 @@ def _gen_next_sid(self): padding = self.IMSI_LEN - len(idx) - len(self.SID_PREFIX[4:]) sid = self.SID_PREFIX + "0" * padding + idx self._sid_idx += 1 - print("Using subscriber IMSI %s" % sid) + print(f"Using subscriber IMSI {sid}") return sid def _generate_imei(self, num_ues=1): @@ -762,7 +780,7 @@ def _generate_imei(self, num_ues=1): imei = str(self._imei_default + self._imei_idx) assert len(imei) <= self.MAX_IMEI_LEN, "Invalid IMEI length" self._imei_idx += 1 - print("Using IMEI %s" % imei) + print(f"Using IMEI {imei}") return imei def _get_s1ap_sub(self, sid, imei): @@ -878,34 +896,6 @@ def exec_command(self, command): stderr=subprocess.DEVNULL, ) - def detect_init_system(self) -> InitMode: - """Detect whether services are running with Docker or systemd.""" - - try: - docker_running = self.exec_command_output("docker ps --filter 'name=magmad' --format '{{.Names}}'").strip() == "magmad" - except subprocess.CalledProcessError: - docker_running = False - logging.info("Docker is not installed") - - try: - systemd_running = self.exec_command_output("systemctl is-active magma@magmad").strip() == "active" - except subprocess.CalledProcessError: - systemd_running = False - logging.info("systemd is not installed") - - if docker_running and systemd_running: - return InitMode.SYSTEMD # default to systemd if both are running - needed by feg integ tests - elif docker_running: - return InitMode.DOCKER - elif systemd_running: - return InitMode.SYSTEMD - else: - raise RuntimeError("Magmad is not running, you have to start magmad either in Docker or systemd") - - @property - def init_system(self): - return self._init_system - def exec_command_output(self, command): """Run a command remotely on magma_dev VM. @@ -924,6 +914,43 @@ def exec_command_output(self, command): shell=False, ).decode("utf-8") + def detect_init_system(self) -> InitMode: + """Detect whether services are running with Docker or systemd.""" + def _is_installed(cmd): + is_installed = self.exec_command(f"type {cmd} >/dev/null 2>&1") == 0 + if not is_installed: + logging.info(f"{cmd} is not installed") + return is_installed + + if _is_installed("docker"): + docker_magmad_running = self.exec_command_output( + "docker ps --filter 'name=magmad' --format '{{.Names}}'", + ).strip() == "magmad" + else: + docker_magmad_running = False + + if _is_installed("systemctl"): + systemd_magmad_running = self.exec_command_output( + "systemctl is-active magma@magmad", + ).strip() == "active" + else: + systemd_magmad_running = False + + if systemd_magmad_running: + # default to systemd if docker and systemd are running - needed by feg integ tests + return InitMode.SYSTEMD + elif docker_magmad_running: + return InitMode.DOCKER + else: + raise RuntimeError( + "Magmad is not running, you have to start magmad " + "either in Docker or systemd", + ) + + @property + def init_system(self): + return self._init_system + def config_stateless(self, cmd): """ Configure the stateless mode on the access gateway @@ -935,14 +962,12 @@ def config_stateless(self, cmd): enable: Enable stateless mode, do nothing if already stateless disable: Disable stateless mode, do nothing if already stateful """ - magtivate_cmd = "source /home/vagrant/build/python/bin/activate" - venvsudo_cmd = "sudo -E PATH=$PATH PYTHONPATH=$PYTHONPATH env" config_stateless_script = "/usr/local/bin/config_stateless_agw.py" ret_code = self.exec_command( - magtivate_cmd + MAGTIVATE_CMD + " && " - + venvsudo_cmd + + VENVSUDO_CMD + " python3 " + config_stateless_script + " " @@ -965,22 +990,56 @@ def corrupt_agw_state(self, key: str): Args: key: redis-db key name """ - magtivate_cmd = "source /home/vagrant/build/python/bin/activate" - state_corrupt_cmd = "state_cli.py corrupt %s" % key.lower() + state_corrupt_cmd = f"state_cli.py corrupt {key.lower()}" - self.exec_command(magtivate_cmd + " && " + state_corrupt_cmd) - print("Corrupted %s on redis" % key) + self.exec_command(MAGTIVATE_CMD + " && " + state_corrupt_cmd) + print(f"Corrupted {key} on redis") def restart_all_services(self): """Restart all magma services on magma_dev VM""" if self._init_system == InitMode.SYSTEMD: self.exec_command( - "sudo service magma@* stop ; sudo service magma@magmad start", + "sudo systemctl stop 'magma@*' 'sctpd' ;" + "sudo systemctl start magma@magmad", ) elif self._init_system == InitMode.DOCKER: - self.exec_command("cd /home/vagrant/magma/lte/gateway/docker && docker-compose restart") - print("Waiting for all services to restart. Sleeping for 60 seconds..") - self.wait_for_restart_to_finish(60) + self.exec_command( + "cd /home/vagrant/magma/lte/gateway/docker " + "&& docker-compose restart", + ) + + self._wait_for_pipelined_to_initialize() + + EXTRA_WAIT_TIME_FOR_OTHER_SERVICES_SECONDS = 10 + print(f"Waiting {EXTRA_WAIT_TIME_FOR_OTHER_SERVICES_SECONDS} seconds to ensure all services restarted ...") + time.sleep(EXTRA_WAIT_TIME_FOR_OTHER_SERVICES_SECONDS) + + def _wait_for_pipelined_to_initialize(self): + """ + Introduced, because pipelined is the first service the tests communicate with and + it has been observed that the previous static waiting time is not sufficient. + """ + print("Waiting for pipelined to be started ...") + wait_time_seconds = 0 + + WAIT_INTERVAL_SECONDS = 5 + MAX_WAIT_SECONDS = 120 + print(f" check every {WAIT_INTERVAL_SECONDS} seconds (max {MAX_WAIT_SECONDS} seconds) if pipelined is started ...") + pipelined_is_running = False + datapath_is_initialized = False + while not datapath_is_initialized: + time.sleep(WAIT_INTERVAL_SECONDS) + wait_time_seconds += WAIT_INTERVAL_SECONDS + pipelined_is_running, datapath_is_initialized = get_datapath_state() + if not pipelined_is_running: + print(f" pipelined not yet running for {wait_time_seconds} seconds ...") + elif not datapath_is_initialized: + print(f" datapath not yet initialized for {wait_time_seconds} seconds ...") + else: + print(f" datapath is initialized after {wait_time_seconds} seconds!") + + if wait_time_seconds >= MAX_WAIT_SECONDS and not datapath_is_initialized: + raise RuntimeError(f"Pipelined failed to initialize after {MAX_WAIT_SECONDS} seconds.") def restart_services(self, services, wait_time=0): """ @@ -1002,10 +1061,41 @@ def restart_services(self, services, wait_time=0): self.exec_command(f"docker restart {s}") self.wait_for_restart_to_finish(wait_time) + def restart_mme(self, wait_time=20): + """ + Restart MME service and wait for the service to come up properly + """ + print("Restarting mme service on gateway") + if self._init_system == InitMode.SYSTEMD: + self.exec_command("sudo systemctl restart magma@mme") + elif self._init_system == InitMode.DOCKER: + self.exec_command( + "docker restart mobilityd pipelined sessiond oai_mme", + ) + self.wait_for_restart_to_finish(wait_time) + + def restart_sctpd(self, wait_time=30): + """ + Restart sctpd service explicitly because it is not managed by magmad + """ + print("Restarting sctpd service on gateway") + if self._init_system == InitMode.SYSTEMD: + self.exec_command("sudo service sctpd restart") + elif self._init_system == InitMode.DOCKER: + self.exec_command_output( + "docker stop sctpd mobilityd pipelined sessiond oai_mme;" + "sudo su -c '/usr/bin/env python3 " + "/usr/local/bin/config_stateless_agw.py sctpd_pre';" + "docker start sctpd mobilityd pipelined sessiond oai_mme", + ) + self.wait_for_restart_to_finish(wait_time) + @staticmethod def wait_for_restart_to_finish(wait_time): for j in range(wait_time): - print(f"Waiting for {wait_time - j} seconds for restart to complete") + print( + f"Waiting for {wait_time - j} seconds for restart to complete", + ) time.sleep(1) def enable_service(self, service): @@ -1046,7 +1136,9 @@ def is_service_active(self, service) -> bool: is_active_service_cmd = "systemctl is-active magma@" + service return self.check_service_activity(is_active_service_cmd).strip() == "active" elif self._init_system == InitMode.DOCKER: - is_active_service_cmd = "docker ps --filter 'name=" + service + "' --format '{{.Status}}'" + is_active_service_cmd = ( + f"docker ps --filter 'name={service}' --format '{{.Status}}'" + ) return self.check_service_activity(is_active_service_cmd).strip()[:2] == "up" return False @@ -1159,9 +1251,15 @@ def config_apn_correction(self, cmd): """ apn_correction_cmd = "" if cmd.name == MagmadUtil.apn_correction_cmds.ENABLE.name: - apn_correction_cmd = "sed -i \'s/enable_apn_correction: false/enable_apn_correction: true/g\' /etc/magma/mme.yml" + apn_correction_cmd = ( + "sed -i \'s/enable_apn_correction: false/" + "enable_apn_correction: true/g\' /etc/magma/mme.yml" + ) else: - apn_correction_cmd = "sed -i \'s/enable_apn_correction: true/enable_apn_correction: false/g\' /etc/magma/mme.yml" + apn_correction_cmd = ( + "sed -i \'s/enable_apn_correction: true/" + "enable_apn_correction: false/g\' /etc/magma/mme.yml" + ) ret_code = self.exec_command( "sudo " + apn_correction_cmd, @@ -1185,7 +1283,7 @@ def config_health_service(self, cmd: health_service_cmds): "sed -i 's/interval_check_mins: 1/interval_" "check_mins: 3/g' /etc/magma/health.yml" ) - self.exec_command("sudo %s" % health_config_cmd) + self.exec_command(f"sudo {health_config_cmd}") if self.is_service_active(magma_health_service_name): self.disable_service(magma_health_service_name) print("Health service is disabled") @@ -1194,7 +1292,7 @@ def config_health_service(self, cmd: health_service_cmds): "sed -i 's/interval_check_mins: 3/interval_" "check_mins: 1/g' /etc/magma/health.yml" ) - self.exec_command("sudo %s" % health_config_cmd) + self.exec_command(f"sudo {health_config_cmd}") if not self.is_service_active(magma_health_service_name): self.enable_service("health") print("Health service is enabled") @@ -1251,32 +1349,6 @@ def config_ha_service(self, cmd): print("Ha service configuration failed") return -1 - def restart_mme(self, wait_time=20): - """ - Restart MME service and wait for the service to come up properly - """ - print("Restarting mme service on gateway") - if self._init_system == InitMode.SYSTEMD: - self.exec_command("sudo systemctl restart magma@mme") - elif self._init_system == InitMode.DOCKER: - self.exec_command("docker restart mobilityd pipelined sessiond oai_mme") - self.wait_for_restart_to_finish(wait_time) - - def restart_sctpd(self, wait_time=30): - """ - Restart sctpd service explicitly because it is not managed by magmad - """ - print("Restarting sctpd service on gateway") - if self._init_system == InitMode.SYSTEMD: - self.exec_command("sudo service sctpd restart") - elif self._init_system == InitMode.DOCKER: - self.exec_command_output( - "docker stop sctpd mobilityd pipelined sessiond oai_mme;" - "sudo su -c '/usr/bin/env python3 /usr/local/bin/config_stateless_agw.py sctpd_pre';" - "docker start sctpd mobilityd pipelined sessiond oai_mme", - ) - self.wait_for_restart_to_finish(wait_time) - def print_redis_state(self): """ Print the per-IMSI state in Redis data store on AGW @@ -1317,10 +1389,9 @@ def get_redis_state(self): """ Get the per-IMSI state in Redis data store on AGW """ - magtivate_cmd = "source /home/vagrant/build/python/bin/activate" imsi_state_cmd = "state_cli.py keys IMSI*" redis_imsi_keys = self.exec_command_output( - magtivate_cmd + " && " + imsi_state_cmd, + MAGTIVATE_CMD + " && " + imsi_state_cmd, ) keys_to_be_cleaned = [] for key in redis_imsi_keys.split("\n"): @@ -1331,7 +1402,7 @@ def get_redis_state(self): mme_nas_state_cmd = "state_cli.py parse mme_nas_state" mme_nas_state = self.exec_command_output( - magtivate_cmd + " && " + mme_nas_state_cmd, + MAGTIVATE_CMD + " && " + mme_nas_state_cmd, ) num_htbl_entries = 0 for state in mme_nas_state.split("\n"): @@ -1342,20 +1413,21 @@ def get_redis_state(self): s1ap_imsi_map_cmd = "state_cli.py parse s1ap_imsi_map" s1ap_imsi_map_state = self.exec_command_output( - magtivate_cmd + " && " + s1ap_imsi_map_cmd, + MAGTIVATE_CMD + " && " + s1ap_imsi_map_cmd, ) # Remove state version output to get only hashmap entries s1ap_imsi_map_entries = len(s1ap_imsi_map_state.split("\n")[:-4]) // 4 mme_ueip_imsi_map_cmd = "state_cli.py parse mme_ueip_imsi_map" mme_ueip_imsi_map_state = self.exec_command_output( - magtivate_cmd + " && " + mme_ueip_imsi_map_cmd, + MAGTIVATE_CMD + " && " + mme_ueip_imsi_map_cmd, ) mme_ueip_imsi_map_entries = 0 for state in mme_ueip_imsi_map_state.split("\n"): if "key" in state: mme_ueip_imsi_map_entries += 1 - return keys_to_be_cleaned, mme_ueip_imsi_map_entries, num_htbl_entries, s1ap_imsi_map_entries + return keys_to_be_cleaned, mme_ueip_imsi_map_entries, \ + num_htbl_entries, s1ap_imsi_map_entries def enable_nat(self, ip_version=4): """Enable Nat""" @@ -1363,10 +1435,14 @@ def enable_nat(self, ip_version=4): self._validate_nated_datapath(ip_version) if ip_version == 4: self.exec_command("sudo ip route del default via 192.168.129.42") - self.exec_command("sudo ip route add default via 10.0.2.2 dev eth0") + self.exec_command( + "sudo ip route add default via 10.0.2.2 dev eth0", + ) else: self.exec_command("sudo ip route del default via 3001::2") - self.exec_command("sudo ip route add default via 2020::10 dev eth0") + self.exec_command( + "sudo ip route add default via 2020::10 dev eth0", + ) def disable_nat(self, ip_version=4): """ @@ -1383,7 +1459,9 @@ def disable_nat(self, ip_version=4): trf 3001::2 eth3 """ if ip_version == 4: - self.exec_command("sudo ip route del default via 10.0.2.2 dev eth0") + self.exec_command( + "sudo ip route del default via 10.0.2.2 dev eth0", + ) self.exec_command( "sudo ip addr replace 192.168.129.1/24 dev uplink_br0", ) @@ -1391,9 +1469,13 @@ def disable_nat(self, ip_version=4): "sudo ip route add default via 192.168.129.42 dev uplink_br0", ) else: - self.exec_command("sudo ip route del default via 2020::10 dev eth0") + self.exec_command( + "sudo ip route del default via 2020::10 dev eth0", + ) self.exec_command("sudo ip addr replace 3001::10 dev uplink_br0") - self.exec_command("sudo ip route -A inet6 add default via 3001::2 dev uplink_br0") + self.exec_command( + "sudo ip route -A inet6 add default via 3001::2 dev uplink_br0", + ) self._set_agw_nat(False) self._validate_non_nat_datapath(ip_version) @@ -1411,7 +1493,6 @@ def _set_agw_nat(self, enable: bool): with open(mconfig_conf, "w") as json_file: json.dump(data, json_file, sort_keys=True, indent=2) - self.restart_sctpd(0) self.restart_all_services() def _validate_non_nat_datapath(self, ip_version=4): @@ -1435,17 +1516,17 @@ def config_ipv6_iface(self, cmd): Args: cmd: Enable or disable eth3 iface on AGW, should be one of - enable: Enable eth3 as nat_iface, do nothing if already configured - disable: Disable eth3 as nat_iface, do nothing if already configured + enable: Enable eth3 as nat_iface, + do nothing if already configured + disable: Disable eth3 as nat_iface, + do nothing if already configured """ - magtivate_cmd = "source /home/vagrant/build/python/bin/activate" - venvsudo_cmd = "sudo -E PATH=$PATH PYTHONPATH=$PYTHONPATH env" config_ipv6_iface_script = "/usr/local/bin/config_iface_for_ipv6.py" ret_code = self.exec_command( - magtivate_cmd + MAGTIVATE_CMD + " && " - + venvsudo_cmd + + VENVSUDO_CMD + " python3 " + config_ipv6_iface_script + " " @@ -1454,10 +1535,8 @@ def config_ipv6_iface(self, cmd): if ret_code == 0: print("Configuration successful") - elif ret_code == 1: - print("Configuration not changed") else: - print("Failed to configure") + raise Exception("Failed to configure the IPV6 interface!") class MobilityUtil(object): @@ -1947,8 +2026,8 @@ def send_ReAuthRequest( ) except grpc.RpcError as err: print( - "error: GetDirectoryFieldRequest error for id: " - "%s! [%s] %s" % (imsi, err.code(), err.details()), + f"Error: GetDirectoryFieldRequest error for id: " + f"{imsi}! [{err.code()}] {err.details()}", ) if res is None: @@ -1982,8 +2061,8 @@ def create_AbortSessionRequest(self, imsi: str) -> AbortSessionResult: ) except grpc.RpcError as err: print( - "Error: GetDirectoryFieldRequest error for id: %s! [%s] %s" - % (imsi, err.code(), err.details()), + f"Error: GetDirectoryFieldRequest error for id: " + f"{imsi}! [{err.code()}] {err.details()}", ) self._print_directoryd_content() @@ -2002,15 +2081,15 @@ def _print_directoryd_content(self): ) except grpc.RpcError as e: print( - "error: couldnt print directoryd content. gRPC failed with %s: %s" - % (e.code(), e.details()), + f"error: couldnt print directoryd content. " + f"gRPC failed with {err.code()} {err.details()}", ) return if all_records_response is None: print("No records were found at directoryd") else: for record in all_records_response.records: - print("%s" % str(record)) + print(f"{record}") def send_SetSessionRules(self, imsi, policy_id, flow_list, qos): """ @@ -2100,19 +2179,18 @@ def get_proxy_port_no(self) -> Optional[int]: def get_flows(self, table_id) -> []: """Fetch the OVS flow rules""" output = self.magma_utils.exec_command_output( - "sudo ovs-ofctl dump-flows gtp_br0 table={0}".format(table_id), + f"sudo ovs-ofctl dump-flows gtp_br0 table={table_id}", ) return output.split("\n") def delete_flows(self, table_id): """Delete the OVS flow rules""" ret_code = self.magma_utils.exec_command( - "sudo ovs-ofctl del-flows gtp_br0 table={0}".format(table_id), + f"sudo ovs-ofctl del-flows gtp_br0 table={table_id}", ) if ret_code != 0: print( - "Failed to delete OVS flow rules for gtp_br0 table=" - + str(table_id), + f"Failed to delete OVS flow rules for gtp_br0 table={table_id}", ) @@ -2132,7 +2210,7 @@ def offload_agw(self, imsi, enb_id, offloadtype=0): try: self._ha_stub.StartAgwOffload(req) except grpc.RpcError as e: - print("gRPC failed with %s: %s" % (e.code(), e.details())) + print(f"gRPC failed with {e.code()}: {e.details()}") return False return True @@ -2170,12 +2248,12 @@ def get_envoy_config(self): while retry < max_retries: try: output = self.magma_utils.exec_command_output( - "sudo ip netns exec envoy_ns1 curl 127.0.0.1:9000/config_dump", + "sudo ip netns exec envoy_ns1 curl " + "127.0.0.1:9000/config_dump", ) - self.dump = json.loads(output) - return self.dump + return json.loads(output) except subprocess.CalledProcessError as e: - logging.debug("cmd error: %s", e) + logging.debug(f"cmd error: {e}") retry = retry + 1 time.sleep(1) diff --git a/lte/gateway/python/integ_tests/s1aptests/s1ap_wrapper.py b/lte/gateway/python/integ_tests/s1aptests/s1ap_wrapper.py index 2083d1282270..865ffd4afe4e 100644 --- a/lte/gateway/python/integ_tests/s1aptests/s1ap_wrapper.py +++ b/lte/gateway/python/integ_tests/s1aptests/s1ap_wrapper.py @@ -533,7 +533,7 @@ def cleanup(self, test=None): if not is_test_successful: print("The test has failed. Restarting Sctpd for cleanup") - self.magmad_util.restart_sctpd() + self.magmad_util.restart_services(['sctpd'], wait_time=30) self.magmad_util.print_redis_state() if TestWrapper.TEST_CASE_EXECUTION_COUNT == 3: self.generate_flaky_summary() @@ -543,7 +543,7 @@ def cleanup(self, test=None): if not self.magmad_util.is_redis_empty(): print("************************* Redis not empty, initiating cleanup") - self.magmad_util.restart_sctpd() + self.magmad_util.restart_services(['sctpd'], wait_time=30) self.magmad_util.print_redis_state() def multiEnbConfig(self, num_of_enbs, enb_list=None): diff --git a/lte/gateway/python/integ_tests/s1aptests/test_3485_timer_for_dedicated_bearer_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_3485_timer_for_dedicated_bearer_with_mme_restart.py index 13328ea38feb..926685d89aca 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_3485_timer_for_dedicated_bearer_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_3485_timer_for_dedicated_bearer_with_mme_restart.py @@ -92,8 +92,8 @@ def test_3485_timer_for_dedicated_bearer_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value ) print( '*******************Received first Activate dedicated bearer ' diff --git a/lte/gateway/python/integ_tests/s1aptests/test_3485_timer_for_default_bearer_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_3485_timer_for_default_bearer_with_mme_restart.py index cc63225fe758..91c92fe42003 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_3485_timer_for_default_bearer_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_3485_timer_for_default_bearer_with_mme_restart.py @@ -128,9 +128,9 @@ def test_3485_timer_for_default_bearer_with_mme_restart(self): ) retransmitted_response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - retransmitted_response.msg_type, - s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, + assert ( + retransmitted_response.msg_type + == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value ) act_def_bearer_req = retransmitted_response.cast( s1ap_types.uePdnConRsp_t, diff --git a/lte/gateway/python/integ_tests/s1aptests/test_3495_timer_for_dedicated_bearer_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_3495_timer_for_dedicated_bearer_with_mme_restart.py index d9017052cc23..770fc7a12dd0 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_3495_timer_for_dedicated_bearer_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_3495_timer_for_dedicated_bearer_with_mme_restart.py @@ -89,9 +89,7 @@ def test_3495_timer_for_dedicated_bearer_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -122,10 +120,7 @@ def test_3495_timer_for_dedicated_bearer_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print("******************* Received deactivate eps bearer context") # Do not send deactivate eps bearer context accept @@ -139,10 +134,7 @@ def test_3495_timer_for_dedicated_bearer_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value deactv_bearer_req = response.cast(s1ap_types.UeDeActvBearCtxtReq_t) self._s1ap_wrapper.sendDeactDedicatedBearerAccept( req.ue_id, deactv_bearer_req.bearerId, diff --git a/lte/gateway/python/integ_tests/s1aptests/test_3495_timer_for_default_bearer_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_3495_timer_for_default_bearer_with_mme_restart.py index 154d6385aef4..b584d3fd8a36 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_3495_timer_for_default_bearer_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_3495_timer_for_default_bearer_with_mme_restart.py @@ -101,9 +101,7 @@ def test_3495_timer_for_default_bearer_with_mme_restart(self): self._s1ap_wrapper.sendPdnConnectivityReq(req.ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -138,9 +136,7 @@ def test_3495_timer_for_default_bearer_with_mme_restart(self): ) # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print( "******************* Received deactivate default eps bearer " @@ -155,9 +151,7 @@ def test_3495_timer_for_default_bearer_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value deactv_bearer_req = response.cast(s1ap_types.UeDeActvBearCtxtReq_t) self._s1ap_wrapper.sendDeactDedicatedBearerAccept( req.ue_id, deactv_bearer_req.bearerId, diff --git a/lte/gateway/python/integ_tests/s1aptests/test_activate_deactivate_multiple_dedicated.py b/lte/gateway/python/integ_tests/s1aptests/test_activate_deactivate_multiple_dedicated.py index 7ebb9316f1b1..6b32fc5f8709 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_activate_deactivate_multiple_dedicated.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_activate_deactivate_multiple_dedicated.py @@ -74,8 +74,8 @@ def test_activate_deactivate_multiple_dedicated(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value ) act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, @@ -113,9 +113,9 @@ def test_activate_deactivate_multiple_dedicated(self): for i in range(num_dedicated_bearers): time.sleep(0.1) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, + assert ( + response.msg_type + == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value ) print("******************* Received deactivate eps bearer context") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_agw_offload_idle_active_ue.py b/lte/gateway/python/integ_tests/s1aptests/test_agw_offload_idle_active_ue.py index 4aa266494fe7..75faef84fc17 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_agw_offload_idle_active_ue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_agw_offload_idle_active_ue.py @@ -69,7 +69,7 @@ def test_agw_offload_idle_active_ue(self): "************************* Offloading UE at state ECM-CONNECTED", ) # Send offloading request - self.assertTrue( + assert ( self._ha_util.offload_agw( "".join(["IMSI"] + [str(i) for i in req.imsi]), enb_list[0][0], @@ -77,14 +77,11 @@ def test_agw_offload_idle_active_ue(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("************************* Offloading UE at state ECM-IDLE") # Send offloading request - self.assertTrue( + assert ( self._ha_util.offload_agw( "".join(["IMSI"] + [str(i) for i in req.imsi]), enb_list[0][0], @@ -92,7 +89,7 @@ def test_agw_offload_idle_active_ue(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue(response, s1ap_types.tfwCmd.UE_PAGING_IND.value) + assert response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value # Send service request to reconnect UE # Auto-release should happen ser_req = s1ap_types.ueserviceReq_t() @@ -105,16 +102,10 @@ def test_agw_offload_idle_active_ue(self): ser_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Send service request again: # This time auto-release should not happen @@ -123,10 +114,7 @@ def test_agw_offload_idle_active_ue(self): ser_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("************************* SLEEPING for 2 sec") time.sleep(2) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_agw_offload_mixed_idle_active_multiue.py b/lte/gateway/python/integ_tests/s1aptests/test_agw_offload_mixed_idle_active_multiue.py index c4c754cc82f3..d3d4b906db71 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_agw_offload_mixed_idle_active_multiue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_agw_offload_mixed_idle_active_multiue.py @@ -83,22 +83,20 @@ def test_agw_offload_mixed_idle_active_multiue(self): ue_cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("************************* Send Offload Request to AGW") # Send offloading request - self.assertTrue(self._ha_util.offload_agw(None, enb_list[0][0])) + assert (self._ha_util.offload_agw(None, enb_list[0][0])) # All UEs should eventually receive Context Release Request # The first half should get it immediately # The second half should first get paging for _ in range(num_ues): response = self._s1ap_wrapper.s1_util.get_response() - self.assertIn( - response.msg_type, + assert ( + response.msg_type + in [ s1ap_types.tfwCmd.UE_CTX_REL_IND.value, s1ap_types.tfwCmd.UE_PAGING_IND.value, @@ -120,16 +118,10 @@ def test_agw_offload_mixed_idle_active_multiue(self): ser_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value for i in range(num_ues): # Send service request again: @@ -143,10 +135,7 @@ def test_agw_offload_mixed_idle_active_multiue(self): ser_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value # Now detach the UEs normally for ue in ue_ids: diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_act_dflt_ber_ctxt_rej.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_act_dflt_ber_ctxt_rej.py index e98226c8ac7f..3b9a3e5d002e 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_act_dflt_ber_ctxt_rej.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_act_dflt_ber_ctxt_rej.py @@ -58,10 +58,7 @@ def test_attach_act_dflt_ber_ctxt_rej(self): attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value # Trigger Authentication Response auth_res = s1ap_types.ueAuthResp_t() @@ -74,10 +71,7 @@ def test_attach_act_dflt_ber_ctxt_rej(self): auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value # Trigger Security Mode Complete sec_mode_complete = s1ap_types.ueSecModeComplete_t() @@ -116,16 +110,10 @@ def test_attach_act_dflt_ber_ctxt_rej(self): ) # Attach Reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("******** released UE contexts ********") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_active_tau_with_combined_tala_update_reattach.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_active_tau_with_combined_tala_update_reattach.py index 03d9f88345c4..864fcaf56371 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_active_tau_with_combined_tala_update_reattach.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_active_tau_with_combined_tala_update_reattach.py @@ -76,10 +76,7 @@ def test_attach_active_tau_with_combined_tala_update_reattach(self): req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Received UE context release indication", ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_asr.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_asr.py index 0d86a37de50b..a3f1684bef31 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_asr.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_asr.py @@ -66,10 +66,7 @@ def test_attach_asr(self): # Receive NW initiated detach request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value print("**************** Received NW initiated Detach Req") print("**************** Sending Detach Accept") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_auth_failure.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_auth_failure.py index f2b1c78063e7..4ca8cd2f028b 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_auth_failure.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_auth_failure.py @@ -49,7 +49,7 @@ def test_attach_auth_failure(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue(response, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received Authentication Request message ") auth_failure = s1ap_types.ueAuthFailure_t() @@ -63,7 +63,7 @@ def test_attach_auth_failure(self): s1ap_types.tfwCmd.UE_AUTH_FAILURE, auth_failure, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue(response, s1ap_types.tfwCmd.UE_AUTH_REJ_IND.value) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REJ_IND.value print("Received Authentication Reject message") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_auth_mac_failure.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_auth_mac_failure.py index e3f679b3c793..309f313fb091 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_auth_mac_failure.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_auth_mac_failure.py @@ -49,7 +49,7 @@ def test_attach_auth_mac_failure(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue(response, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received Authentication Request message ") auth_failure = s1ap_types.ueAuthFailure_t() @@ -63,7 +63,7 @@ def test_attach_auth_mac_failure(self): s1ap_types.tfwCmd.UE_AUTH_FAILURE, auth_failure, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue(response, s1ap_types.tfwCmd.UE_AUTH_REJ_IND.value) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REJ_IND.value print("Received Authentication Reject message") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_complete_after_ics_timer_expiry.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_complete_after_ics_timer_expiry.py index 89555b2deb6f..70c511637af1 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_complete_after_ics_timer_expiry.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_complete_after_ics_timer_expiry.py @@ -61,10 +61,7 @@ def test_attach_complete_after_ics_timer_expiry(self): ) print("****** Sent ATTACH_REQUEST") response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("****** Received AUTH_REQ_IND") delay_init_ctxt_setup_resp = s1ap_types.UeDelayInitCtxtSetupRsp() delay_init_ctxt_setup_resp.ue_Id = req.ue_id @@ -88,10 +85,7 @@ def test_attach_complete_after_ics_timer_expiry(self): ) print("****** Sent UE_AUTH_RESP") response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("****** Received UE_SEC_MOD_CMD_IND") # Trigger Security Mode Complete @@ -126,10 +120,7 @@ def test_attach_complete_after_ics_timer_expiry(self): print("****** Sent ATTACH_COMPLETE") response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("****** Received UE_CTX_REL_IND") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_ICS_Failure.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_ICS_Failure.py index 886f16a8a223..48f08c113d50 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_ICS_Failure.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_ICS_Failure.py @@ -51,9 +51,7 @@ def test_attach_detach_ics_failure(self): s1ap_types.tfwCmd.UE_ATTACH_REQUEST, attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value init_ctxt_setup_fail = s1ap_types.ueInitCtxtSetupFail() init_ctxt_setup_fail.ue_Id = req.ue_id @@ -72,9 +70,7 @@ def test_attach_detach_ics_failure(self): s1ap_types.tfwCmd.UE_AUTH_RESP, auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value self._s1ap_wrapper._s1_util.issue_cmd( s1ap_types.tfwCmd.UE_SET_INIT_CTXT_SETUP_FAIL, init_ctxt_setup_fail, @@ -88,9 +84,7 @@ def test_attach_detach_ics_failure(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("*** Received Initial Context Setup Failure ***") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_after_ue_context_release.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_after_ue_context_release.py index 906d508e3b17..7c994d4f2782 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_after_ue_context_release.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_after_ue_context_release.py @@ -63,9 +63,7 @@ def test_attach_detach_after_ue_context_release(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Running UE detach (switch-off) for ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated.py index 09f99505b0bd..15e4512d0024 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated.py @@ -78,9 +78,7 @@ def test_attach_detach_dedicated(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -112,10 +110,7 @@ def test_attach_detach_dedicated(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print("******************* Received deactivate eps bearer context") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_activation_reject.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_activation_reject.py index 30293325de68..59570279cde5 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_activation_reject.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_activation_reject.py @@ -82,9 +82,7 @@ def test_attach_detach_dedicated_activation_reject(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_ebi.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_ebi.py index ddc6e2a18a8a..0a4290dc76f0 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_ebi.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_ebi.py @@ -83,9 +83,7 @@ def test_attach_detach_dedicated_bearer_deactivation_invalid_ebi(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_imsi.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_imsi.py index b9a511019bb1..b6d76474cd12 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_imsi.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_imsi.py @@ -84,9 +84,7 @@ def test_attach_detach_dedicated_bearer_deactivation_invalid_imsi(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_lbi.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_lbi.py index 7e4513a86207..288e59031b2d 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_lbi.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_bearer_deactivation_invalid_lbi.py @@ -82,8 +82,8 @@ def test_attach_detach_dedicated_bearer_deactivation_invalid_lbi(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value ) act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_deactivation_timer_expiry.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_deactivation_timer_expiry.py index fcf4aad9289c..de380eeb1dc5 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_deactivation_timer_expiry.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_deactivation_timer_expiry.py @@ -78,9 +78,7 @@ def test_attach_detach_dedicated_deactivation_timer_expiry(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -115,10 +113,7 @@ def test_attach_detach_dedicated_deactivation_timer_expiry(self): # TODO:Receive retransmissions once support is added # at s1ap tester response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value deact_ded_ber_ctxt_req = response.cast( s1ap_types.UeDeActvBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_looped.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_looped.py index 46786b1d7b34..3363ea094223 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_looped.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_looped.py @@ -77,10 +77,7 @@ def test_attach_detach_dedicated_looped(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -112,10 +109,7 @@ def test_attach_detach_dedicated_looped(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print("************** Received deactivate eps bearer context") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_multi_ue.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_multi_ue.py index 85b22467d28f..7e717af3c223 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_multi_ue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_multi_ue.py @@ -78,9 +78,7 @@ def test_attach_detach_dedicated_multi_ue(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value print( "********************** Received activate dedicated EPS" " bearer context request", @@ -120,10 +118,7 @@ def test_attach_detach_dedicated_multi_ue(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print( "********************** Received deactivate EPS bearer" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_qci_0.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_qci_0.py index ef355d8da617..2b3053d86466 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_qci_0.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_dedicated_qci_0.py @@ -80,10 +80,7 @@ def test_attach_detach_dedicated_qci_0(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_FW_ERAB_SETUP_REQ_FAILED_FOR_ERABS.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_FW_ERAB_SETUP_REQ_FAILED_FOR_ERABS.value erab_setup_failed_for_bearers = response.cast( s1ap_types.FwErabSetupFailedTosetup, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_disconnect_default_pdn.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_disconnect_default_pdn.py index eb6ebeec554c..670cbc8bb1f0 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_disconnect_default_pdn.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_disconnect_default_pdn.py @@ -59,9 +59,7 @@ def test_attach_detach_disconnect_default_pdn(self): # Receive PDN Disconnect Reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_DISCONNECT_REJ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_DISCONNECT_REJ.value # Now detach the UE self._s1ap_wrapper.s1_util.detach( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_duplicate_nas_resp_messages.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_duplicate_nas_resp_messages.py index f8ccabe7823d..1e61b1c9e4d4 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_duplicate_nas_resp_messages.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_duplicate_nas_resp_messages.py @@ -61,10 +61,7 @@ def test_attach_detach_duplicate_nas_resp_messages(self): ") ***", ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print( "*** Authentication Request Message Received (", str(i + 1), @@ -97,10 +94,7 @@ def test_attach_detach_duplicate_nas_resp_messages(self): ") ***", ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print( "*** Security Mode Command Message Received (", str(i + 1), @@ -143,10 +137,7 @@ def test_attach_detach_duplicate_nas_resp_messages(self): ") ***", ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND.value print( "*** Attach Accept Message Received in DL NAS transport msg (", str(i + 1), diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_emm_status.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_emm_status.py index 563e826e8165..44150efb1861 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_emm_status.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_emm_status.py @@ -71,9 +71,7 @@ def test_attach_detach_emm_status(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Running UE detach (switch-off) for ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_enb_rlf_initial_ue_msg.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_enb_rlf_initial_ue_msg.py index 4a814b9889b8..5374db711b3c 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_enb_rlf_initial_ue_msg.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_enb_rlf_initial_ue_msg.py @@ -34,7 +34,9 @@ def tearDown(self): "Restart sctpd service to clear Redis state as test case doesn't" " intend to initiate detach procedure", ) - self._s1ap_wrapper.magmad_util.restart_sctpd() + self._s1ap_wrapper.magmad_util.restart_services( + ['sctpd'], wait_time=30, + ) self._s1ap_wrapper.magmad_util.print_redis_state() def test_attach_detach_enb_rlf_initial_ue_msg(self): @@ -64,10 +66,7 @@ def test_attach_detach_enb_rlf_initial_ue_msg(self): attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value # Trigger Authentication Response auth_res = s1ap_types.ueAuthResp_t() @@ -80,10 +79,7 @@ def test_attach_detach_enb_rlf_initial_ue_msg(self): auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value # Trigger Security Mode Complete sec_mode_complete = s1ap_types.ueSecModeComplete_t() diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_maxbearers_twopdns.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_maxbearers_twopdns.py index f825ca155127..1fcbc108ec1b 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_maxbearers_twopdns.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_maxbearers_twopdns.py @@ -96,9 +96,7 @@ def test_attach_detach_maxbearers_twopdns(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -113,9 +111,7 @@ def test_attach_detach_maxbearers_twopdns(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context req response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -151,10 +147,7 @@ def test_attach_detach_maxbearers_twopdns(self): qci_val=idx + 1, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_dedicated.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_dedicated.py index d6b65816131c..c67cd422d5df 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_dedicated.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_dedicated.py @@ -75,9 +75,7 @@ def test_attach_detach_multiple_dedicated(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -116,10 +114,7 @@ def test_attach_detach_multiple_dedicated(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print("******************* Received deactivate eps bearer context") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_ip_blocks_mobilityd_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_ip_blocks_mobilityd_restart.py index 876479a7d50b..ad29b2e863d0 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_ip_blocks_mobilityd_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_ip_blocks_mobilityd_restart.py @@ -53,7 +53,7 @@ def test_attach_detach_multiple_ip_blocks_mobilityd_restart(self): curr_blocks = self._s1ap_wrapper.mobility_util.list_ip_blocks() # Check if old_blocks and curr_blocks contain same ip blocks after # restart - self.assertListEqual(old_blocks, curr_blocks) + assert old_blocks == curr_blocks req = self._s1ap_wrapper.ue_req print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_rar_tcp_data.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_rar_tcp_data.py index ca712602bfb0..e77e7ed1f24d 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_rar_tcp_data.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_rar_tcp_data.py @@ -192,8 +192,8 @@ def test_attach_detach_multiple_rar_tcp_data(self): # Receive Activate dedicated bearer request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value ) act_ded_ber_ctxt_req1 = response.cast( s1ap_types.UeActDedBearCtxtReq_t, @@ -220,8 +220,8 @@ def test_attach_detach_multiple_rar_tcp_data(self): # Receive Activate dedicated bearer request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value ) act_ded_ber_ctxt_req2 = response.cast( s1ap_types.UeActDedBearCtxtReq_t, @@ -253,8 +253,8 @@ def test_attach_detach_multiple_rar_tcp_data(self): time.sleep(5) # sleep for 5 seconds before retrying assert len(uplink_flows) > 2, "Uplink flow missing for UE" - self.assertIsNotNone( - uplink_flows[0]["match"]["tunnel_id"], + assert ( + uplink_flows[0]["match"]["tunnel_id"] is not None, "Uplink flow missing tunnel id match", ) @@ -281,9 +281,8 @@ def test_attach_detach_multiple_rar_tcp_data(self): time.sleep(5) # sleep for 5 seconds before retrying assert len(downlink_flows) > 2, "Downlink flow missing for UE" - self.assertEqual( - downlink_flows[0]["match"]["ipv4_dst"], - ue_ip, + assert ( + downlink_flows[0]["match"]["ipv4_dst"] == ue_ip, "UE IP match missing from downlink flow", ) @@ -294,7 +293,7 @@ def test_attach_detach_multiple_rar_tcp_data(self): if action["field"] == "tunnel_id" and action["type"] == "SET_FIELD" ) - self.assertTrue( + assert ( has_tunnel_action, "Downlink flow missing set tunnel action", ) @@ -315,9 +314,9 @@ def test_attach_detach_multiple_rar_tcp_data(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, + assert ( + response.msg_type + == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value ) print("******************* Received deactivate eps bearer context") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_secondary_pdn.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_secondary_pdn.py index da913d06d978..6a2537d925b9 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_secondary_pdn.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_multiple_secondary_pdn.py @@ -85,8 +85,9 @@ def test_attach_detach_multiple_secondary_pdn(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn[i]) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, + assert ( + response.msg_type + == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value ) act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) @@ -118,9 +119,9 @@ def test_attach_detach_multiple_secondary_pdn(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, + assert ( + response.msg_type + == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value ) print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_non_nat_dp_ul_tcp.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_non_nat_dp_ul_tcp.py index 87573c8a966f..2a0a1a20802d 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_non_nat_dp_ul_tcp.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_non_nat_dp_ul_tcp.py @@ -70,7 +70,7 @@ def test_attach_detach_non_nat_dp_ul_tcp(self): # Validate assigned IP address. addr = attach.esmInfo.pAddr.addrInfo ue_ipv4 = ipaddress.ip_address(bytes(addr[:4])) - self.assertEqual(ue_ipv4, ipaddress.IPv4Address(ue_ips[i])) + assert ue_ipv4 == ipaddress.IPv4Address(ue_ips[i]) # Wait on EMM Information from MME self._s1ap_wrapper._s1_util.receive_emm_info() diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_nw_triggered_delete_last_pdn.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_nw_triggered_delete_last_pdn.py index d5ce99e90b0f..2449199b8801 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_nw_triggered_delete_last_pdn.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_nw_triggered_delete_last_pdn.py @@ -73,9 +73,7 @@ def test_attach_detach_nw_triggered_delete_last_pdn(self): flow_list, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -107,10 +105,7 @@ def test_attach_detach_nw_triggered_delete_last_pdn(self): ) # Receive NW initiated detach request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value print("**************** Received NW initiated Detach Req") print("**************** Sending Detach Accept") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_nw_triggered_delete_secondary_pdn.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_nw_triggered_delete_secondary_pdn.py index c610fbd82a3c..6761870c0aa6 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_nw_triggered_delete_secondary_pdn.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_nw_triggered_delete_secondary_pdn.py @@ -81,9 +81,7 @@ def test_attach_detach_nw_triggered_delete_secondary_pdn(self): # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_sec_pdn = response.cast(s1ap_types.uePdnConRsp_t) addr = act_sec_pdn.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -108,9 +106,7 @@ def test_attach_detach_nw_triggered_delete_secondary_pdn(self): ) # Receive Activate dedicated EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast(s1ap_types.UeActDedBearCtxtReq_t) # Send Activate dedicated EPS bearer context accept self._s1ap_wrapper.sendActDedicatedBearerAccept( @@ -142,9 +138,7 @@ def test_attach_detach_nw_triggered_delete_secondary_pdn(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value deactv_bearer_req = response.cast(s1ap_types.UeDeActvBearCtxtReq_t) print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_ps_service_not_available.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_ps_service_not_available.py index c2a366a3263b..ab8fc7fd9f2d 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_ps_service_not_available.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_ps_service_not_available.py @@ -68,9 +68,7 @@ def test_attach_detach_ps_service_not_available(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Running UE detach (switch-off) for ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_activation_reject.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_activation_reject.py index a3ae108f7fa7..205cb7d17dfd 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_activation_reject.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_activation_reject.py @@ -97,10 +97,7 @@ def test_attach_detach_rar_activation_reject(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -113,10 +110,7 @@ def test_attach_detach_rar_activation_reject(self): # Dedicated Bearer Activation Request message. # Handling re-transmitted Dedicated Bearer Activation Request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value print( "********************** Ignoring re-transmitted Dedicated Bearer " "Activation Request", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_tcp_data.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_tcp_data.py index e40256352b3f..e2d2d4f9caba 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_tcp_data.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_tcp_data.py @@ -176,9 +176,7 @@ def test_attach_detach_rar_tcp_data(self): # Receive Activate dedicated bearer request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -211,8 +209,8 @@ def test_attach_detach_rar_tcp_data(self): time.sleep(5) # sleep for 5 seconds before retrying assert len(uplink_flows) > 1, "Uplink flow missing for UE" - self.assertIsNotNone( - uplink_flows[0]["match"]["tunnel_id"], + assert ( + uplink_flows[0]["match"]["tunnel_id"] is not None, "Uplink flow missing tunnel id match", ) @@ -239,9 +237,8 @@ def test_attach_detach_rar_tcp_data(self): time.sleep(5) # sleep for 5 seconds before retrying assert len(downlink_flows) > 1, "Downlink flow missing for UE" - self.assertEqual( - downlink_flows[0]["match"]["ipv4_dst"], - ue_ip, + assert ( + downlink_flows[0]["match"]["ipv4_dst"] == ue_ip, "UE IP match missing from downlink flow", ) @@ -252,7 +249,7 @@ def test_attach_detach_rar_tcp_data(self): if action["field"] == "tunnel_id" and action["type"] == "SET_FIELD" ) - self.assertTrue( + assert ( has_tunnel_action, "Downlink flow missing set tunnel action", ) @@ -270,10 +267,7 @@ def test_attach_detach_rar_tcp_data(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print("******************* Received deactivate eps bearer context") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_tcp_he.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_tcp_he.py index 0ece48edf324..eda6838f5431 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_tcp_he.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_rar_tcp_he.py @@ -187,9 +187,7 @@ def test_attach_detach_rar_tcp_he(self): # Receive Activate dedicated bearer request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -220,8 +218,8 @@ def test_attach_detach_rar_tcp_he(self): time.sleep(5) # sleep for 5 seconds before retrying assert len(uplink_flows) > 1, "Uplink flow missing for UE" - self.assertIsNotNone( - uplink_flows[0]["match"]["tunnel_id"], + assert ( + uplink_flows[0]["match"]["tunnel_id"] is not None, "Uplink flow missing tunnel id match", ) @@ -248,9 +246,8 @@ def test_attach_detach_rar_tcp_he(self): time.sleep(5) # sleep for 5 seconds before retrying assert len(downlink_flows) > 1, "Downlink flow missing for UE" - self.assertEqual( - downlink_flows[0]["match"]["ipv4_dst"], - ue_ip, + assert ( + downlink_flows[0]["match"]["ipv4_dst"] == ue_ip, "UE IP match missing from downlink flow", ) @@ -261,7 +258,7 @@ def test_attach_detach_rar_tcp_he(self): if action["field"] == "tunnel_id" and action["type"] == "SET_FIELD" ) - self.assertTrue( + assert ( has_tunnel_action, "Downlink flow missing set tunnel action", ) @@ -280,10 +277,7 @@ def test_attach_detach_rar_tcp_he(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print("******************* Received deactivate eps bearer context") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn.py index 0d8c4fffb862..056577f753b5 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn.py @@ -79,9 +79,7 @@ def test_attach_detach_secondary_pdn(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -118,9 +116,7 @@ def test_attach_detach_secondary_pdn(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print( "******************* Received deactivate eps bearer context" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_disconnect_dedicated_bearer.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_disconnect_dedicated_bearer.py index 40bd43ea8ad5..dc59b4ced2e3 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_disconnect_dedicated_bearer.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_disconnect_dedicated_bearer.py @@ -92,8 +92,8 @@ def test_attach_detach_secondary_pdn_disconnect_dedicated_bearer(self): flow_list1, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value ) act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, @@ -109,8 +109,9 @@ def test_attach_detach_secondary_pdn_disconnect_dedicated_bearer(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, + assert ( + response.msg_type + == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value ) act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo @@ -135,8 +136,8 @@ def test_attach_detach_secondary_pdn_disconnect_dedicated_bearer(self): flow_list2, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value ) act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, @@ -173,10 +174,7 @@ def test_attach_detach_secondary_pdn_disconnect_dedicated_bearer(self): # Receive PDN Disconnect reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_PDN_DISCONNECT_REJ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_DISCONNECT_REJ.value print( "******************** Received PDN Disconnect Reject for " diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_disconnect_invalid_bearer.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_disconnect_invalid_bearer.py index cffbc7aebf91..4e65cee932d8 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_disconnect_invalid_bearer.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_disconnect_invalid_bearer.py @@ -85,9 +85,7 @@ def test_attach_detach_secondary_pdn_disconnect_invalid_bearer(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -135,9 +133,7 @@ def test_attach_detach_secondary_pdn_disconnect_invalid_bearer(self): # Receive PDN Disconnect reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_DISCONNECT_REJ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_DISCONNECT_REJ.value print("************************* Received PDN disconnect reject") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_invalid_apn.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_invalid_apn.py index c9803ec20f68..c11ee78c3593 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_invalid_apn.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_invalid_apn.py @@ -60,15 +60,10 @@ def test_attach_detach_secondary_pdn_invalid_apn(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN REJ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value # Verify cause pdn_con_rsp = response.cast(s1ap_types.uePdnConRsp_t) - self.assertEqual( - pdn_con_rsp.m.conRejInfo.cause, - s1ap_types.TFW_ESM_CAUSE_MISSING_OR_UNKNOWN_APN, - ) + assert pdn_con_rsp.m.conRejInfo.cause == s1ap_types.TFW_ESM_CAUSE_MISSING_OR_UNKNOWN_APN print("Sleeping for 5 seconds") time.sleep(5) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_looped.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_looped.py index 9a53320a8ff1..c171f0409239 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_looped.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_looped.py @@ -84,9 +84,7 @@ def test_attach_detach_secondary_pdn_looped(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_multi_ue.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_multi_ue.py index c9f3842039c3..bf513ffa211c 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_multi_ue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_multi_ue.py @@ -89,9 +89,7 @@ def test_attach_detach_secondary_pdn_multi_ue(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) print( @@ -133,10 +131,7 @@ def test_attach_detach_secondary_pdn_multi_ue(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print( "******************* Received deactivate eps bearer context" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_no_disconnect.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_no_disconnect.py index 25cc64063c49..f32098816ae6 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_no_disconnect.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_no_disconnect.py @@ -79,9 +79,7 @@ def test_attach_detach_secondary_pdn_no_disconnect(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer.py index 89ba57c08db4..91c1ad8be0b6 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer.py @@ -91,9 +91,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -108,9 +106,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -135,9 +131,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -171,10 +165,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print( "******************* Received deactivate eps bearer context" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_deactivate.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_deactivate.py index 9c16b026fe66..6a4bb390660f 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_deactivate.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_deactivate.py @@ -93,9 +93,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer_deactivate(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -110,9 +108,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer_deactivate(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -135,9 +131,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer_deactivate(self): flow_list2, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -176,10 +170,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer_deactivate(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value deactv_bearer_req = response.cast(s1ap_types.UeDeActvBearCtxtReq_t) @@ -202,10 +193,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer_deactivate(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value deactv_bearer_req = response.cast(s1ap_types.UeDeActvBearCtxtReq_t) # Send Deactivate dedicated bearer rsp diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_looped.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_looped.py index 112ba9ff5155..dfafb78bf78a 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_looped.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_looped.py @@ -88,10 +88,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer_looped(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context req response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -115,10 +112,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer_looped(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -153,10 +147,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer_looped(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print( "*************** Received deactivate eps bearer context" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_multi_ue.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_multi_ue.py index ef8196240d20..4c5fde2366b2 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_multi_ue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_dedicated_bearer_multi_ue.py @@ -92,9 +92,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer_multi_ue(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ips.append(ipaddress.ip_address(bytes(addr[:4]))) @@ -121,9 +119,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer_multi_ue(self): flow_list[i], ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -166,10 +162,7 @@ def test_attach_detach_secondary_pdn_with_dedicated_bearer_multi_ue(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print( "******************* Received deactivate eps bearer context" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_pcscf_address.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_pcscf_address.py index 2c21eef87c9b..199a1c9c32a8 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_pcscf_address.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_secondary_pdn_with_pcscf_address.py @@ -104,9 +104,7 @@ def test_attach_detach_secondary_pdn_with_pcscf_address(self): ) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ips.append(ipaddress.ip_address(bytes(addr[:4]))) @@ -153,10 +151,7 @@ def test_attach_detach_secondary_pdn_with_pcscf_address(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print( "******************* Received deactivate eps bearer context" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_service.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_service.py index c3a1935b7dd1..e3988beb806e 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_service.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_service.py @@ -69,18 +69,14 @@ def test_attach_detach_service(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SERVICE_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SERVICE_REJECT_IND.value print( "************************* Received Service Reject for UE id ", ue_id, ) # Wait for UE Context Release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_setsessionrules_tcp_data.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_setsessionrules_tcp_data.py index 64eb02c39de0..32705139865f 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_setsessionrules_tcp_data.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_setsessionrules_tcp_data.py @@ -141,9 +141,7 @@ def test_attach_detach_setsessionrules_tcp_data(self): # Receive Activate dedicated bearer request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -170,9 +168,7 @@ def test_attach_detach_setsessionrules_tcp_data(self): # Triggers a delete bearer followed by a create bearer request # Receive Deactivate dedicated bearer request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value deactivate_ber_ctxt_req = response.cast( s1ap_types.UeDeActvBearCtxtReq_t, ) @@ -184,9 +180,7 @@ def test_attach_detach_setsessionrules_tcp_data(self): # Receive Activate dedicated bearer request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -219,14 +213,11 @@ def test_attach_detach_setsessionrules_tcp_data(self): time.sleep(5) # sleep for 5 seconds before retrying assert len(uplink_flows) == 2, "There should be 2 UL flow rules for UE" - self.assertIsNotNone( - uplink_flows[0]["match"]["tunnel_id"], - "Uplink flow missing tunnel id match", - ) - self.assertIsNotNone( - uplink_flows[1]["match"]["tunnel_id"], - "Uplink flow missing tunnel id match", - ) + for i in range(len(uplink_flows)): + assert ( + uplink_flows[i]["match"]["tunnel_id"] is not None, + "Uplink flow missing tunnel id match", + ) # DOWNLINK print("Checking for downlink flow") @@ -251,9 +242,8 @@ def test_attach_detach_setsessionrules_tcp_data(self): time.sleep(5) # sleep for 5 seconds before retrying assert len(downlink_flows) == 3, "Downlink flows must have been 3 for UE" - self.assertEqual( - downlink_flows[0]["match"]["ipv4_dst"], - ue_ip, + assert ( + downlink_flows[0]["match"]["ipv4_dst"] == ue_ip, "UE IP match missing from downlink flow", ) @@ -264,7 +254,7 @@ def test_attach_detach_setsessionrules_tcp_data(self): if action["field"] == "tunnel_id" and action["type"] == "SET_FIELD" ) - self.assertTrue( + assert ( has_tunnel_action, "Downlink flow missing set tunnel action", ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_static_ip.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_static_ip.py index fbaf9f74a742..2bde9139186c 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_static_ip.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_static_ip.py @@ -56,9 +56,9 @@ def test_attach_detach_static_ip(self): addr = attach.esmInfo.pAddr.addrInfo ue_ipv4 = ipaddress.ip_address(bytes(addr[:4])) if i < (num_ues - 1): - self.assertEqual(ue_ipv4, ipaddress.IPv4Address(ue_ips[i])) + assert ue_ipv4 == ipaddress.IPv4Address(ue_ips[i]) else: - self.assertIn(ue_ipv4, ipaddress.ip_network("192.168.128.0/24")) + assert ue_ipv4 in ipaddress.ip_network("192.168.128.0/24") # Wait on EMM Information from MME self._s1ap_wrapper._s1_util.receive_emm_info() diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_two_pdns_with_tcptraffic.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_two_pdns_with_tcptraffic.py index 6e49945f675b..299f5374d760 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_two_pdns_with_tcptraffic.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_two_pdns_with_tcptraffic.py @@ -83,9 +83,7 @@ def test_attach_detach_two_pdns_with_tcptraffic(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value pdn_conn_rsp = response.cast(s1ap_types.uePdnConRsp_t) ims_addr = pdn_conn_rsp.m.pdnInfo.pAddr.addrInfo ims_ip = ipaddress.ip_address(bytes(ims_addr[:4])) @@ -144,9 +142,7 @@ def test_attach_detach_two_pdns_with_tcptraffic(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print( "******************* Received deactivate EPS bearer context", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_corrupt_stateless_mme.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_corrupt_stateless_mme.py index d995a9bf50bd..25fd524a9b53 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_corrupt_stateless_mme.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_corrupt_stateless_mme.py @@ -39,66 +39,55 @@ def test_attach_detach_with_corrupt_stateless_mme(self): wait_for_s1 = True self._s1ap_wrapper.configUEDevice(1) - services_state_dict = { - 'mme': 'mme_nas_state', - } - req = self._s1ap_wrapper.ue_req print( "************************* Running End to End attach for ", "UE id ", req.ue_id, ) - for s in services_state_dict: - # Now actually complete the attach - self._s1ap_wrapper._s1_util.attach( - req.ue_id, s1ap_types.tfwCmd.UE_END_TO_END_ATTACH_REQUEST, - s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND, - s1ap_types.ueAttachAccept_t, - ) - - # Wait on EMM Information from MME - self._s1ap_wrapper._s1_util.receive_emm_info() - - print("************************* Corrupting %s state" % s) - self._s1ap_wrapper.magmad_util.corrupt_agw_state( - services_state_dict[s], - ) - - print("************************* Restarting %s service" % s) - wait_for_restart = 100 - self._s1ap_wrapper.magmad_util.restart_services( - [s], wait_for_restart, - ) - - # Re-establish S1 connection between eNB and MME - self._s1ap_wrapper._s1setup() - - print( - "************************* Re-running End to End attach for ", - "UE id ", - req.ue_id, - ) - - # Repeat the attach - self._s1ap_wrapper._s1_util.attach( - req.ue_id, - s1ap_types.tfwCmd.UE_END_TO_END_ATTACH_REQUEST, - s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND, - s1ap_types.ueAttachAccept_t, - ) - - # Wait on EMM Information from MME - self._s1ap_wrapper._s1_util.receive_emm_info() - - # Now detach the UE - print( - "************************* Running UE detach for UE id ", - req.ue_id, - ) - self._s1ap_wrapper.s1_util.detach( - req.ue_id, detach_type, wait_for_s1, - ) + self._s1ap_wrapper._s1_util.attach( + req.ue_id, s1ap_types.tfwCmd.UE_END_TO_END_ATTACH_REQUEST, + s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND, + s1ap_types.ueAttachAccept_t, + ) + + # Wait on EMM Information from MME + self._s1ap_wrapper._s1_util.receive_emm_info() + + print("************************* Corrupting mme state") + self._s1ap_wrapper.magmad_util.corrupt_agw_state("mme_nas_state") + + print("************************* Restarting service sctpd") + self._s1ap_wrapper.magmad_util.restart_services(["sctpd"], wait_time=60) + + # Re-establish S1 connection between eNB and MME + self._s1ap_wrapper._s1setup() + + print( + "************************* Re-running End to End attach for ", + "UE id ", + req.ue_id, + ) + + # Repeat the attach + self._s1ap_wrapper._s1_util.attach( + req.ue_id, + s1ap_types.tfwCmd.UE_END_TO_END_ATTACH_REQUEST, + s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND, + s1ap_types.ueAttachAccept_t, + ) + + # Wait on EMM Information from MME + self._s1ap_wrapper._s1_util.receive_emm_info() + + # Now detach the UE + print( + "************************* Running UE detach for UE id ", + req.ue_id, + ) + self._s1ap_wrapper.s1_util.detach( + req.ue_id, detach_type, wait_for_s1, + ) if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_he_policy.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_he_policy.py index 1cc592358853..4e932a022146 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_he_policy.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_he_policy.py @@ -123,9 +123,7 @@ def test_attach_detach_with_he_policy(self): # Receive Activate dedicated bearer request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -161,10 +159,7 @@ def test_attach_detach_with_he_policy(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print("******************* Received deactivate eps bearer context") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_ipv6_pcscf_and_dns_addr.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_ipv6_pcscf_and_dns_addr.py index 46aa466ec8dd..37f6cc99f907 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_ipv6_pcscf_and_dns_addr.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_ipv6_pcscf_and_dns_addr.py @@ -83,9 +83,7 @@ def test_attach_detach_with_ipv6_pcscf_and_dns_addr(self): ) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo @@ -101,9 +99,7 @@ def test_attach_detach_with_ipv6_pcscf_and_dns_addr(self): # Receive Router Advertisement message response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value routerAdv = response.cast(s1ap_types.ueRouterAdv_t) print( "************* Received Router Advertisement for APN-%s" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_ovs.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_ovs.py index f491ee8eb342..93454183b9da 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_ovs.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_ovs.py @@ -41,14 +41,11 @@ def check_imsi_metadata(self, flow, ue_req): if a["field"] == "metadata" ), None, ) - self.assertIsNotNone(imsi_action) + assert imsi_action is not None imsi64 = imsi_action["value"] # Convert between compacted uint IMSI and string received_imsi = decode_imsi(imsi64) - self.assertEqual( - sent_imsi, received_imsi, - "IMSI set in metadata field does not match sent IMSI", - ) + assert sent_imsi == received_imsi, "IMSI set in metadata field does not match sent IMSI" def test_attach_detach_with_ovs(self): """ @@ -60,10 +57,7 @@ def test_attach_detach_with_ovs(self): print("Checking for default table 0 flows") flows = get_flows(datapath, {"table_id": self.SPGW_TABLE}) - self.assertEqual( - len(flows), 2, - "There should only be 2 default table 0 flows", - ) + assert len(flows) == 2, "There should only be 2 default table 0 flows" self._s1ap_wrapper.configUEDevice(1) req = self._s1ap_wrapper.ue_req @@ -96,9 +90,9 @@ def test_attach_detach_with_ovs(self): break time.sleep(5) # sleep for 5 seconds before retrying - self.assertEqual(len(uplink_flows), 1, "Uplink flow missing for UE") - self.assertIsNotNone( - uplink_flows[0]["match"]["tunnel_id"], + assert len(uplink_flows) == 1, "Uplink flow missing for UE" + assert ( + uplink_flows[0]["match"]["tunnel_id"] is not None, "Uplink flow missing tunnel id match", ) self.check_imsi_metadata(uplink_flows[0], req) @@ -126,12 +120,9 @@ def test_attach_detach_with_ovs(self): break time.sleep(5) # sleep for 5 seconds before retrying - self.assertEqual( - len(downlink_flows), 1, - "Downlink flow missing for UE", - ) - self.assertEqual( - downlink_flows[0]["match"]["ipv4_dst"], ue_ip, + assert len(downlink_flows) == 1, "Downlink flow missing for UE" + assert ( + downlink_flows[0]["match"]["ipv4_dst"] == ue_ip, "UE IP match missing from downlink flow", ) @@ -141,7 +132,7 @@ def test_attach_detach_with_ovs(self): if action["field"] == "tunnel_id" and action["type"] == "SET_FIELD" ) - self.assertTrue( + assert ( has_tunnel_action, "Downlink flow missing set tunnel action", ) @@ -155,10 +146,7 @@ def test_attach_detach_with_ovs(self): print("Checking that uplink/downlink flows were deleted") flows = get_flows(datapath, {"table_id": self.SPGW_TABLE}) - self.assertEqual( - len(flows), 2, - "There should only be 2 default table 0 flows", - ) + assert len(flows) == 2, "There should only be 2 default table 0 flows" if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_sctpd_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_sctpd_restart.py index bef9a8f01679..f74366f66b95 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_sctpd_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_detach_with_sctpd_restart.py @@ -64,8 +64,9 @@ def test_attach_detach_with_sctpd_restart(self): "gateway", ) - self._s1ap_wrapper.magmad_util.restart_sctpd() - + self._s1ap_wrapper.magmad_util.restart_services( + ['sctpd'], wait_time=30, + ) # Re-establish S1 connection between eNB and MME self._s1ap_wrapper._s1setup() diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_emergency.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_emergency.py index d13ccefa524a..e5023046fb0a 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_emergency.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_emergency.py @@ -41,7 +41,7 @@ def _test_attach_response_for_id_type(self, id_type, expected_ue_state): ) # Assert cause - self.assertEqual(msg.ueState, expected_ue_state) + assert msg.ueState == expected_ue_state print( "************************* Emergency attach rejection successful", "UE id ", req.ue_id, diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_info_timerexpiration_max_retries.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_info_timerexpiration_max_retries.py index 0c16b189d6dc..9924a372cd50 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_info_timerexpiration_max_retries.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_info_timerexpiration_max_retries.py @@ -63,10 +63,7 @@ def test_attach_esm_info_timerexpiration_max_retries(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ") auth_res = s1ap_types.ueAuthResp_t() @@ -81,10 +78,7 @@ def test_attach_esm_info_timerexpiration_max_retries(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("Received Security Mode Command ue-id", auth_res.ue_Id) time.sleep(1) @@ -99,10 +93,7 @@ def test_attach_esm_info_timerexpiration_max_retries(self): for i in range(max_retries): # Esm Information Request indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value print( "Received Esm Information Request (", i + 1, @@ -167,10 +158,7 @@ def test_attach_esm_info_timerexpiration_max_retries(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_info_with_apn_correction.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_info_with_apn_correction.py index 2a868de95256..f5fe93484b94 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_info_with_apn_correction.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_info_with_apn_correction.py @@ -66,10 +66,7 @@ def test_attach_esm_info_with_apn_correction(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ") auth_res = s1ap_types.ueAuthResp_t() @@ -84,10 +81,7 @@ def test_attach_esm_info_with_apn_correction(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("Received Security Mode Command ue-id", auth_res.ue_Id) time.sleep(1) @@ -105,10 +99,7 @@ def test_attach_esm_info_with_apn_correction(self): sec_mode_complete.ue_Id, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value esm_info_req = response.cast(s1ap_types.ueEsmInformationReq_t) # Sending Esm Information Response print( @@ -164,10 +155,7 @@ def test_attach_esm_info_with_apn_correction(self): ) # Wait for UE context release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Disable APN Correction self._s1ap_wrapper.magmad_util.config_apn_correction( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information.py index fecdc3bfd263..0726a1ba07e9 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information.py @@ -56,10 +56,7 @@ def test_attach_esm_information(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ") auth_res = s1ap_types.ueAuthResp_t() @@ -74,10 +71,7 @@ def test_attach_esm_information(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("Received Security Mode Command ue-id", auth_res.ue_Id) time.sleep(1) @@ -95,10 +89,7 @@ def test_attach_esm_information(self): sec_mode_complete.ue_Id, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value esm_info_req = response.cast(s1ap_types.ueEsmInformationReq_t) # Sending Esm Information Response @@ -154,10 +145,7 @@ def test_attach_esm_information(self): ) # Wait for UE context release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information_timerexpiration.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information_timerexpiration.py index fab0360e4659..19984c4e9c7d 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information_timerexpiration.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information_timerexpiration.py @@ -57,10 +57,7 @@ def test_attach_esm_information_timerexpiration(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ") auth_res = s1ap_types.ueAuthResp_t() @@ -75,10 +72,7 @@ def test_attach_esm_information_timerexpiration(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("Received Security Mode Command ue-id", auth_res.ue_Id) time.sleep(1) @@ -97,9 +91,9 @@ def test_attach_esm_information_timerexpiration(self): sec_mode_complete.ue_Id, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value, + assert ( + response.msg_type + == s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value ) esm_info_req = response.cast(s1ap_types.ueEsmInformationReq_t) @@ -156,10 +150,7 @@ def test_attach_esm_information_timerexpiration(self): ) # Wait for UE context release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information_wrong_apn.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information_wrong_apn.py index f4fbda6b721a..99c44b6f913a 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information_wrong_apn.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_esm_information_wrong_apn.py @@ -51,9 +51,7 @@ def test_attach_esm_information_wrong_apn(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ") auth_res = s1ap_types.ueAuthResp_t() @@ -67,9 +65,7 @@ def test_attach_esm_information_wrong_apn(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("Received Security Mode Command ue-id", auth_res.ue_Id) time.sleep(1) @@ -85,9 +81,7 @@ def test_attach_esm_information_wrong_apn(self): "Received Esm Information Request ue-id", sec_mode_complete.ue_Id, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value esm_info_req = response.cast(s1ap_types.ueEsmInformationReq_t) # Sending Esm Information Response print( @@ -107,9 +101,7 @@ def test_attach_esm_information_wrong_apn(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value print("*** Running UE detach ***") # Now detach the UE @@ -123,9 +115,7 @@ def test_attach_esm_information_wrong_apn(self): ) # Wait for UE context release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_ics_drop_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_ics_drop_with_mme_restart.py index ef979294402e..c67dc85ac3b2 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_ics_drop_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_ics_drop_with_mme_restart.py @@ -62,9 +62,7 @@ def test_attach_ics_drop_with_mme_restart(self): s1ap_types.tfwCmd.UE_ATTACH_REQUEST, attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("******************** Received Authentiction Request Indication") # Send Authentication Response @@ -78,9 +76,7 @@ def test_attach_ics_drop_with_mme_restart(self): s1ap_types.tfwCmd.UE_AUTH_RESP, auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("******************** Received Security Mode Command Indication") print( @@ -107,9 +103,7 @@ def test_attach_ics_drop_with_mme_restart(self): # enbApp sends UE_ICS_DROPD_IND message to tfwApp after dropping # ICS request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ICS_DROPD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ICS_DROPD_IND.value print( "******************** Received Initial Context Setup Dropped " "Indication", @@ -160,10 +154,7 @@ def test_attach_ics_drop_with_mme_restart(self): " with detach type ", nw_init_detach_req.Type, ) - self.assertEqual( - nw_init_detach_req.Type, - s1ap_types.ueNwInitDetType_t.TFW_RE_ATTACH_REQUIRED.value, - ) + assert nw_init_detach_req.Type == s1ap_types.ueNwInitDetType_t.TFW_RE_ATTACH_REQUIRED.value if resp_count == 1: # Send detach accept @@ -186,9 +177,7 @@ def test_attach_ics_drop_with_mme_restart(self): else: break - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("******************** Received UE Context Release indication") print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_ics_failure_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_ics_failure_with_mme_restart.py index 742906320527..a934b310b8ea 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_ics_failure_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_ics_failure_with_mme_restart.py @@ -62,9 +62,7 @@ def test_attach_ics_failure_with_mme_restart(self): s1ap_types.tfwCmd.UE_ATTACH_REQUEST, attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("******************** Received Authentiction Request Indication") # Send Authentication Response @@ -79,9 +77,7 @@ def test_attach_ics_failure_with_mme_restart(self): s1ap_types.tfwCmd.UE_AUTH_RESP, auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("******************** Received Security Mode Command Indication") print( @@ -105,9 +101,7 @@ def test_attach_ics_failure_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("******************** Received Initial Context Setup Indication") print("******************** Restarting MME service on gateway") @@ -131,9 +125,7 @@ def test_attach_ics_failure_with_mme_restart(self): # Waiting for UE Context Release indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("******************** Received UE Context Release indication") print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_implicit_detach_timer_expiry.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_implicit_detach_timer_expiry.py index 8359c3c67f71..ed1f3e345002 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_implicit_detach_timer_expiry.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_implicit_detach_timer_expiry.py @@ -78,9 +78,7 @@ def test_attach_implicit_detach_timer_expiry(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # For implicit detach timer to expire, first ensure that # mobile reachability timer is expired or not and then @@ -110,13 +108,9 @@ def test_attach_implicit_detach_timer_expiry(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SERVICE_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SERVICE_REJECT_IND.value response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value time.sleep(0.5) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_inactive_tau_with_combined_tala_update_reattach.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_inactive_tau_with_combined_tala_update_reattach.py index 61e6ed284609..c3ee94166c75 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_inactive_tau_with_combined_tala_update_reattach.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_inactive_tau_with_combined_tala_update_reattach.py @@ -75,9 +75,7 @@ def test_attach_inactive_tau_with_combined_tala_update_reattach(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Received UE context release indication", ) @@ -97,18 +95,14 @@ def test_attach_inactive_tau_with_combined_tala_update_reattach(self): # Waiting for TAU Accept Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value print( "************************* Received Tracking Area Update Accept " "Indication", ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Received UE context release indication", ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_ipv4v6_pdn_type.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_ipv4v6_pdn_type.py index 1952db6db630..496bd33682c4 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_ipv4v6_pdn_type.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_ipv4v6_pdn_type.py @@ -36,16 +36,10 @@ def test_attach_ipv4v6_pdn_type(self): resp_ipv4_ipv6 = self._create_attach_ipv4v6_pdn_type_req( pdn_type_value=3, ) - self.assertEqual( - resp_ipv4_ipv6.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert resp_ipv4_ipv6.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # IPv6 is equal to 2 resp_ipv6 = self._create_attach_ipv4v6_pdn_type_req(pdn_type_value=2) - self.assertEqual( - resp_ipv6.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert resp_ipv6.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value def _create_attach_ipv4v6_pdn_type_req(self, pdn_type_value): # Ground work. @@ -77,10 +71,7 @@ def _create_attach_ipv4v6_pdn_type_req(self, pdn_type_value): attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value # Trigger Authentication Response auth_res = s1ap_types.ueAuthResp_t() @@ -93,10 +84,7 @@ def _create_attach_ipv4v6_pdn_type_req(self, pdn_type_value): auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value # Trigger Security Mode Complete sec_mode_complete = s1ap_types.ueSecModeComplete_t() @@ -108,10 +96,7 @@ def _create_attach_ipv4v6_pdn_type_req(self, pdn_type_value): # Attach Reject will be sent since IPv6 PDN Type is not configured if pdn_type_value == 2: response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value return self._s1ap_wrapper.s1_util.get_response() # Receive initial context setup and attach accept indication diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_missing_imsi.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_missing_imsi.py index 2ed12636da5a..7017094d2045 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_missing_imsi.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_missing_imsi.py @@ -44,9 +44,7 @@ def test_attach_missing_imsi(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value ue_id = 2 print("************************* Adding IMSI entry for UE id ", ue_id) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_mobile_reachability_timer_expiry.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_mobile_reachability_timer_expiry.py index cfd655e22987..7731fe9d921f 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_mobile_reachability_timer_expiry.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_mobile_reachability_timer_expiry.py @@ -77,9 +77,7 @@ def test_attach_mobile_reachability_timer_expiry(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Delay by 6 minutes to ensure Mobile reachability timer expires. # MOBILE REACHABILITY TIMER VALUE = 1 minute (conf file) + delta value @@ -107,9 +105,7 @@ def test_attach_mobile_reachability_timer_expiry(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("************************* Running UE detach for UE id ", ue_id) # Now detach the UE diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_no_initial_context_resp.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_no_initial_context_resp.py index 6139cd797709..6e0b21312aeb 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_no_initial_context_resp.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_no_initial_context_resp.py @@ -49,10 +49,7 @@ def test_attach_no_initial_context_resp(self): attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value auth_res = s1ap_types.ueAuthResp_t() auth_res.ue_Id = req.ue_id sqnrecvd = s1ap_types.ueSqnRcvd_t() @@ -64,10 +61,7 @@ def test_attach_no_initial_context_resp(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value sec_mode_complete = s1ap_types.ueSecModeComplete_t() sec_mode_complete.ue_Id = req.ue_id diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_nw_initiated_detach_fail.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_nw_initiated_detach_fail.py index e16c2784ec74..3e8c6b01efff 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_nw_initiated_detach_fail.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_nw_initiated_detach_fail.py @@ -82,10 +82,7 @@ def test_attach_nw_initiated_detach_fail(self): # Wait for timer 3422 expiry 5 times for _ in range(5): response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value print("**************** Received NW initiated Detach Req") time.sleep(6) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_nw_initiated_detach_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_nw_initiated_detach_with_mme_restart.py index 46f56afb8447..76079132471c 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_nw_initiated_detach_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_nw_initiated_detach_with_mme_restart.py @@ -75,10 +75,7 @@ def test_attach_nw_initiated_detach_with_mme_restart(self): ) # Receive NW initiated detach request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value print("**************** Received NW initiated Detach Req") print( "************************* Restarting MME service on", @@ -91,10 +88,7 @@ def test_attach_nw_initiated_detach_with_mme_restart(self): # Receive NW initiated detach request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value print("**************** Received second NW initiated Detach Req") print("**************** Sending Detach Accept") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_restricted_plmn.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_restricted_plmn.py index 4ed1b16222c4..c32f91e2060c 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_restricted_plmn.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_restricted_plmn.py @@ -79,8 +79,8 @@ def test_attach_restricted_plmn(self): # Attach Reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value ) attach_rej = response.cast(s1ap_types.ueAttachRejInd_t) @@ -90,13 +90,11 @@ def test_attach_restricted_plmn(self): ) # Verify cause - self.assertEqual(attach_rej.cause, s1ap_types.TFW_EMM_CAUSE_PLMN_NA) + assert attach_rej.cause == s1ap_types.TFW_EMM_CAUSE_PLMN_NA # Context release response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Received ue context release cmd for " "UE id ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_security_mode_reject.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_security_mode_reject.py index 67eb5d60f8fa..5014365ec7db 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_security_mode_reject.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_security_mode_reject.py @@ -50,9 +50,7 @@ def test_attach_security_mode_reject(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ") auth_res = s1ap_types.ueAuthResp_t() @@ -66,9 +64,7 @@ def test_attach_security_mode_reject(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("Received Security Mode Command ue-id", auth_res.ue_Id) sec_mode_reject = s1ap_types.ueSecModeReject_t() diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_service.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_service.py index 7f5a6194a981..6dc0ba6aa573 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_service.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_service.py @@ -64,9 +64,7 @@ def test_attach_service(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Sending Service request for UE id ", @@ -82,9 +80,7 @@ def test_attach_service(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print( "************************* Running UE detach for UE id ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_multi_ue.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_multi_ue.py index 0c3786ee109a..40ede80d84fa 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_multi_ue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_multi_ue.py @@ -68,9 +68,7 @@ def test_attach_service_multi_ue(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value for req in reqs: ue_id = req.ue_id @@ -88,9 +86,7 @@ def test_attach_service_multi_ue(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value for req in reqs: print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_ue_radio_capability.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_ue_radio_capability.py index 9fa3fd91af38..7c1e648f1367 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_ue_radio_capability.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_ue_radio_capability.py @@ -65,9 +65,7 @@ def test_attach_service_ue_radio_capability(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Sending Service request for UE id ", @@ -83,9 +81,7 @@ def test_attach_service_ue_radio_capability(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print( "************************* Running UE detach for UE id ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers.py index 919698317dcc..c3e38dd8fc6d 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers.py @@ -201,9 +201,7 @@ def test_attach_service_with_multi_pdns_and_bearers(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -218,9 +216,7 @@ def test_attach_service_with_multi_pdns_and_bearers(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -247,9 +243,7 @@ def test_attach_service_with_multi_pdns_and_bearers(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -288,9 +282,7 @@ def test_attach_service_with_multi_pdns_and_bearers(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("Sleeping for 5 seconds") time.sleep(5) @@ -313,9 +305,7 @@ def test_attach_service_with_multi_pdns_and_bearers(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("Sleeping for 5 seconds") time.sleep(5) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_failure.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_failure.py index 0bcc794d44be..b66c82e46d12 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_failure.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_failure.py @@ -200,9 +200,7 @@ def test_attach_service_with_multi_pdns_and_bearers_failure(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -217,9 +215,7 @@ def test_attach_service_with_multi_pdns_and_bearers_failure(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -244,9 +240,7 @@ def test_attach_service_with_multi_pdns_and_bearers_failure(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -287,9 +281,7 @@ def test_attach_service_with_multi_pdns_and_bearers_failure(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Send the bearers to be included in failed to setup list in ICS Rsp init_ctxt_setup_failed_erabs = s1ap_types.UeInitCtxtSetupFailedErabs() @@ -326,9 +318,7 @@ def test_attach_service_with_multi_pdns_and_bearers_failure(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("Sleeping for 5 seconds") time.sleep(5) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_looped.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_looped.py index c2080a9f5827..c4d3b4dd1196 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_looped.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_looped.py @@ -203,9 +203,7 @@ def test_attach_service_with_multi_pdns_and_bearers_looped(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -220,9 +218,7 @@ def test_attach_service_with_multi_pdns_and_bearers_looped(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -249,9 +245,7 @@ def test_attach_service_with_multi_pdns_and_bearers_looped(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -295,9 +289,7 @@ def test_attach_service_with_multi_pdns_and_bearers_looped(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Verify if paging flow rules are created ip_list = [default_ip, sec_ip] @@ -317,9 +309,7 @@ def test_attach_service_with_multi_pdns_and_bearers_looped(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, ser_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("Sleeping for 5 seconds") time.sleep(5) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_mt_data.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_mt_data.py index e3fbf5b8580d..22348e1cebef 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_mt_data.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_mt_data.py @@ -207,9 +207,7 @@ def test_attach_service_with_multi_pdns_and_bearers_mt_data(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -224,9 +222,7 @@ def test_attach_service_with_multi_pdns_and_bearers_mt_data(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -254,9 +250,7 @@ def test_attach_service_with_multi_pdns_and_bearers_mt_data(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -298,9 +292,7 @@ def test_attach_service_with_multi_pdns_and_bearers_mt_data(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Verify if paging flow rules are created ip_list = [default_ip, sec_ip] @@ -314,7 +306,7 @@ def test_attach_service_with_multi_pdns_and_bearers_mt_data(self): req, duration=1, is_udp=True, ) as test: response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue(response, s1ap_types.tfwCmd.UE_PAGING_IND.value) + assert response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value # Send service request to reconnect UE print( "************************* Sending Service request for UE id ", @@ -335,9 +327,7 @@ def test_attach_service_with_multi_pdns_and_bearers_mt_data(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value test.verify() print("Sleeping for 5 seconds") @@ -359,9 +349,7 @@ def test_attach_service_with_multi_pdns_and_bearers_mt_data(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print( "******************* Received deactivate eps bearer context" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_multi_ue.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_multi_ue.py index d3f301f0f713..3cab237539fd 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_multi_ue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_with_multi_pdns_and_bearers_multi_ue.py @@ -207,9 +207,7 @@ def test_attach_service_with_multi_pdns_and_bearers_multi_ue(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -231,9 +229,7 @@ def test_attach_service_with_multi_pdns_and_bearers_multi_ue(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ips.append(ipaddress.ip_address(bytes(addr[:4]))) @@ -264,9 +260,7 @@ def test_attach_service_with_multi_pdns_and_bearers_multi_ue(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -318,9 +312,7 @@ def test_attach_service_with_multi_pdns_and_bearers_multi_ue(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Verify if paging flow rules are created ip_list = [default_ips[i], sec_ips[i]] self._s1ap_wrapper.s1_util.verify_paging_flow_rules(ip_list) @@ -346,9 +338,7 @@ def test_attach_service_with_multi_pdns_and_bearers_multi_ue(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, ser_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value # Delay of 10 seconds to make sure flows are added print("Sleeping for 10 seconds") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_without_mac.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_without_mac.py index 1a0c0afd0826..540b0fe7ef4b 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_service_without_mac.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_service_without_mac.py @@ -66,9 +66,7 @@ def test_attach_service_without_mac(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Sending Service request for UE id ", @@ -85,9 +83,7 @@ def test_attach_service_without_mac(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SERVICE_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SERVICE_REJECT_IND.value print( "************************* Received Service Reject for UE id ", ue_id, diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_standalone_act_dflt_ber_ctxt_rej.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_standalone_act_dflt_ber_ctxt_rej.py index b5f911962fb1..88365fef4ae7 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_standalone_act_dflt_ber_ctxt_rej.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_standalone_act_dflt_ber_ctxt_rej.py @@ -96,9 +96,7 @@ def test_attach_standalone_act_dflt_ber_ctxt_rej(self): self._s1ap_wrapper.sendPdnConnectivityReq(req.ue_id, apn, pdn_type=3) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_standalone_act_dflt_ber_ctxt_rej_ded_bearer_activation.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_standalone_act_dflt_ber_ctxt_rej_ded_bearer_activation.py index ec824cd6383d..f9fdebccc5c7 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_standalone_act_dflt_ber_ctxt_rej_ded_bearer_activation.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_standalone_act_dflt_ber_ctxt_rej_ded_bearer_activation.py @@ -203,9 +203,7 @@ def test_attach_standalone_act_dflt_ber_ctxt_rej_ded_bearer_activation( self._s1ap_wrapper.sendPdnConnectivityReq(req.ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_ue_ctxt_release_cmp_delay.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_ue_ctxt_release_cmp_delay.py index 25e286e00f0e..907eeda366b7 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_ue_ctxt_release_cmp_delay.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_ue_ctxt_release_cmp_delay.py @@ -54,10 +54,7 @@ def test_attach_ue_ctxt_release_cmp_delay(self): attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value # Trigger Authentication Response auth_res = s1ap_types.ueAuthResp_t() @@ -70,10 +67,7 @@ def test_attach_ue_ctxt_release_cmp_delay(self): auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value # Trigger Security Mode Complete sec_mode_complete = s1ap_types.ueSecModeComplete_t() @@ -114,10 +108,7 @@ def test_attach_ue_ctxt_release_cmp_delay(self): ) time.sleep(0.5) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_EMM_INFORMATION.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_EMM_INFORMATION.value time.sleep(0.5) # Now detach the UE @@ -129,10 +120,7 @@ def test_attach_ue_ctxt_release_cmp_delay(self): detach_req, ) response = self._s1ap_wrapper._s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_DETACH_ACCEPT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DETACH_ACCEPT_IND.value print( "*** Sending UE context release request ", @@ -152,10 +140,7 @@ def test_attach_ue_ctxt_release_cmp_delay(self): uectxtrel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value time.sleep(10) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_attach_with_multiple_mme_restarts.py b/lte/gateway/python/integ_tests/s1aptests/test_attach_with_multiple_mme_restarts.py index 4d17e653da69..1fae98fa9230 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_attach_with_multiple_mme_restarts.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_attach_with_multiple_mme_restarts.py @@ -51,10 +51,7 @@ def test_attach_with_multiple_mme_restarts(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("************************* Received UE_AUTH_REQ_IND") # Try consecutive mme restarts @@ -76,10 +73,7 @@ def test_attach_with_multiple_mme_restarts(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("************************* Received UE_SEC_MOD_CMD_IND") self._s1ap_wrapper.magmad_util.restart_services(['mme']) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_concurrent_secondary_pdn_reject.py b/lte/gateway/python/integ_tests/s1aptests/test_concurrent_secondary_pdn_reject.py index c4b932deeb3f..ac8fd29b937c 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_concurrent_secondary_pdn_reject.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_concurrent_secondary_pdn_reject.py @@ -85,15 +85,10 @@ def test_concurrent_secondary_pdn_reject(self): # Receive PDN connectivity reject for internet APN response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value # Verify cause pdn_con_rsp = response.cast(s1ap_types.uePdnConRsp_t) - self.assertEqual( - pdn_con_rsp.m.conRejInfo.cause, - s1ap_types.TFW_ESM_CAUSE_MISSING_OR_UNKNOWN_APN, - ) + assert pdn_con_rsp.m.conRejInfo.cause == s1ap_types.TFW_ESM_CAUSE_MISSING_OR_UNKNOWN_APN print( "************************* Received PDN Connectivity " @@ -104,9 +99,7 @@ def test_concurrent_secondary_pdn_reject(self): # Receive PDN CONN RSP/Activate default EPS bearer context # request for ims APN response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) print( "************************* Received Activate default EPS bearer " @@ -151,9 +144,7 @@ def test_concurrent_secondary_pdn_reject(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value deactv_bearer_req = response.cast(s1ap_types.UeDeActvBearCtxtReq_t) print( "******************* Received deactivate eps bearer context" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_concurrent_secondary_pdns.py b/lte/gateway/python/integ_tests/s1aptests/test_concurrent_secondary_pdns.py index e875e6dce459..9f73fc5cbe4e 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_concurrent_secondary_pdns.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_concurrent_secondary_pdns.py @@ -91,9 +91,7 @@ def test_concurrent_secondary_pdns(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req1 = response.cast(s1ap_types.uePdnConRsp_t) print( "************************* Received Activate default EPS bearer " @@ -114,9 +112,7 @@ def test_concurrent_secondary_pdns(self): # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req2 = response.cast(s1ap_types.uePdnConRsp_t) addr2 = act_def_bearer_req2.m.pdnInfo.pAddr.addrInfo sec_ip2 = ipaddress.ip_address(bytes(addr2[:4])) @@ -162,9 +158,7 @@ def test_concurrent_secondary_pdns(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value deactv_bearer_req = response.cast(s1ap_types.UeDeActvBearCtxtReq_t) print( "******************* Received deactivate eps bearer context" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_continuous_random_attach.py b/lte/gateway/python/integ_tests/s1aptests/test_continuous_random_attach.py index cee1b6f53d5e..64dc4fbbc688 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_continuous_random_attach.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_continuous_random_attach.py @@ -37,7 +37,9 @@ def tearDown(self): "subsequent test cases", ) self._s1ap_wrapper._s1_util.delete_ovs_flow_rules() - self._s1ap_wrapper.magmad_util.restart_sctpd() + self._s1ap_wrapper.magmad_util.restart_services( + ['sctpd'], wait_time=30, + ) self._s1ap_wrapper.magmad_util.print_redis_state() def handle_msg(self, msg): diff --git a/lte/gateway/python/integ_tests/s1aptests/test_data_flow_after_service_request.py b/lte/gateway/python/integ_tests/s1aptests/test_data_flow_after_service_request.py index 7c98a90056a3..99eb0700c7ab 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_data_flow_after_service_request.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_data_flow_after_service_request.py @@ -85,9 +85,7 @@ def test_data_flow_after_service_request(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value for req in reqs: ue_id = req.ue_id @@ -105,8 +103,8 @@ def test_data_flow_after_service_request(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value ) with test: diff --git a/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode.py b/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode.py index 3d88c9eb039b..37d539b3571c 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode.py @@ -181,9 +181,7 @@ def test_dedicated_bearer_activation_idle_mode(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Verify if paging flow rules are created ip_list = [default_ip] @@ -222,9 +220,7 @@ def test_dedicated_bearer_activation_idle_mode(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PAGING_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value print("*********** Received Paging for UE id ", ue_id) print("*********** Sending Service request for UE id ", ue_id) @@ -238,15 +234,11 @@ def test_dedicated_bearer_activation_idle_mode(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, ser_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("*********** Received ICS Request for UE id ", ue_id) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn1 = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -259,9 +251,7 @@ def test_dedicated_bearer_activation_idle_mode(self): ue_id, act_ded_ber_req_oai_apn1.bearerId, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn2 = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode_multi_ue.py b/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode_multi_ue.py index 6b7a880612c1..fbd258d21d71 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode_multi_ue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode_multi_ue.py @@ -193,9 +193,7 @@ def test_dedicated_bearer_activation_idle_mode_multi_ue(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Verify if paging flow rules are created ip_list = [default_ips[i]] self._s1ap_wrapper.s1_util.verify_paging_flow_rules(ip_list) @@ -243,9 +241,7 @@ def test_dedicated_bearer_activation_idle_mode_multi_ue(self): ue_id = req.ue_id response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PAGING_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value print("*********** Received Paging for UE id ", ue_id) self._s1ap_wrapper._ue_idx = 0 @@ -263,15 +259,11 @@ def test_dedicated_bearer_activation_idle_mode_multi_ue(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("*********** Received ICS Request for UE id ", ue_id) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn1 = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -284,9 +276,7 @@ def test_dedicated_bearer_activation_idle_mode_multi_ue(self): ue_id, act_ded_ber_req_oai_apn1.bearerId, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn2 = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode_paging_timer_expiry.py b/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode_paging_timer_expiry.py index db00d88d303d..055462d92f40 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode_paging_timer_expiry.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_dedicated_bearer_activation_idle_mode_paging_timer_expiry.py @@ -163,9 +163,7 @@ def test_dedicated_bearer_activation_idle_mode_paging_timer_expiry(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Verify if paging flow rules are created ip_list = [default_ip] @@ -189,16 +187,12 @@ def test_dedicated_bearer_activation_idle_mode_paging_timer_expiry(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PAGING_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value print("*********** Received Paging for UE id ", ue_id) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PAGING_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value print("*********** Received second Paging for UE id ", ue_id) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_different_enb_s1ap_id_same_ue.py b/lte/gateway/python/integ_tests/s1aptests/test_different_enb_s1ap_id_same_ue.py index a7ccc3ca2522..681cc0b1a27b 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_different_enb_s1ap_id_same_ue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_different_enb_s1ap_id_same_ue.py @@ -50,10 +50,7 @@ def test_different_enb_s1ap_id_same_ue(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ") auth_res = s1ap_types.ueAuthResp_t() @@ -68,10 +65,7 @@ def test_different_enb_s1ap_id_same_ue(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("Received Security Mode Command ue-id", auth_res.ue_Id) attach_req = s1ap_types.ueAttachRequest_t() @@ -133,10 +127,7 @@ def test_different_enb_s1ap_id_same_ue(self): ) # Wait for UE context release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_duplicate_attach.py b/lte/gateway/python/integ_tests/s1aptests/test_duplicate_attach.py index ddea872c5ff9..7f7f5b791e08 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_duplicate_attach.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_duplicate_attach.py @@ -54,10 +54,7 @@ def test_duplicate_attach(self): auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value sec_mode_complete = s1ap_types.ueSecModeComplete_t() sec_mode_complete.ue_Id = req.ue_id @@ -90,10 +87,7 @@ def test_duplicate_attach(self): ) continue - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************ Received UE context release indication", ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_enb_complete_reset.py b/lte/gateway/python/integ_tests/s1aptests/test_enb_complete_reset.py index dd76870f7e5b..dbffe2bc5518 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_enb_complete_reset.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_enb_complete_reset.py @@ -77,7 +77,7 @@ def test_enb_complete_reset(self): reset_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual(response.msg_type, s1ap_types.tfwCmd.RESET_ACK.value) + assert response.msg_type == s1ap_types.tfwCmd.RESET_ACK.value # Sleep for 3 seconds to ensure that MME has cleaned up all S1 state # before proceeding diff --git a/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset.py b/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset.py index 941881e9a9d2..9ba0155fafa0 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset.py @@ -82,7 +82,7 @@ def test_enb_partial_reset(self): s1ap_types.tfwCmd.RESET_REQ, reset_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual(response.msg_type, s1ap_types.tfwCmd.RESET_ACK.value) + assert response.msg_type == s1ap_types.tfwCmd.RESET_ACK.value # Sleep for 3 seconds to ensure that MME has cleaned up all S1 state # before proceeding diff --git a/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_con_dereg.py b/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_con_dereg.py index 69f6e365f4bb..81527daeb4c3 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_con_dereg.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_con_dereg.py @@ -70,10 +70,7 @@ def test_enb_partial_reset_con_dereg(self): attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value # Trigger Authentication Response auth_res = s1ap_types.ueAuthResp_t() @@ -86,10 +83,7 @@ def test_enb_partial_reset_con_dereg(self): auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value # Trigger Security Mode Complete sec_mode_complete = s1ap_types.ueSecModeComplete_t() @@ -143,7 +137,7 @@ def test_enb_partial_reset_con_dereg(self): reset_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual(response.msg_type, s1ap_types.tfwCmd.RESET_ACK.value) + assert response.msg_type == s1ap_types.tfwCmd.RESET_ACK.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_multi_ue.py b/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_multi_ue.py index 2dd9477cc541..8c26fe87166e 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_multi_ue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_multi_ue.py @@ -97,7 +97,7 @@ def test_enb_partial_reset_multi_ue(self): s1ap_types.tfwCmd.RESET_REQ, reset_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual(response.msg_type, s1ap_types.tfwCmd.RESET_ACK.value) + assert response.msg_type == s1ap_types.tfwCmd.RESET_ACK.value # Sleep for 3 seconds to ensure that MME has cleaned up all S1 state # before proceeding diff --git a/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_multi_ue_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_multi_ue_with_mme_restart.py index c75daeb3b6eb..a25dd87e4839 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_multi_ue_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_multi_ue_with_mme_restart.py @@ -109,7 +109,7 @@ def test_enb_partial_reset_multi_ue_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual(response.msg_type, s1ap_types.tfwCmd.RESET_ACK.value) + assert response.msg_type == s1ap_types.tfwCmd.RESET_ACK.value # Send service request for all the Reset UE Ids for indx in range(reset_req.r.partialRst.numOfConn): @@ -126,8 +126,8 @@ def test_enb_partial_reset_multi_ue_with_mme_restart(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value ) # Trigger detach request diff --git a/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_with_unknown_ue_s1ap_ids.py b/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_with_unknown_ue_s1ap_ids.py index 7ccbca8a9b7c..23a29526a532 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_with_unknown_ue_s1ap_ids.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_enb_partial_reset_with_unknown_ue_s1ap_ids.py @@ -103,7 +103,7 @@ def test_enb_partial_reset_with_unknown_ue_s1ap_ids(self): reset_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual(response.msg_type, s1ap_types.tfwCmd.RESET_ACK.value) + assert response.msg_type == s1ap_types.tfwCmd.RESET_ACK.value # Sleep for 3 seconds to ensure that MME has cleaned up all S1 state # before proceeding diff --git a/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_ded_bearer_deact.py b/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_ded_bearer_deact.py index 745b8c34bcf5..f60738fdbab1 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_ded_bearer_deact.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_ded_bearer_deact.py @@ -104,10 +104,7 @@ def test_eps_bearer_context_status_ded_bearer_deact(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn[i]) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) print( @@ -136,10 +133,7 @@ def test_eps_bearer_context_status_ded_bearer_deact(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -162,10 +156,7 @@ def test_eps_bearer_context_status_ded_bearer_deact(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -205,10 +196,7 @@ def test_eps_bearer_context_status_ded_bearer_deact(self): cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print(" Sleeping for 2 seconds") time.sleep(2) print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_def_bearer_deact.py b/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_def_bearer_deact.py index 6d9a6dd8f777..87b3a7fcbb21 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_def_bearer_deact.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_def_bearer_deact.py @@ -100,10 +100,7 @@ def test_eps_bearer_context_status_def_bearer_deact(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn[i]) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) print( @@ -132,10 +129,7 @@ def test_eps_bearer_context_status_def_bearer_deact(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -175,10 +169,7 @@ def test_eps_bearer_context_status_def_bearer_deact(self): cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Sending Tracking Area Update ", "request for UE id ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_multiple_ded_bearer_deact.py b/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_multiple_ded_bearer_deact.py index 76ccadc46311..50306c4fe8c0 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_multiple_ded_bearer_deact.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_eps_bearer_context_status_multiple_ded_bearer_deact.py @@ -114,10 +114,7 @@ def test_eps_bearer_context_status_multiple_ded_bearer_deact(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast(s1ap_types.UeActDedBearCtxtReq_t) self._s1ap_wrapper.sendActDedicatedBearerAccept( ue_id, @@ -131,10 +128,7 @@ def test_eps_bearer_context_status_multiple_ded_bearer_deact(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn[i]) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) print( @@ -163,10 +157,7 @@ def test_eps_bearer_context_status_multiple_ded_bearer_deact(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -189,10 +180,7 @@ def test_eps_bearer_context_status_multiple_ded_bearer_deact(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -232,10 +220,7 @@ def test_eps_bearer_context_status_multiple_ded_bearer_deact(self): cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print(" Sleeping for 2 seconds") time.sleep(2) print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_gateway_metrics_attach_detach.py b/lte/gateway/python/integ_tests/s1aptests/test_gateway_metrics_attach_detach.py index da339f8e7b60..05ff51f1ec2b 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_gateway_metrics_attach_detach.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_gateway_metrics_attach_detach.py @@ -43,7 +43,7 @@ def test_gateway_metrics_attach_detach(self): "mme_new_association", label_values_success, ) - self.assertGreater(mme_new_association, 0) + assert mme_new_association > 0 num_ues = 2 detach_type = [ @@ -95,13 +95,13 @@ def test_gateway_metrics_attach_detach(self): "ue_attach", label_values_ue_attach_result, ) - assert(val == v_ue_attach + 1) + assert (val == v_ue_attach + 1) val = self._getMetricValueGivenLabel( "spgw_create_session", label_values_success, ) - assert(val == v_spgw_create_session + 1) + assert (val == v_spgw_create_session + 1) val = self._getMetricValueGivenLabel( "ue_detach", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_guti_attach_with_zero_mtmsi.py b/lte/gateway/python/integ_tests/s1aptests/test_guti_attach_with_zero_mtmsi.py index 352c7e39784d..254b2fe40ed7 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_guti_attach_with_zero_mtmsi.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_guti_attach_with_zero_mtmsi.py @@ -71,10 +71,7 @@ def test_guti_attach_with_zero_mtmsi(self): ureq, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value time.sleep(5) @@ -114,10 +111,7 @@ def test_guti_attach_with_zero_mtmsi(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value id_req = response.cast(s1ap_types.ueIdentityReqInd_t) print( "********************** Received identity req for UE id", @@ -137,10 +131,7 @@ def test_guti_attach_with_zero_mtmsi(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value auth_req = response.cast(s1ap_types.ueAuthReqInd_t) print( "********************** Received auth req for UE id", @@ -161,10 +152,7 @@ def test_guti_attach_with_zero_mtmsi(self): response = self._s1ap_wrapper.s1_util.get_response() sec_mode_cmd = response.cast(s1ap_types.ueSecModeCmdInd_t) - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print( "********************** Received security mode cmd for UE id", sec_mode_cmd.ue_Id, @@ -221,10 +209,7 @@ def test_guti_attach_with_zero_mtmsi(self): ) # Wait for UE context release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_ue_registered.py b/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_ue_registered.py index 45227af35aff..9d07465e5819 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_ue_registered.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_ue_registered.py @@ -67,9 +67,7 @@ def test_ics_timer_expiry_ue_registered(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("*** Sending indication to drop Initial Context Setup Req ***") drop_init_ctxt_setup_req = s1ap_types.UeDropInitCtxtSetup() @@ -100,14 +98,10 @@ def test_ics_timer_expiry_ue_registered(self): # enbApp sends UE_ICS_DROPD_IND message to tfwApp after dropping # ICS request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ICS_DROPD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ICS_DROPD_IND.value response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Received UE_CTX_REL_IND for UE id ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_ue_unregistered.py b/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_ue_unregistered.py index 142e31d3c1ff..51e58b35f670 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_ue_unregistered.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_ue_unregistered.py @@ -52,9 +52,7 @@ def test_ics_timer_expiry_ue_unregistered(self): s1ap_types.tfwCmd.UE_ATTACH_REQUEST, attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("*** Sending indication to drop Initial Context Setup Req ***") drop_init_ctxt_setup_req = s1ap_types.UeDropInitCtxtSetup() @@ -76,9 +74,7 @@ def test_ics_timer_expiry_ue_unregistered(self): s1ap_types.tfwCmd.UE_AUTH_RESP, auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value # Trigger Security Mode Complete sec_mode_complete = s1ap_types.ueSecModeComplete_t() @@ -90,14 +86,10 @@ def test_ics_timer_expiry_ue_unregistered(self): # enbApp sends UE_ICS_DROPD_IND message to tfwApp after dropping # ICS request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ICS_DROPD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ICS_DROPD_IND.value response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Received UE_CTX_REL_IND for UE id ", req.ue_id, diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_with_mme_restart.py index 099ff77516b1..131994698a85 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ics_timer_expiry_with_mme_restart.py @@ -74,9 +74,7 @@ def test_ics_timer_expiry_with_mme_restart(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("*** Sending indication to drop Initial Context Setup Req ***") drop_init_ctxt_setup_req = s1ap_types.UeDropInitCtxtSetup() @@ -105,9 +103,7 @@ def test_ics_timer_expiry_with_mme_restart(self): # enbApp sends UE_ICS_DROPD_IND message to tfwApp after dropping # ICS request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ICS_DROPD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ICS_DROPD_IND.value print("************************* Restarting MME service on gateway") wait_for_restart = 30 self._s1ap_wrapper.magmad_util.restart_services( @@ -116,9 +112,7 @@ def test_ics_timer_expiry_with_mme_restart(self): print("************************* Waiting for response from MME") response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Received UE_CTX_REL_IND for UE id ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_identity_timer_3470_expiry.py b/lte/gateway/python/integ_tests/s1aptests/test_identity_timer_3470_expiry.py index 4daa1fde8950..1d28d7a34616 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_identity_timer_3470_expiry.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_identity_timer_3470_expiry.py @@ -55,9 +55,7 @@ def test_identity_timer_3470_expiry(self): ") ***", ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value print( "*** Identity Request Message Received (", str(i + 1), @@ -65,9 +63,7 @@ def test_identity_timer_3470_expiry(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("*** Received UE Context Release Indication ***") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_idle_mode_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_idle_mode_with_mme_restart.py index 8dfa3434c616..813efa406a01 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_idle_mode_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_idle_mode_with_mme_restart.py @@ -75,9 +75,7 @@ def test_idle_mode_with_mme_restart(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("************************* Restarting MME service on gateway") wait_for_restart = 30 @@ -99,9 +97,7 @@ def test_idle_mode_with_mme_restart(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("************************* Running UE detach for UE id ", ue_id) # Now detach the UE diff --git a/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_no_imeisv_in_smc.py b/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_no_imeisv_in_smc.py index 17caea1c2fd4..d08117946d64 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_no_imeisv_in_smc.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_no_imeisv_in_smc.py @@ -84,10 +84,7 @@ def test_imei_restriction_no_imeisv_in_smc(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value auth_req = response.cast(s1ap_types.ueAuthReqInd_t) print( "********************** Received auth req for UE id", @@ -107,10 +104,7 @@ def test_imei_restriction_no_imeisv_in_smc(self): print("********************** Sent auth rsp for UE id", ue_ids[0]) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value sec_mod_cmd = response.cast(s1ap_types.ueSecModeCmdInd_t) print( "********************** Received security mode cmd for UE id", @@ -132,10 +126,7 @@ def test_imei_restriction_no_imeisv_in_smc(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value id_req = response.cast(s1ap_types.ueIdentityReqInd_t) print( "********************** Received identity req for UE id", @@ -150,7 +141,7 @@ def test_imei_restriction_no_imeisv_in_smc(self): identity_resp.idValPres = True imeisv = "9900048235103723" # Check if the len of imeisv exceeds 16 - self.assertLessEqual(len(imeisv), 16) + assert len(imeisv) <= 16 len_imeisv = len(imeisv) for i in range(0, len_imeisv): identity_resp.idVal[i] = ctypes.c_ubyte(int(imeisv[i])) @@ -162,10 +153,7 @@ def test_imei_restriction_no_imeisv_in_smc(self): # Receive Attach Reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value attach_rej = response.cast(s1ap_types.ueAttachRejInd_t) print( "********************** Received attach reject for UE id %d" @@ -173,17 +161,11 @@ def test_imei_restriction_no_imeisv_in_smc(self): ) # Verify cause - self.assertEqual( - attach_rej.cause, - s1ap_types.TFW_EMM_CAUSE_IMEI_NOT_ACCEPTED, - ) + assert attach_rej.cause == s1ap_types.TFW_EMM_CAUSE_IMEI_NOT_ACCEPTED # UE Context release response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value ue_context_rel = response.cast(s1ap_types.ueCntxtRelReq_t) print( "********************** Received UE_CTX_REL_IND for UE id ", @@ -214,10 +196,7 @@ def test_imei_restriction_no_imeisv_in_smc(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value auth_req = response.cast(s1ap_types.ueAuthReqInd_t) print( "********************** Received auth req for UE id", @@ -236,10 +215,7 @@ def test_imei_restriction_no_imeisv_in_smc(self): print("********************** Sent auth rsp for UE id", ue_ids[1]) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value sec_mod_cmd = response.cast(s1ap_types.ueSecModeCmdInd_t) print( "********************** Received security mode cmd for UE id", @@ -261,10 +237,7 @@ def test_imei_restriction_no_imeisv_in_smc(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value id_req = response.cast(s1ap_types.ueIdentityReqInd_t) print( "********************** Received identity req for UE id", @@ -303,10 +276,7 @@ def test_imei_restriction_no_imeisv_in_smc(self): ue_ids[1], ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_EMM_INFORMATION.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_EMM_INFORMATION.value print("********************** Sleeping for 0.5 seconds ") time.sleep(0.5) @@ -323,10 +293,7 @@ def test_imei_restriction_no_imeisv_in_smc(self): ) # Wait for UE context release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value ue_context_rel = response.cast(s1ap_types.ueCntxtRelReq_t) print( "********************** Received UE_CTX_REL_IND for UE id ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_smc.py b/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_smc.py index 56a94e62ae50..856b776caf27 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_smc.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_smc.py @@ -74,9 +74,7 @@ def test_imei_restriction_smc(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value auth_req = response.cast(s1ap_types.ueAuthReqInd_t) print( "********************** Received auth req for UE id", @@ -95,9 +93,7 @@ def test_imei_restriction_smc(self): print("********************** Sent auth rsp for UE id", ue_ids[0]) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value sec_mod_cmd = response.cast(s1ap_types.ueSecModeCmdInd_t) print( "********************** Received security mode cmd for UE id", @@ -110,7 +106,7 @@ def test_imei_restriction_smc(self): sec_mode_complete.imeisv_pres = True imeisv = "9900048235103723" # Check if the len of imeisv exceeds 16 - self.assertLessEqual(len(imeisv), 16) + assert len(imeisv) <= 16 for i in range(0, len(imeisv)): sec_mode_complete.imeisv[i] = ctypes.c_ubyte(int(imeisv[i])) self._s1ap_wrapper._s1_util.issue_cmd( @@ -123,9 +119,7 @@ def test_imei_restriction_smc(self): # Receive Attach Reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value attach_rej = response.cast(s1ap_types.ueAttachRejInd_t) print( "********************** Received attach reject for UE id %d" @@ -133,15 +127,11 @@ def test_imei_restriction_smc(self): ) # Verify cause - self.assertEqual( - attach_rej.cause, s1ap_types.TFW_EMM_CAUSE_IMEI_NOT_ACCEPTED, - ) + assert attach_rej.cause == s1ap_types.TFW_EMM_CAUSE_IMEI_NOT_ACCEPTED # UE Context release response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value ue_context_rel = response.cast(s1ap_types.ueCntxtRelReq_t) print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_wildcard_snr.py b/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_wildcard_snr.py index 657d33fd8e8b..248e835f8339 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_wildcard_snr.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_imei_restriction_wildcard_snr.py @@ -68,9 +68,7 @@ def test_imei_restriction_wildcard_snr(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value auth_req = response.cast(s1ap_types.ueAuthReqInd_t) print( "********************** Received auth req for UE id", @@ -89,9 +87,7 @@ def test_imei_restriction_wildcard_snr(self): print("********************** Sent auth rsp for UE id", req.ue_id) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value sec_mod_cmd = response.cast(s1ap_types.ueSecModeCmdInd_t) print( "********************** Received security mode cmd for UE id", @@ -104,7 +100,7 @@ def test_imei_restriction_wildcard_snr(self): sec_mode_complete.imeisv_pres = True imeisv = "9933382135103723" # Check if the len of imeisv exceeds 16 - self.assertLessEqual(len(imeisv), 16) + assert len(imeisv) <= 16 for i in range(0, len(imeisv)): sec_mode_complete.imeisv[i] = ctypes.c_ubyte(int(imeisv[i])) self._s1ap_wrapper._s1_util.issue_cmd( @@ -117,9 +113,7 @@ def test_imei_restriction_wildcard_snr(self): # Receive Attach Reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value attach_rej = response.cast(s1ap_types.ueAttachRejInd_t) print( "********************** Received attach reject for UE id %d" @@ -127,15 +121,11 @@ def test_imei_restriction_wildcard_snr(self): ) # Verify cause - self.assertEqual( - attach_rej.cause, s1ap_types.TFW_EMM_CAUSE_IMEI_NOT_ACCEPTED, - ) + assert attach_rej.cause == s1ap_types.TFW_EMM_CAUSE_IMEI_NOT_ACCEPTED # UE Context release response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value ue_context_rel = response.cast(s1ap_types.ueCntxtRelReq_t) print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_implicit_detach_timer_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_implicit_detach_timer_with_mme_restart.py index 9e2357f5a428..05c630474803 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_implicit_detach_timer_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_implicit_detach_timer_with_mme_restart.py @@ -88,10 +88,7 @@ def test_implicit_detach_timer_with_mme_restart(self): req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Delay by 6 minutes to ensure Mobile reachability timer expires. # Mobile Reachability Timer value = 1 minute (conf file) + delta value @@ -141,9 +138,8 @@ def test_implicit_detach_timer_with_mme_restart(self): req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SERVICE_REJECT_IND.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_SERVICE_REJECT_IND.value ) print( "************************* Received Service Reject for UE id ", @@ -152,10 +148,7 @@ def test_implicit_detach_timer_with_mme_restart(self): # Wait for UE Context Release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ded_bearer_dl_tcp.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ded_bearer_dl_tcp.py index 8b64d920450c..d9e3385aa5df 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ded_bearer_dl_tcp.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ded_bearer_dl_tcp.py @@ -93,9 +93,7 @@ def test_ipv4v6_non_nat_ded_bearer_dl_tcp(self): # Receive Router Advertisement message apn = "magma" response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value router_adv = response.cast(s1ap_types.ueRouterAdv_t) print( "********** Received Router Advertisement for APN-%s" @@ -136,9 +134,7 @@ def test_ipv4v6_non_nat_ded_bearer_dl_tcp(self): qos, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ded_bearer_ul_tcp.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ded_bearer_ul_tcp.py index 1dbb5543b816..0080c21cfa35 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ded_bearer_ul_tcp.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ded_bearer_ul_tcp.py @@ -94,9 +94,7 @@ def test_ipv4v6_non_nat_ded_bearer_ul_tcp(self): # Receive Router Advertisement message apn = "magma" response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value router_adv = response.cast(s1ap_types.ueRouterAdv_t) print( "********** Received Router Advertisement for APN-%s" @@ -137,9 +135,7 @@ def test_ipv4v6_non_nat_ded_bearer_ul_tcp(self): qos, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ul_tcp.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ul_tcp.py index 158f6f923039..4358b68ade56 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ul_tcp.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_non_nat_ul_tcp.py @@ -91,9 +91,7 @@ def test_ipv4v6_non_nat_ul_tcp(self): # Receive Router Advertisement message apn = "magma" response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value router_adv = response.cast(s1ap_types.ueRouterAdv_t) print( "********** Received Router Advertisement for APN-%s" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_paging_with_dedicated_bearer.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_paging_with_dedicated_bearer.py index 90891a309781..d7225014fa77 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_paging_with_dedicated_bearer.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_paging_with_dedicated_bearer.py @@ -77,9 +77,7 @@ def test_ipv4v6_paging_with_dedicated_bearer(self): # Receive Router Advertisement message apn = "magma" response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value router_adv = response.cast(s1ap_types.ueRouterAdv_t) print( "********** Received Router Advertisement for APN-%s" @@ -120,9 +118,7 @@ def test_ipv4v6_paging_with_dedicated_bearer(self): qos, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req = response.cast(s1ap_types.UeActDedBearCtxtReq_t) self._s1ap_wrapper.sendActDedicatedBearerAccept( req.ue_id, act_ded_ber_req.bearerId, @@ -160,9 +156,7 @@ def test_ipv4v6_paging_with_dedicated_bearer(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, ue_cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("********** UE moved to idle mode") print("********** Sleeping for 5 seconds") @@ -177,7 +171,7 @@ def test_ipv4v6_paging_with_dedicated_bearer(self): ) self._s1ap_wrapper.s1_util.run_ipv6_data(default_ipv6) response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue(response, s1ap_types.tfwCmd.UE_PAGING_IND.value) + assert response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value print("********** Received UE_PAGING_IND") # Send service request to reconnect UE ser_req = s1ap_types.ueserviceReq_t() @@ -190,9 +184,7 @@ def test_ipv4v6_paging_with_dedicated_bearer(self): ) print("********** Sent UE_SERVICE_REQUEST") response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("********** Received INT_CTX_SETUP_IND") print("********** Sleeping for 5 seconds") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn.py index 1a8cdd010b48..2ac3e947368f 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn.py @@ -94,9 +94,7 @@ def test_ipv4v6_secondary_pdn(self): ) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) pdnType = act_def_bearer_req.m.pdnInfo.pAddr.pdnType @@ -122,9 +120,7 @@ def test_ipv4v6_secondary_pdn(self): # Receive Router Advertisement message response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value routerAdv = response.cast(s1ap_types.ueRouterAdv_t) print( "************* Received Router Advertisement for APN-%s" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_multi_ue.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_multi_ue.py index 7e57c080279f..86d72de1ca91 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_multi_ue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_multi_ue.py @@ -89,9 +89,7 @@ def test_ipv4v6_secondary_pdn_multi_ue(self): ) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo @@ -109,9 +107,7 @@ def test_ipv4v6_secondary_pdn_multi_ue(self): # Receive Router Advertisement message response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value routerAdv = response.cast(s1ap_types.ueRouterAdv_t) print( "******************* Received Router Advertisement for APN-%s" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_rs_retransmit.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_rs_retransmit.py index c61a0672cfaf..4af8beb73a20 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_rs_retransmit.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_rs_retransmit.py @@ -89,9 +89,7 @@ def test_ipv4v6_secondary_pdn_rs_retransmit(self): ) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_spgw_initiated_ded_bearer.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_spgw_initiated_ded_bearer.py index 93476b21b591..452ad0f23c69 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_spgw_initiated_ded_bearer.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_spgw_initiated_ded_bearer.py @@ -85,9 +85,7 @@ def test_ipv4v6_secondary_pdn_spgw_initiated_ded_bearer(self): ) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) pdn_type = act_def_bearer_req.m.pdnInfo.pAddr.pdnType addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo @@ -109,9 +107,7 @@ def test_ipv4v6_secondary_pdn_spgw_initiated_ded_bearer(self): # Receive Router Advertisement message response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value router_adv = response.cast(s1ap_types.ueRouterAdv_t) print( "******************* Received Router Advertisement for APN-%s" @@ -139,9 +135,7 @@ def test_ipv4v6_secondary_pdn_spgw_initiated_ded_bearer(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast(s1ap_types.UeActDedBearCtxtReq_t) self._s1ap_wrapper.sendActDedicatedBearerAccept( req.ue_id, act_ded_ber_ctxt_req.bearerId, @@ -184,9 +178,7 @@ def test_ipv4v6_secondary_pdn_spgw_initiated_ded_bearer(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print("******************* Received deactivate eps bearer context") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_with_ded_bearer.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_with_ded_bearer.py index 86b9cc68a821..56f85423ea00 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_with_ded_bearer.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_with_ded_bearer.py @@ -153,9 +153,7 @@ def test_ipv4v6_secondary_pdn_with_ded_bearer(self): ) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) pdnType = act_def_bearer_req.m.pdnInfo.pAddr.pdnType @@ -182,9 +180,7 @@ def test_ipv4v6_secondary_pdn_with_ded_bearer(self): # Receive Router Advertisement message response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value routerAdv = response.cast(s1ap_types.ueRouterAdv_t) print( "******************* Received Router Advertisement for APN-%s" @@ -213,9 +209,7 @@ def test_ipv4v6_secondary_pdn_with_ded_bearer(self): qos, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_with_ded_bearer_multi_ue.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_with_ded_bearer_multi_ue.py index 56862355a5ca..59ac085c6e9c 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_with_ded_bearer_multi_ue.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv4v6_secondary_pdn_with_ded_bearer_multi_ue.py @@ -164,9 +164,7 @@ def test_ipv4v6_secondary_pdn_with_ded_bearer_multi_ue(self): ) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo @@ -188,9 +186,7 @@ def test_ipv4v6_secondary_pdn_with_ded_bearer_multi_ue(self): # Receive Router Advertisement message response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value routerAdv = response.cast(s1ap_types.ueRouterAdv_t) print( "******************* Received Router Advertisement for APN-%s" @@ -219,9 +215,7 @@ def test_ipv4v6_secondary_pdn_with_ded_bearer_multi_ue(self): qos, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_ded_bearer_dl_tcp.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_ded_bearer_dl_tcp.py index 9e1a978d5a97..4bac7e86b913 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_ded_bearer_dl_tcp.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_ded_bearer_dl_tcp.py @@ -92,9 +92,7 @@ def test_ipv6_non_nat_ded_bearer_dl_tcp(self): # Receive Router Advertisement message apn = "magma" response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value router_adv = response.cast(s1ap_types.ueRouterAdv_t) print( "********** Received Router Advertisement for APN-%s" @@ -135,9 +133,7 @@ def test_ipv6_non_nat_ded_bearer_dl_tcp(self): qos, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_ded_bearer_ul_tcp.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_ded_bearer_ul_tcp.py index 8dcad6cb94a9..35e6c16e9a16 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_ded_bearer_ul_tcp.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_ded_bearer_ul_tcp.py @@ -92,9 +92,7 @@ def test_ipv6_non_nat_ded_bearer_ul_tcp(self): # Receive Router Advertisement message apn = "magma" response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value router_adv = response.cast(s1ap_types.ueRouterAdv_t) print( "********** Received Router Advertisement for APN-%s" @@ -135,9 +133,7 @@ def test_ipv6_non_nat_ded_bearer_ul_tcp(self): qos, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_tcp.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_tcp.py index a9861dab814f..737bab335606 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_tcp.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_tcp.py @@ -87,9 +87,7 @@ def test_ipv6_non_nat_dp_dl_tcp(self): # Receive Router Advertisement message apn = "magma" response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value router_adv = response.cast(s1ap_types.ueRouterAdv_t) print( "********** Received Router Advertisement for APN-%s" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_udp.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_udp.py index 1a045363213e..c9b9befd3247 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_udp.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_dl_udp.py @@ -87,9 +87,7 @@ def test_ipv6_non_nat_dp_dl_udp(self): # Receive Router Advertisement message apn = "magma" response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value router_adv = response.cast(s1ap_types.ueRouterAdv_t) print( "********** Received Router Advertisement for APN-%s" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_ul_tcp.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_ul_tcp.py index db223adc7973..8fcf0ee17ce9 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_ul_tcp.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_non_nat_dp_ul_tcp.py @@ -88,9 +88,7 @@ def test_ipv6_non_nat_dp_ul_tcp(self): # Receive Router Advertisement message apn = "magma" response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value router_adv = response.cast(s1ap_types.ueRouterAdv_t) print( "********** Received Router Advertisement for APN-%s" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_paging_with_dedicated_bearer.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_paging_with_dedicated_bearer.py index 66c49198ef4b..529969b3da99 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_paging_with_dedicated_bearer.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_paging_with_dedicated_bearer.py @@ -75,9 +75,7 @@ def test_ipv6_paging_with_dedicated_bearer(self): # Receive Router Advertisement message apn = "magma" response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value router_adv = response.cast(s1ap_types.ueRouterAdv_t) print( "********** Received Router Advertisement for APN-%s" @@ -118,9 +116,7 @@ def test_ipv6_paging_with_dedicated_bearer(self): qos, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req = response.cast(s1ap_types.UeActDedBearCtxtReq_t) self._s1ap_wrapper.sendActDedicatedBearerAccept( req.ue_id, act_ded_ber_req.bearerId, @@ -157,9 +153,7 @@ def test_ipv6_paging_with_dedicated_bearer(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, ue_cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("********** UE moved to idle mode") print("********** Sleeping for 5 seconds") @@ -174,7 +168,7 @@ def test_ipv6_paging_with_dedicated_bearer(self): ) self._s1ap_wrapper.s1_util.run_ipv6_data(default_ipv6) response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue(response, s1ap_types.tfwCmd.UE_PAGING_IND.value) + assert response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value print("********** Received UE_PAGING_IND") # Send service request to reconnect UE ser_req = s1ap_types.ueserviceReq_t() @@ -187,9 +181,7 @@ def test_ipv6_paging_with_dedicated_bearer(self): ) print("********** Sent UE_SERVICE_REQUEST") response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print("********** Received INT_CTX_SETUP_IND") print("********** Sleeping for 5 seconds") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_secondary_pdn_rs_retransmit.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_secondary_pdn_rs_retransmit.py index 375b6b62cab0..e6407bf32e2b 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_secondary_pdn_rs_retransmit.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_secondary_pdn_rs_retransmit.py @@ -93,9 +93,7 @@ def test_ipv6_secondary_pdn_rs_retransmit(self): ) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) print( @@ -109,9 +107,7 @@ def test_ipv6_secondary_pdn_rs_retransmit(self): ) # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value print( "******************* Received deactivate eps bearer context" diff --git a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_secondary_pdn_with_ded_bearer.py b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_secondary_pdn_with_ded_bearer.py index 48cf00c63e85..2e72336b436d 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_ipv6_secondary_pdn_with_ded_bearer.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_ipv6_secondary_pdn_with_ded_bearer.py @@ -137,9 +137,7 @@ def test_ipv6_secondary_pdn_with_ded_bearer(self): ) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) print( @@ -158,9 +156,7 @@ def test_ipv6_secondary_pdn_with_ded_bearer(self): # Receive Router Advertisement message response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ROUTER_ADV_IND.value routerAdv = response.cast(s1ap_types.ueRouterAdv_t) print( "******************* Received Router Advertisement for APN-%s" @@ -189,9 +185,7 @@ def test_ipv6_secondary_pdn_with_ded_bearer(self): qos, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_mobile_reachability_tmr_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_mobile_reachability_tmr_with_mme_restart.py index 993fd7d2702e..ba29e8ade003 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_mobile_reachability_tmr_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_mobile_reachability_tmr_with_mme_restart.py @@ -87,10 +87,7 @@ def test_mobile_reachability_tmr_with_mme_restart(self): req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("************************* Restarting MME service on gateway") wait_for_restart = 30 @@ -132,10 +129,7 @@ def test_mobile_reachability_tmr_with_mme_restart(self): req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SERVICE_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SERVICE_REJECT_IND.value print( "************************* Received Service Reject for UE id ", ue_id, @@ -143,10 +137,7 @@ def test_mobile_reachability_tmr_with_mme_restart(self): # Wait for UE Context Release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_complete_reset.py b/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_complete_reset.py index 63a21d1926eb..752ca591ed66 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_complete_reset.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_complete_reset.py @@ -103,10 +103,7 @@ def test_multi_enb_complete_reset(self): reset_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.RESET_ACK.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.RESET_ACK.value print( "Waiting for 3 seconds to ensure that MME has cleaned up all S1 " diff --git a/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_paging_request.py b/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_paging_request.py index 2c50e4cea2ad..b790894345db 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_paging_request.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_paging_request.py @@ -95,9 +95,7 @@ def test_multi_enb_paging_request(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, ue_cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value time.sleep(0.5) print( "********************* Running UE downlink (UDP) for UE id ", @@ -107,28 +105,28 @@ def test_multi_enb_paging_request(self): req, duration=1, is_udp=True, ) as test: response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue( - response, s1ap_types.tfwCmd.UE_PAGING_IND.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue( - response, s1ap_types.tfwCmd.UE_PAGING_IND.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue( - response, s1ap_types.tfwCmd.UE_PAGING_IND.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue( - response, s1ap_types.tfwCmd.UE_PAGING_IND.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue( - response, s1ap_types.tfwCmd.UE_PAGING_IND.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value ) # Send service request to reconnect UE ser_req = s1ap_types.ueserviceReq_t() @@ -140,10 +138,7 @@ def test_multi_enb_paging_request(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, ser_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value test.verify() time.sleep(0.5) # Now detach the UE diff --git a/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_partial_reset.py b/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_partial_reset.py index b289e6851c20..75ed1661e656 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_partial_reset.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_multi_enb_partial_reset.py @@ -114,7 +114,7 @@ def test_multi_enb_partial_reset(self): reset_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual(response.msg_type, s1ap_types.tfwCmd.RESET_ACK.value) + assert response.msg_type == s1ap_types.tfwCmd.RESET_ACK.value print( "Waiting for 3 seconds to ensure that MME has cleaned up all S1 " diff --git a/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_auth.py b/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_auth.py index 173144787fa9..91b359b6b06d 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_auth.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_auth.py @@ -67,9 +67,7 @@ def test_nas_non_delivery_for_auth(self): """ Waiting for UE Context Release from MME """ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("Received UE_CTX_REL_IND") # Reset the nas non delivery flag nas_non_del = s1ap_types.UeNasNonDel() diff --git a/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_identity_req.py b/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_identity_req.py index eb68ab5932e6..1913f00bb009 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_identity_req.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_identity_req.py @@ -67,9 +67,7 @@ def test_nas_non_delivery_for_identity_req(self): """ Waiting for UE Context Release command from MME """ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("Received UE_CTX_REL_IND") # Reset the nas non delivery flag nas_non_del = s1ap_types.UeNasNonDel() diff --git a/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_smc.py b/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_smc.py index 9e9789dc85f7..4847ea4f78e1 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_smc.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_nas_non_delivery_for_smc.py @@ -50,9 +50,7 @@ def test_nas_non_delivery_for_smc(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ue-Id", req.ue_id) """ The purpose of UE_SET_NAS_NON_DELIVERY command is to prepare @@ -86,9 +84,7 @@ def test_nas_non_delivery_for_smc(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("Received UE_CTX_REL_IND") # Reset the nas non delivery flag diff --git a/lte/gateway/python/integ_tests/s1aptests/test_no_attach_complete.py b/lte/gateway/python/integ_tests/s1aptests/test_no_attach_complete.py index 887908bb7221..c649ca5afcf2 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_no_attach_complete.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_no_attach_complete.py @@ -108,10 +108,7 @@ def test_no_attach_complete(self): attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value auth_res = s1ap_types.ueAuthResp_t() auth_res.ue_Id = req.ue_id sqn_recvd = s1ap_types.ueSqnRcvd_t() @@ -124,10 +121,7 @@ def test_no_attach_complete(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value sec_mode_complete = s1ap_types.ueSecModeComplete_t() sec_mode_complete.ue_Id = req.ue_id @@ -151,18 +145,12 @@ def test_no_attach_complete(self): # then aborts attach procedure for i in range(4): response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND.value print("************************* Timeout", i + 1) print("***************** Attach Aborted and UE Context released") response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_no_attach_complete_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_no_attach_complete_with_mme_restart.py index a85011cdd74b..34f9e534f0bf 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_no_attach_complete_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_no_attach_complete_with_mme_restart.py @@ -67,10 +67,7 @@ def test_no_attach_complete_with_mme_restart(self): attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value auth_res = s1ap_types.ueAuthResp_t() auth_res.ue_Id = req.ue_id sqn_recvd = s1ap_types.ueSqnRcvd_t() @@ -83,10 +80,7 @@ def test_no_attach_complete_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value sec_mode_complete = s1ap_types.ueSecModeComplete_t() sec_mode_complete.ue_Id = req.ue_id @@ -125,20 +119,14 @@ def test_no_attach_complete_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_NW_INIT_DETACH_REQUEST.value nw_init_detach_req = response.cast(s1ap_types.ueNwInitdetachReq_t) print( "**************** Received NW initiated Detach Req with detach " "type set to ", nw_init_detach_req.Type, ) - self.assertEqual( - nw_init_detach_req.Type, - s1ap_types.ueNwInitDetType_t.TFW_RE_ATTACH_REQUIRED.value, - ) + assert nw_init_detach_req.Type == s1ap_types.ueNwInitDetType_t.TFW_RE_ATTACH_REQUIRED.value print("**************** Sending Detach Accept") # Send detach accept @@ -167,16 +155,10 @@ def test_no_attach_complete_with_mme_restart(self): nw_init_detach_req.Type, "Ignoring...", ) - self.assertEqual( - nw_init_detach_req.Type, - s1ap_types.ueNwInitDetType_t.TFW_RE_ATTACH_REQUIRED.value, - ) + assert nw_init_detach_req.Type == s1ap_types.ueNwInitDetType_t.TFW_RE_ATTACH_REQUIRED.value response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("****** Received Ue context release command *********") print("****** Triggering end-end attach after mme restart *********") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_no_auth_resp_with_mme_restart_reattach.py b/lte/gateway/python/integ_tests/s1aptests/test_no_auth_resp_with_mme_restart_reattach.py index 0a935dfad35d..53803f720223 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_no_auth_resp_with_mme_restart_reattach.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_no_auth_resp_with_mme_restart_reattach.py @@ -58,10 +58,7 @@ def test_no_auth_resp_with_mme_restart_reattach(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("************************* Received Auth Req for ue", req.ue_id) print("************************* Restarting MME service on gateway") @@ -84,10 +81,7 @@ def test_no_auth_resp_with_mme_restart_reattach(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Received UE_CTX_REL_IND for ue", req.ue_id, diff --git a/lte/gateway/python/integ_tests/s1aptests/test_no_auth_response.py b/lte/gateway/python/integ_tests/s1aptests/test_no_auth_response.py index 4e0f5395a4dc..de22efc9bb24 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_no_auth_response.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_no_auth_response.py @@ -93,23 +93,17 @@ def test_no_auth_response(self): # Wait for timer 3460 expiry 5 times, until context is released for i in range(5): response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("************************* Timeout", i + 1) print("************************* Timeouts complete") # Attach Reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value # Context release response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("************************* Context released") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_no_auth_response_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_no_auth_response_with_mme_restart.py index 637ef1309ce6..85a3c8c2cb16 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_no_auth_response_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_no_auth_response_with_mme_restart.py @@ -56,25 +56,19 @@ def test_no_auth_response_with_mme_restart(self): # Wait for timer expiry 5 times, until context is released for i in range(5): response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("************************* Timeout", i + 1) print("********* Received Auth Req for ue", req.ue_id) print("************************* Timeouts complete") # Attach Reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ATTACH_REJECT_IND.value print("********* Received Attach Reject for ue", req.ue_id) # Context release response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("********* Received UE_CTX_REL_IND for ue", req.ue_id) print("************************* Restarting MME service on", "gateway") @@ -94,9 +88,7 @@ def test_no_auth_response_with_mme_restart(self): time.sleep(0.5) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_EMM_INFORMATION.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_EMM_INFORMATION.value print( "******************* Running UE detach (switch-off) for ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_no_esm_information_rsp_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_no_esm_information_rsp_with_mme_restart.py index 74484cf123d0..48990616da31 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_no_esm_information_rsp_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_no_esm_information_rsp_with_mme_restart.py @@ -57,9 +57,7 @@ def test_no_esm_information_rsp_with_mme_restart(self): global response response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received Auth Req for ue-id", ue_id) auth_res = s1ap_types.ueAuthResp_t() @@ -73,9 +71,7 @@ def test_no_esm_information_rsp_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("Received Security Mode Command for ue-id", ue_id) sec_mode_complete = s1ap_types.ueSecModeComplete_t() @@ -87,9 +83,7 @@ def test_no_esm_information_rsp_with_mme_restart(self): # Esm Information Request indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value print("Received Esm Information Request ue-id", ue_id) print("************************* Restarting MME service on", "gateway") @@ -109,9 +103,7 @@ def test_no_esm_information_rsp_with_mme_restart(self): ) # Wait for UE_CTX_REL_IND response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # Perform end-end attach self._s1ap_wrapper.s1_util.attach( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_no_identity_rsp_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_no_identity_rsp_with_mme_restart.py index b6f6b1dad74b..ad34e0467a07 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_no_identity_rsp_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_no_identity_rsp_with_mme_restart.py @@ -65,10 +65,7 @@ def test_no_identity_rsp_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value print( "Received Identity req ind ", s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value, @@ -125,10 +122,7 @@ def test_no_identity_rsp_with_mme_restart(self): break # Context release - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("********** UE Context released **********") time.sleep(5) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_no_security_mode_complete.py b/lte/gateway/python/integ_tests/s1aptests/test_no_security_mode_complete.py index 2abb9ca07cc5..231604cdec0d 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_no_security_mode_complete.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_no_security_mode_complete.py @@ -91,9 +91,7 @@ def test_no_security_mode_complete(self): s1ap_types.tfwCmd.UE_ATTACH_REQUEST, attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value auth_res = s1ap_types.ueAuthResp_t() auth_res.ue_Id = req.ue_id sqnRecvd = s1ap_types.ueSqnRcvd_t() @@ -106,17 +104,13 @@ def test_no_security_mode_complete(self): # Wait for timer 3460 expiry 5 times, until context is released for i in range(5): response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("************************* Timeout", i + 1) print("************************* Timeouts complete") # Context release response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("************************* Context released") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_no_smc_with_mme_restart_reattach.py b/lte/gateway/python/integ_tests/s1aptests/test_no_smc_with_mme_restart_reattach.py index dd2748e90db1..573986654b23 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_no_smc_with_mme_restart_reattach.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_no_smc_with_mme_restart_reattach.py @@ -50,9 +50,7 @@ def test_no_smc_with_mme_restart_reattach(self): s1ap_types.tfwCmd.UE_ATTACH_REQUEST, attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("************* Received Auth Req for ue", req.ue_id) auth_res = s1ap_types.ueAuthResp_t() auth_res.ue_Id = req.ue_id @@ -66,9 +64,7 @@ def test_no_smc_with_mme_restart_reattach(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("************* Received SMC for ue", req.ue_id) @@ -84,9 +80,7 @@ def test_no_smc_with_mme_restart_reattach(self): print("Received SMC retx from previous run... Ignoring") response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("****** Triggering end-end attach after mme restart *********") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_outoforder_attach_complete_ICSR.py b/lte/gateway/python/integ_tests/s1aptests/test_outoforder_attach_complete_ICSR.py index 2e4e13137bd2..b6b7e69be19e 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_outoforder_attach_complete_ICSR.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_outoforder_attach_complete_ICSR.py @@ -64,10 +64,7 @@ def test_outoforder_attach_complete_icsr(self): attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value delay_init_ctxt_setup_resp = s1ap_types.UeDelayInitCtxtSetupRsp() delay_init_ctxt_setup_resp.ue_Id = req.ue_id @@ -90,10 +87,7 @@ def test_outoforder_attach_complete_icsr(self): auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value # Trigger Security Mode Complete sec_mode_complete = s1ap_types.ueSecModeComplete_t() @@ -140,10 +134,7 @@ def test_outoforder_attach_complete_icsr(self): ) # Wait for UE context release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value time.sleep(1) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_outoforder_erab_setup_rsp_dedicated_bearer.py b/lte/gateway/python/integ_tests/s1aptests/test_outoforder_erab_setup_rsp_dedicated_bearer.py index c6a723c2bd57..ee6a00728061 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_outoforder_erab_setup_rsp_dedicated_bearer.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_outoforder_erab_setup_rsp_dedicated_bearer.py @@ -177,9 +177,7 @@ def test_outoforder_erab_setup_rsp_dedicated_bearer(self): # Receive Activate dedicated bearer request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast(s1ap_types.UeActDedBearCtxtReq_t) print("Sleeping for 5 seconds") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_outoforder_erab_setup_rsp_default_bearer.py b/lte/gateway/python/integ_tests/s1aptests/test_outoforder_erab_setup_rsp_default_bearer.py index d377fbcb7b0d..6814caf852c7 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_outoforder_erab_setup_rsp_default_bearer.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_outoforder_erab_setup_rsp_default_bearer.py @@ -90,9 +90,7 @@ def test_outoforder_erab_setup_rsp_default_bearer(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -130,8 +128,8 @@ def test_outoforder_erab_setup_rsp_default_bearer(self): # Receive UE_DEACTIVATE_BER_REQ response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.UE_DEACTIVATE_BER_REQ.value ) print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_paging_after_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_paging_after_mme_restart.py index d49120e1bbeb..aa11a2c1772d 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_paging_after_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_paging_after_mme_restart.py @@ -80,9 +80,7 @@ def test_paging_after_mme_restart(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, ue_cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value wait_time = 0.3 time.sleep(wait_time) print('************************* Restarting MME service on', 'gateway') @@ -99,7 +97,7 @@ def test_paging_after_mme_restart(self): req, duration=1, is_udp=True, ) as test: response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue(response, s1ap_types.tfwCmd.UE_PAGING_IND.value) + assert response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value print('************************ Received Paging Indication') # Send service request to reconnect UE @@ -119,9 +117,7 @@ def test_paging_after_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value test.verify() time.sleep(0.5) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_paging_request.py b/lte/gateway/python/integ_tests/s1aptests/test_paging_request.py index 374565680920..e01f397301c7 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_paging_request.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_paging_request.py @@ -79,9 +79,7 @@ def test_paging_request(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, ue_cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value time.sleep(0.3) print( @@ -92,7 +90,7 @@ def test_paging_request(self): req, duration=1, is_udp=True, ) as test: response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue(response, s1ap_types.tfwCmd.UE_PAGING_IND.value) + assert response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value # Send service request to reconnect UE ser_req = s1ap_types.ueserviceReq_t() ser_req.ue_Id = ue_id @@ -103,8 +101,8 @@ def test_paging_request(self): s1ap_types.tfwCmd.UE_SERVICE_REQUEST, ser_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, + assert ( + response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value ) test.verify() diff --git a/lte/gateway/python/integ_tests/s1aptests/test_paging_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_paging_with_mme_restart.py index dc4d6b413e60..035f534e3b95 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_paging_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_paging_with_mme_restart.py @@ -86,10 +86,7 @@ def test_paging_with_mme_restart(self): ue_cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value time.sleep(0.3) print( @@ -102,7 +99,7 @@ def test_paging_with_mme_restart(self): is_udp=True, ) as test: response = self._s1ap_wrapper.s1_util.get_response() - self.assertTrue(response, s1ap_types.tfwCmd.UE_PAGING_IND.value) + assert response.msg_type == s1ap_types.tfwCmd.UE_PAGING_IND.value print("************************ Received Paging Indication") print( @@ -145,10 +142,7 @@ def test_paging_with_mme_restart(self): else: break - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value test.verify() time.sleep(0.5) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_resync.py b/lte/gateway/python/integ_tests/s1aptests/test_resync.py index f26af231b78a..cfb08e109d36 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_resync.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_resync.py @@ -54,10 +54,7 @@ def test_resync(self): attach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value auth_res = s1ap_types.ueAuthResp_t() auth_res.ue_Id = req.ue_id sqn_recvd = s1ap_types.ueSqnRcvd_t() @@ -77,10 +74,7 @@ def test_resync(self): response = self._s1ap_wrapper.s1_util.get_response() # Verify that EPC re-sends Authentication Request - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("************************* Retrying authentication") # Use SQN received from EPC as is sqn_recvd.pres = False @@ -90,10 +84,7 @@ def test_resync(self): auth_res, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value # Trigger Security mode complete message sec_mode_complete = s1ap_types.ueSecModeComplete_t() @@ -138,10 +129,7 @@ def test_resync(self): detach_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_s1_handover.py b/lte/gateway/python/integ_tests/s1aptests/test_s1_handover.py index ac357da6d619..5ff39790298e 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_s1_handover.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_s1_handover.py @@ -120,10 +120,7 @@ def test_s1_handover(self): # Handover Request to Target ENB. # Wait for S1 Handover Request Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value s1ho_req_ind = response.cast(s1ap_types.FwNbS1HoReqInd_t) print( "************************* Received S1 Handover Request " @@ -154,10 +151,7 @@ def test_s1_handover(self): # Handover Command to Source ENB. # Wait for S1 Handover Command Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_CMD_IND.value s1ho_cmd_ind = response.cast(s1ap_types.FwNbS1HoCmdInd_t) print( "************************* Received S1 Handover Command " @@ -188,10 +182,7 @@ def test_s1_handover(self): # Status Transfer to Target ENB. # Wait for MME Status Transfer Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_MME_STATUS_TRSFR_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_MME_STATUS_TRSFR_IND.value mme_status_trf_ind = response.cast(s1ap_types.FwNbMmeStatusTrnsfrInd_t) print( "************************* Received MME Status Transfer " @@ -222,21 +213,10 @@ def test_s1_handover(self): # source ENB for clearing UE context from source ENB # Wait for UE Context Release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value ue_ctxt_rel_ind = response.cast(s1ap_types.FwNbUeCtxRelInd_t) - self.assertEqual( - # causeType = 0 (Radio network) - ue_ctxt_rel_ind.relCause.causeType, - 0, - ) - self.assertEqual( - # causeVal = 2 (successful-handover) - ue_ctxt_rel_ind.relCause.causeVal, - 2, - ) + assert ue_ctxt_rel_ind.relCause.causeType == 0 # causeType = 0 (Radio network) + assert ue_ctxt_rel_ind.relCause.causeVal == 2 # causeVal = 2 (successful-handover) print( "************************* Received UE Context Release Command " "after successful handover", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_cancel.py b/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_cancel.py index f341bf364862..e62b5f0e1b96 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_cancel.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_cancel.py @@ -118,10 +118,7 @@ def test_s1_handover_cancel(self): # Handover Request to Target ENB. # Wait for S1 Handover Request Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value s1ho_req_ind = response.cast(s1ap_types.FwNbS1HoReqInd_t) print( "************************* Received S1 Handover Request " @@ -152,10 +149,7 @@ def test_s1_handover_cancel(self): # Handover Command to Source ENB. # Wait for S1 Handover Command Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_CMD_IND.value s1ho_cmd_ind = response.cast(s1ap_types.FwNbS1HoCmdInd_t) print( "************************* Received S1 Handover Command " @@ -186,10 +180,7 @@ def test_s1_handover_cancel(self): # Handover Cancel Ack to Source ENB. # Wait for S1 Handover Cancel Ack Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_CANCEL_ACK_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_CANCEL_ACK_IND.value s1ho_cancl_ack_ind = response.cast(s1ap_types.FwNbS1HoCancelAckInd_t) print( "************************* Received S1 Handover Cancel Ack " diff --git a/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_failure.py b/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_failure.py index 4994c817fb53..d138dc9a014f 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_failure.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_failure.py @@ -119,10 +119,7 @@ def test_s1_handover_failure(self): # Handover Request to Target ENB. # Wait for S1 Handover Request Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value s1ho_req_ind = response.cast(s1ap_types.FwNbS1HoReqInd_t) print( "************************* Received S1 Handover Request " @@ -153,10 +150,7 @@ def test_s1_handover_failure(self): # Handover Preparation Failure to Source ENB. # Wait for S1 Handover Preparation Failure Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_PREP_FAIL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_PREP_FAIL_IND.value s1ho_prep_fail_ind = response.cast(s1ap_types.FwNbS1HoPrepFailInd_t) print( "************************* Received S1 Handover Preparation " diff --git a/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_ping_pong.py b/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_ping_pong.py index c4b961a3c2af..250e977cd9fd 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_ping_pong.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_ping_pong.py @@ -121,10 +121,7 @@ def test_s1_handover_ping_pong(self): # Handover Request to Target ENB. # Wait for S1 Handover Request Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value s1ho_req_ind = response.cast(s1ap_types.FwNbS1HoReqInd_t) print( "************************* Received S1 Handover Request " @@ -155,10 +152,7 @@ def test_s1_handover_ping_pong(self): # Handover Command to Source ENB. # Wait for S1 Handover Command Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_CMD_IND.value s1ho_cmd_ind = response.cast(s1ap_types.FwNbS1HoCmdInd_t) print( "************************* Received S1 Handover Command " @@ -189,10 +183,7 @@ def test_s1_handover_ping_pong(self): # Status Transfer to Target ENB. # Wait for MME Status Transfer Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_MME_STATUS_TRSFR_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_MME_STATUS_TRSFR_IND.value mme_status_trf_ind = response.cast(s1ap_types.FwNbMmeStatusTrnsfrInd_t) print( "************************* Received MME Status Transfer " @@ -223,21 +214,10 @@ def test_s1_handover_ping_pong(self): # source ENB for clearing UE context from source ENB # Wait for UE Context Release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value ue_ctxt_rel_ind = response.cast(s1ap_types.FwNbUeCtxRelInd_t) - self.assertEqual( - # causeType = 0 (Radio network) - ue_ctxt_rel_ind.relCause.causeType, - 0, - ) - self.assertEqual( - # causeVal = 2 (successful-handover) - ue_ctxt_rel_ind.relCause.causeVal, - 2, - ) + assert ue_ctxt_rel_ind.relCause.causeType == 0 # causeType = 0 (Radio network) + assert ue_ctxt_rel_ind.relCause.causeVal == 2 # causeVal = 2 (successful-handover) print( "************************* Received UE Context Release Command " "after successful handover", @@ -282,10 +262,7 @@ def test_s1_handover_ping_pong(self): # Handover Request to Target ENB. # Wait for S1 Handover Request Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value s1ho_req_ind = response.cast(s1ap_types.FwNbS1HoReqInd_t) print( "************************* Received S1 Handover Request " @@ -316,10 +293,7 @@ def test_s1_handover_ping_pong(self): # Handover Command to Source ENB. # Wait for S1 Handover Command Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_CMD_IND.value s1ho_cmd_ind = response.cast(s1ap_types.FwNbS1HoCmdInd_t) print( "************************* Received S1 Handover Command " @@ -350,10 +324,7 @@ def test_s1_handover_ping_pong(self): # Status Transfer to Target ENB. # Wait for MME Status Transfer Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_MME_STATUS_TRSFR_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_MME_STATUS_TRSFR_IND.value mme_status_trf_ind = response.cast(s1ap_types.FwNbMmeStatusTrnsfrInd_t) print( "************************* Received MME Status Transfer " @@ -384,21 +355,10 @@ def test_s1_handover_ping_pong(self): # source ENB for clearing UE context from source ENB # Wait for UE Context Release command response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value ue_ctxt_rel_ind = response.cast(s1ap_types.FwNbUeCtxRelInd_t) - self.assertEqual( - # causeType = 0 (Radio network) - ue_ctxt_rel_ind.relCause.causeType, - 0, - ) - self.assertEqual( - # causeVal = 2 (successful-handover) - ue_ctxt_rel_ind.relCause.causeVal, - 2, - ) + assert ue_ctxt_rel_ind.relCause.causeType == 0 # causeType = 0 (Radio network) + assert ue_ctxt_rel_ind.relCause.causeVal == 2 # causeVal = 2 (successful-handover) print( "************************* Received UE Context Release Command " "after successful handover", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_timer_expiry.py b/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_timer_expiry.py index 2fb8f2f14e57..82ef4a17379b 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_timer_expiry.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_s1_handover_timer_expiry.py @@ -121,10 +121,7 @@ def test_s1_handover_timer_expiry(self): # Handover Request to Target ENB. # Wait for S1 Handover Request Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_REQ_IND.value s1ho_req_ind = response.cast(s1ap_types.FwNbS1HoReqInd_t) print( "************************* Received S1 Handover Request " @@ -155,10 +152,7 @@ def test_s1_handover_timer_expiry(self): # Handover Command to Source ENB. # Wait for S1 Handover Command Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_CMD_IND.value s1ho_cmd_ind = response.cast(s1ap_types.FwNbS1HoCmdInd_t) print( "************************* Received S1 Handover Command " @@ -177,10 +171,7 @@ def test_s1_handover_timer_expiry(self): # Command Indication to allow the S1 Reloc Timer to Expire # Wait for S1 HO Command Drop Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_CMD_DROP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_CMD_DROP_IND.value s1ho_cmd_drp_ind = response.cast(s1ap_types.FwNbS1HoCmdDropInd_t) print( "************************* Received S1 Handover Command Drop " @@ -200,10 +191,7 @@ def test_s1_handover_timer_expiry(self): # source ENB # Wait for S1 HO Cancel Ack Indication response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.S1_HANDOVER_CANCEL_ACK_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.S1_HANDOVER_CANCEL_ACK_IND.value s1ho_cancl_ack_ind = response.cast(s1ap_types.FwNbS1HoCancelAckInd_t) print( "************************* Received S1 Handover Cancel Ack " diff --git a/lte/gateway/python/integ_tests/s1aptests/test_s1setup_failure_incorrect_plmn.py b/lte/gateway/python/integ_tests/s1aptests/test_s1setup_failure_incorrect_plmn.py index 69f7b367ec93..44f9b2559d12 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_s1setup_failure_incorrect_plmn.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_s1setup_failure_incorrect_plmn.py @@ -50,7 +50,7 @@ def tearDown(self): print("The test has failed. Restarting Sctpd for cleanup") magmad_client = MagmadServiceGrpc() magmad_util = MagmadUtil(magmad_client) - magmad_util.restart_sctpd() + magmad_util.restart_services(['sctpd'], wait_time=30) magmad_util.print_redis_state() if s1ap_wrapper.TestWrapper.TEST_CASE_EXECUTION_COUNT == 3: s1ap_wrapper.TestWrapper.generate_flaky_summary() diff --git a/lte/gateway/python/integ_tests/s1aptests/test_s1setup_failure_incorrect_tac.py b/lte/gateway/python/integ_tests/s1aptests/test_s1setup_failure_incorrect_tac.py index 2e04ea3aa736..55d7dfd9b91b 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_s1setup_failure_incorrect_tac.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_s1setup_failure_incorrect_tac.py @@ -49,7 +49,7 @@ def tearDown(self): print("The test has failed. Restarting Sctpd for cleanup") magmad_client = MagmadServiceGrpc() magmad_util = MagmadUtil(magmad_client) - magmad_util.restart_sctpd() + magmad_util.restart_services(['sctpd'], wait_time=30) magmad_util.print_redis_state() if s1ap_wrapper.TestWrapper.TEST_CASE_EXECUTION_COUNT == 3: s1ap_wrapper.TestWrapper.generate_flaky_summary() diff --git a/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_auth_req.py b/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_auth_req.py index 0a9bf76829ee..05149b7d7313 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_auth_req.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_auth_req.py @@ -49,9 +49,7 @@ def test_sctp_abort_after_auth_req(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print( "Received auth req ind ", s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_identity_req.py b/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_identity_req.py index b2945ba4fc9c..3c59ddf94a88 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_identity_req.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_identity_req.py @@ -49,9 +49,7 @@ def test_sctp_abort_after_identity_req(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value print( "Received Identity req ind ", s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value, diff --git a/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_smc.py b/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_smc.py index 0e783d1a55a6..f60e84c2743d 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_smc.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_smc.py @@ -49,9 +49,7 @@ def test_sctp_abort_after_smc(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ue-id", req.ue_id) auth_res = s1ap_types.ueAuthResp_t() @@ -65,9 +63,7 @@ def test_sctp_abort_after_smc(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("Received Security Mode Command ue-id", req.ue_id) print("send SCTP ABORT") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_auth_req.py b/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_auth_req.py index 0fc26dd1742a..161b52d61ca6 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_auth_req.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_auth_req.py @@ -49,9 +49,7 @@ def test_sctp_shutdown_after_auth_req(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ue-id", req.ue_id) print("send SCTP SHUTDOWN") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_identity_req.py b/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_identity_req.py index 556eed032f75..1779c4fae39c 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_identity_req.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_identity_req.py @@ -49,9 +49,7 @@ def test_sctp_shutdown_after_identity_req(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value print( "Received Identity req ind ", s1ap_types.tfwCmd.UE_IDENTITY_REQ_IND.value, diff --git a/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_multi_ue_attach.py b/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_multi_ue_attach.py index c9bafb517f7f..1f587edbc7d7 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_multi_ue_attach.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_multi_ue_attach.py @@ -27,7 +27,9 @@ def tearDown(self): "Restart sctpd service to clear Redis state as test case doesn't" " intend to initiate detach procedure", ) - self._s1ap_wrapper.magmad_util.restart_sctpd() + self._s1ap_wrapper.magmad_util.restart_services( + ['sctpd'], wait_time=30, + ) self._s1ap_wrapper.magmad_util.print_redis_state() def test_sctp_shutdown_after_multi_ue_attach(self): diff --git a/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_smc.py b/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_smc.py index 7c137e3bfbf1..58a51aacd6b8 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_smc.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_after_smc.py @@ -50,9 +50,7 @@ def test_sctp_shutdown_after_smc(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ue-id", req.ue_id) auth_res = s1ap_types.ueAuthResp_t() @@ -66,9 +64,7 @@ def test_sctp_shutdown_after_smc(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("Received Security Mode Command ue-id", req.ue_id) print("send SCTP SHUTDOWN") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_while_mme_is_stopped.py b/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_while_mme_is_stopped.py index aa06dcc0908f..0c2fd76654c9 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_while_mme_is_stopped.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_sctp_shutdown_while_mme_is_stopped.py @@ -54,10 +54,11 @@ def test_sctp_shutdown_while_mme_is_stopped(self): # Wait for EMM Information from MME self._s1ap_wrapper._s1_util.receive_emm_info() - print("Stopping MME service") - self._s1ap_wrapper.magmad_util.exec_command( - "sudo service magma@mme stop", - ) + print("Stopping MME, mobilityd, pipelined, and sessiond service") + self._s1ap_wrapper.magmad_util.disable_service('mme') + self._s1ap_wrapper.magmad_util.disable_service('mobilityd') + self._s1ap_wrapper.magmad_util.disable_service('pipelined') + self._s1ap_wrapper.magmad_util.disable_service('sessiond') print("send SCTP SHUTDOWN") self._s1ap_wrapper._s1_util.issue_cmd( @@ -67,19 +68,11 @@ def test_sctp_shutdown_while_mme_is_stopped(self): print("Redis state after SCTP shutdown") self._s1ap_wrapper.magmad_util.print_redis_state() - print("Starting MME service and waiting for 30 seconds") - self._s1ap_wrapper.magmad_util.exec_command( - "sudo service magma@mobilityd start", - ) - self._s1ap_wrapper.magmad_util.exec_command( - "sudo service magma@pipelined start", - ) - self._s1ap_wrapper.magmad_util.exec_command( - "sudo service magma@sessiond start", - ) - self._s1ap_wrapper.magmad_util.exec_command( - "sudo service magma@mme start", - ) + print("Starting the stopped services and waiting for 30 seconds") + self._s1ap_wrapper.magmad_util.enable_service('mobilityd') + self._s1ap_wrapper.magmad_util.enable_service('pipelined') + self._s1ap_wrapper.magmad_util.enable_service('sessiond') + self._s1ap_wrapper.magmad_util.enable_service('mme') time.sleep(30) print("Re-establish S1 connection between eNB and MME") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_reject_multiple_sessions_not_allowed_per_apn.py b/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_reject_multiple_sessions_not_allowed_per_apn.py index 97808d8fe8d6..89bd5b0c592b 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_reject_multiple_sessions_not_allowed_per_apn.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_reject_multiple_sessions_not_allowed_per_apn.py @@ -67,14 +67,9 @@ def test_secondary_pdn_reject_multiple_sessions_not_allowed_per_apn(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN Connectivity reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value pdn_con_rsp = response.cast(s1ap_types.uePdnConRsp_t) - self.assertEqual( - pdn_con_rsp.m.conRejInfo.cause, - s1ap_types.TFW_ESM_CAUSE_MULTIPLE_PDN_CON_FOR_A_GIVEN_APN_NA, - ) + assert pdn_con_rsp.m.conRejInfo.cause == s1ap_types.TFW_ESM_CAUSE_MULTIPLE_PDN_CON_FOR_A_GIVEN_APN_NA print("Sleeping for 5 seconds") time.sleep(5) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_reject_unknown_pdn_type.py b/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_reject_unknown_pdn_type.py index 0b7774dd1716..5d3f99c75ee0 100755 --- a/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_reject_unknown_pdn_type.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_reject_unknown_pdn_type.py @@ -80,15 +80,10 @@ def test_secondary_pdn_reject_unknown_pdn_type(self): self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn, pdn_type=2) # Receive PDN Connectivity reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value # Verify cause pdn_con_rsp = response.cast(s1ap_types.uePdnConRsp_t) - self.assertEqual( - pdn_con_rsp.m.conRejInfo.cause, - s1ap_types.TFW_ESM_CAUSE_UNKNOWN_PDN_TYPE, - ) + assert pdn_con_rsp.m.conRejInfo.cause == s1ap_types.TFW_ESM_CAUSE_UNKNOWN_PDN_TYPE print("Sleeping for 5 seconds") time.sleep(5) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_with_dedicated_bearer_multiple_services_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_with_dedicated_bearer_multiple_services_restart.py index ff2d2d37b2e1..53b6b82816f4 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_with_dedicated_bearer_multiple_services_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_secondary_pdn_with_dedicated_bearer_multiple_services_restart.py @@ -208,9 +208,7 @@ def test_secondary_pdn_with_dedicated_bearer_multiple_services_restart( ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_oai_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -225,9 +223,7 @@ def test_secondary_pdn_with_dedicated_bearer_multiple_services_restart( self._s1ap_wrapper.sendPdnConnectivityReq(ue_id, apn) # Receive PDN CONN RSP/Activate default EPS bearer context request response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value act_def_bearer_req = response.cast(s1ap_types.uePdnConRsp_t) addr = act_def_bearer_req.m.pdnInfo.pAddr.addrInfo sec_ip = ipaddress.ip_address(bytes(addr[:4])) @@ -254,9 +250,7 @@ def test_secondary_pdn_with_dedicated_bearer_multiple_services_restart( ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_req_ims_apn = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_send_error_ind_for_dl_nas_with_auth_req.py b/lte/gateway/python/integ_tests/s1aptests/test_send_error_ind_for_dl_nas_with_auth_req.py index f11f871fed66..98c49d45798d 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_send_error_ind_for_dl_nas_with_auth_req.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_send_error_ind_for_dl_nas_with_auth_req.py @@ -51,9 +51,7 @@ def test_send_error_ind_for_dl_nas_with_auth_req(self): ) print("************************* Sent attach request") response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("************************* Received authentication request") # Send error indication @@ -73,9 +71,7 @@ def test_send_error_ind_for_dl_nas_with_auth_req(self): # Context release response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("************************* Received UE_CTX_REL_IND") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_send_error_ind_for_erab_setup_req.py b/lte/gateway/python/integ_tests/s1aptests/test_send_error_ind_for_erab_setup_req.py index 82548fa831a1..4c01338cfd41 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_send_error_ind_for_erab_setup_req.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_send_error_ind_for_erab_setup_req.py @@ -83,9 +83,7 @@ def test_send_error_ind_for_erab_setup_req(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ACT_DED_BER_REQ.value act_ded_ber_ctxt_req = response.cast( s1ap_types.UeActDedBearCtxtReq_t, ) @@ -108,9 +106,7 @@ def test_send_error_ind_for_erab_setup_req(self): s1ap_types.tfwCmd.ENB_ERR_IND_MSG, error_ind, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Received UE_CTX_REL_IND for UE id ", req.ue_id, diff --git a/lte/gateway/python/integ_tests/s1aptests/test_service_info.py b/lte/gateway/python/integ_tests/s1aptests/test_service_info.py index cdad023f46dc..49cda0b586a2 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_service_info.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_service_info.py @@ -35,17 +35,16 @@ def _check_timing_metrics(self, service_util): print("UPTIME ", uptime) # Sanity checks - self.assertGreater(start_time, 0) - - self.assertGreaterEqual(uptime, 0) + assert start_time > 0 + assert uptime >= 0 # Make sure uptime is updating and start time is not time.sleep(1) new_uptime = service_util.get_uptime() new_start_time = service_util.get_start_time() - self.assertGreater(new_uptime, uptime) - self.assertEqual(start_time, new_start_time) + assert new_uptime > uptime + assert new_start_time == start_time print("START TIME ", new_start_time) print("UPTIME ", new_uptime) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_service_req_ul_udp_data_with_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_service_req_ul_udp_data_with_mme_restart.py index 4caf88b702df..590214062005 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_service_req_ul_udp_data_with_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_service_req_ul_udp_data_with_mme_restart.py @@ -80,9 +80,7 @@ def test_service_req_ul_udp_data_with_mme_restart(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("************************* Restarting MME service on gateway") wait_for_restart = 30 @@ -112,9 +110,7 @@ def test_service_req_ul_udp_data_with_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value print( "************************* Running UE uplink (UDP) for UE id ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_services_are_running.py b/lte/gateway/python/integ_tests/s1aptests/test_services_are_running.py new file mode 100644 index 000000000000..a8f7a24e48fb --- /dev/null +++ b/lte/gateway/python/integ_tests/s1aptests/test_services_are_running.py @@ -0,0 +1,124 @@ +""" +Copyright 2022 The Magma Authors. + +This source code is licensed under the BSD-style license found in the +LICENSE file in the root directory of this source tree. + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +import time +import unittest + +import yaml +from integ_tests.s1aptests import s1ap_wrapper +from s1ap_utils import InitMode, MagmadUtil +from yaml.loader import SafeLoader + +SERVICE_START_TIME = 'start_time' +SERVICE_ACTIVE = 'active_status' +SERVICE_RESULT = 'result' + + +class TestServicesAreRunning(unittest.TestCase): + """ + A simple smoke test that checks if all relevant magma services are running. + This test was introduced because of GH14007 where a service that is not used + in the integration tests was damaged in the magma debian package artifact. + """ + + def setUp(self): + """Initialize""" + self._s1ap_wrapper = s1ap_wrapper.TestWrapper( + health_service=MagmadUtil.health_service_cmds.ENABLE, + ) + + def test_services_are_running(self): + + if self._s1ap_wrapper.magmad_util.init_system.value != InitMode.SYSTEMD.value: + self.skipTest("Systemd only test.") + + services = self._get_services() + + """ + Initialize service status dictionary. + The dict holds for each service status results that are collected each time the status + is queried. Also for each service a result list holds reporting about issues with the + queried status results. + """ + service_status = { + service: { + SERVICE_START_TIME: [], + SERVICE_ACTIVE: [], + SERVICE_RESULT: [], + } for service in services + } + + self._query_state_of_services(service_status) + + print('Waiting 10 seconds for second check to identify services in a restart-loop.') + time.sleep(10) + + self._query_state_of_services(service_status) + + failed_services = self._get_failed_services(service_status) + + for service, state in failed_services.items(): + print(f'{service} failed with reason(s) "{state[SERVICE_RESULT]}"') + + assert not failed_services, "Services are not running correctly. See logging above." + + def _get_services(self): + """ + Returns a list of all services managed by magmad and additionally magmad itself, + openvswitch-switch and sctpd. + """ + non_magmad_services = [ + 'magma@magmad', + 'openvswitch-switch', + 'sctpd', + ] + + raw_magmad_yml = self._s1ap_wrapper.magmad_util.exec_command_output('cat /etc/magma/magmad.yml') + magmad_yml = yaml.load(raw_magmad_yml, Loader=SafeLoader) + magmad_services = magmad_yml['magma_services'] + + return non_magmad_services + [f'magma@{service}' for service in magmad_services] + + def _query_state_of_services(self, service_status): + for service, status in service_status.items(): + active_state = self._s1ap_wrapper.magmad_util.check_service_activity( + f'systemctl is-active {service}', + ).strip() + start_time = self._s1ap_wrapper.magmad_util.exec_command_output( + f'systemctl show {service} --property=ActiveEnterTimestamp', + ).strip() + + status[SERVICE_START_TIME].append(start_time) + status[SERVICE_ACTIVE].append(active_state) + + print(f'checking {service} ...') + print(f' {active_state}') + print(f' {start_time}') + + def _get_failed_services(self, service_status): + for service, status in service_status.items(): + # was the service not active? + active_status_first_check = status[SERVICE_ACTIVE][0] + active_status_second_check = status[SERVICE_ACTIVE][1] + not_active = active_status_first_check != 'active' or active_status_second_check != 'active' + if not_active: + status[SERVICE_RESULT].append('not active') + + # was the service restarted? + start_time_first_check = status[SERVICE_START_TIME][0] + start_time_second_check = status[SERVICE_START_TIME][1] + restarted = start_time_first_check != start_time_second_check + if restarted: + status[SERVICE_RESULT].append('restarted') + + return {service: status for service, status in service_status.items() if len(status[SERVICE_RESULT]) > 0} diff --git a/lte/gateway/python/integ_tests/s1aptests/test_standalone_pdn_conn_req.py b/lte/gateway/python/integ_tests/s1aptests/test_standalone_pdn_conn_req.py index 7f5731282bc5..245cc9c9a1ff 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_standalone_pdn_conn_req.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_standalone_pdn_conn_req.py @@ -67,9 +67,7 @@ def test_standalone_pdn_conn_req(self): ) # Receive PDN Connectivity Reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value print("Received PDN CONNECTIVITY REJECT") print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_standalone_pdn_conn_req_with_apn_correction.py b/lte/gateway/python/integ_tests/s1aptests/test_standalone_pdn_conn_req_with_apn_correction.py index 70988d7e459a..e5d3ad7a1bc2 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_standalone_pdn_conn_req_with_apn_correction.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_standalone_pdn_conn_req_with_apn_correction.py @@ -87,10 +87,7 @@ def test_standalone_pdn_conn_req_with_apn_correction(self): ) # Receive PDN Connectivity Reject response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_PDN_CONN_RSP_IND.value print("Received PDN CONNECTIVITY REJECT") print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_stateless_multi_ue_mixedstate_mme_restart.py b/lte/gateway/python/integ_tests/s1aptests/test_stateless_multi_ue_mixedstate_mme_restart.py index 501ed95ac196..c3c7e33fa232 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_stateless_multi_ue_mixedstate_mme_restart.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_stateless_multi_ue_mixedstate_mme_restart.py @@ -57,10 +57,7 @@ def exec_attach_req_step(self, ue_id): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_AUTH_REQ_IND.value print("Received auth req ind ue-id", attach_req.ue_Id) def exec_auth_resp_step(self, ue_id): @@ -77,10 +74,7 @@ def exec_auth_resp_step(self, ue_id): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_SEC_MOD_CMD_IND.value print("Received Security Mode Command ue-id", auth_res.ue_Id) def exec_sec_mode_complete_step(self, ue_id): @@ -96,10 +90,7 @@ def exec_sec_mode_complete_step(self, ue_id): sec_mode_complete.ue_Id, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_ESM_INFORMATION_REQ.value esm_info_req = response.cast(s1ap_types.ueEsmInformationReq_t) return esm_info_req.tId @@ -210,10 +201,7 @@ def test_stateless_multi_ue_mixedstate_mme_restart(self): ue_cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value tid = {} # start attach procedures for the remaining UEs @@ -289,10 +277,7 @@ def test_stateless_multi_ue_mixedstate_mme_restart(self): ser_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value self.dl_flow_rules[idle_session_ips[i]] = [] # Verify default bearer rules @@ -320,10 +305,7 @@ def test_stateless_multi_ue_mixedstate_mme_restart(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value if __name__ == "__main__": diff --git a/lte/gateway/python/integ_tests/s1aptests/test_tau_mixed_partial_lists.py b/lte/gateway/python/integ_tests/s1aptests/test_tau_mixed_partial_lists.py index 3fc66c6724c8..908d0fc1cec5 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_tau_mixed_partial_lists.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_tau_mixed_partial_lists.py @@ -83,9 +83,7 @@ def test_tau_mixed_partial_lists(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Sending Tracking Area Update ", @@ -102,9 +100,7 @@ def test_tau_mixed_partial_lists(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value tau_acc = response.cast(s1ap_types.ueTauAccept_t) print( "************************* Received Tracking Area Update ", @@ -113,9 +109,7 @@ def test_tau_mixed_partial_lists(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print("************************* Sleeping for 2 seconds") time.sleep(2) diff --git a/lte/gateway/python/integ_tests/s1aptests/test_tau_periodic_active.py b/lte/gateway/python/integ_tests/s1aptests/test_tau_periodic_active.py index c6a733c47e59..85e47cbcbbbc 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_tau_periodic_active.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_tau_periodic_active.py @@ -67,9 +67,7 @@ def test_tau_periodic_active(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value for _ in range(num_taus): timer = threading.Timer(tau_period, lambda: None) @@ -93,10 +91,7 @@ def test_tau_periodic_active(self): response = self._s1ap_wrapper.s1_util.get_response() if s1ap_types.tfwCmd.INT_CTX_SETUP_IND.value == response.msg_type: response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value print( "************************* Sending UE context release ", @@ -110,15 +105,10 @@ def test_tau_periodic_active(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value else: - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_TAU_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_TAU_REJECT_IND.value print( "************************* Running UE detach (switch-off) for ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_tau_periodic_inactive.py b/lte/gateway/python/integ_tests/s1aptests/test_tau_periodic_inactive.py index 33a4732753fb..c0403ae9700b 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_tau_periodic_inactive.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_tau_periodic_inactive.py @@ -65,9 +65,7 @@ def test_tau_periodic_inactive(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value for _ in range(num_taus): timer = threading.Timer(tau_period, lambda: None) @@ -89,14 +87,10 @@ def test_tau_periodic_inactive(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Running UE detach (switch-off) for ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating.py b/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating.py index 16245f9e9c5f..143e3efa8004 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating.py @@ -77,10 +77,7 @@ def test_tau_ta_updating(self): cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value # For the 1st UE, send TAU with Eps_Updt_Type # TA_UPDATING and active flag set to true @@ -128,10 +125,7 @@ def test_tau_ta_updating(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value tau_acc = response.cast(s1ap_types.ueTauAccept_t) print( "************************* Received Tracking Area Update ", @@ -140,10 +134,7 @@ def test_tau_ta_updating(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value for ue in ue_ids: print( diff --git a/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating_connected_mode.py b/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating_connected_mode.py index 6ca71cb8e3c6..932e491e0e07 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating_connected_mode.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating_connected_mode.py @@ -77,9 +77,7 @@ def test_tau_ta_updating_connected_mode(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_TAU_ACCEPT_IND.value tau_acc = response.cast(s1ap_types.ueTauAccept_t) print( "************************* Received Tracking Area Update ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating_reject.py b/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating_reject.py index efd3c0eea64f..71d39d6e629e 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating_reject.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_tau_ta_updating_reject.py @@ -82,9 +82,7 @@ def test_tau_ta_updating_reject(self): s1ap_types.tfwCmd.UE_CNTXT_REL_REQUEST, cntxt_rel_req, ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_CTX_REL_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_CTX_REL_IND.value print( "************************* Sending Tracking Area Update ", @@ -101,9 +99,7 @@ def test_tau_ta_updating_reject(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.UE_TAU_REJECT_IND.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.UE_TAU_REJECT_IND.value tau_rej = response.cast(s1ap_types.ueTauRejInd_t) print( "************************* Received Tracking Area Update ", diff --git a/lte/gateway/python/integ_tests/s1aptests/test_x2_handover.py b/lte/gateway/python/integ_tests/s1aptests/test_x2_handover.py index 870906dbb62d..d7ddf91a4391 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_x2_handover.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_x2_handover.py @@ -81,17 +81,17 @@ def test_x2_handover(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.MME_CONFIGURATION_TRANSFER.value, + assert ( + response.msg_type + == s1ap_types.tfwCmd.MME_CONFIGURATION_TRANSFER.value ) print("************************* Received MME_CONFIGURATION_TRANSFER") print("************************* Sending ENB_CONFIGURATION_TRANSFER") response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.MME_CONFIGURATION_TRANSFER.value, + assert ( + response.msg_type + == s1ap_types.tfwCmd.MME_CONFIGURATION_TRANSFER.value ) print("************************* Received MME_CONFIGURATION_TRANSFER") @@ -102,9 +102,7 @@ def test_x2_handover(self): ) # Receive Path Switch Request Ack response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.PATH_SW_REQ_ACK.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.PATH_SW_REQ_ACK.value print("************************* Received Path Switch Request Ack") diff --git a/lte/gateway/python/integ_tests/s1aptests/test_x2_handover_ping_pong.py b/lte/gateway/python/integ_tests/s1aptests/test_x2_handover_ping_pong.py index a73de0c8fae9..c6018aa3c6b6 100644 --- a/lte/gateway/python/integ_tests/s1aptests/test_x2_handover_ping_pong.py +++ b/lte/gateway/python/integ_tests/s1aptests/test_x2_handover_ping_pong.py @@ -82,18 +82,12 @@ def test_x2_handover_ping_pong(self): ) response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.MME_CONFIGURATION_TRANSFER.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.MME_CONFIGURATION_TRANSFER.value print("****************** Received MME_CONFIGURATION_TRANSFER") print("****************** Sending ENB_CONFIGURATION_TRANSFER") response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, - s1ap_types.tfwCmd.MME_CONFIGURATION_TRANSFER.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.MME_CONFIGURATION_TRANSFER.value print("****************** Received MME_CONFIGURATION_TRANSFER") print("****************** Sending X2_HO_TRIGGER_REQ") @@ -103,9 +97,7 @@ def test_x2_handover_ping_pong(self): ) # Receive Path Switch Request Ack response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.PATH_SW_REQ_ACK.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.PATH_SW_REQ_ACK.value print("****************** Received Path Switch Request Ack") @@ -115,9 +107,7 @@ def test_x2_handover_ping_pong(self): ) # Receive Path Switch Request Ack response = self._s1ap_wrapper.s1_util.get_response() - self.assertEqual( - response.msg_type, s1ap_types.tfwCmd.PATH_SW_REQ_ACK.value, - ) + assert response.msg_type == s1ap_types.tfwCmd.PATH_SW_REQ_ACK.value print("****************** Received Path Switch Request Ack for 2nd HO") print("****************** Running UE detach for UE id ", req.ue_id) # Now detach the UE diff --git a/lte/gateway/python/scripts/BUILD.bazel b/lte/gateway/python/scripts/BUILD.bazel index fdb6fdbf6841..e03bc055369b 100644 --- a/lte/gateway/python/scripts/BUILD.bazel +++ b/lte/gateway/python/scripts/BUILD.bazel @@ -95,6 +95,15 @@ py_binary( ], ) +# Note: Not included in the magma debian package. Only used for integration tests. +py_binary( + name = "config_iface_for_ipv6", + srcs = ["config_iface_for_ipv6.py"], + imports = [ORC8R_ROOT], + legacy_create_init = False, + deps = ["//orc8r/gateway/python/magma/configuration:service_configs"], +) + py_binary( name = "config_stateless_agw", srcs = ["config_stateless_agw.py"], diff --git a/lte/gateway/python/scripts/config_iface_for_ipv6.py b/lte/gateway/python/scripts/config_iface_for_ipv6.py index fc6828deacdd..90c2211fd50f 100755 --- a/lte/gateway/python/scripts/config_iface_for_ipv6.py +++ b/lte/gateway/python/scripts/config_iface_for_ipv6.py @@ -21,74 +21,37 @@ from magma.configuration.service_configs import ( load_override_config, - load_service_config, save_override_config, ) -return_codes = Enum( - "return_codes", "IPV4_ENABLED IPV6_ENABLED INVALID", start=0, -) +PIPELINED_SERVICE = "pipelined" + IPV6_IFACE_CONFIGS = [ - ("pipelined", "nat_iface"), - ("pipelined", "uplink_eth_port_name"), + "nat_iface", + "uplink_eth_port_name", ] -def check_ipv6_iface_config(service, config_name, config_value): - """Check if eth3 interface is configured""" - service_config = load_service_config(service) - if service_config.get(config_name) == config_value: - print("IPV6_ENABLED\t%s -> %s" % (service, config_name)) - return return_codes.IPV6_ENABLED - return return_codes.IPV4_ENABLED - - -def check_ipv6_iface(): - """Check the interface configured""" - ipv6_enabled = 0 - for service, config in IPV6_IFACE_CONFIGS: - if ( - check_ipv6_iface_config(service, config, "eth3") - == return_codes.IPV6_ENABLED - ): - ipv6_enabled += 1 - - if ipv6_enabled == 0: - res = return_codes.IPV4_ENABLED - elif ipv6_enabled == len(IPV6_IFACE_CONFIGS): - res = return_codes.IPV6_ENABLED - else: - res = return_codes.INVALID - - print("Check returning", res) - return res - - -def enable_eth3_iface(): +def _enable_eth3_iface(): """Enable eth3 interface as nat_iface""" - if check_ipv6_iface() == return_codes.IPV6_ENABLED: - print("eth3 interface is already enabled") - sys.exit(return_codes.IPV6_ENABLED.value) - for service, config in IPV6_IFACE_CONFIGS: - cfg = load_override_config(service) or {} - cfg[config] = "eth3" - save_override_config(service, cfg) + _change_iface("eth3") -def disable_eth3_iface(): +def _disable_eth3_iface(): """Disable eth3 interface as nat_iface""" - if check_ipv6_iface() == return_codes.IPV4_ENABLED: - print("IPv4 is already enabled") - sys.exit(return_codes.IPV4_ENABLED.value) - for service, config in IPV6_IFACE_CONFIGS: - cfg = load_override_config(service) or {} - cfg[config] = "eth2" - save_override_config(service, cfg) + _change_iface("eth2") + + +def _change_iface(iface): + for config in IPV6_IFACE_CONFIGS: + cfg = load_override_config(PIPELINED_SERVICE) or {} + cfg[config] = iface + save_override_config(PIPELINED_SERVICE, cfg) ETH3_IFACE_FUNC_DICT = { - "enable": enable_eth3_iface, - "disable": disable_eth3_iface, + "enable": _enable_eth3_iface, + "disable": _disable_eth3_iface, } diff --git a/lte/gateway/python/scripts/config_stateless_agw.py b/lte/gateway/python/scripts/config_stateless_agw.py index 966e26a50bfd..9a1e40d73536 100755 --- a/lte/gateway/python/scripts/config_stateless_agw.py +++ b/lte/gateway/python/scripts/config_stateless_agw.py @@ -103,6 +103,7 @@ def clear_redis_state(): ]: for key in redis_client.scan_iter(key_regex): redis_client.delete(key) + redis_client.save() def flushall_redis(): diff --git a/lte/gateway/python/setup.py b/lte/gateway/python/setup.py index 8bbe9789f5c2..c559bb516199 100644 --- a/lte/gateway/python/setup.py +++ b/lte/gateway/python/setup.py @@ -28,7 +28,9 @@ 'magma.enodebd.data_models', 'magma.enodebd.device_config', 'magma.enodebd.devices', + 'magma.enodebd.devices.baicells_qrtb', 'magma.enodebd.devices.experimental', + 'magma.enodebd.devices.freedomfi_one', 'magma.enodebd.state_machines', 'magma.enodebd.tr069', 'magma.health', diff --git a/lte/gateway/release/pydep b/lte/gateway/release/pydep index 32b48eeb447d..d6f17ee32f95 100755 --- a/lte/gateway/release/pydep +++ b/lte/gateway/release/pydep @@ -47,9 +47,6 @@ import shlex import shutil import subprocess import sys -import tarfile -import zipfile -from datetime import datetime from functools import lru_cache, partial from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union, cast @@ -153,105 +150,6 @@ def gen_sys_package_name(py_pkgname: str, use_py2: bool = False) -> str: return "{}-{}".format(prefix, suffix).lower() # deb likes lowercase -@lru_cache(maxsize=128) -def get_package(pkgname: str, - version: Optional[str] = None, - use_latest_if_needed: bool = False) -> str: - """ - Downloads and verifies a package from PyPI into - /tmp/pyreq-{pkgname}/{version}. If the version number is not specified, we - assume the latest version. - - Args: - pkgname: The name of the package - version: The requested version number - use_latest_if_needed: If the requested version isn't available, we use - the latest from PyPI. (Default: False) - - Returns path to the downloaded tar.gz - """ - - pkg_info_url = PYPI_API_BASE.format(pkgname) - - resp = requests.get(pkg_info_url) - if resp.status_code != 200: - raise ValueError("couldn't get package info for {} ({})".format( - pkgname, resp.status_code)) - - r = resp.json() - - # get latest package version if version not specified, or doesn't exist - if (not version - or (use_latest_if_needed and version not in r['releases']) - or not r['releases'][version]): - version = r['info']['version'] - - # get package info for specified version. there can, apparently, be more - # than one release package per version, so we use the one with the most - # recent release time to disambiguate. - release = {} # type: Dict[str, str] - newest_time = None - for rel in r['releases'][version]: - if rel['packagetype'] != 'sdist': - continue - ul_time = datetime.strptime(rel['upload_time'], "%Y-%m-%dT%H:%M:%S") - if not newest_time or ul_time > newest_time: - newest_time = ul_time - release = rel - - # download package - dl_path = "/tmp/pyreq-{}/{}".format(pkgname, version) - filename = _wget(release['url'], dl_path) - if _md5sum(filename) != release['md5_digest']: - raise ValueError("downloaded file doesn't match md5sum, aborting") - - return filename - - -def _unpack_tarfile(filepath: str, file_type: str) -> str: - """ - Unpacks a tar.gz, and returns a path to the unpacked directory. - """ - extract_path = os.path.dirname(filepath) - tarball = tarfile.open(filepath, "r:" + file_type) - top_level = tarball.getmembers()[0] - if not top_level.isdir(): - raise ValueError("archive doesn't contain a top level directory") - - tarball.extractall(extract_path) - tarball.close() - return "{}/{}".format(extract_path, top_level.name) - - -def _unpack_zip(filepath: str) -> str: - """ - Unpacks a zip, and returns a path to the unpacked directory. - """ - extract_path = os.path.dirname(filepath) - zfile = zipfile.ZipFile(filepath) - - # we take a guess that it's going to extract to a directory, yolo - top_level = os.path.dirname(zfile.infolist()[0].filename) - - zfile.extractall(extract_path) - zfile.close() - return "{}/{}".format(extract_path, top_level) - - -def _unpack(filepath: str) -> str: - """ - Unpacks a tar.gz or zip, and returns a path to the unpacked directory. - """ - if filepath.endswith(".zip"): - return _unpack_zip(filepath) - elif filepath.endswith(".tar.gz"): - return _unpack_tarfile(filepath, "gz") - elif filepath.endswith(".tar.bz2"): - return _unpack_tarfile(filepath, "bz2") - else: - raise ValueError("Unsupported package archive: {}".format(filepath)) - - def _get_requires(pkg_dir: str) -> Optional[str]: """ Given an unpacked python package, search for a requires.txt file in an @@ -663,38 +561,6 @@ def _existing_build(version: Optional[str], candidates: List[str]) -> bool: return already_built -@lru_cache(maxsize=128) -def get_pkg_deps(pkgname: str, - version: Optional[str] = None, - use_latest_if_needed: bool = False, - clean: bool = True) -> List[str]: - """ - Get the direct dependencies for a package. - - Args: - pkgname: The python package name. - version: The desired version (optional) - use_latest_if_needed: If the requested version isn't available, we use - the latest from PyPI. (Default: False) - clean: Remove temporary build files. (Default: True) - - Returns: - List of tuples containing (depname, version_str) - """ - - path = _unpack(get_package(pkgname, version, use_latest_if_needed)) - requires_txt = _get_requires(path) - if requires_txt: - dependencies = _parse_requires_txt(requires_txt) - else: - dependencies = [] - - if clean: - _cleanup(pkgname) - - return dependencies - - @contextlib.contextmanager def tmpvirtualenv(): """ diff --git a/lte/protos/oai/s1ap_state.proto b/lte/protos/oai/s1ap_state.proto index 5ec5cb9b4ec9..54ebafd416c1 100644 --- a/lte/protos/oai/s1ap_state.proto +++ b/lte/protos/oai/s1ap_state.proto @@ -21,10 +21,30 @@ message SupportedTaList { repeated SupportedTaiItems supported_tai_items = 2; } +message ERabAdmittedItem { + uint32 e_rab_id = 1; + bytes transport_layer_address = 2; + uint32 gtp_teid = 3; +} + +message ERabAdmittedList { + uint32 no_of_items = 1; + repeated ERabAdmittedItem item = 2; +} + +enum S1apEnbState { + S1AP_INIT = 0; /// The sctp association has been established but s1 hasn't been + /// setup. + S1AP_RESETING = 1; /// The s1state is resetting due to an SCTP reset on the bound + /// association. + S1AP_READY = 2; ///< MME and eNB are S1 associated, UE contexts can be added + S1AP_SHUTDOWN = 3; /// The S1 state is being torn down due to sctp shutdown. +} + message EnbDescription { uint32 enb_id = 1; - int32 s1_state = 2; // enum mme_s1_enb_state_s + int32 s1_state = 2 [deprecated = true]; // enum mme_s1_enb_state_s bytes enb_name = 3; // char[] uint32 default_paging_drx = 4; // uint8_t uint32 nb_ue_associated = 5; @@ -39,10 +59,20 @@ message EnbDescription { bytes ran_cp_ipaddr = 12; // eNB sctp end point IP addr uint32 ran_cp_ipaddr_sz = 13; // eNB sctp end point IP addr size map ue_id_map = 14; // mme_ue_s1ap_id -> comp_s1ap_id + S1apEnbState s1_enb_state = 15; +} + +enum S1apUeState { + S1AP_UE_INVALID_STATE = 0; + S1AP_UE_WAITING_ICSR = 1; ///< Waiting for Initial Context Setup Response + S1AP_UE_HANDOVER = 2; ///< Handover procedure triggered + S1AP_UE_CONNECTED = 3; ///< UE context ready + S1AP_UE_WAITING_CRC = 4; /// UE Context release Procedure initiated , waiting for + /// UE Context Release Complete } message UeDescription { - int32 s1_ue_state = 2; // enum s1_ue_state_s + int32 s1_ue_state = 2 [deprecated = true]; // enum s1_ue_state_s uint32 enb_ue_s1ap_id = 3; // enb_ue_s1ap_id_t uint32 mme_ue_s1ap_id = 4; // mme_ue_s1ap_id_t @@ -54,6 +84,8 @@ message UeDescription { uint32 sctp_assoc_id = 8; // sctp_assoc_id_t S1apHandoverState s1ap_handover_state = 9; // s1ap_handover_state_t + uint64 comp_s1ap_id = 10; // sctp_assoc_id & enb_ue_s1ap_id + S1apUeState s1ap_ue_state = 11; } message S1apState { @@ -74,4 +106,8 @@ message S1apHandoverState { uint32 target_enb_ue_s1ap_id = 4; // enb_ue_s1ap_id_t uint32 target_sctp_stream_recv = 5; // sctp_stream_id_t uint32 target_sctp_stream_send = 6; // sctp_stream_id_t + uint32 source_enb_ue_s1ap_id = 7; + uint32 source_sctp_stream_recv = 8; + uint32 source_sctp_stream_send = 9; + ERabAdmittedList e_rab_admitted_list = 10; } diff --git a/nms/app/util/ErrorUtils.ts b/nms/app/util/ErrorUtils.ts index 1c5527b2d37a..f639e0fde030 100644 --- a/nms/app/util/ErrorUtils.ts +++ b/nms/app/util/ErrorUtils.ts @@ -11,17 +11,12 @@ * limitations under the License. */ -import {AxiosError, AxiosResponse} from 'axios'; - -function isAxiosError(error: any): error is AxiosError { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-member-access - return 'isAxiosError' in error && error.isAxiosError; -} +import axios, {AxiosError, AxiosResponse} from 'axios'; export function isAxiosErrorResponse( error: any, ): error is AxiosError & {response: AxiosResponse} { - return isAxiosError(error) && !!error.response; + return axios.isAxiosError(error) && !!error.response; } export function getErrorMessage( @@ -29,10 +24,9 @@ export function getErrorMessage( fallbackMessage = 'Unknown Error', ): string { let errorMessage; - if (isAxiosError<{message?: string}>(error)) { + if (isAxiosErrorResponse(error)) { errorMessage = error.response?.data?.message ?? error.message; - } - if (error instanceof Error) { + } else if (error instanceof Error) { errorMessage = error.message; } return errorMessage || fallbackMessage; diff --git a/nms/scripts/createOrganization.ts b/nms/scripts/createOrganization.ts index 22e75ffc8ac1..f02f8f298e22 100644 --- a/nms/scripts/createOrganization.ts +++ b/nms/scripts/createOrganization.ts @@ -15,6 +15,7 @@ import Sequelize from 'sequelize'; import {Organization} from '../shared/sequelize_models'; import {OrganizationModel} from '../shared/sequelize_models/models/organization'; +import {syncOrganizationWithOrc8rTenant} from '../server/util/tenantsSync'; import {union} from 'lodash'; type OrganizationObject = { @@ -31,12 +32,13 @@ async function updateOrganization( `Updating organization ${organizationObject.name} to: ` + `networkIDs=[${organizationObject.networkIDs.join(' ')}]`, ); - await organization.update({ + const updated = await organization.update({ networkIDs: union( organization.networkIDs ?? [], organizationObject.networkIDs, ), }); + await syncOrganizationWithOrc8rTenant(updated); } async function createOrganization(organizationObject: OrganizationObject) { @@ -44,7 +46,7 @@ async function createOrganization(organizationObject: OrganizationObject) { `Creating a new organization: name=${organizationObject.name}, ` + `networkIDs=[${organizationObject.networkIDs.join(' ')}]`, ); - await Organization.create({ + const organization = await Organization.create({ name: organizationObject.name, networkIDs: organizationObject.networkIDs, csvCharset: '', @@ -52,6 +54,7 @@ async function createOrganization(organizationObject: OrganizationObject) { ssoEntrypoint: '', ssoIssuer: '', }); + await syncOrganizationWithOrc8rTenant(organization); } async function createOrUpdateOrganization( @@ -74,7 +77,7 @@ function main() { const args = process.argv.slice(2); if (args.length < 1) { console.log( - 'Usage: createOrganization.js ,, ...', + 'Usage: createOrganization.ts ,, ...', ); process.exit(1); } @@ -85,6 +88,7 @@ function main() { networkIDs, csvCharset: '', } as const; + createOrUpdateOrganization(organizationObject) .then(() => { console.log('Success'); diff --git a/nms/scripts/mockServer.ts b/nms/scripts/mockServer.ts index 928f298626db..fdcf632d4483 100644 --- a/nms/scripts/mockServer.ts +++ b/nms/scripts/mockServer.ts @@ -281,6 +281,15 @@ networks.forEach(network => { res.status(200).jsonp([]); } }); + server.get(`/magma/v1/tenants`, (req, res) => { + res.status(200).jsonp([]); + }); + server.post(`/magma/v1/tenants`, (req, res) => { + res.status(201).jsonp({}); + }); + server.put(`/magma/v1/tenants`, (req, res) => { + res.status(204).jsonp({}); + }); server.get( `/magma/v1/lte/{network}/enodebs/12020000051696P0013/state`, (req, res) => { diff --git a/nms/scripts/setPassword.ts b/nms/scripts/setPassword.ts index acbfdd712a0c..90d69e40a55f 100644 --- a/nms/scripts/setPassword.ts +++ b/nms/scripts/setPassword.ts @@ -17,6 +17,7 @@ import {AccessRoles} from '../shared/roles'; import {Organization, User} from '../shared/sequelize_models'; import {OrganizationModel} from '../shared/sequelize_models/models/organization'; import {UserModel} from '../shared/sequelize_models/models/user'; +import {syncOrganizationWithOrc8rTenant} from '../server/util/tenantsSync'; const SALT_GEN_ROUNDS = 10; @@ -88,6 +89,7 @@ async function createOrFetchOrganization( ]); org = o; } + await syncOrganizationWithOrc8rTenant(org); return org; } diff --git a/nms/server/auth/express.ts b/nms/server/auth/express.ts index 6dafec62009e..0e68bd2a4e32 100644 --- a/nms/server/auth/express.ts +++ b/nms/server/auth/express.ts @@ -226,7 +226,7 @@ function userMiddleware(options: Options) { }); res.status(200).send({users}); } catch (error) { - res.status(400).send({error: (error as Error).toString()}); + res.status(400).send({message: (error as Error).toString()}); } }); @@ -311,7 +311,7 @@ function userMiddleware(options: Options) { ); res.status(201).send({user}); } catch (error) { - res.status(400).send({error: (error as Error).toString()}); + res.status(400).send({message: (error as Error).toString()}); await logUserChange(req, req.user, 'CREATE', req.body, 'FAILURE'); } }, diff --git a/nms/server/auth/expressOnboarding.ts b/nms/server/auth/expressOnboarding.ts index 5f65a320e1d9..f7c3dc1c97c1 100644 --- a/nms/server/auth/expressOnboarding.ts +++ b/nms/server/auth/expressOnboarding.ts @@ -79,7 +79,7 @@ export default function () { res.status(200).send({success: true}); } catch (error) { - res.status(400).send({error: (error as Error).toString()}); + res.status(400).send({message: (error as Error).toString()}); } }, ); diff --git a/nms/server/host/routes.ts b/nms/server/host/routes.ts index 5175b8bad8f2..3cb81b24ada4 100644 --- a/nms/server/host/routes.ts +++ b/nms/server/host/routes.ts @@ -14,7 +14,6 @@ import OrchestratorAPI from '../api/OrchestratorAPI'; import Sequelize from 'sequelize'; import asyncHandler from '../util/asyncHandler'; -import axios from 'axios'; import crypto from 'crypto'; import featureConfigs, {FeatureConfig} from '../features'; import logging from '../../shared/logging'; @@ -24,11 +23,14 @@ import { sequelize, } from '../../shared/sequelize_models'; import {FeatureFlagModel} from '../../shared/sequelize_models/models/featureflag'; -import {OrganizationModel} from '../../shared/sequelize_models/models/organization'; import {Request, Router} from 'express'; import {User} from '../../shared/sequelize_models'; import {UserRawType} from '../../shared/sequelize_models/models/user'; import {getPropsToUpdate} from '../auth/util'; +import { + rethrowUnlessNotFoundError, + syncOrganizationWithOrc8rTenant, +} from '../util/tenantsSync'; import type {FeatureID} from '../../shared/types/features'; const logger = logging.getLogger(module); @@ -171,7 +173,7 @@ router.post( ), }); if (organization) { - return res.status(409).send({error: 'Organization exists already'}); + return res.status(409).send({message: 'Organization exists already'}); } organization = await Organization.create({ name: req.body.name, @@ -198,7 +200,7 @@ router.put( ), }); if (!organization) { - return res.status(404).send({error: 'Organization does not exist'}); + return res.status(404).send({message: 'Organization does not exist'}); } const updated = await organization.update(req.body); await syncOrganizationWithOrc8rTenant(updated); @@ -225,7 +227,7 @@ router.post( ), }); if (!organization) { - return res.status(404).send({error: 'Organization does not exist'}); + return res.status(404).send({message: 'Organization does not exist'}); } try { @@ -259,7 +261,7 @@ router.post( const user = await User.create(props); res.status(200).send({user}); } catch (error) { - res.status(400).send({error: (error as Error).toString()}); + res.status(400).send({message: (error as Error).toString()}); } }, ), @@ -292,41 +294,6 @@ router.delete( }), ); -async function syncOrganizationWithOrc8rTenant( - organization: OrganizationModel, -): Promise { - let orc8rTenant; - try { - orc8rTenant = ( - await OrchestratorAPI.tenants.tenantsTenantIdGet({ - tenantId: organization.id, - }) - ).data; - } catch (error) { - // Ignore "not found" since there is no guarantee NMS and Orc8r are in sync - rethrowUnlessNotFoundError(error); - } - - if (orc8rTenant) { - await OrchestratorAPI.tenants.tenantsTenantIdPut({ - tenant: { - id: organization.id, - name: organization.name, - networks: organization.networkIDs, - }, - tenantId: organization.id, - }); - } else { - await OrchestratorAPI.tenants.tenantsPost({ - tenant: { - id: organization.id, - name: organization.name, - networks: organization.networkIDs, - }, - }); - } -} - async function deleteOrc8rTenant(organizationId: number) { try { await OrchestratorAPI.tenants.tenantsTenantIdDelete({ @@ -338,10 +305,4 @@ async function deleteOrc8rTenant(organizationId: number) { } } -function rethrowUnlessNotFoundError(error: unknown) { - if (!(axios.isAxiosError(error) && error?.response?.status === 404)) { - throw error; - } -} - export default router; diff --git a/nms/server/util/tenantsSync.ts b/nms/server/util/tenantsSync.ts new file mode 100644 index 000000000000..e90b55917d30 --- /dev/null +++ b/nms/server/util/tenantsSync.ts @@ -0,0 +1,57 @@ +/** + * Copyright 2022 The Magma Authors. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import OrchestratorAPI from '../api/OrchestratorAPI'; +import axios from 'axios'; +import {OrganizationModel} from '../../shared/sequelize_models/models/organization'; + +export async function syncOrganizationWithOrc8rTenant( + organization: OrganizationModel, +): Promise { + let orc8rTenant; + try { + orc8rTenant = ( + await OrchestratorAPI.tenants.tenantsTenantIdGet({ + tenantId: organization.id, + }) + ).data; + } catch (error) { + // Ignore "not found" since there is no guarantee NMS and Orc8r are in sync + rethrowUnlessNotFoundError(error); + } + + if (orc8rTenant) { + await OrchestratorAPI.tenants.tenantsTenantIdPut({ + tenant: { + id: organization.id, + name: organization.name, + networks: organization.networkIDs, + }, + tenantId: organization.id, + }); + } else { + await OrchestratorAPI.tenants.tenantsPost({ + tenant: { + id: organization.id, + name: organization.name, + networks: organization.networkIDs, + }, + }); + } +} + +export function rethrowUnlessNotFoundError(error: unknown) { + if (!(axios.isAxiosError(error) && error?.response?.status === 404)) { + throw error; + } +} diff --git a/orc8r/cloud/docker/fluentd_daemon/Gemfile.lock b/orc8r/cloud/docker/fluentd_daemon/Gemfile.lock index af9a65e7b930..eaecba3448fe 100644 --- a/orc8r/cloud/docker/fluentd_daemon/Gemfile.lock +++ b/orc8r/cloud/docker/fluentd_daemon/Gemfile.lock @@ -61,7 +61,7 @@ GEM strptime (>= 0.2.4, < 1.0.0) tzinfo (>= 1.0, < 3.0) tzinfo-data (~> 1.0) - webrick (>= 1.4.2, < 1.8.0 ) + webrick (>= 1.4.2, < 1.8.0) yajl-ruby (~> 1.0) http (3.3.0) addressable (~> 2.3) @@ -110,7 +110,7 @@ GEM unf_ext unf_ext (0.0.7.6) webrick (1.7.0) - yajl-ruby (1.4.2) + yajl-ruby (1.4.3) PLATFORMS ruby diff --git a/orc8r/cloud/go/services/configurator/storage/sql.go b/orc8r/cloud/go/services/configurator/storage/sql.go index 2db6151298d2..bf9264f4b6a1 100644 --- a/orc8r/cloud/go/services/configurator/storage/sql.go +++ b/orc8r/cloud/go/services/configurator/storage/sql.go @@ -22,7 +22,6 @@ import ( sq "github.com/Masterminds/squirrel" "github.com/thoas/go-funk" - "google.golang.org/protobuf/proto" "magma/orc8r/cloud/go/sqorc" "magma/orc8r/cloud/go/storage" @@ -94,7 +93,7 @@ func (fact *sqlConfiguratorStorageFactory) InitializeServiceStorage() (err error } }() - // Named return values below so we can automatically decide tx commit/ + // Named return values below, so we can automatically decide tx commit/ // rollback in deferred function _, err = fact.builder.CreateTable(networksTable). @@ -115,7 +114,7 @@ func (fact *sqlConfiguratorStorageFactory) InitializeServiceStorage() (err error // tables that are already created will also have the type column. // TODO Remove after 1-2 months to ensure service isn't disrupted _, err = tx.Exec(fmt.Sprintf("ALTER TABLE %s ADD COLUMN IF NOT EXISTS %s text", networksTable, nwTypeCol)) - // special case sqlite3 because ADD COLUMN IF NOT EXISTS is not supported + // special case sqlite3 because ADD COLUMN IF NOT EXISTS is not supported, // and we only run sqlite3 for unit tests if err != nil && os.Getenv("SQL_DRIVER") != "sqlite3" { err = fmt.Errorf("failed to add 'type' field to networks table: %w", err) @@ -245,15 +244,13 @@ func (store *sqlConfiguratorStorage) Rollback() error { } func (store *sqlConfiguratorStorage) LoadNetworks(filter *NetworkLoadFilter, loadCriteria *NetworkLoadCriteria) (*NetworkLoadResult, error) { - filterCopy := proto.Clone(filter).(*NetworkLoadFilter) - loadCriteriaCopy := proto.Clone(loadCriteria).(*NetworkLoadCriteria) emptyRet := &NetworkLoadResult{NetworkIDsNotFound: []string{}, Networks: []*Network{}} - if funk.IsEmpty(filterCopy.Ids) && funk.IsEmpty(filterCopy.TypeFilter) { + if funk.IsEmpty(filter.Ids) && funk.IsEmpty(filter.TypeFilter) { return emptyRet, nil } - selectBuilder := store.getLoadNetworksSelectBuilder(filterCopy, loadCriteriaCopy) - if loadCriteriaCopy.LoadConfigs { + selectBuilder := store.getLoadNetworksSelectBuilder(filter, loadCriteria) + if loadCriteria.LoadConfigs { selectBuilder = selectBuilder.LeftJoin( fmt.Sprintf( "%s ON %s.%s = %s.%s", @@ -267,13 +264,13 @@ func (store *sqlConfiguratorStorage) LoadNetworks(filter *NetworkLoadFilter, loa } defer sqorc.CloseRowsLogOnError(rows, "LoadNetworks") - loadedNetworksByID, loadedNetworkIDs, err := scanNetworkRows(rows, loadCriteriaCopy) + loadedNetworksByID, loadedNetworkIDs, err := scanNetworkRows(rows, loadCriteria) if err != nil { return emptyRet, err } ret := &NetworkLoadResult{ - NetworkIDsNotFound: getNetworkIDsNotFound(loadedNetworksByID, filterCopy.Ids), + NetworkIDsNotFound: getNetworkIDsNotFound(loadedNetworksByID, filter.Ids), Networks: make([]*Network, 0, len(loadedNetworksByID)), } for _, nid := range loadedNetworkIDs { @@ -283,16 +280,15 @@ func (store *sqlConfiguratorStorage) LoadNetworks(filter *NetworkLoadFilter, loa } func (store *sqlConfiguratorStorage) LoadAllNetworks(loadCriteria *NetworkLoadCriteria) ([]*Network, error) { - emptyNetworks := []*Network{} + var emptyNetworks []*Network idsToExclude := []string{InternalNetworkID} - loadCriteriaCopy := proto.Clone(loadCriteria).(*NetworkLoadCriteria) - selectBuilder := store.builder.Select(getNetworkQueryColumns(loadCriteriaCopy)...). + selectBuilder := store.builder.Select(getNetworkQueryColumns(loadCriteria)...). From(networksTable). Where(sq.NotEq{ fmt.Sprintf("%s.%s", networksTable, nwIDCol): idsToExclude, }) - if loadCriteriaCopy.LoadConfigs { + if loadCriteria.LoadConfigs { selectBuilder = selectBuilder.LeftJoin( fmt.Sprintf( "%s ON %s.%s = %s.%s", @@ -306,7 +302,7 @@ func (store *sqlConfiguratorStorage) LoadAllNetworks(loadCriteria *NetworkLoadCr } defer sqorc.CloseRowsLogOnError(rows, "LoadAllNetworks") - loadedNetworksByID, loadedNetworkIDs, err := scanNetworkRows(rows, loadCriteriaCopy) + loadedNetworksByID, loadedNetworkIDs, err := scanNetworkRows(rows, loadCriteria) if err != nil { return emptyNetworks, err } @@ -319,42 +315,41 @@ func (store *sqlConfiguratorStorage) LoadAllNetworks(loadCriteria *NetworkLoadCr } func (store *sqlConfiguratorStorage) CreateNetwork(network *Network) (*Network, error) { - networkCopy := proto.Clone(network).(*Network) - exists, err := store.doesNetworkExist(networkCopy.ID) + exists, err := store.doesNetworkExist(network.ID) if err != nil { return &Network{}, err } if exists { - return &Network{}, fmt.Errorf("a network with ID %s already exists", networkCopy.ID) + return &Network{}, fmt.Errorf("a network with ID %s already exists", network.ID) } _, err = store.builder.Insert(networksTable). Columns(nwIDCol, nwTypeCol, nwNameCol, nwDescCol). - Values(networkCopy.ID, networkCopy.Type, networkCopy.Name, networkCopy.Description). + Values(network.ID, network.Type, network.Name, network.Description). RunWith(store.tx). Exec() if err != nil { return &Network{}, fmt.Errorf("error inserting network: %s", err) } - if funk.IsEmpty(networkCopy.Configs) { - return networkCopy, nil + if funk.IsEmpty(network.Configs) { + return network, nil } // Sort config keys for deterministic behavior - configKeys := funk.Keys(networkCopy.Configs).([]string) + configKeys := funk.Keys(network.Configs).([]string) sort.Strings(configKeys) insertBuilder := store.builder.Insert(networkConfigTable). Columns(nwcIDCol, nwcTypeCol, nwcValCol) for _, configKey := range configKeys { - insertBuilder = insertBuilder.Values(networkCopy.ID, configKey, networkCopy.Configs[configKey]) + insertBuilder = insertBuilder.Values(network.ID, configKey, network.Configs[configKey]) } _, err = insertBuilder.RunWith(store.tx).Exec() if err != nil { return &Network{}, fmt.Errorf("error inserting network configs: %w", err) } - return networkCopy, nil + return network, nil } func (store *sqlConfiguratorStorage) UpdateNetworks(updates []*NetworkUpdateCriteria) error { @@ -362,8 +357,8 @@ func (store *sqlConfiguratorStorage) UpdateNetworks(updates []*NetworkUpdateCrit return err } - networksToDelete := []string{} - networksToUpdate := []*NetworkUpdateCriteria{} + var networksToDelete []string + var networksToUpdate []*NetworkUpdateCriteria for _, update := range updates { if update.DeleteNetwork { networksToDelete = append(networksToDelete, update.ID) @@ -399,9 +394,8 @@ func (store *sqlConfiguratorStorage) UpdateNetworks(updates []*NetworkUpdateCrit } func (store *sqlConfiguratorStorage) CountEntities(networkID string, filter *EntityLoadFilter) (*EntityCountResult, error) { - filterCopy := proto.Clone(filter).(*EntityLoadFilter) ret := &EntityCountResult{Count: 0} - count, err := store.countEntities(networkID, filterCopy) + count, err := store.countEntities(networkID, filter) if err != nil { return ret, err } @@ -410,19 +404,17 @@ func (store *sqlConfiguratorStorage) CountEntities(networkID string, filter *Ent } func (store *sqlConfiguratorStorage) LoadEntities(networkID string, filter *EntityLoadFilter, criteria *EntityLoadCriteria) (*EntityLoadResult, error) { - filterCopy := proto.Clone(filter).(*EntityLoadFilter) - criteriaCopy := proto.Clone(criteria).(*EntityLoadCriteria) - if err := validatePaginatedLoadParameters(filterCopy, criteriaCopy); err != nil { + if err := validatePaginatedLoadParameters(filter, criteria); err != nil { return &EntityLoadResult{}, err } - entsByTK, err := store.loadEntities(networkID, filterCopy, criteriaCopy) + entsByTK, err := store.loadEntities(networkID, filter, criteria) if err != nil { return &EntityLoadResult{}, err } if criteria.LoadAssocsFromThis { - assocs, err := store.loadAssocs(networkID, filterCopy, criteriaCopy, loadChildren) + assocs, err := store.loadAssocs(networkID, filter, criteria, loadChildren) if err != nil { return &EntityLoadResult{}, err } @@ -439,7 +431,7 @@ func (store *sqlConfiguratorStorage) LoadEntities(networkID string, filter *Enti } if criteria.LoadAssocsToThis { - parentAssocs, err := store.loadAssocs(networkID, filterCopy, criteriaCopy, loadParents) + parentAssocs, err := store.loadAssocs(networkID, filter, criteria, loadParents) if err != nil { return &EntityLoadResult{}, err } @@ -461,10 +453,10 @@ func (store *sqlConfiguratorStorage) LoadEntities(networkID string, filter *Enti res.Entities = append(res.Entities, ent) } SortEntities(res.Entities) // for deterministic return - res.EntitiesNotFound = calculateIDsNotFound(entsByTK, filterCopy.IDs) + res.EntitiesNotFound = calculateIDsNotFound(entsByTK, filter.IDs) // Set next page token when there may be more pages to return - if len(res.Entities) == store.getEntityLoadPageSize(criteriaCopy) { + if len(res.Entities) == store.getEntityLoadPageSize(criteria) { res.NextPageToken, err = getNextPageToken(res.Entities) if err != nil { return &EntityLoadResult{}, err @@ -475,23 +467,22 @@ func (store *sqlConfiguratorStorage) LoadEntities(networkID string, filter *Enti } func (store *sqlConfiguratorStorage) CreateEntity(networkID string, entity *NetworkEntity) (*NetworkEntity, error) { - entityCopy := proto.Clone(entity).(*NetworkEntity) - exists, err := store.doesEntExist(networkID, entityCopy.GetTK()) + exists, err := store.doesEntExist(networkID, entity.GetTK()) if err != nil { return &NetworkEntity{}, err } if exists { - return &NetworkEntity{}, fmt.Errorf("an entity '%s' already exists", entityCopy.GetTK()) + return &NetworkEntity{}, fmt.Errorf("an entity '%s' already exists", entity.GetTK()) } // Physical ID must be unique across all networks, since we use a gateway's // physical ID to search for its network (and ent) - physicalIDExists, err := store.doesPhysicalIDExist(entityCopy.GetPhysicalID()) + physicalIDExists, err := store.doesPhysicalIDExist(entity.GetPhysicalID()) if err != nil { return &NetworkEntity{}, err } if physicalIDExists { - return &NetworkEntity{}, fmt.Errorf("an entity with physical ID '%s' already exists", entityCopy.GetPhysicalID()) + return &NetworkEntity{}, fmt.Errorf("an entity with physical ID '%s' already exists", entity.GetPhysicalID()) } // First insert the associations as graph edges. This step involves a @@ -503,7 +494,7 @@ func (store *sqlConfiguratorStorage) CreateEntity(networkID string, entity *Netw // shouldn't be a problem on the load side because we load graphs via // graph ID, not by traversing edges. - createdEnt, err := store.insertIntoEntityTable(networkID, entityCopy) + createdEnt, err := store.insertIntoEntityTable(networkID, entity) if err != nil { return &NetworkEntity{}, err } @@ -533,28 +524,27 @@ func (store *sqlConfiguratorStorage) CreateEntity(networkID string, entity *Netw } func (store *sqlConfiguratorStorage) UpdateEntity(networkID string, update *EntityUpdateCriteria) (*NetworkEntity, error) { - updateCopy := proto.Clone(update).(*EntityUpdateCriteria) emptyRet := &NetworkEntity{Type: update.Type, Key: update.Key} - entToUpdate, err := store.loadEntToUpdate(networkID, updateCopy) - if err != nil && !updateCopy.DeleteEntity { + entToUpdate, err := store.loadEntToUpdate(networkID, update) + if err != nil && !update.DeleteEntity { return emptyRet, fmt.Errorf("failed to load entity being updated: %w", err) } if entToUpdate == nil { return emptyRet, nil } - if updateCopy.DeleteEntity { + if update.DeleteEntity { // Cascading FK relations in the schema will handle the other tables _, err := store.builder.Delete(entityTable). Where(sq.And{ sq.Eq{entNidCol: networkID}, - sq.Eq{entTypeCol: updateCopy.Type}, - sq.Eq{entKeyCol: updateCopy.Key}, + sq.Eq{entTypeCol: update.Type}, + sq.Eq{entKeyCol: update.Key}, }). RunWith(store.tx). Exec() if err != nil { - return emptyRet, fmt.Errorf("failed to delete entity (%s, %s): %w", updateCopy.Type, updateCopy.Key, err) + return emptyRet, fmt.Errorf("failed to delete entity (%s, %s): %w", update.Type, update.Key, err) } // Deleting a node could partition its graph @@ -568,13 +558,13 @@ func (store *sqlConfiguratorStorage) UpdateEntity(networkID string, update *Enti // Then, update the fields on the entity table entToUpdate.NetworkID = networkID - err = store.processEntityFieldsUpdate(entToUpdate.Pk, updateCopy, entToUpdate) + err = store.processEntityFieldsUpdate(entToUpdate.Pk, update, entToUpdate) if err != nil { return entToUpdate, err } // Finally, process edge updates for the graph - err = store.processEdgeUpdates(networkID, updateCopy, entToUpdate) + err = store.processEdgeUpdates(networkID, update, entToUpdate) if err != nil { return entToUpdate, err } @@ -583,11 +573,9 @@ func (store *sqlConfiguratorStorage) UpdateEntity(networkID string, update *Enti } func (store *sqlConfiguratorStorage) LoadGraphForEntity(networkID string, entityID *EntityID, loadCriteria *EntityLoadCriteria) (*EntityGraph, error) { - entityIDCopy := proto.Clone(entityID).(*EntityID) - loadCriteriaCopy := proto.Clone(loadCriteria).(*EntityLoadCriteria) // We just care about getting the graph ID off this entity so use an empty // load criteria - singleEnt, err := store.loadEntities(networkID, &EntityLoadFilter{IDs: []*EntityID{entityIDCopy}}, &EntityLoadCriteria{}) + singleEnt, err := store.loadEntities(networkID, &EntityLoadFilter{IDs: []*EntityID{entityID}}, &EntityLoadCriteria{}) if err != nil { return &EntityGraph{}, fmt.Errorf("failed to load entity for graph query: %w", err) } @@ -597,10 +585,10 @@ func (store *sqlConfiguratorStorage) LoadGraphForEntity(networkID string, entity ent = e } if ent == nil { - return &EntityGraph{}, fmt.Errorf("could not find requested entity (%s) for graph query", entityIDCopy.String()) + return &EntityGraph{}, fmt.Errorf("could not find requested entity (%s) for graph query", entityID.String()) } - internalGraph, err := store.loadGraphInternal(networkID, ent.GraphID, loadCriteriaCopy) + internalGraph, err := store.loadGraphInternal(networkID, ent.GraphID, loadCriteria) if err != nil { return &EntityGraph{}, err } diff --git a/orc8r/cloud/go/services/configurator/storage/sql_entity_write_helpers.go b/orc8r/cloud/go/services/configurator/storage/sql_entity_write_helpers.go index 3e3c10bfa44a..acf77242e364 100644 --- a/orc8r/cloud/go/services/configurator/storage/sql_entity_write_helpers.go +++ b/orc8r/cloud/go/services/configurator/storage/sql_entity_write_helpers.go @@ -21,7 +21,6 @@ import ( sq "github.com/Masterminds/squirrel" "github.com/thoas/go-funk" - "google.golang.org/protobuf/proto" "magma/orc8r/cloud/go/sqorc" "magma/orc8r/cloud/go/storage" @@ -70,19 +69,18 @@ func (store *sqlConfiguratorStorage) doesPhysicalIDExist(physicalID string) (boo } func (store *sqlConfiguratorStorage) insertIntoEntityTable(networkID string, ent *NetworkEntity) (*NetworkEntity, error) { - entCopy := proto.Clone(ent).(*NetworkEntity) - entCopy.Pk = store.idGenerator.New() - entCopy.GraphID = store.idGenerator.New() // potentially-temporary graph ID + ent.Pk = store.idGenerator.New() + ent.GraphID = store.idGenerator.New() // potentially-temporary graph ID _, err := store.builder.Insert(entityTable). Columns(entPkCol, entNidCol, entTypeCol, entKeyCol, entGidCol, entNameCol, entDescCol, entPidCol, entConfCol). - Values(entCopy.Pk, networkID, entCopy.Type, entCopy.Key, entCopy.GraphID, toNullable(entCopy.Name), toNullable(entCopy.Description), toNullable(entCopy.PhysicalID), toNullable(entCopy.Config)). + Values(ent.Pk, networkID, ent.Type, ent.Key, ent.GraphID, toNullable(ent.Name), toNullable(ent.Description), toNullable(ent.PhysicalID), toNullable(ent.Config)). RunWith(store.tx). Exec() if err != nil { - return &NetworkEntity{}, fmt.Errorf("error creating entity %s: %w", entCopy.GetTK(), err) + return &NetworkEntity{}, fmt.Errorf("error creating entity %s: %w", ent.GetTK(), err) } - return entCopy, nil + return ent, nil } func (store *sqlConfiguratorStorage) createEdges(networkID string, entity *NetworkEntity) (EntitiesByTK, error) { diff --git a/orc8r/cloud/go/services/configurator/storage/sql_test.go b/orc8r/cloud/go/services/configurator/storage/sql_test.go index 393f2871a92b..e3ba4cf45ff8 100644 --- a/orc8r/cloud/go/services/configurator/storage/sql_test.go +++ b/orc8r/cloud/go/services/configurator/storage/sql_test.go @@ -43,9 +43,8 @@ var mockResult = sqlmock.NewResult(1, 1) func TestSqlConfiguratorStorage_LoadNetworks(t *testing.T) { runFactory := func(ids []string, loadCriteria *storage.NetworkLoadCriteria) func(store storage.ConfiguratorStorage) (interface{}, error) { - loadCriteriaCopy := proto.Clone(loadCriteria).(*storage.NetworkLoadCriteria) return func(store storage.ConfiguratorStorage) (interface{}, error) { - return store.LoadNetworks(&storage.NetworkLoadFilter{Ids: ids}, loadCriteriaCopy) + return store.LoadNetworks(&storage.NetworkLoadFilter{Ids: ids}, loadCriteria) } } @@ -204,9 +203,8 @@ func TestSqlConfiguratorStorage_LoadNetworks(t *testing.T) { func TestSqlConfiguratorStorage_CreateNetwork(t *testing.T) { runFactory := func(network *storage.Network) func(store storage.ConfiguratorStorage) (interface{}, error) { - networkCopy := proto.Clone(network).(*storage.Network) return func(store storage.ConfiguratorStorage) (interface{}, error) { - return store.CreateNetwork(networkCopy) + return store.CreateNetwork(network) } } @@ -431,10 +429,8 @@ func TestSqlConfiguratorStorage_UpdateNetworks(t *testing.T) { func TestSqlConfiguratorStorage_LoadEntities(t *testing.T) { runFactory := func(networkID string, filter *storage.EntityLoadFilter, loadCriteria *storage.EntityLoadCriteria) func(store storage.ConfiguratorStorage) (interface{}, error) { - filterCopy := proto.Clone(filter).(*storage.EntityLoadFilter) - loadCriteriaCopy := proto.Clone(loadCriteria).(*storage.EntityLoadCriteria) return func(store storage.ConfiguratorStorage) (interface{}, error) { - return store.LoadEntities(networkID, filterCopy, loadCriteriaCopy) + return store.LoadEntities(networkID, filter, loadCriteria) } } @@ -944,9 +940,8 @@ func TestSqlConfiguratorStorage_LoadEntities(t *testing.T) { func TestSqlConfiguratorStorage_CreateEntity(t *testing.T) { runFactory := func(networkID string, entity *storage.NetworkEntity) func(store storage.ConfiguratorStorage) (interface{}, error) { - entityCopy := proto.Clone(entity).(*storage.NetworkEntity) return func(store storage.ConfiguratorStorage) (interface{}, error) { - return store.CreateEntity(networkID, entityCopy) + return store.CreateEntity(networkID, entity) } } @@ -1063,9 +1058,8 @@ func TestSqlConfiguratorStorage_CreateEntity(t *testing.T) { func TestSqlConfiguratorStorage_UpdateEntity(t *testing.T) { runFactory := func(networkID string, update *storage.EntityUpdateCriteria) func(store storage.ConfiguratorStorage) (interface{}, error) { - updateCopy := proto.Clone(update).(*storage.EntityUpdateCriteria) return func(store storage.ConfiguratorStorage) (interface{}, error) { - return store.UpdateEntity(networkID, updateCopy) + return store.UpdateEntity(networkID, update) } } @@ -1339,10 +1333,8 @@ func TestSqlConfiguratorStorage_UpdateEntity(t *testing.T) { func TestSqlConfiguratorStorage_LoadGraphForEntity(t *testing.T) { runFactory := func(networkID string, entityID *storage.EntityID, loadCriteria *storage.EntityLoadCriteria) func(store storage.ConfiguratorStorage) (interface{}, error) { - entityIDCopy := proto.Clone(entityID).(*storage.EntityID) - loadCriteriaCopy := proto.Clone(loadCriteria).(*storage.EntityLoadCriteria) return func(store storage.ConfiguratorStorage) (interface{}, error) { - return store.LoadGraphForEntity(networkID, entityIDCopy, loadCriteriaCopy) + return store.LoadGraphForEntity(networkID, entityID, loadCriteria) } } @@ -1655,7 +1647,6 @@ func getTestCaseForEntityUpdate( expectedEdgeLoads []expectedEntQueryResult, expectedGraphMerges ...[2]string, ) *testCase { - updateCopy := proto.Clone(update).(*storage.EntityUpdateCriteria) expectedResult := &storage.NetworkEntity{ NetworkID: "network", Type: entToUpdate.entType, @@ -1664,12 +1655,12 @@ func getTestCaseForEntityUpdate( Pk: entToUpdate.pk, Version: entToUpdate.version + 1, - Name: stringValue(updateCopy.NewName), - Description: stringValue(updateCopy.NewDescription), - Config: bytesVal(updateCopy.NewConfig), + Name: stringValue(update.NewName), + Description: stringValue(update.NewDescription), + Config: bytesVal(update.NewConfig), } - if updateCopy.NewPhysicalID != nil { - expectedResult.PhysicalID = updateCopy.NewPhysicalID.Value + if update.NewPhysicalID != nil { + expectedResult.PhysicalID = update.NewPhysicalID.Value } else { expectedResult.PhysicalID = entToUpdate.physicalID } @@ -1681,11 +1672,11 @@ func getTestCaseForEntityUpdate( }, ).(map[orc8r_storage.TK]expectedEntQueryResult) - if !funk.IsEmpty(updateCopy.AssociationsToAdd) { - expectedResult.Associations = append(expectedResult.Associations, updateCopy.AssociationsToAdd...) + if !funk.IsEmpty(update.AssociationsToAdd) { + expectedResult.Associations = append(expectedResult.Associations, update.AssociationsToAdd...) } - if updateCopy.AssociationsToSet != nil { - expectedResult.Associations = append(expectedResult.Associations, updateCopy.AssociationsToSet.AssociationsToSet...) + if update.AssociationsToSet != nil { + expectedResult.Associations = append(expectedResult.Associations, update.AssociationsToSet.AssociationsToSet...) } if !funk.IsEmpty(expectedGraphMerges) { @@ -1696,28 +1687,28 @@ func getTestCaseForEntityUpdate( setup: func(m sqlmock.Sqlmock) { // Basic fields expectBasicEntityQueries(m, entToUpdate) - updateWithArgs := []driver.Value{} - if updateCopy.NewName != nil { - updateWithArgs = append(updateWithArgs, updateCopy.NewName.Value) + var updateWithArgs []driver.Value + if update.NewName != nil { + updateWithArgs = append(updateWithArgs, update.NewName.Value) } - if updateCopy.NewDescription != nil { - updateWithArgs = append(updateWithArgs, updateCopy.NewDescription.Value) + if update.NewDescription != nil { + updateWithArgs = append(updateWithArgs, update.NewDescription.Value) } - if updateCopy.NewPhysicalID != nil { - updateWithArgs = append(updateWithArgs, updateCopy.NewPhysicalID.Value) + if update.NewPhysicalID != nil { + updateWithArgs = append(updateWithArgs, update.NewPhysicalID.Value) } - if updateCopy.NewConfig != nil { - updateWithArgs = append(updateWithArgs, updateCopy.NewConfig.Value) + if update.NewConfig != nil { + updateWithArgs = append(updateWithArgs, update.NewConfig.Value) } updateWithArgs = append(updateWithArgs, entToUpdate.pk) m.ExpectExec("UPDATE cfg_entities").WithArgs(updateWithArgs...).WillReturnResult(mockResult) // Graph - if updateCopy.AssociationsToSet != nil { + if update.AssociationsToSet != nil { m.ExpectExec("DELETE FROM cfg_assocs").WithArgs(entToUpdate.pk).WillReturnResult(mockResult) - expectEdgeQueries(m, updateCopy.AssociationsToSet.AssociationsToSet, edgeLoadsByTk) - expectEdgeInsertions(m, assocsToEdges(entToUpdate.pk, updateCopy.AssociationsToSet.AssociationsToSet, edgeLoadsByTk)) + expectEdgeQueries(m, update.AssociationsToSet.AssociationsToSet, edgeLoadsByTk) + expectEdgeInsertions(m, assocsToEdges(entToUpdate.pk, update.AssociationsToSet.AssociationsToSet, edgeLoadsByTk)) if !funk.IsEmpty(expectedGraphMerges) { expectMergeGraphs(m, expectedGraphMerges) } @@ -1732,17 +1723,17 @@ func getTestCaseForEntityUpdate( ) } - if !funk.IsEmpty(updateCopy.AssociationsToAdd) { - expectEdgeQueries(m, updateCopy.AssociationsToAdd, edgeLoadsByTk) - expectEdgeInsertions(m, assocsToEdges(entToUpdate.pk, updateCopy.AssociationsToAdd, edgeLoadsByTk)) + if !funk.IsEmpty(update.AssociationsToAdd) { + expectEdgeQueries(m, update.AssociationsToAdd, edgeLoadsByTk) + expectEdgeInsertions(m, assocsToEdges(entToUpdate.pk, update.AssociationsToAdd, edgeLoadsByTk)) if !funk.IsEmpty(expectedGraphMerges) { expectMergeGraphs(m, expectedGraphMerges) } } - if !funk.IsEmpty(updateCopy.AssociationsToDelete) { - expectEdgeQueries(m, updateCopy.AssociationsToDelete, edgeLoadsByTk) - expectEdgeDeletions(m, assocsToEdges(entToUpdate.pk, updateCopy.AssociationsToDelete, edgeLoadsByTk)) + if !funk.IsEmpty(update.AssociationsToDelete) { + expectEdgeQueries(m, update.AssociationsToDelete, edgeLoadsByTk) + expectEdgeDeletions(m, assocsToEdges(entToUpdate.pk, update.AssociationsToDelete, edgeLoadsByTk)) // fix graph, but no partition detected expectBulkEntityQuery(m, []driver.Value{entToUpdate.graphID}, entToUpdate) @@ -1755,7 +1746,7 @@ func getTestCaseForEntityUpdate( } }, run: func(store storage.ConfiguratorStorage) (interface{}, error) { - return store.UpdateEntity("network", updateCopy) + return store.UpdateEntity("network", update) }, expectedResult: expectedResult, } diff --git a/orc8r/cloud/go/services/configurator/storage/storage.go b/orc8r/cloud/go/services/configurator/storage/storage.go index 573754a83057..dac9c82717c7 100644 --- a/orc8r/cloud/go/services/configurator/storage/storage.go +++ b/orc8r/cloud/go/services/configurator/storage/storage.go @@ -20,7 +20,6 @@ import ( "github.com/golang/glog" "github.com/thoas/go-funk" - "google.golang.org/protobuf/proto" "magma/orc8r/cloud/go/storage" ) @@ -162,12 +161,11 @@ func (m *NetworkEntity) GetTK() storage.TK { } func (m *NetworkEntity) GetGraphEdges() []*GraphEdge { - mCopy := proto.Clone(m).(*NetworkEntity) - myID := mCopy.GetID() + myID := m.GetID() existingAssocs := map[storage.TK]bool{} - edges := make([]*GraphEdge, 0, len(mCopy.Associations)) - for _, assoc := range mCopy.Associations { + edges := make([]*GraphEdge, 0, len(m.Associations)) + for _, assoc := range m.Associations { if _, exists := existingAssocs[assoc.ToTK()]; exists { continue } diff --git a/orc8r/cloud/go/services/tenants/client_api.go b/orc8r/cloud/go/services/tenants/client_api.go index 2165e1d7c8ca..94d589ad3f28 100644 --- a/orc8r/cloud/go/services/tenants/client_api.go +++ b/orc8r/cloud/go/services/tenants/client_api.go @@ -19,7 +19,6 @@ import ( "github.com/golang/glog" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" tenant_protos "magma/orc8r/cloud/go/services/tenants/protos" "magma/orc8r/lib/go/merrors" @@ -92,12 +91,11 @@ func SetTenant(ctx context.Context, tenantID int64, tenant *tenant_protos.Tenant return err } - tenantCopy := proto.Clone(tenant).(*tenant_protos.Tenant) _, err = oc.SetTenant( ctx, &tenant_protos.IDAndTenant{ Id: tenantID, - Tenant: tenantCopy, + Tenant: tenant, }, ) if err != nil { @@ -155,8 +153,7 @@ func CreateOrUpdateControlProxy(ctx context.Context, controlProxy *tenant_protos return err } - controlProxyCopy := proto.Clone(controlProxy).(*tenant_protos.CreateOrUpdateControlProxyRequest) - _, err = oc.CreateOrUpdateControlProxy(ctx, controlProxyCopy) + _, err = oc.CreateOrUpdateControlProxy(ctx, controlProxy) if err != nil { return mapErr(err) } diff --git a/orc8r/gateway/python/magma/magmad/config_manager.py b/orc8r/gateway/python/magma/magmad/config_manager.py index 1873dcbebd81..2f19a7c9f35a 100644 --- a/orc8r/gateway/python/magma/magmad/config_manager.py +++ b/orc8r/gateway/python/magma/magmad/config_manager.py @@ -158,7 +158,6 @@ def did_mconfig_change(serv_name): ), ) - services_to_restart = [] if SHARED_MCONFIG in mconfig.configs_by_key and did_mconfig_change(SHARED_MCONFIG): logging.info("Shared config changed. Restarting all services.") services_to_restart = self._services diff --git a/orc8r/gateway/python/magma/magmad/main.py b/orc8r/gateway/python/magma/magmad/main.py index ca8b7948ffb9..d6186dfa3801 100644 --- a/orc8r/gateway/python/magma/magmad/main.py +++ b/orc8r/gateway/python/magma/magmad/main.py @@ -63,6 +63,7 @@ def main(): # Create service manager services = service.config.get('magma_services') init_system = service.config.get('init_system', 'systemd') + logging.info("Running magmad with init system %s", init_system) registered_dynamic_services = service.config.get( 'registered_dynamic_services', [], ) diff --git a/src/go/capture/README.md b/src/go/capture/README.md index 36adfcffa543..2843d71feb77 100644 --- a/src/go/capture/README.md +++ b/src/go/capture/README.md @@ -1,13 +1,13 @@ -#Capture Service +# Capture Service The capture service allows remote introspection into RPC calls of any GRPC service. Targeting is config driven -##Prerequisites +## Prerequisites - Running the capture service requires that the capture service dial/server options are attached to the GRPC client or GRPC server. - /src/go/middleware.go has two helper functions```GetDialOptions```and```GetServerOptions```that handle this for you. The capture service expects identical config and capture.Buffer pointers to be passed into the middleware. -##Configuration Instructions +## Configuration Instructions - The capture service holds a pointer to the config option, so changing the targeted MatchSpecs can be done without restarting the service. - Multiple MatchSpecs can be set and it also supports wildcarding. ### Examples: @@ -32,7 +32,7 @@ Targeting is config driven Method: "*", } ``` -4. Record all RPCs. +- Record all RPCs. ``` &configpb.CaptureConfig_MatchSpec{ Service: "*", @@ -40,25 +40,27 @@ Targeting is config driven } ``` -#Command Line Use +# Command Line Use Using prototool is an easy way to make grpc calls. https://github.com/uber/prototool -##Flush Capture Service Buffer +## Flush Capture Service Buffer ```prototool grpc --address 192.168.60.142:6001 --method magma.capture.Capture/Flush --data '{}'``` -##Get Config from Config Service +## Get Config from Config Service ```prototool grpc --address 192.168.60.142:6000 --method magma.config.Config/GetConfig --data '{}'``` -##Replace config with wild card matchspec +## Replace config with wild card matchspec -```prototool grpc --address 192.168.60.142:6000 --method magma.config.Config/ReplaceConfig --data '{"config":{"logLevel":"INFO","sctpdDownstreamServiceTarget":"unix:///tmp/sctpd_downstream.sock","sctpdUpstreamServiceTarget":"unix:///tmp/sctpd_upstream.sock","mmeSctpdDownstreamServiceTarget":"unix:///tmp/mme_sctpd_downstream.sock","mmeSctpdUpstreamServiceTarget":"unix:///tmp/mme_sctpd_upstream.sock","configServicePort":"6000","vagrantPrivateNetworkIp":"192.168.60.142","captureServicePort":"6001","captureConfig":{"matchSpecs":[{"service":"*","method":"*"}]}}}'``` +``` +prototool grpc --address 192.168.60.142:6000 --method magma.config.Config/ReplaceConfig --data '{"config":{"logLevel":"INFO","sctpdDownstreamServiceTarget":"unix:///tmp/sctpd_downstream.sock","sctpdUpstreamServiceTarget":"unix:///tmp/sctpd_upstream.sock","mmeSctpdDownstreamServiceTarget":"unix:///tmp/mme_sctpd_downstream.sock","mmeSctpdUpstreamServiceTarget":"unix:///tmp/mme_sctpd_upstream.sock","configServicePort":"6000","vagrantPrivateNetworkIp":"192.168.60.142","captureServicePort":"6001","captureConfig":{"matchSpecs":[{"service":"*","method":"*"}]}}}' +``` -#Golden File Generation +# Golden File Generation 1. Follow prerequisites listed above and ensure that magma vm and trfgen vm are both on and AGWD is running on magma VM and proxying sctpd uplink and downlink traffic. 2. Build and run the capture service from the magma_test vm ```