summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
bd9c98e)
Change-Id: I428177806ab0e9539017e2cf7bac0bc5a96ea71a
Signed-off-by: Markku Virtanen <markku.virtanen@nokia.com>
_, xAppRmrEndpoint, err := ConstructEndpointAddresses(*clientEndpoint)
if err != nil {
_, xAppRmrEndpoint, err := ConstructEndpointAddresses(*clientEndpoint)
if err != nil {
- xapp.Logger.Error("%s", err.Error())
+ c.registry.DeleteRESTSubscription(restSubId)
+ xapp.Logger.Error("XAPP-SubReq transaction not created, endpoint createtion failed for RESTSubId=%s, Meid=%s", *restSubId, *meid)
return
}
var xAppEventInstanceID int64
var e2EventInstanceID int64
return
}
var xAppEventInstanceID int64
var e2EventInstanceID int64
for index := 0; index < len(subReqList.E2APSubscriptionRequests); index++ {
subReqMsg := subReqList.E2APSubscriptionRequests[index]
for index := 0; index < len(subReqList.E2APSubscriptionRequests); index++ {
subReqMsg := subReqList.E2APSubscriptionRequests[index]
if err != nil {
// Send notification to xApp that prosessing of a Subscription Request has failed.
e2EventInstanceID = (int64)(0)
if err != nil {
// Send notification to xApp that prosessing of a Subscription Request has failed.
e2EventInstanceID = (int64)(0)
+ errorCause = err.Error()
resp := &models.SubscriptionResponse{
SubscriptionID: restSubId,
SubscriptionInstances: []*models.SubscriptionInstance{
&models.SubscriptionInstance{E2EventInstanceID: &e2EventInstanceID,
resp := &models.SubscriptionResponse{
SubscriptionID: restSubId,
SubscriptionInstances: []*models.SubscriptionInstance{
&models.SubscriptionInstance{E2EventInstanceID: &e2EventInstanceID,
- ErrorCause: nil, //TODO: Suitable Error cause.
+ ErrorCause: &errorCause,
XappEventInstanceID: &xAppEventInstanceID},
},
}
// Mark REST subscription request processed.
restSubscription.SetProcessed()
XappEventInstanceID: &xAppEventInstanceID},
},
}
// Mark REST subscription request processed.
restSubscription.SetProcessed()
- xapp.Logger.Info("Sending unsuccessful REST notification to endpoint=%v:%v, XappEventInstanceID=%v, E2EventInstanceID=%v, %s",
- clientEndpoint.Host, *clientEndpoint.HTTPPort, xAppEventInstanceID, e2EventInstanceID, idstring(nil, trans))
+ xapp.Logger.Info("Sending unsuccessful REST notification (cause %s) to endpoint=%v:%v, XappEventInstanceID=%v, E2EventInstanceID=%v, %s",
+ errorCause, clientEndpoint.Host, *clientEndpoint.HTTPPort, xAppEventInstanceID, e2EventInstanceID, idstring(nil, trans))
xapp.Subscription.Notify(resp, *clientEndpoint)
c.UpdateCounter(cRestSubFailNotifToXapp)
} else {
xapp.Subscription.Notify(resp, *clientEndpoint)
c.UpdateCounter(cRestSubFailNotifToXapp)
} else {
err := c.tracker.Track(trans)
if err != nil {
err := c.tracker.Track(trans)
if err != nil {
- err = fmt.Errorf("XAPP-SubReq: %s", idstring(err, trans))
- xapp.Logger.Error("%s", err.Error())
+ xapp.Logger.Error("XAPP-SubReq Tracking error: %s", idstring(err, trans))
+ err = fmt.Errorf("Tracking failure")
return nil, err
}
subs, err := c.registry.AssignToSubscription(trans, subReqMsg, c.ResetTestFlag, c)
if err != nil {
return nil, err
}
subs, err := c.registry.AssignToSubscription(trans, subReqMsg, c.ResetTestFlag, c)
if err != nil {
- err = fmt.Errorf("XAPP-SubReq: %s", idstring(err, trans))
- xapp.Logger.Error("%s", err.Error())
+ xapp.Logger.Error("XAPP-SubReq Assign error: %s", idstring(err, trans))
trans.Release()
return themsg, nil
case *e2ap.E2APSubscriptionFailure:
trans.Release()
return themsg, nil
case *e2ap.E2APSubscriptionFailure:
- err = fmt.Errorf("SubscriptionFailure received")
+ err = fmt.Errorf("E2 SubscriptionFailure received")
+ err = fmt.Errorf("unexpected E2 subscription response received")
+ } else {
+ err = fmt.Errorf("E2 subscription response timeout")
- err = fmt.Errorf("XAPP-SubReq: failed %s", idstring(err, trans, subs))
- xapp.Logger.Error("%s", err.Error())
+
+ xapp.Logger.Error("XAPP-SubReq E2 subscription failed %s", idstring(err, trans, subs))
c.registry.RemoveFromSubscription(subs, trans, waitRouteCleanup_ms, c)
return nil, err
}
c.registry.RemoveFromSubscription(subs, trans, waitRouteCleanup_ms, c)
return nil, err
}
//
actionType, err := r.CheckActionTypes(subReqMsg)
if err != nil {
//
actionType, err := r.CheckActionTypes(subReqMsg)
if err != nil {
- xapp.Logger.Debug("CREATE %s", err)
+ xapp.Logger.Info("CREATE %s", err)
+ err = fmt.Errorf("E2 content validation failed")
subs, endPointFound := r.findExistingSubs(trans, subReqMsg)
if subs == nil {
if subs, err = r.allocateSubs(trans, subReqMsg, resetTestFlag); err != nil {
subs, endPointFound := r.findExistingSubs(trans, subReqMsg)
if subs == nil {
if subs, err = r.allocateSubs(trans, subReqMsg, resetTestFlag); err != nil {
+ xapp.Logger.Error("%s", err.Error())
+ err = fmt.Errorf("subscription not allocated")
return nil, err
}
newAlloc = true
return nil, err
}
newAlloc = true
err := r.rtmgrClient.SubscriptionRequestCreate(subRouteAction)
if err != nil {
c.UpdateCounter(cRouteCreateFail)
err := r.rtmgrClient.SubscriptionRequestCreate(subRouteAction)
if err != nil {
c.UpdateCounter(cRouteCreateFail)
+ xapp.Logger.Error("%s", err.Error())
+ err = fmt.Errorf("RTMGR route create failure")
err := r.rtmgrClient.SubscriptionRequestUpdate(subRouteAction)
if err != nil {
c.UpdateCounter(cRouteCreateUpdateFail)
err := r.rtmgrClient.SubscriptionRequestUpdate(subRouteAction)
if err != nil {
c.UpdateCounter(cRouteCreateUpdateFail)
+ xapp.Logger.Error("%s", err.Error())
+ err = fmt.Errorf("RTMGR route update failure")
return err
}
c.UpdateCounter(cMergedSubscriptions)
return err
}
c.UpdateCounter(cMergedSubscriptions)
var xAppRMREndPoint string
if host == "" || (HTTP_port == 0 && RMR_port == 0) {
var xAppRMREndPoint string
if host == "" || (HTTP_port == 0 && RMR_port == 0) {
- err := fmt.Errorf("ClientEndpoint aprovided no PORT numbers")
+ err := fmt.Errorf("ClientEndpoint provided without PORT numbers")
return "INVALID_HTTP_ADDRESS:" + host + (string)(*clientEndpoint.HTTPPort),
"INVALID_RMR_ADDRESS:" + host + (string)(*clientEndpoint.RMRPort),
err
return "INVALID_HTTP_ADDRESS:" + host + (string)(*clientEndpoint.HTTPPort),
"INVALID_RMR_ADDRESS:" + host + (string)(*clientEndpoint.RMRPort),
err
// Req
params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
// Req
params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll")
waiter.WaitResult(t)
e2SubsId := xappConn1.WaitRESTNotification(t, restSubId)
waiter.WaitResult(t)
e2SubsId := xappConn1.WaitRESTNotification(t, restSubId)
params.SetMeid("RAN_NAME_1")
restSubId2 := xappConn2.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send REST subscriber request for second subscriber : %v", restSubId2)
params.SetMeid("RAN_NAME_1")
restSubId2 := xappConn2.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send REST subscriber request for second subscriber : %v", restSubId2)
- xappConn2.ExpectRESTNotification(t, restSubId2)
+ xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail")
waiter.WaitResult(t)
// e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete
xappConn2.WaitRESTNotification(t, restSubId2)
waiter.WaitResult(t)
// e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete
xappConn2.WaitRESTNotification(t, restSubId2)
// | | |
//
//-----------------------------------------------------------------------------
// | | |
//
//-----------------------------------------------------------------------------
func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) {
CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start")
func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) {
CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start")
xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId)
delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId)
delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail")
e2termConn1.SendSubsDelResp(t, delreq, delmsg)
e2termConn1.SendSubsDelResp(t, delreq, delmsg)
- // e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - TODO: Should we delete this?
xappConn1.WaitRESTNotification(t, restSubId)
// Wait that subs is cleaned
xappConn1.WaitRESTNotification(t, restSubId)
// Wait that subs is cleaned
e2termConn1.RecvSubsDelReq(t)
xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId)
e2termConn1.RecvSubsDelReq(t)
xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail")
e2termConn1.RecvSubsDelReq(t)
xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId)
e2termConn1.RecvSubsDelReq(t)
xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId)
e2termConn1.RecvSubsDelReq(t)
xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId)
e2termConn1.RecvSubsDelReq(t)
xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail")
e2termConn1.RecvSubsDelReq(t)
xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId)
e2termConn1.RecvSubsDelReq(t)
xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId)
e2termConn1.SendSubsFail(t, fparams1, cremsg1)
delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
e2termConn1.SendSubsFail(t, fparams1, cremsg1)
delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail")
e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
e2SubsId := xappConn1.WaitRESTNotification(t, restSubId)
xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId)
e2termConn1.SendSubsDelResp(t, delreq1, delmsg1)
e2SubsId := xappConn1.WaitRESTNotification(t, restSubId)
xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId)
_, cremsg = e2termConn1.RecvSubsReq(t)
_, cremsg = e2termConn1.RecvSubsReq(t)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail")
// Subscription already created in E2 Node.
fparams := &teststube2ap.E2StubSubsFailParams{}
// Subscription already created in E2 Node.
fparams := &teststube2ap.E2StubSubsFailParams{}
_, cremsg = e2termConn1.RecvSubsReq(t)
_, cremsg = e2termConn1.RecvSubsReq(t)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail")
// Subscription already created in E2 Node.
fparams := &teststube2ap.E2StubSubsFailParams{}
// Subscription already created in E2 Node.
fparams := &teststube2ap.E2StubSubsFailParams{}
_, cremsg = e2termConn1.RecvSubsReq(t)
_, cremsg = e2termConn1.RecvSubsReq(t)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail")
// Subscription already created in E2 Node.
fparams := &teststube2ap.E2StubSubsFailParams{}
// Subscription already created in E2 Node.
fparams := &teststube2ap.E2StubSubsFailParams{}
_, cremsg = e2termConn1.RecvSubsReq(t)
_, cremsg = e2termConn1.RecvSubsReq(t)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail")
// Subscription already created in E2 Node.
fparams := &teststube2ap.E2StubSubsFailParams{}
// Subscription already created in E2 Node.
fparams := &teststube2ap.E2StubSubsFailParams{}
_, cremsg = e2termConn1.RecvSubsReq(t)
_, cremsg = e2termConn1.RecvSubsReq(t)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail")
// Subscription already created in E2 Node.
fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action
// Subscription already created in E2 Node.
fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action
_, cremsg = e2termConn1.RecvSubsReq(t)
_, cremsg = e2termConn1.RecvSubsReq(t)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail")
// Subscription already created in E2 Node.
fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action
// Subscription already created in E2 Node.
fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action
// E2t: Receive SubsDelReq
delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
// E2t: Receive SubsDelReq
delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
- xappConn1.ExpectRESTNotification(t, restSubId)
+ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail")
// Subscription does not exist in in E2 Node.
e2termConn1.SendSubsDelFail(t, delreq, delmsg)
// Subscription does not exist in in E2 Node.
e2termConn1.SendSubsDelFail(t, delreq, delmsg)
type E2RestIds struct {
RestSubsId string
E2SubsId uint32
type E2RestIds struct {
RestSubsId string
E2SubsId uint32
}
func (trans *RmrTransactionId) String() string {
}
func (trans *RmrTransactionId) String() string {
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
func (tc *E2Stub) ExpectRESTNotification(t *testing.T, restSubsId string) {
func (tc *E2Stub) ExpectRESTNotification(t *testing.T, restSubsId string) {
+ tc.expectNotification(t, restSubsId, "")
+}
+
+func (tc *E2Stub) ExpectRESTNotificationOk(t *testing.T, restSubsId string) {
+ tc.expectNotification(t, restSubsId, "allOk")
+}
+
+func (tc *E2Stub) ExpectRESTNotificationNok(t *testing.T, restSubsId string, expectError string) {
+ tc.expectNotification(t, restSubsId, expectError)
+}
+
+func (tc *E2Stub) expectNotification(t *testing.T, restSubsId string, expectError string) {
tc.Info("### Started to wait REST notification for %v on port %v f(RMR port %v), %v responses expected", restSubsId, *tc.clientEndpoint.HTTPPort, *tc.clientEndpoint.RMRPort, tc.requestCount)
tc.restSubsIdList = []string{restSubsId}
tc.Info("### Started to wait REST notification for %v on port %v f(RMR port %v), %v responses expected", restSubsId, *tc.clientEndpoint.HTTPPort, *tc.clientEndpoint.RMRPort, tc.requestCount)
tc.restSubsIdList = []string{restSubsId}
tc.TestError(t, "### REST notification count unexpectedly ZERO for %s (%v)", restSubsId, tc)
} else if e2Ids.RestSubsId != restSubsId {
tc.TestError(t, "### Unexpected REST notifications received |%s:%s| (%v)", e2Ids.RestSubsId, restSubsId, tc)
tc.TestError(t, "### REST notification count unexpectedly ZERO for %s (%v)", restSubsId, tc)
} else if e2Ids.RestSubsId != restSubsId {
tc.TestError(t, "### Unexpected REST notifications received |%s:%s| (%v)", e2Ids.RestSubsId, restSubsId, tc)
+ } else if e2Ids.ErrorCause == "" && expectError == "allFail" {
+ tc.TestError(t, "### Unexpected ok cause received from REST notifications |%s:%s| (%v)", e2Ids.RestSubsId, restSubsId, tc)
+ } else if e2Ids.ErrorCause != "" && expectError == "allOk" {
+ tc.TestError(t, "### Unexpected error cause (%s) received from REST notifications |%s:%s| (%v)", e2Ids.ErrorCause, e2Ids.RestSubsId, restSubsId, tc)
} else {
tc.requestCount--
if tc.requestCount == 0 {
} else {
tc.requestCount--
if tc.requestCount == 0 {
} else {
tc.Info("### Expected REST notifications received for %s, (%v)", e2Ids.RestSubsId, tc)
}
} else {
tc.Info("### Expected REST notifications received for %s, (%v)", e2Ids.RestSubsId, tc)
}
+ if e2Ids.ErrorCause != "" && expectError == "allFail" {
+ tc.Info("### REST Notification: %s, ErrorCause: %v", e2Ids.RestSubsId, e2Ids.ErrorCause)
+ }
tc.Info("### REST Notification received Notif for %s : %v", e2Ids.RestSubsId, e2Ids.E2SubsId)
tc.ListedRESTNotifications <- e2Ids
}
tc.Info("### REST Notification received Notif for %s : %v", e2Ids.RestSubsId, e2Ids.E2SubsId)
tc.ListedRESTNotifications <- e2Ids
}
tc.restSubsIdList = append(tc.restSubsIdList[:i], tc.restSubsIdList[i+1:]...)
//tc.Info("Removed %s from Listed REST notifications, %v entries left", *resp.SubscriptionID, len(tc.restSubsIdList))
tc.restSubsIdList = append(tc.restSubsIdList[:i], tc.restSubsIdList[i+1:]...)
//tc.Info("Removed %s from Listed REST notifications, %v entries left", *resp.SubscriptionID, len(tc.restSubsIdList))
- tc.CallBackListedNotifications <- E2RestIds{*resp.SubscriptionID, uint32(*resp.SubscriptionInstances[0].E2EventInstanceID)}
+ if resp.SubscriptionInstances[0].ErrorCause != nil {
+ tc.CallBackListedNotifications <- E2RestIds{*resp.SubscriptionID, uint32(*resp.SubscriptionInstances[0].E2EventInstanceID), *resp.SubscriptionInstances[0].ErrorCause}
+ } else {
+ tc.CallBackListedNotifications <- E2RestIds{*resp.SubscriptionID, uint32(*resp.SubscriptionInstances[0].E2EventInstanceID), ""}
+ }
if len(tc.restSubsIdList) == 0 {
//tc.Info("All listed REST notifications received for endpoint=%s", tc.clientEndpoint)
if len(tc.restSubsIdList) == 0 {
//tc.Info("All listed REST notifications received for endpoint=%s", tc.clientEndpoint)