From 6bd579175aaa85f1dd864ad10fe4209ed6b450ea Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Thu, 16 Jun 2022 09:47:23 +0300 Subject: [PATCH] Fix for two problems - Submgr sent incorrect error information in response to xapp in completely successful case - Checking of received E2SubscriptionDirectives was also fixed Change-Id: Ibd3347f9c8db0e931c95b349f7cbaa789fb24e98 Signed-off-by: Anssi Mannila --- pkg/control/control.go | 29 ++++++++++++----------------- pkg/control/e2ap.go | 6 ++++++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/pkg/control/control.go b/pkg/control/control.go index 0c97afb..4c0cf9a 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -445,6 +445,12 @@ func (c *Control) RESTSubscriptionHandler(params interface{}) (*models.Subscript return nil, common.SubscribeBadRequestCode } + e2SubscriptionDirectives, err := c.GetE2SubscriptionDirectives(p) + if err != nil { + xapp.Logger.Error("%s", err) + c.UpdateCounter(cRestSubFailToXapp) + return nil, common.SubscribeBadRequestCode + } _, xAppRmrEndpoint, err := ConstructEndpointAddresses(*p.ClientEndpoint) if err != nil { xapp.Logger.Error("%s", err.Error()) @@ -484,12 +490,6 @@ func (c *Control) RESTSubscriptionHandler(params interface{}) (*models.Subscript } c.WriteRESTSubscriptionToDb(restSubId, restSubscription) - e2SubscriptionDirectives, err := c.GetE2SubscriptionDirectives(p) - if err != nil { - xapp.Logger.Error("%s", err) - c.registry.DeleteRESTSubscription(&restSubId) - return nil, common.SubscribeBadRequestCode - } go c.processSubscriptionRequests(restSubscription, &subReqList, p.ClientEndpoint, p.Meid, &restSubId, xAppRmrEndpoint, md5sum, e2SubscriptionDirectives) c.UpdateCounter(cRestSubRespToXapp) @@ -698,11 +698,11 @@ func (c *Control) sendUnsuccesfullResponseNotification(restSubId *string, restSu restSubscription.SetProcessed(err) c.UpdateRESTSubscriptionInDB(*restSubId, restSubscription, false) if trans != nil { - xapp.Logger.Debug("Sending unsuccessful REST notification (Error cause %s) to endpoint=%v:%v, XappEventInstanceID=%v, E2EventInstanceID=%v, %s", - errorInfo.ErrorCause, clientEndpoint.Host, *clientEndpoint.HTTPPort, xAppEventInstanceID, e2EventInstanceID, idstring(nil, trans)) + xapp.Logger.Debug("Sending unsuccessful REST notification: ErrorCause:%s, ErrorSource:%s, TimeoutType:%s, to Endpoint=%v:%v, XappEventInstanceID=%v, E2EventInstanceID=%v, %s", + errorInfo.ErrorCause, errorInfo.ErrorSource, errorInfo.TimeoutType, clientEndpoint.Host, *clientEndpoint.HTTPPort, xAppEventInstanceID, e2EventInstanceID, idstring(nil, trans)) } else { - xapp.Logger.Debug("Sending unsuccessful REST notification (Error cause %s) to endpoint=%v:%v, XappEventInstanceID=%v, E2EventInstanceID=%v", - errorInfo.ErrorCause, clientEndpoint.Host, *clientEndpoint.HTTPPort, xAppEventInstanceID, e2EventInstanceID) + xapp.Logger.Debug("Sending unsuccessful REST notification: ErrorCause:%s, ErrorSource:%s, TimeoutType:%s, to Endpoint=%v:%v, XappEventInstanceID=%v, E2EventInstanceID=%v", + errorInfo.ErrorCause, errorInfo.ErrorSource, errorInfo.TimeoutType, clientEndpoint.Host, *clientEndpoint.HTTPPort, xAppEventInstanceID, e2EventInstanceID) } c.UpdateCounter(cRestSubFailNotifToXapp) @@ -738,13 +738,8 @@ func (c *Control) sendSuccesfullResponseNotification(restSubId *string, restSubs // Mark REST subscription request processesd. restSubscription.SetProcessed(nil) c.UpdateRESTSubscriptionInDB(*restSubId, restSubscription, false) - if errorInfo.ErrorCause != " " { - xapp.Logger.Debug("Sending successful REST notification (Error cause %s) to endpoint=%v:%v, XappEventInstanceID=%v, E2EventInstanceID=%v, %s", - errorInfo.ErrorCause, clientEndpoint.Host, *clientEndpoint.HTTPPort, xAppEventInstanceID, e2EventInstanceID, idstring(nil, trans)) - } else { - xapp.Logger.Debug("Sending successful REST notification to endpoint=%v:%v, XappEventInstanceID=%v, E2EventInstanceID=%v, %s", - clientEndpoint.Host, *clientEndpoint.HTTPPort, xAppEventInstanceID, e2EventInstanceID, idstring(nil, trans)) - } + xapp.Logger.Debug("Sending successful REST notification: ErrorCause:%s, ErrorSource:%s, TimeoutType:%s, to Endpoint=%v:%v, XappEventInstanceID=%v, E2EventInstanceID=%v, %s", + errorInfo.ErrorCause, errorInfo.ErrorSource, errorInfo.TimeoutType, clientEndpoint.Host, *clientEndpoint.HTTPPort, xAppEventInstanceID, e2EventInstanceID, idstring(nil, trans)) c.UpdateCounter(cRestSubNotifToXapp) xapp.Subscription.Notify(resp, *clientEndpoint) diff --git a/pkg/control/e2ap.go b/pkg/control/e2ap.go index 1c10846..93bd42d 100644 --- a/pkg/control/e2ap.go +++ b/pkg/control/e2ap.go @@ -128,6 +128,12 @@ func (e *E2ap) CheckActionNotAdmittedList(msgType int, actionNotAdmittedList e2a actionNotAdmittedString = "ActionNotAdmittedList: " + string(jsonActionNotAdmittedList) } } + + if msgType == xapp.RIC_SUB_FAILURE { + prefixString = "RICSubscriptionFailure" + err := fmt.Errorf("%s", prefixString) + errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "") + } err := fmt.Errorf("%s %s", prefixString, actionNotAdmittedString) errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "") return errorInfo -- 2.16.6