"github.com/stretchr/testify/assert"
)
- func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) {
-
+ func TestSuiteSetup(t *testing.T) {
// The effect of this call shall endure thgough the UT suite!
// If this causes any issues, the previout interface can be restored
- // like this:
+ // like this:git log
// SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker())
SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker())
+ }
+
+ //-----------------------------------------------------------------------------
+ // TestRESTSubReqAndDeleteOkWithE2apUtWrapper
+ //
+ // stub stub stub
+ // +-------+ +---------+ +---------+ +---------+
+ // | xapp | | submgr | | e2term | | rtmgr |
+ // +-------+ +---------+ +---------+ +---------+
+ // | | | |
+ // | RESTSubReq | | |
+ // |---------------->| | |
+ // | | RouteCreate | |
+ // | |--------------------------->| // The order of these events may vary
+ // | | | |
+ // | RESTSubResp | | | // The order of these events may vary
+ // |<----------------| | |
+ // | | RouteResponse| |
+ // | |<---------------------------| // The order of these events may vary
+ // | | | |
+ // | | SubReq | |
+ // | |------------->| | // The order of these events may vary
+ // | | | |
+ // | | SubResp | |
+ // | |<-------------| |
+ // | RESTNotif1 | | |
+ // |<----------------| | |
+ // | | | |
+ // | RESTSubDelReq | | |
+ // |---------------->| | |
+ // | | SubDelReq | |
+ // | |------------->| |
+ // | | | |
+ // | RESTSubDelResp| | |
+ // |<----------------| | |
+ // | | | |
+ // | | SubDelResp | |
+ // | |<-------------| |
+ // | | | |
+ // | | | |
+ //
+ //-----------------------------------------------------------------------------
+ func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) {
restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil)
waitSubsCleanup(t, e2SubsId, 10)
}
+ //-----------------------------------------------------------------------------
+ // TestRESTSubReqAndE1apDeleteReqPackingError
+ //
+ // stub stub stub
+ // +-------+ +---------+ +---------+ +---------+
+ // | xapp | | submgr | | e2term | | rtmgr |
+ // +-------+ +---------+ +---------+ +---------+
+ // | | | |
+ // | RESTSubReq | | |
+ // |---------------->| | |
+ // | | RouteCreate | |
+ // | |--------------------------->| // The order of these events may vary
+ // | | | |
+ // | RESTSubResp | | | // The order of these events may vary
+ // |<----------------| | |
+ // | | RouteResponse| |
+ // | |<---------------------------| // The order of these events may vary
+ // | | | |
+ // | | SubReq | |
+ // | |------------->| | // The order of these events may vary
+ // | | | |
+ // | | SubResp | |
+ // | |<-------------| |
+ // | RESTNotif1 | | |
+ // |<----------------| | |
+ // | | | |
+ // | RESTSubDelReq | | |
+ // |---------------->| | |
+ // | | | |
+ // | RESTSubDelResp| | |
+ // |<----------------| | |
+ // | | | |
+ // | | | |
+ //
+ //-----------------------------------------------------------------------------
+ func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) {
+
+ restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil)
+
+ e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false)
+ xappConn1.SendRESTSubsDelReq(t, &restSubId)
+ defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true)
+
+ waitSubsCleanup(t, e2SubsId, 10)
+ }
+
+ //-----------------------------------------------------------------------------
+ // TestRESTSubReqAndE1apDeleteRespUnpackingError
+ //
+ // stub stub stub
+ // +-------+ +---------+ +---------+ +---------+
+ // | xapp | | submgr | | e2term | | rtmgr |
+ // +-------+ +---------+ +---------+ +---------+
+ // | | | |
+ // | RESTSubReq | | |
+ // |---------------->| | |
+ // | | RouteCreate | |
+ // | |--------------------------->| // The order of these events may vary
+ // | | | |
+ // | RESTSubResp | | | // The order of these events may vary
+ // |<----------------| | |
+ // | | RouteResponse| |
+ // | |<---------------------------| // The order of these events may vary
+ // | | | |
+ // | | SubReq | |
+ // | |------------->| | // The order of these events may vary
+ // | | | |
+ // | | SubResp | |
+ // | |<-------------| |
+ // | RESTNotif1 | | |
+ // |<----------------| | |
+ // | | | |
+ // | RESTSubDelReq | | |
+ // |---------------->| | |
+ // | | SubDelReq | |
+ // | |------------->| |
+ // | | | |
+ // | RESTSubDelResp| | |
+ // |<----------------| | | // The order of these events may vary
+ // | | | |
+ // | | SubDelResp | |
+ // | |<-------------| | // 1.st NOK
+ // | | | |
+ // | | SubDelReq | |
+ // | |------------->| |
+ // | | | |
+ // | | SubDelResp | |
+ // | |<-------------| | // 2.nd NOK
+ //
+ //-----------------------------------------------------------------------------
+
+ func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) {
+
+ restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil)
+
+ xappConn1.SendRESTSubsDelReq(t, &restSubId)
+ e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false)
+ delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
+ e2termConn1.SendSubsDelResp(t, delreq, delmsg)
+
+ delreq, delmsg = e2termConn1.RecvSubsDelReq(t)
+ e2termConn1.SendSubsDelResp(t, delreq, delmsg)
+
+ defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true)
+
+ waitSubsCleanup(t, e2SubsId, 10)
+ }
+
//-----------------------------------------------------------------------------
// TestSubReqAndRouteNok
//
})
const subReqCount int = 1
- const parameterSet = 1
- const actionDefinitionPresent bool = true
- const actionParamCount int = 1
// Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side
waiter := rtmgrHttp.AllocNextSleep(50, false)
newSubsId := mainCtrl.get_registry_next_subid(t)
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
xappConn1.ExpectRESTNotification(t, restSubId)
waiter.WaitResult(t)
// xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr
waiter := rtmgrHttp.AllocNextEvent(false)
newSubsId := mainCtrl.get_registry_next_subid(t)
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_1")
restSubId2 := xappConn2.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send REST subscriber request for second subscriber : %v", restSubId2)
// Subs Create
const subReqCount int = 1
- const parameterSet = 1
- const actionDefinitionPresent bool = true
- const actionParamCount int = 1
// In order to force both XAPP's to create their own subscriptions, force rtmgr to block a while so that 2nd create
// gets into execution before the rtmgrg responds for the first one.
waiter := rtmgrHttp.AllocNextSleep(10, true)
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId1 := xappConn1.SendRESTSubsReq(t, params)
restSubId2 := xappConn2.SendRESTSubsReq(t, params)
})
const subReqCount int = 1
- const parameterSet = 1
- const actionDefinitionPresent bool = true
- const actionParamCount int = 1
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
// Del. This will fail as processing of the subscription
})
//Req1
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId1 := xappConn1.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1)
//Req2
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
restSubId2 := xappConn2.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2)
Counter{cSubDelRespToXapp, 2},
})
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params)
xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1)
- params = xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn1.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_2")
restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params)
xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2)
Counter{cSubDelRespToXapp, 1},
})
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId)
Counter{cSubDelRespFromE2, 1},
})
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId)
Counter{cSubDelReqTimerExpiry, 2},
})
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId)
Counter{cSubDelReqTimerExpiry, 2},
})
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId)
})
const subReqCount int = 1
- const parameterSet = 1
- const actionDefinitionPresent bool = true
- const actionParamCount int = 1
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"})
// Req2
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_1")
xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler)
Counter{cSubDelRespToXapp, 2},
})
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId1 := xappConn1.SendRESTSubsReq(t, params)
crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
- params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount)
restSubId2 := xappConn2.SendRESTSubsReq(t, params2)
xappConn1.ExpectRESTNotification(t, restSubId1)
})
const subReqCount int = 1
- const parameterSet = 1
- const actionDefinitionPresent bool = true
- const actionParamCount int = 1
// Req1
- params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId1 := xappConn1.SendRESTSubsReq(t, params1)
crereq1, _ := e2termConn1.RecvSubsReq(t)
// Req2
subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId)
- params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount)
params2.SetMeid("RAN_NAME_1")
restSubId2 := xappConn2.SendRESTSubsReq(t, params2)
mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10)
})
const subReqCount int = 1
- const parameterSet = 1
- const actionDefinitionPresent bool = true
- const actionParamCount int = 1
// Req1
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId1 := xappConn1.SendRESTSubsReq(t, params)
crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
// Req2
subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId)
- params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount)
params2.SetMeid("RAN_NAME_1")
restSubId2 := xappConn2.SendRESTSubsReq(t, params2)
mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10)
})
const subReqCount int = 1
- const parameterSet = 1
- const actionDefinitionPresent bool = true
- const actionParamCount int = 1
- params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount)
+ params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId)
})
const subReqCount int = 1
- const parameterSet = 1
- const actionDefinitionPresent bool = true
- const policyParamCount int = 1
// Req
- params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount)
+ params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount)
restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)
// Policy change
instanceId := int64(e2SubsId)
// GetRESTSubsReqPolicyParams sets some coutners on tc side.
- params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount)
+ params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount)
params.SubsReqParams.SubscriptionDetails[0].InstanceID = &instanceId
params.SetTimeToWait("w200ms")
restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params)
})
const subReqCount int = 1
- const parameterSet = 1
- const actionDefinitionPresent bool = true
- const actionParamCount int = 1
// Req1
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId1 := xappConn1.SendRESTSubsReq(t, params)
crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)
// Req2
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_11")
// Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1
// would not work as notification would not be received
})
const subReqCount int = 1
- const parameterSet int = 1
- const actionDefinitionPresent bool = true
- const actionParamCount int = 1
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
params.SetSubActionTypes("insert")
// Req
})
const subReqCount int = 1
- const parameterSet = 1
- const actionDefinitionPresent bool = true
- const actionParamCount int = 1
// Remove possible existing subscription
mainCtrl.removeExistingSubscriptions(t)
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
//Req
mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription
xapp.Logger.Info("Send REST subscriber request for subscriber 1 : %v", restSubId1)
// Create subscription 2 with same action
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_1")
xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler)
xappConn2.WaitRESTNotificationForAnySubscriptionId(t)
func TestRESTReportSubReqAndSubDelOk(t *testing.T) {
CaseBegin("TestRESTReportSubReqAndSubDelOk")
subReqCount := 1
- parameterSet := 1 // E2SM-gNB-X2
- actionDefinitionPresent := true
- actionParamCount := 1
testIndex := 1
- RESTReportSubReqAndSubDelOk(t, subReqCount, parameterSet, actionDefinitionPresent, actionParamCount, testIndex)
+ RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex)
}
-func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, parameterSet int, actionDefinitionPresent bool, actionParamCount int, testIndex int) {
- xapp.Logger.Info("TEST: TestRESTReportSubReqAndSubDelOk with parameter set %v", testIndex)
+func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) {
+ xapp.Logger.Info("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex)
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
var e2SubsId []uint32
CaseBegin("TestRESTPolicySubReqAndSubDelOk")
subReqCount := 2
- actionDefinitionPresent := true
- policyParamCount := 1
testIndex := 1
- RESTPolicySubReqAndSubDelOk(t, subReqCount, actionDefinitionPresent, policyParamCount, testIndex)
+ RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex)
subReqCount = 19
- actionDefinitionPresent = false
- policyParamCount = 0
testIndex = 2
- RESTPolicySubReqAndSubDelOk(t, subReqCount, actionDefinitionPresent, policyParamCount, testIndex)
+ RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex)
}
*/
-func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, actionDefinitionPresent bool, policyParamCount int, testIndex int) {
- xapp.Logger.Info("TEST: TestRESTPolicySubReqAndSubDelOk with parameter set %v", testIndex)
+func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) {
+ xapp.Logger.Info("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex)
// Req
- params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount)
+ params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
- //params := xappConn1.GetRESTSubsReqPolicyParams1(subReqCount, actionDefinitionPresent, policyParamCount)
+ //params := xappConn1.GetRESTSubsReqPolicyParams1(subReqCount)
//restSubId := xappConn1.SendRESTPolicySubsReq(t, params)
var e2SubsId []uint32
})
// Req
- params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount)
+ params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId)
})
// Req
- params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount)
+ params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId)
func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) {
subReqCount := 2
- parameterSet := 1
- actionDefinitionPresent := true
- actionParamCount := 1
mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{
Counter{cSubReqFromXapp, 1},
})
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId)
func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) {
subReqCount := 2
- parameterSet := 1
- actionDefinitionPresent := false
- actionParamCount := 0
mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{
Counter{cSubReqFromXapp, 1},
})
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId)
func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) {
subReqCount := 19
- parameterSet := 1
- actionDefinitionPresent := false
- actionParamCount := 0
mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{
Counter{cSubReqFromXapp, 1},
})
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId)
queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"})
// Req2
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_1")
eventTriggerDefinition := "1234"
params.SetSubEventTriggerDefinition(eventTriggerDefinition)
queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"})
// Req2
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_1")
actionId := int64(1)
queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"})
// Req2
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_1")
params.SetSubActionIDs(int64(2))
})
// Req1
- params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount)
+ params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount)
//Subs Create
restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params)
queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"})
// Req2
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_1")
restSubId2 := xappConn2.SendRESTSubsReq(t, params)
})
// Req1
- params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount)
+ params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount)
//Subs Create
restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params)
queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"})
// Req2
- params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount)
+ params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount)
params.SetMeid("RAN_NAME_1")
restSubId2 := xappConn2.SendRESTSubsReq(t, params)
queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"})
// Req2
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_1")
actionDefinition := "5678"
params.SetSubActionDefinition(actionDefinition)
queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"})
// Req2
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_1")
actionDefinition := "56782"
params.SetSubActionDefinition(actionDefinition)
queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"})
// Req2
- params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = xappConn2.GetRESTSubsReqReportParams(subReqCount)
params.SetMeid("RAN_NAME_1")
params.SetTimeToWait("w200ms")
restSubId2 := xappConn2.SendRESTSubsReq(t, params)
func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) {
xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseDecodeFail")
subReqCount := 1
- parameterSet := 1 // E2SM-gNB-X2
- actionDefinitionPresent := true
- actionParamCount := 1
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
crereq, cremsg := e2termConn1.RecvSubsReq(t)
func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) {
xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId")
subReqCount := 1
- parameterSet := 1 // E2SM-gNB-X2
- actionDefinitionPresent := true
- actionParamCount := 1
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
crereq, cremsg := e2termConn1.RecvSubsReq(t)
func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) {
xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseNoTransaction")
subReqCount := 1
- parameterSet := 1 // E2SM-gNB-X2
- actionDefinitionPresent := true
- actionParamCount := 1
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
crereq, cremsg := e2termConn1.RecvSubsReq(t)
func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) {
xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureDecodeFail")
subReqCount := 1
- parameterSet := 1 // E2SM-gNB-X2
- actionDefinitionPresent := true
- actionParamCount := 1
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
crereq, cremsg := e2termConn1.RecvSubsReq(t)
func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) {
xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId")
subReqCount := 1
- parameterSet := 1 // E2SM-gNB-X2
- actionDefinitionPresent := true
- actionParamCount := 1
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
crereq, cremsg := e2termConn1.RecvSubsReq(t)
func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) {
xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureNoTransaction")
subReqCount := 1
- parameterSet := 1 // E2SM-gNB-X2
- actionDefinitionPresent := true
- actionParamCount := 1
// Req
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
crereq, cremsg := e2termConn1.RecvSubsReq(t)
mainCtrl.wait_registry_empty(t, 10)
}
+//-----------------------------------------------------------------------------
+// TestRESTSubReqFailAsn1PackSubReqError
+//
+// stub stub
+// +-------+ +---------+ +---------+
+// | xapp | | submgr | | e2term |
+// +-------+ +---------+ +---------+
+// | | |
+// | RESTSubReq | |
+// |---------------->| |
+// | | |
+// | RESTSubResp | |
+// |<----------------| |
+// | | |
+// | ASN.1 encode fails |
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | SubDelFail |
+// | |<-------------|
+// | | |
+// | RESTNotif | |
+// | unsuccess | |
+// |<----------------| |
+// | | |
+// | [SUBS DELETE] |
+// | | |
+//
+//-----------------------------------------------------------------------------
+func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) {
+
+ mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{
+ Counter{cSubReqFromXapp, 1},
+ Counter{cSubDelReqToE2, 1},
+ Counter{cSubDelFailFromE2, 1},
+ Counter{cSubRespToXapp, 1},
+ })
+
+ subReqCount := 1
+
+ var params *teststube2ap.RESTSubsReqParams = nil
+ params = xappConn1.GetRESTSubsReqReportParams(subReqCount)
+ e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false)
+
+ // Req
+ restSubId := xappConn1.SendRESTSubsReq(t, params)
+ xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId)
+
+ // E2t: Receive SubsDelReq
+ delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
+ xappConn1.ExpectRESTNotification(t, restSubId)
+
+ // Subscription does not exist in in E2 Node.
+ e2termConn1.SendSubsDelFail(t, delreq, delmsg)
+
+ e2SubsId := xappConn1.WaitRESTNotification(t, restSubId)
+ xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId)
+
+ e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true)
+ // Wait that subs is cleaned
+ waitSubsCleanup(t, e2SubsId, 10)
+ mainCtrl.VerifyCounterValues(t)
+}
+
////////////////////////////////////////////////////////////////////////////////////
// Services for UT cases
////////////////////////////////////////////////////////////////////////////////////
const subReqCount int = 1
-const parameterSet = 1
-const actionDefinitionPresent bool = true
-const actionParamCount int = 1
-const policyParamCount int = 1
const host string = "localhost"
func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) {
if params == nil {
- params = fromXappConn.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params = fromXappConn.GetRESTSubsReqReportParams(subReqCount)
}
restSubId := fromXappConn.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId)
func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) {
- params := xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn2.GetRESTSubsReqReportParams(subReqCount)
if meid != "" {
params.SetMeid(meid)
}
}
func createXapp1PolicySubscription(t *testing.T) (string, uint32) {
- params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount)
+ params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId)
}
func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) {
- params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount)
+ params := xappConn1.GetRESTSubsReqReportParams(subReqCount)
restSubId := xappConn1.SendRESTSubsReq(t, params)
crereq1, cremsg1 := e2termConn1.RecvSubsReq(t)