From f28853b537355b9ce04d7f3617bc80b3f0c34a1a Mon Sep 17 00:00:00 2001 From: Juha Hyttinen Date: Mon, 9 Mar 2020 14:02:50 +0200 Subject: [PATCH] Subsfailure case internal delete and retry in duplicate cause case Remove deadcode Change-Id: I1dec5ff890174e3bbb246ad1d9a2f391c3bda97e Signed-off-by: Juha Hyttinen --- container-tag.yaml | 2 +- e2ap/libe2ap_wrapper/wrapper.c | 415 --------------------- e2ap/libe2ap_wrapper/wrapper.h | 68 ---- e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscription.go | 4 +- .../e2ap/e2ap_tests/msg_e2ap_subscriptiondelete.go | 2 +- e2ap/pkg/e2ap/msg_e2ap.go | 173 +++++---- e2ap/pkg/e2ap_wrapper/packer_e2ap.go | 8 +- pkg/control/control.go | 42 ++- pkg/control/e2ap.go | 2 - pkg/control/ut_messaging_test.go | 198 +++++++++- pkg/teststube2ap/stubE2.go | 10 +- 11 files changed, 328 insertions(+), 596 deletions(-) delete mode 100644 e2ap/libe2ap_wrapper/wrapper.c delete mode 100644 e2ap/libe2ap_wrapper/wrapper.h diff --git a/container-tag.yaml b/container-tag.yaml index 31d99a0..def39d2 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -2,4 +2,4 @@ # By default this file is in the docker build directory, # but the location can configured in the JJB template. --- -tag: "4.0.0.4" +tag: "4.0.0.5" diff --git a/e2ap/libe2ap_wrapper/wrapper.c b/e2ap/libe2ap_wrapper/wrapper.c deleted file mode 100644 index bd34275..0000000 --- a/e2ap/libe2ap_wrapper/wrapper.c +++ /dev/null @@ -1,415 +0,0 @@ -/* -================================================================================== - Copyright (c) 2019 AT&T Intellectual Property. - Copyright (c) 2019 Nokia - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - 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. -================================================================================== -*/ - -#include -#include "wrapper.h" - -size_t encode_E2AP_PDU(E2AP_PDU_t* pdu, void* buffer, size_t buf_size) -{ - asn_enc_rval_t encode_result; - encode_result = aper_encode_to_buffer(&asn_DEF_E2AP_PDU, NULL, pdu, buffer, buf_size); - if (encode_result.encoded == -1) { - return -1; - } - return encode_result.encoded; -} - -E2AP_PDU_t* decode_E2AP_PDU(const void* buffer, size_t buf_size) -{ - asn_dec_rval_t decode_result; - E2AP_PDU_t *pdu = 0; - decode_result = aper_decode_complete(NULL, &asn_DEF_E2AP_PDU, (void **)&pdu, buffer, buf_size); - if (decode_result.code == RC_OK) { - return pdu; - } else { - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return 0; - } -} - -long e2ap_get_ric_subscription_request_sequence_number(void *buffer, size_t buf_size) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_initiatingMessage) - { - RICInitiatingMessage_t* initiatingMessage = &pdu->choice.initiatingMessage; - if ( initiatingMessage->procedureCode == ProcedureCode_id_ricSubscription - && initiatingMessage->value.present == RICInitiatingMessage__value_PR_RICsubscriptionRequest) - { - RICsubscriptionRequest_t *ric_subscription_request = &(initiatingMessage->value.choice.RICsubscriptionRequest); - for (int i = 0; i < ric_subscription_request->protocolIEs.list.count; ++i) - { - if (ric_subscription_request->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - long sequence_number = ric_subscription_request->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber; - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return sequence_number; - } - else - errorCode = -3; - } - } - else - errorCode = -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} - -ssize_t e2ap_set_ric_subscription_request_sequence_number(void *buffer, size_t buf_size, long sequence_number) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_initiatingMessage) - { - RICInitiatingMessage_t* initiatingMessage = &pdu->choice.initiatingMessage; - if ( initiatingMessage->procedureCode == ProcedureCode_id_ricSubscription - && initiatingMessage->value.present == RICInitiatingMessage__value_PR_RICsubscriptionRequest) - { - RICsubscriptionRequest_t *ricSubscriptionRequest = &initiatingMessage->value.choice.RICsubscriptionRequest; - for (int i = 0; i < ricSubscriptionRequest->protocolIEs.list.count; ++i) - { - if (ricSubscriptionRequest->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - ricSubscriptionRequest->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number; - size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size); - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return encode_size; - } - else - errorCode = -3; - } - } - else - return -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} - -/* RICsubscriptionResponse */ -long e2ap_get_ric_subscription_response_sequence_number(void *buffer, size_t buf_size) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_successfulOutcome) - { - RICSuccessfulOutcome_t* successfulOutcome = &pdu->choice.successfulOutcome; - if ( successfulOutcome->procedureCode == ProcedureCode_id_ricSubscription - && successfulOutcome->value.present == RICSuccessfulOutcome__value_PR_RICsubscriptionResponse) - { - RICsubscriptionResponse_t *ricSubscriptionResponse = &successfulOutcome->value.choice.RICsubscriptionResponse; - for (int i = 0; i < ricSubscriptionResponse->protocolIEs.list.count; ++i) - { - if (ricSubscriptionResponse->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - long sequence_number = ricSubscriptionResponse->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber; - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return sequence_number; - } - else - errorCode = -3; - } - } - else - errorCode = -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} - -ssize_t e2ap_set_ric_subscription_response_sequence_number(void *buffer, size_t buf_size, long sequence_number) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_successfulOutcome) - { - RICSuccessfulOutcome_t* successfulOutcome = &pdu->choice.successfulOutcome; - if ( successfulOutcome->procedureCode == ProcedureCode_id_ricSubscription - && successfulOutcome->value.present == RICSuccessfulOutcome__value_PR_RICsubscriptionResponse) - { - RICsubscriptionResponse_t *ricSubscriptionResponse = &successfulOutcome->value.choice.RICsubscriptionResponse; - for (int i = 0; i < ricSubscriptionResponse->protocolIEs.list.count; ++i) - { - if (ricSubscriptionResponse->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - ricSubscriptionResponse->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number; - size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size); - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return encode_size; - } - else - errorCode = -3; - } - } - else - errorCode = -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} - -/* RICsubscriptionDeleteRequest */ -long e2ap_get_ric_subscription_delete_request_sequence_number(void *buffer, size_t buf_size) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_initiatingMessage) - { - RICInitiatingMessage_t* initiatingMessage = &pdu->choice.initiatingMessage; - if ( initiatingMessage->procedureCode == ProcedureCode_id_ricSubscriptionDelete - && initiatingMessage->value.present == RICInitiatingMessage__value_PR_RICsubscriptionDeleteRequest ) - { - RICsubscriptionDeleteRequest_t *subscriptionDeleteRequest = &initiatingMessage->value.choice.RICsubscriptionDeleteRequest; - for (int i = 0; i < subscriptionDeleteRequest->protocolIEs.list.count; ++i) - { - if (subscriptionDeleteRequest->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - long sequence_number = subscriptionDeleteRequest->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber; - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return sequence_number; - } - else - errorCode = -3; - } - } - else - errorCode = -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} - -ssize_t e2ap_set_ric_subscription_delete_request_sequence_number(void *buffer, size_t buf_size, long sequence_number) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_initiatingMessage) - { - RICInitiatingMessage_t* initiatingMessage = &pdu->choice.initiatingMessage; - if ( initiatingMessage->procedureCode == ProcedureCode_id_ricSubscriptionDelete - && initiatingMessage->value.present == RICInitiatingMessage__value_PR_RICsubscriptionDeleteRequest ) - { - RICsubscriptionDeleteRequest_t* subscriptionDeleteRequest = &initiatingMessage->value.choice.RICsubscriptionDeleteRequest; - for (int i = 0; i < subscriptionDeleteRequest->protocolIEs.list.count; ++i) - { - if (subscriptionDeleteRequest->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - subscriptionDeleteRequest->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number; - size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size); - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return encode_size; - } - else - errorCode = -3; - } - } - else - errorCode = -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} - -/* RICsubscriptionDeleteResponse */ -long e2ap_get_ric_subscription_delete_response_sequence_number(void *buffer, size_t buf_size) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_successfulOutcome) - { - RICSuccessfulOutcome_t* successfulOutcome = &pdu->choice.successfulOutcome; - if ( successfulOutcome->procedureCode == ProcedureCode_id_ricSubscriptionDelete - && successfulOutcome->value.present == RICSuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse ) - { - RICsubscriptionDeleteResponse_t* subscriptionDeleteResponse = &successfulOutcome->value.choice.RICsubscriptionDeleteResponse; - for (int i = 0; i < subscriptionDeleteResponse->protocolIEs.list.count; ++i) - { - if (subscriptionDeleteResponse->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - long sequence_number = subscriptionDeleteResponse->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber; - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return sequence_number; - } - else - errorCode = -3; - } - } - else - errorCode = -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} - -ssize_t e2ap_set_ric_subscription_delete_response_sequence_number(void *buffer, size_t buf_size, long sequence_number) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_successfulOutcome) - { - RICSuccessfulOutcome_t* successfulOutcome = &pdu->choice.successfulOutcome; - if ( successfulOutcome->procedureCode == ProcedureCode_id_ricSubscriptionDelete - && successfulOutcome->value.present == RICSuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse ) - { - RICsubscriptionDeleteResponse_t* subscriptionDeleteResponse = &successfulOutcome->value.choice.RICsubscriptionDeleteResponse; - for (int i = 0; i < subscriptionDeleteResponse->protocolIEs.list.count; ++i) - { - if (subscriptionDeleteResponse->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - subscriptionDeleteResponse->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number; - size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size); - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return encode_size; - } - else - errorCode = -3; - } - } - else - errorCode = -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} - -// This function is not used currently. Can be deleted if not needed -ssize_t e2ap_set_ric_subscription_failure_sequence_number(void *buffer, size_t buf_size, long sequence_number) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_unsuccessfulOutcome) - { - RICUnsuccessfulOutcome_t* unsuccessfulOutcome = &pdu->choice.unsuccessfulOutcome; - if (unsuccessfulOutcome->procedureCode == ProcedureCode_id_ricSubscription - && unsuccessfulOutcome->value.present == RICUnsuccessfulOutcome__value_PR_RICsubscriptionFailure) - { - RICsubscriptionFailure_t* subscriptionFailure = &unsuccessfulOutcome->value.choice.RICsubscriptionFailure; - for (int i = 0; i < subscriptionFailure->protocolIEs.list.count; ++i) - { - if (subscriptionFailure->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - subscriptionFailure->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number; - size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size); - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return encode_size; - } - else - errorCode = -3; - } - } - else - errorCode = -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} - -long e2ap_get_ric_subscription_failure_sequence_number(void *buffer, size_t buf_size) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_unsuccessfulOutcome) - { - RICUnsuccessfulOutcome_t* unsuccessfulOutcome = &pdu->choice.unsuccessfulOutcome; - if (unsuccessfulOutcome->procedureCode == ProcedureCode_id_ricSubscription - && unsuccessfulOutcome->value.present == RICUnsuccessfulOutcome__value_PR_RICsubscriptionFailure) - { - RICsubscriptionFailure_t* subscriptionFailure = &unsuccessfulOutcome->value.choice.RICsubscriptionFailure;; - for (int i = 0; i < subscriptionFailure->protocolIEs.list.count; ++i) - { - if (subscriptionFailure->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - long sequence_number = subscriptionFailure->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber; - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return sequence_number; - } - else - errorCode = -3; - } - } - else - errorCode = -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} - -// This function is not used currently. Can be deleted if not needed -ssize_t e2ap_set_ric_subscription_delete_failure_sequence_number(void *buffer, size_t buf_size, long sequence_number) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_unsuccessfulOutcome) - { - RICUnsuccessfulOutcome_t* unsuccessfulOutcome = &pdu->choice.unsuccessfulOutcome; - if (unsuccessfulOutcome->procedureCode == ProcedureCode_id_ricSubscriptionDelete - && unsuccessfulOutcome->value.present == RICUnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure) - { - RICsubscriptionDeleteFailure_t* subscriptionDeleteFailure = &unsuccessfulOutcome->value.choice.RICsubscriptionDeleteFailure; - for (int i = 0; i < subscriptionDeleteFailure->protocolIEs.list.count; ++i) - { - if (subscriptionDeleteFailure->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - subscriptionDeleteFailure->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber = sequence_number; - size_t encode_size = encode_E2AP_PDU(pdu, buffer, buf_size); - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return encode_size; - } - else - errorCode = -3; - } - } - else - errorCode = -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} - -long e2ap_get_ric_subscription_delete_failure_sequence_number(void *buffer, size_t buf_size) -{ - int errorCode = -1; - E2AP_PDU_t *pdu = decode_E2AP_PDU(buffer, buf_size); - if (pdu != NULL && pdu->present == E2AP_PDU_PR_unsuccessfulOutcome) - { - RICUnsuccessfulOutcome_t* unsuccessfulOutcome = &pdu->choice.unsuccessfulOutcome; - if (unsuccessfulOutcome->procedureCode == ProcedureCode_id_ricSubscriptionDelete - && unsuccessfulOutcome->value.present == RICUnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure) - { - RICsubscriptionDeleteFailure_t* subscriptionDeleteFailure = &unsuccessfulOutcome->value.choice.RICsubscriptionDeleteFailure;; - for (int i = 0; i < subscriptionDeleteFailure->protocolIEs.list.count; ++i) - { - if (subscriptionDeleteFailure->protocolIEs.list.array[i]->id == ProtocolIE_ID_id_RICrequestID) - { - long sequence_number = subscriptionDeleteFailure->protocolIEs.list.array[i]->value.choice.RICrequestID.ricRequestSequenceNumber; - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return sequence_number; - } - else - errorCode = -3; - } - } - else - errorCode = -2; - } - ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu); - return errorCode; -} diff --git a/e2ap/libe2ap_wrapper/wrapper.h b/e2ap/libe2ap_wrapper/wrapper.h deleted file mode 100644 index ee6c9bc..0000000 --- a/e2ap/libe2ap_wrapper/wrapper.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -================================================================================== - Copyright (c) 2019 AT&T Intellectual Property. - Copyright (c) 2019 Nokia - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - 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 _WRAPPER_H_ -#define _WRAPPER_H_ - -#ifndef ASN_DISABLE_OER_SUPPORT -#define ASN_DISABLE_OER_SUPPORT -#endif - -#include "RICsubscriptionRequest.h" -#include "RICsubscriptionResponse.h" -#include "RICsubscriptionDeleteRequest.h" -#include "RICsubscriptionDeleteResponse.h" -#include "RICsubscriptionFailure.h" -#include "RICsubscriptionDeleteFailure.h" -#include "E2AP-PDU.h" -#include "RICInitiatingMessage.h" -#include "RICSuccessfulOutcome.h" -#include "RICUnsuccessfulOutcome.h" -#include "ProtocolIE-Container.h" -#include "ProtocolIE-Field.h" - -size_t encode_E2AP_PDU(E2AP_PDU_t* pdu, void* buffer, size_t buf_size); -E2AP_PDU_t* decode_E2AP_PDU(const void* buffer, size_t buf_size); - -long e2ap_get_ric_subscription_request_sequence_number(void *buffer, size_t buf_size); -ssize_t e2ap_set_ric_subscription_request_sequence_number(void *buffer, size_t buf_size, long sequence_number); -RICsubscription_t* e2ap_get_ric_subscription_request_ric_subscription(void *buffer, size_t buffer_size); - -/* RICsubscriptionResponse */ -long e2ap_get_ric_subscription_response_sequence_number(void *buffer, size_t buf_size); -ssize_t e2ap_set_ric_subscription_response_sequence_number(void *buffer, size_t buf_size, long sequence_number); - -/* RICsubscriptionDeleteRequest */ -long e2ap_get_ric_subscription_delete_request_sequence_number(void *buffer, size_t buf_size); -ssize_t e2ap_set_ric_subscription_delete_request_sequence_number(void *buffer, size_t buf_size, long sequence_number); - -/* RICsubscriptionDeleteResponse */ -long e2ap_get_ric_subscription_delete_response_sequence_number(void *buffer, size_t buf_size); -ssize_t e2ap_set_ric_subscription_delete_response_sequence_number(void *buffer, size_t buf_size, long sequence_number); - -/* RICsubscriptionFailure */ -long e2ap_get_ric_subscription_failure_sequence_number(void *buffer, size_t buf_size); -ssize_t e2ap_set_ric_subscription_failure_sequence_number(void *buffer, size_t buf_size, long sequence_number); - -/* RICsubscriptionFailure */ -long e2ap_get_ric_subscription_delete_failure_sequence_number(void *buffer, size_t buf_size); -ssize_t e2ap_set_ric_subscription_delete_failure_sequence_number(void *buffer, size_t buf_size, long sequence_number); - - -#endif /* _WRAPPER_H_ */ diff --git a/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscription.go b/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscription.go index 50a4eab..9b2d8c6 100644 --- a/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscription.go +++ b/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscription.go @@ -132,7 +132,7 @@ func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionResponse(t *testing.T) { item := e2ap.ActionNotAdmittedItem{} item.ActionId = index item.Cause.Content = 1 - item.Cause.CauseVal = 1 + item.Cause.Value = 1 arespenc.ActionNotAdmittedList.Items = append(arespenc.ActionNotAdmittedList.Items, item) } @@ -170,7 +170,7 @@ func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionFailure(t *testing.T) { item := e2ap.ActionNotAdmittedItem{} item.ActionId = index item.Cause.Content = 1 - item.Cause.CauseVal = 1 + item.Cause.Value = 1 afailenc.ActionNotAdmittedList.Items = append(afailenc.ActionNotAdmittedList.Items, item) } // NOT SUPPORTED CURRENTLY diff --git a/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscriptiondelete.go b/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscriptiondelete.go index 9eeccff..eae103e 100644 --- a/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscriptiondelete.go +++ b/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscriptiondelete.go @@ -104,7 +104,7 @@ func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionDeleteFailure(t *testing.T) { afailenc.RequestId.Seq = 22 afailenc.FunctionId = 33 afailenc.Cause.Content = 1 - afailenc.Cause.CauseVal = 1 + afailenc.Cause.Value = 1 // NOT SUPPORTED CURRENTLY // afailenc.CriticalityDiagnostics.Present = false // afailenc.CriticalityDiagnostics.ProcCodePresent = true diff --git a/e2ap/pkg/e2ap/msg_e2ap.go b/e2ap/pkg/e2ap/msg_e2ap.go index 2784a2c..8020049 100644 --- a/e2ap/pkg/e2ap/msg_e2ap.go +++ b/e2ap/pkg/e2ap/msg_e2ap.go @@ -96,83 +96,6 @@ const ( // ) -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -const ( - E2AP_IndicationTypeReport uint64 = 0 - E2AP_IndicationTypeInsert uint64 = 1 -) - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -const ( - E2AP_ActionTypeReport uint64 = 0 - E2AP_ActionTypeInsert uint64 = 1 - E2AP_ActionTypePolicy uint64 = 2 - E2AP_ActionTypeInvalid uint64 = 99 // For RIC internal usage only -) - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -const ( - E2AP_SubSeqActionTypeContinue uint64 = 0 - E2AP_SubSeqActionTypeWait uint64 = 1 -) - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -const ( - E2AP_TimeToWaitZero uint64 = 0 - E2AP_TimeToWaitW1ms uint64 = 1 - E2AP_TimeToWaitW2ms uint64 = 2 - E2AP_TimeToWaitW5ms uint64 = 3 - E2AP_TimeToWaitW10ms uint64 = 4 - E2AP_TimeToWaitW20ms uint64 = 4 - E2AP_TimeToWaitW30ms uint64 = 5 - E2AP_TimeToWaitW40ms uint64 = 6 - E2AP_TimeToWaitW50ms uint64 = 7 - E2AP_TimeToWaitW100ms uint64 = 8 - E2AP_TimeToWaitW200ms uint64 = 9 - E2AP_TimeToWaitW500ms uint64 = 10 - E2AP_TimeToWaitW1s uint64 = 11 - E2AP_TimeToWaitW2s uint64 = 12 - E2AP_TimeToWaitW5s uint64 = 13 - E2AP_TimeToWaitW10s uint64 = 14 - E2AP_TimeToWaitW20s uint64 = 15 - E2AP_TimeToWaitW60 uint64 = 16 -) - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -const ( - E2AP_InterfaceDirectionIncoming uint32 = 0 - E2AP_InterfaceDirectionOutgoing uint32 = 1 -) - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -const ( - E2AP_CriticalityReject uint8 = 0 - E2AP_CriticalityIgnore uint8 = 1 - E2AP_CriticalityNotify uint8 = 2 -) - -//----------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------- -const ( - E2AP_ENBIDMacroPBits20 uint8 = 20 - E2AP_ENBIDHomeBits28 uint8 = 28 - E2AP_ENBIDShortMacroits18 uint8 = 18 - E2AP_ENBIDlongMacroBits21 uint8 = 21 -) - //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- @@ -212,6 +135,14 @@ type FunctionId uint16 //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- + +const ( + E2AP_ENBIDMacroPBits20 uint8 = 20 + E2AP_ENBIDHomeBits28 uint8 = 28 + E2AP_ENBIDShortMacroits18 uint8 = 18 + E2AP_ENBIDlongMacroBits21 uint8 = 21 +) + type NodeId struct { Bits uint8 Id uint32 @@ -245,6 +176,12 @@ type InterfaceId struct { //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- + +const ( + E2AP_InterfaceDirectionIncoming uint32 = 0 + E2AP_InterfaceDirectionOutgoing uint32 = 1 +) + type EventTriggerDefinition struct { InterfaceId InterfaceDirection uint32 @@ -274,6 +211,32 @@ type ActionDefinition struct { //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- +const ( + E2AP_SubSeqActionTypeContinue uint64 = 0 + E2AP_SubSeqActionTypeWait uint64 = 1 +) + +const ( + E2AP_TimeToWaitZero uint64 = 0 + E2AP_TimeToWaitW1ms uint64 = 1 + E2AP_TimeToWaitW2ms uint64 = 2 + E2AP_TimeToWaitW5ms uint64 = 3 + E2AP_TimeToWaitW10ms uint64 = 4 + E2AP_TimeToWaitW20ms uint64 = 4 + E2AP_TimeToWaitW30ms uint64 = 5 + E2AP_TimeToWaitW40ms uint64 = 6 + E2AP_TimeToWaitW50ms uint64 = 7 + E2AP_TimeToWaitW100ms uint64 = 8 + E2AP_TimeToWaitW200ms uint64 = 9 + E2AP_TimeToWaitW500ms uint64 = 10 + E2AP_TimeToWaitW1s uint64 = 11 + E2AP_TimeToWaitW2s uint64 = 12 + E2AP_TimeToWaitW5s uint64 = 13 + E2AP_TimeToWaitW10s uint64 = 14 + E2AP_TimeToWaitW20s uint64 = 15 + E2AP_TimeToWaitW60 uint64 = 16 +) + type SubsequentAction struct { Present bool Type uint64 @@ -283,6 +246,14 @@ type SubsequentAction struct { //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- + +const ( + E2AP_ActionTypeReport uint64 = 0 + E2AP_ActionTypeInsert uint64 = 1 + E2AP_ActionTypePolicy uint64 = 2 + E2AP_ActionTypeInvalid uint64 = 99 // For RIC internal usage only +) + type ActionToBeSetupItem struct { ActionId uint64 ActionType uint64 @@ -293,9 +264,47 @@ type ActionToBeSetupItem struct { //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- + +const ( + E2AP_CauseContent_RadioNetwork uint8 = 1 + E2AP_CauseContent_Transport uint8 = 2 + E2AP_CauseContent_Protocol uint8 = 3 + E2AP_CauseContent_Misc uint8 = 4 + E2AP_CauseContent_Ric uint8 = 5 +) + +//const ( +// E2AP_CauseValue_RadioNetwork_ uint8 = 0 +//) +//const ( +// E2AP_CauseValue_Transport_ uint8 = 0 +//) +//const ( +// E2AP_CauseValue_Protocol_ uint8 = 0 +//) +//const ( +// E2AP_CauseValue_Misc_ uint8 = 0 +//) + +const ( + E2AP_CauseValue_Ric_function_id_Invalid uint8 = 0 + E2AP_CauseValue_Ric_action_not_supported uint8 = 1 + E2AP_CauseValue_Ric_excessive_actions uint8 = 2 + E2AP_CauseValue_Ric_duplicate_action uint8 = 3 + E2AP_CauseValue_Ric_duplicate_event uint8 = 4 + E2AP_CauseValue_Ric_function_resource_limit uint8 = 5 + E2AP_CauseValue_Ric_request_id_unknown uint8 = 6 + E2AP_CauseValue_Ric_inconsistent_action_subsequent_action_sequence uint8 = 7 + E2AP_CauseValue_Ric_control_message_invalid uint8 = 8 + E2AP_CauseValue_Ric_call_process_id_invalid uint8 = 9 + E2AP_CauseValue_Ric_function_not_required uint8 = 10 + E2AP_CauseValue_Ric_excessive_functions uint8 = 11 + E2AP_CauseValue_Ric_ric_resource_limi uint8 = 12 +) + type Cause struct { - Content uint8 - CauseVal uint8 + Content uint8 + Value uint8 } //----------------------------------------------------------------------------- @@ -330,6 +339,12 @@ type ActionNotAdmittedList struct { //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- +const ( + E2AP_CriticalityReject uint8 = 0 + E2AP_CriticalityIgnore uint8 = 1 + E2AP_CriticalityNotify uint8 = 2 +) + type CriticalityDiagnosticsIEListItem struct { IeCriticality uint8 //Crit IeID uint32 diff --git a/e2ap/pkg/e2ap_wrapper/packer_e2ap.go b/e2ap/pkg/e2ap_wrapper/packer_e2ap.go index 7069f86..46836f6 100644 --- a/e2ap/pkg/e2ap_wrapper/packer_e2ap.go +++ b/e2ap/pkg/e2ap_wrapper/packer_e2ap.go @@ -378,7 +378,7 @@ func (item *e2apEntryNotAdmittedList) set(data *e2ap.ActionNotAdmittedList) erro for i := 0; i < len(data.Items); i++ { item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricActionID = (C.ulong)(data.Items[i].ActionId) item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.content = (C.uchar)(data.Items[i].Cause.Content) - item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.cause = (C.uchar)(data.Items[i].Cause.CauseVal) + item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.cause = (C.uchar)(data.Items[i].Cause.Value) item.entry.contentLength++ } @@ -391,7 +391,7 @@ func (item *e2apEntryNotAdmittedList) get(data *e2ap.ActionNotAdmittedList) erro for i := 0; i < conlen; i++ { data.Items[i].ActionId = (uint64)(item.entry.RICActionNotAdmittedItem[i].ricActionID) data.Items[i].Cause.Content = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.content) - data.Items[i].Cause.CauseVal = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.cause) + data.Items[i].Cause.Value = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.cause) } return nil } @@ -1044,7 +1044,7 @@ func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) Pack(data *e2ap.E2APSubsc return err, nil } e2apMsg.msgC.ricCause.content = (C.uchar)(e2apMsg.msgG.Cause.Content) - e2apMsg.msgC.ricCause.cause = (C.uchar)(e2apMsg.msgG.Cause.CauseVal) + e2apMsg.msgC.ricCause.cause = (C.uchar)(e2apMsg.msgG.Cause.Value) e2apMsg.msgC.criticalityDiagnosticsPresent = false if e2apMsg.msgG.CriticalityDiagnostics.Present { e2apMsg.msgC.criticalityDiagnosticsPresent = true @@ -1077,7 +1077,7 @@ func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) UnPack(msg *e2ap.PackedDa return err, e2apMsg.msgG } e2apMsg.msgG.Cause.Content = (uint8)(e2apMsg.msgC.ricCause.content) - e2apMsg.msgG.Cause.CauseVal = (uint8)(e2apMsg.msgC.ricCause.cause) + e2apMsg.msgG.Cause.Value = (uint8)(e2apMsg.msgC.ricCause.cause) if e2apMsg.msgC.criticalityDiagnosticsPresent == true { e2apMsg.msgG.CriticalityDiagnostics.Present = true if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&e2apMsg.msgG.CriticalityDiagnostics); err != nil { diff --git a/pkg/control/control.go b/pkg/control/control.go index b5c60ec..152d08a 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -331,17 +331,39 @@ func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *Tran subRfMsg, valid := subs.GetCachedResponse() if subRfMsg == nil && valid == true { - event := c.sendE2TSubscriptionRequest(subs, trans, parentTrans) - switch event.(type) { - case *e2ap.E2APSubscriptionResponse: - subRfMsg, valid = subs.SetCachedResponse(event, true) - case *e2ap.E2APSubscriptionFailure: - subRfMsg, valid = subs.SetCachedResponse(event, false) - default: - xapp.Logger.Info("SUBS-SubReq: internal delete due event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) - subRfMsg, valid = subs.SetCachedResponse(nil, false) - c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) + + // + // In case of failure + // - make internal delete + // - in case duplicate cause, retry (currently max 1 retry) + // + maxRetries := uint64(1) + doRetry := true + for retries := uint64(0); retries <= maxRetries && doRetry; retries++ { + doRetry = false + + event := c.sendE2TSubscriptionRequest(subs, trans, parentTrans) + switch themsg := event.(type) { + case *e2ap.E2APSubscriptionResponse: + subRfMsg, valid = subs.SetCachedResponse(event, true) + case *e2ap.E2APSubscriptionFailure: + subRfMsg, valid = subs.SetCachedResponse(event, false) + doRetry = true + for _, item := range themsg.ActionNotAdmittedList.Items { + if item.Cause.Content != e2ap.E2AP_CauseContent_Ric || (item.Cause.Value != e2ap.E2AP_CauseValue_Ric_duplicate_action && item.Cause.Value != e2ap.E2AP_CauseValue_Ric_duplicate_event) { + doRetry = false + break + } + } + xapp.Logger.Info("SUBS-SubReq: internal delete and possible retry due event(%s) retry(%t,%d/%d) %s", typeofSubsMessage(event), doRetry, retries, maxRetries, idstring(nil, trans, subs, parentTrans)) + c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) + default: + xapp.Logger.Info("SUBS-SubReq: internal delete due event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) + subRfMsg, valid = subs.SetCachedResponse(nil, false) + c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) + } } + xapp.Logger.Debug("SUBS-SubReq: Handling (e2t response %s) %s", typeofSubsMessage(subRfMsg), idstring(nil, trans, subs, parentTrans)) } else { xapp.Logger.Debug("SUBS-SubReq: Handling (cached response %s) %s", typeofSubsMessage(subRfMsg), idstring(nil, trans, subs, parentTrans)) diff --git a/pkg/control/e2ap.go b/pkg/control/e2ap.go index ed2f690..b21eb3f 100644 --- a/pkg/control/e2ap.go +++ b/pkg/control/e2ap.go @@ -20,8 +20,6 @@ package control /* -#include - #cgo LDFLAGS: -le2ap_wrapper -le2ap */ import "C" diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index c0d76e2..a9339c2 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -672,6 +672,12 @@ func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { // | | SubFail | // | |<-------------| // | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | // | SubFail | | // |<-------------| | // | | | @@ -685,11 +691,173 @@ func TestSubReqSubFailRespInSubmgr(t *testing.T) { // Xapp: Send SubsReq cretrans := xappConn1.SendSubsReq(t, nil, nil) - // E2t: Receive SubsReq and send SubsFail - crereq, cremsg := e2termConn1.RecvSubsReq(t) - fparams := &teststube2ap.E2StubSubsFailParams{} - fparams.Set(crereq) - e2termConn1.SendSubsFail(t, fparams, cremsg) + // E2t: Receive SubsReq and send SubsFail (first) + crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) + fparams1 := &teststube2ap.E2StubSubsFailParams{} + fparams1.Set(crereq1) + e2termConn1.SendSubsFail(t, fparams1, cremsg1) + + // E2t: Receive SubsDelReq and send SubsDelResp (internal first) + delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) + + // Xapp: Receive SubsFail + e2SubsId := xappConn1.RecvSubsFail(t, cretrans) + + // Wait that subs is cleaned + mainCtrl.wait_subs_clean(t, e2SubsId, 10) + + xappConn1.TestMsgChanEmpty(t) + xappConn2.TestMsgChanEmpty(t) + e2termConn1.TestMsgChanEmpty(t) + mainCtrl.wait_registry_empty(t, 10) +} + +//----------------------------------------------------------------------------- +// TestSubReqSubFailRespInSubmgrWithDuplicate +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | SubReq | | +// |------------->| | +// | | | +// | | SubReq | +// | |------------->| +// | | | +// | | SubFail | +// | |<-------------| +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | | | +// | SubResp | | +// |<-------------| | +// | | | +// | [SUBS DELETE] | +// | | | +// +//----------------------------------------------------------------------------- + +func TestSubReqSubFailRespInSubmgrWithDuplicate(t *testing.T) { + + CaseBegin("TestSubReqSubFailRespInSubmgrWithDuplicate start") + + // Xapp: Send SubsReq + cretrans := xappConn1.SendSubsReq(t, nil, nil) + + // E2t: Receive SubsReq and send SubsFail (first) + crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) + fparams1 := &teststube2ap.E2StubSubsFailParams{} + fparams1.Set(crereq1) + fparams1.SetCauseVal(-1, 5, 3) + e2termConn1.SendSubsFail(t, fparams1, cremsg1) + + // E2t: Receive SubsDelReq and send SubsDelResp (internal) + delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) + + // E2t: Receive SubsReq and send SubsResp (second) + crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) + e2termConn1.SendSubsResp(t, crereq2, cremsg2) + + // XAPP: Receive SubsResp + e2SubsId := xappConn1.RecvSubsResp(t, cretrans) + + // Delete + deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId) + delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) + xappConn1.RecvSubsDelResp(t, deltrans2) + + // Wait that subs is cleaned + mainCtrl.wait_subs_clean(t, e2SubsId, 10) + + xappConn1.TestMsgChanEmpty(t) + xappConn2.TestMsgChanEmpty(t) + e2termConn1.TestMsgChanEmpty(t) + mainCtrl.wait_registry_empty(t, 10) +} + +//----------------------------------------------------------------------------- +// TestSubReqSubFailRespInSubmgrWithDuplicateFail +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | SubReq | | +// |------------->| | +// | | | +// | | SubReq | +// | |------------->| +// | | | +// | | SubFail | +// | |<-------------| +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// | | SubReq | +// | |------------->| +// | | | +// | | SubFail | +// | |<-------------| +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | SubFail | | +// |<-------------| | +// | | | +// +//----------------------------------------------------------------------------- + +func TestSubReqSubFailRespInSubmgrWithDuplicateFail(t *testing.T) { + + CaseBegin("TestSubReqSubFailRespInSubmgrWithDuplicateFail start") + + // Xapp: Send SubsReq + cretrans := xappConn1.SendSubsReq(t, nil, nil) + + // E2t: Receive SubsReq and send SubsFail (first) + crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) + fparams1 := &teststube2ap.E2StubSubsFailParams{} + fparams1.Set(crereq1) + fparams1.SetCauseVal(-1, 5, 3) + e2termConn1.SendSubsFail(t, fparams1, cremsg1) + + // E2t: Receive SubsDelReq and send SubsDelResp (internal first) + delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) + + // E2t: Receive SubsReq and send SubsFail (second) + crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) + fparams2 := &teststube2ap.E2StubSubsFailParams{} + fparams2.Set(crereq2) + fparams2.SetCauseVal(-1, 5, 3) + e2termConn1.SendSubsFail(t, fparams2, cremsg2) + + // E2t: Receive SubsDelReq and send SubsDelResp (internal second) + delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) // Xapp: Receive SubsFail e2SubsId := xappConn1.RecvSubsFail(t, cretrans) @@ -1071,6 +1239,12 @@ func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { // |--------------------------->| | // | | | SubFail1 | // | | |<-------------| +// | | | | +// | | | SubDelReq | +// | | |------------->| +// | | | SubDelResp | +// | | |<-------------| +// | | | | // | | SubFail1 | | // | |<-------------| | // | | | | @@ -1085,6 +1259,8 @@ func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { rparams1 := &teststube2ap.E2StubSubsReqParams{} rparams1.Init() cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) + + // E2t: Receive SubsReq (first) crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) //Req2 @@ -1094,10 +1270,14 @@ func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) mainCtrl.wait_msgcounter_change(t, seqBef2, 10) - //E2T Fail - fparams := &teststube2ap.E2StubSubsFailParams{} - fparams.Set(crereq1) - e2termConn1.SendSubsFail(t, fparams, cremsg1) + // E2t: send SubsFail (first) + fparams1 := &teststube2ap.E2StubSubsFailParams{} + fparams1.Set(crereq1) + e2termConn1.SendSubsFail(t, fparams1, cremsg1) + + // E2t: internal delete + delreq, delmsg := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq, delmsg) //Fail1 e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) diff --git a/pkg/teststube2ap/stubE2.go b/pkg/teststube2ap/stubE2.go index 0ebb29f..292f964 100644 --- a/pkg/teststube2ap/stubE2.go +++ b/pkg/teststube2ap/stubE2.go @@ -156,12 +156,12 @@ func (p *E2StubSubsFailParams) SetCauseVal(ind int, content uint8, causeval uint if ind < 0 { for index := int(0); index < len(p.Fail.ActionNotAdmittedList.Items); index++ { p.Fail.ActionNotAdmittedList.Items[index].Cause.Content = content - p.Fail.ActionNotAdmittedList.Items[index].Cause.CauseVal = causeval + p.Fail.ActionNotAdmittedList.Items[index].Cause.Value = causeval } return } p.Fail.ActionNotAdmittedList.Items[ind].Cause.Content = content - p.Fail.ActionNotAdmittedList.Items[ind].Cause.CauseVal = causeval + p.Fail.ActionNotAdmittedList.Items[ind].Cause.Value = causeval } //----------------------------------------------------------------------------- @@ -269,7 +269,7 @@ func (tc *E2Stub) SendSubsResp(t *testing.T, req *e2ap.E2APSubscriptionRequest, item := e2ap.ActionNotAdmittedItem{} item.ActionId = index item.Cause.Content = 1 - item.Cause.CauseVal = 1 + item.Cause.Value = 1 resp.ActionNotAdmittedList.Items = append(resp.ActionNotAdmittedList.Items, item) } @@ -569,8 +569,8 @@ func (tc *E2Stub) SendSubsDelFail(t *testing.T, req *e2ap.E2APSubscriptionDelete resp.RequestId.Id = req.RequestId.Id resp.RequestId.Seq = req.RequestId.Seq resp.FunctionId = req.FunctionId - resp.Cause.Content = 3 // CauseMisc - resp.Cause.CauseVal = 4 // unspecified + resp.Cause.Content = 3 // CauseMisc + resp.Cause.Value = 4 // unspecified packerr, packedMsg := e2SubsDelFail.Pack(resp) if packerr != nil { -- 2.16.6