tc.restSubsIdList = []string{restSubsId}
xapp.Subscription.SetResponseCB(tc.ListedRestNotifHandler)
if tc.requestCount == 0 {
- tc.TestError(t, "### NO REST notifications SET received for endpoint=%s, request zount ZERO! (%v)", tc.clientEndpoint, tc)
+ tc.TestError(t, "### NO REST notifications SET received for endpoint=%s, request zount ZERO! (%v)", tc.clientEndpoint, *tc)
}
go func() {
select {
case e2Ids := <-tc.CallBackListedNotifications:
if tc.requestCount == 0 {
- tc.TestError(t, "### REST notification count unexpectedly ZERO for %s (%v)", 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, expected %s bunt got %s instead| (%v)", e2Ids.RestSubsId, restSubsId, tc)
+ tc.TestError(t, "### Unexpected REST notifications received, expected %s bunt got %s instead| (%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)
+ 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 ErrorCause: (%s), ErrorSource: (%s), TimeoutType: (%s) received from REST notifications |%s:%s| (%v)", e2Ids.ErrorCause, e2Ids.ErrorSource, e2Ids.TimeoutType, e2Ids.RestSubsId, restSubsId, tc)
+ tc.TestError(t, "### Unexpected ErrorCause: (%s), ErrorSource: (%s), TimeoutType: (%s) received from REST notifications |%s:%s| (%v)", e2Ids.ErrorCause, e2Ids.ErrorSource, e2Ids.TimeoutType, e2Ids.RestSubsId, restSubsId, *tc)
} else {
tc.requestCount--
if tc.requestCount == 0 {
- tc.Debug("### All expected REST notifications received for %s (%v)", e2Ids.RestSubsId, tc)
+ tc.Debug("### All expected REST notifications received for %s (%v)", e2Ids.RestSubsId, *tc)
} else {
- tc.Debug("### Expected REST notifications received for %s, (%v)", e2Ids.RestSubsId, tc)
+ tc.Debug("### Expected REST notifications received for %s, (%v)", e2Ids.RestSubsId, *tc)
}
if e2Ids.ErrorCause != "" && expectError == "allFail" {
tc.Debug("### REST Notification: RestSubsId: %s, ErrorCause: %s, ErrorSource: (%s), TimeoutType: (%s)", e2Ids.RestSubsId, e2Ids.ErrorCause, e2Ids.ErrorSource, e2Ids.TimeoutType)
select {
case e2SubsId := <-tc.ListedRESTNotifications:
if e2SubsId.RestSubsId == restSubsId {
- tc.Debug("### Expected REST notifications received %s, e2SubsId %v for endpoint=%s, (%v)", e2SubsId.RestSubsId, e2SubsId.E2SubsId, tc.clientEndpoint, tc)
+ tc.Debug("### Expected REST notifications received %s, e2SubsId %v for endpoint=%v, (%v)", e2SubsId.RestSubsId, e2SubsId.E2SubsId, tc.clientEndpoint, *tc)
return e2SubsId.E2SubsId
} else {
- tc.TestError(t, "### Unexpected REST notification %s received, expected %s for endpoint=%s, (%v)", e2SubsId.RestSubsId, restSubsId, tc.clientEndpoint, tc)
+ tc.TestError(t, "### Unexpected REST notification %s received, expected %v for endpoint=%v, (%v)", e2SubsId.RestSubsId, restSubsId, tc.clientEndpoint, *tc)
xapp.Logger.Debug("CALL STACK:\n %s", stack)
return 0
}
func (tc *E2Stub) ListedRestNotifHandler(resp *clientmodel.SubscriptionResponse) {
if len(tc.restSubsIdList) == 0 {
- tc.Error("Unexpected listed REST notifications received for endpoint=%s, expected restSubsId list size was ZERO!", tc.clientEndpoint)
+ tc.Error("Unexpected listed REST notifications received for endpoint=%v, expected restSubsId list size was ZERO!", tc.clientEndpoint)
} else {
for i, subsId := range tc.restSubsIdList {
if *resp.SubscriptionID == subsId {
// }
if len(tc.restSubsIdList) == 0 {
- tc.Debug("All listed REST notifications received for endpoint=%s", tc.clientEndpoint)
+ tc.Debug("All listed REST notifications received for endpoint=%v", tc.clientEndpoint)
}
return
if resp.SubscriptionInstances[0].E2EventInstanceID != nil {
e2RestIds.E2SubsId = uint32(*resp.SubscriptionInstances[0].E2EventInstanceID)
}
- if resp.SubscriptionInstances[0].ErrorCause != nil {
- e2RestIds.ErrorCause = *resp.SubscriptionInstances[0].ErrorCause
- } else {
- e2RestIds.ErrorCause = "nil"
- }
- if resp.SubscriptionInstances[0].ErrorSource != nil {
- e2RestIds.ErrorSource = *resp.SubscriptionInstances[0].ErrorSource
- } else {
- e2RestIds.ErrorSource = "nil"
- }
- if resp.SubscriptionInstances[0].TimeoutType != nil {
- e2RestIds.TimeoutType = *resp.SubscriptionInstances[0].TimeoutType
- } else {
- e2RestIds.TimeoutType = "nil"
- }
+ e2RestIds.ErrorCause = resp.SubscriptionInstances[0].ErrorCause
+ e2RestIds.ErrorSource = resp.SubscriptionInstances[0].ErrorSource
+ e2RestIds.TimeoutType = resp.SubscriptionInstances[0].TimeoutType
}
}
return e2RestIds
// Swagger generated code makes checks for the values that are inserted the subscription function
// If error cause is unknown and POST is not done, the problem is in the inserted values
tc.Error("======== REST subscription request failed %s ========", err.Error())
- if resp != nil {
- tc.PrintSubscriptionInsctanceErrorInfo(resp)
- } else {
- tc.Error("Subscribe resp == nil")
- }
return ""
}
tc.subscriptionId = *resp.SubscriptionID
return *resp.SubscriptionID
}
-//-----------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------
-func (tc *E2Stub) PrintSubscriptionInsctanceErrorInfo(resp *clientmodel.SubscriptionResponse) {
- for _, subscriptionInstance := range resp.SubscriptionInstances {
- if subscriptionInstance != nil {
- if subscriptionInstance.RejectCause != nil {
- tc.Error("subscriptionInstance.RejectCause= %s", *subscriptionInstance.RejectCause)
- }
- if subscriptionInstance.ErrorCause != nil {
- tc.Error("subscriptionInstance.ErrorCause= %s", *subscriptionInstance.ErrorCause)
- }
- if subscriptionInstance.ErrorSource != nil {
- tc.Error("subscriptionInstance.ErrorSource= %s", *subscriptionInstance.ErrorSource)
- }
- if subscriptionInstance.TimeoutType != nil {
- tc.Error("subscriptionInstance.TimeoutType = %s", *subscriptionInstance.TimeoutType)
- }
- }
- }
-}
-
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
p.SubsReqParams.E2SubscriptionDirectives = E2SubscriptionDirectives
p.SubsReqParams.E2SubscriptionDirectives.E2RetryCount = &E2RetryCount
p.SubsReqParams.E2SubscriptionDirectives.E2TimeoutTimerValue = E2TimeoutTimerValue
- p.SubsReqParams.E2SubscriptionDirectives.RMRRoutingNeeded = &RMRRoutingNeeded
+ p.SubsReqParams.E2SubscriptionDirectives.RMRRoutingNeeded = RMRRoutingNeeded
}
func (p *RESTSubsReqParams) RemoveE2SubscriptionDirectives() {
e2SubscriptionDirectives := &clientmodel.SubscriptionParamsE2SubscriptionDirectives{}
e2SubscriptionDirectives.E2TimeoutTimerValue = e2Timeout
e2SubscriptionDirectives.E2RetryCount = &e2RetryCount
- e2SubscriptionDirectives.RMRRoutingNeeded = &routingNeeded
+ e2SubscriptionDirectives.RMRRoutingNeeded = routingNeeded
p.SubsReqParams.E2SubscriptionDirectives = e2SubscriptionDirectives
}