}
func TestRanStatusChangeViaSDLNotification(t *testing.T) {
+ mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{
+ Counter{cE2StateChangedToUp, 3},
+ })
+
// Current UT test cases use these ran names
xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED)
xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED)
mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED")
mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED")
mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED")
+
+ mainCtrl.VerifyCounterValues(t)
}
//-----------------------------------------------------------------------------
mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{
Counter{cRestSubReqFromXapp, 1},
Counter{cRestReqRejDueE2Down, 1},
+ Counter{cE2StateChangedToDown, 1},
+ Counter{cE2StateChangedToUp, 1},
})
// E2 disconnect after E2term has received response
// Restore E2 connection for following test cases
mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED")
- mainCtrl.VerifyCounterValues(t)
mainCtrl.VerifyAllClean(t)
+ mainCtrl.VerifyCounterValues(t)
//os.Exit(0)
}
Counter{cSubReqToE2, 1},
Counter{cSubRespFromE2, 1},
Counter{cRestSubFailNotifToXapp, 1},
+ Counter{cE2StateChangedToDown, 1},
+ Counter{cE2StateChangedToUp, 1},
})
// Req
Counter{cRestSubNotifToXapp, 1},
Counter{cRestSubDelReqFromXapp, 1},
Counter{cRestSubDelRespToXapp, 1},
+ Counter{cE2StateChangedToDown, 1},
+ Counter{cE2StateChangedToUp, 1},
})
// Req
Counter{cSubDelReqToE2, 1},
Counter{cSubDelRespFromE2, 1},
Counter{cRestSubDelRespToXapp, 1},
+ Counter{cE2StateChangedToUp, 1},
})
// Req
e2termConn1.SendSubsResp(t, crereq, cremsg)
e2SubsId := xappConn1.WaitRESTNotification(t, restSubId)
- // Submgr should not react any other connection state changes than CONNECTED and DISCONNECTED
+ // Submgr should not react to any other connection state changes than CONNECTED and DISCONNECTED
mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED")
mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING")
mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN")
queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"})
+ mainCtrl.WaitOngoingRequestMapEmpty()
+
//1.st resend
restSubId_resend := xappConn1.SendRESTSubsReq(t, params)
assert.Equal(t, restSubId_resend, restSubId)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
//2.nd resend
restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params)
assert.Equal(t, restSubId_resend2, restSubId)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"})
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
//1.st resend with subscription ID
params.SetSubscriptionID(&restSubId)
assert.Equal(t, restSubId_resend, restSubId)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
//2.nd resend without subscription ID (faking app restart)
params = xappConn1.GetRESTSubsReqReportParams(subReqCount)
assert.Equal(t, restSubId_resend2, restSubId)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
// Send modified requst, this time with e2 subscriptions.
params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1)
e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend)
assert.NotEqual(t, e2SubsId2, 0)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler)
params = xappConn1.GetRESTSubsReqReportParams(subReqCount)
e2SubsId1 = xappConn1.WaitAnyRESTNotification(t)
assert.Equal(t, e2SubsId, e2SubsId1)
+ mainCtrl.WaitOngoingRequestMapEmpty()
+
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
e2SubsIds := []uint32{e2SubsId, e2SubsId2}
restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
// Send modified request, this time with e2 subscriptions.
params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1)
e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend)
assert.NotEqual(t, e2SubsId2, 0)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler)
params = xappConn1.GetRESTSubsReqReportParams(subReqCount)
e2SubsId1 = xappConn1.WaitAnyRESTNotification(t)
assert.Equal(t, e2SubsId, e2SubsId1)
+ mainCtrl.WaitOngoingRequestMapEmpty()
+
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
e2SubsIds := []uint32{e2SubsId, e2SubsId2}
restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
// Send modified requst, this time with e2 subscriptions.
params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1)
e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend)
assert.NotEqual(t, e2SubsId2, 0)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
// fresh create.
restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params)
- <-time.After(100 * time.Millisecond)
+ mainCtrl.WaitOngoingRequestMapEmpty()
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
<-time.After(time.Second * 1)
// Delete subscription 1, and wait until it has removed the first endpoint
- subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1)
xappConn1.SendRESTSubsDelReq(t, &restSubId1)
- mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10)
-
+ mainCtrl.WaitRESTSubscriptionDelete(restSubId1)
// Above wait does not work correctly anymore as this delay makes this test case work
- //<-time.After(time.Second * 1)
mainCtrl.SimulateRestart(t)
xapp.Logger.Debug("mainCtrl.SimulateRestart done 2")