Code Review
/
ric-plt
/
submgr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix for E2 Connection status counters
[ric-plt/submgr.git]
/
pkg
/
control
/
ut_messaging_test.go
diff --git
a/pkg/control/ut_messaging_test.go
b/pkg/control/ut_messaging_test.go
index
7d7f67b
..
79eccd2
100644
(file)
--- a/
pkg/control/ut_messaging_test.go
+++ b/
pkg/control/ut_messaging_test.go
@@
-46,6
+46,10
@@
func TestSuiteSetup(t *testing.T) {
}
func TestRanStatusChangeViaSDLNotification(t *testing.T) {
}
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)
// Current UT test cases use these ran names
xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED)
xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED)
@@
-57,6
+61,8
@@
func TestRanStatusChangeViaSDLNotification(t *testing.T) {
mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED")
mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED")
mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED")
mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED")
mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED")
mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED")
+
+ mainCtrl.VerifyCounterValues(t)
}
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
@@
-83,6
+89,8
@@
func TestRESTSubReqAfterE2ConnBreak(t *testing.T) {
mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{
Counter{cRestSubReqFromXapp, 1},
Counter{cRestReqRejDueE2Down, 1},
mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{
Counter{cRestSubReqFromXapp, 1},
Counter{cRestReqRejDueE2Down, 1},
+ Counter{cE2StateChangedToDown, 1},
+ Counter{cE2StateChangedToUp, 1},
})
// E2 disconnect after E2term has received response
})
// E2 disconnect after E2term has received response
@@
-95,8
+103,8
@@
func TestRESTSubReqAfterE2ConnBreak(t *testing.T) {
// Restore E2 connection for following test cases
mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED")
// Restore E2 connection for following test cases
mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED")
- mainCtrl.VerifyCounterValues(t)
mainCtrl.VerifyAllClean(t)
mainCtrl.VerifyAllClean(t)
+ mainCtrl.VerifyCounterValues(t)
//os.Exit(0)
}
//os.Exit(0)
}
@@
-135,6
+143,8
@@
func TestRESTSubReqE2ConnBreak(t *testing.T) {
Counter{cSubReqToE2, 1},
Counter{cSubRespFromE2, 1},
Counter{cRestSubFailNotifToXapp, 1},
Counter{cSubReqToE2, 1},
Counter{cSubRespFromE2, 1},
Counter{cRestSubFailNotifToXapp, 1},
+ Counter{cE2StateChangedToDown, 1},
+ Counter{cE2StateChangedToUp, 1},
})
// Req
})
// Req
@@
-212,6
+222,8
@@
func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) {
Counter{cRestSubNotifToXapp, 1},
Counter{cRestSubDelReqFromXapp, 1},
Counter{cRestSubDelRespToXapp, 1},
Counter{cRestSubNotifToXapp, 1},
Counter{cRestSubDelReqFromXapp, 1},
Counter{cRestSubDelRespToXapp, 1},
+ Counter{cE2StateChangedToDown, 1},
+ Counter{cE2StateChangedToUp, 1},
})
// Req
})
// Req
@@
-289,6
+301,7
@@
func TestRESTOtherE2ConnectionChanges(t *testing.T) {
Counter{cSubDelReqToE2, 1},
Counter{cSubDelRespFromE2, 1},
Counter{cRestSubDelRespToXapp, 1},
Counter{cSubDelReqToE2, 1},
Counter{cSubDelRespFromE2, 1},
Counter{cRestSubDelRespToXapp, 1},
+ Counter{cE2StateChangedToUp, 1},
})
// Req
})
// Req
@@
-300,7
+313,7
@@
func TestRESTOtherE2ConnectionChanges(t *testing.T) {
e2termConn1.SendSubsResp(t, crereq, cremsg)
e2SubsId := xappConn1.WaitRESTNotification(t, restSubId)
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")
mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED")
mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING")
mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN")
@@
-2983,19
+2996,21
@@
func TestRESTSubReqRetransmissionV2(t *testing.T) {
queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"})
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)
//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)
//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)
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
@@
-3067,7
+3082,7
@@
func TestRESTSubReqRetransmissionV3(t *testing.T) {
queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"})
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)
//1.st resend with subscription ID
params.SetSubscriptionID(&restSubId)
@@
-3075,7
+3090,7
@@
func TestRESTSubReqRetransmissionV3(t *testing.T) {
assert.Equal(t, restSubId_resend, 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)
//2.nd resend without subscription ID (faking app restart)
params = xappConn1.GetRESTSubsReqReportParams(subReqCount)
@@
-3083,7
+3098,7
@@
func TestRESTSubReqRetransmissionV3(t *testing.T) {
assert.Equal(t, restSubId_resend2, restSubId)
assert.Equal(t, restSubId_resend2, restSubId)
-
<-time.After(100 * time.Millisecond
)
+
mainCtrl.WaitOngoingRequestMapEmpty(
)
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
@@
-3169,7
+3184,7
@@
func TestRESTSubReqRetransmissionV4(t *testing.T) {
restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)
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)
// Send modified requst, this time with e2 subscriptions.
params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1)
@@
-3190,7
+3205,7
@@
func TestRESTSubReqRetransmissionV4(t *testing.T) {
e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend)
assert.NotEqual(t, e2SubsId2, 0)
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)
xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler)
params = xappConn1.GetRESTSubsReqReportParams(subReqCount)
@@
-3203,6
+3218,8
@@
func TestRESTSubReqRetransmissionV4(t *testing.T) {
e2SubsId1 = xappConn1.WaitAnyRESTNotification(t)
assert.Equal(t, e2SubsId, e2SubsId1)
e2SubsId1 = xappConn1.WaitAnyRESTNotification(t)
assert.Equal(t, e2SubsId, e2SubsId1)
+ mainCtrl.WaitOngoingRequestMapEmpty()
+
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
e2SubsIds := []uint32{e2SubsId, e2SubsId2}
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
e2SubsIds := []uint32{e2SubsId, e2SubsId2}
@@
-3290,7
+3307,7
@@
func TestRESTSubReqRetransmissionV5(t *testing.T) {
restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)
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)
// Send modified requst, this time with e2 subscriptions.
params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1)
@@
-3313,7
+3330,7
@@
func TestRESTSubReqRetransmissionV5(t *testing.T) {
e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend)
assert.NotEqual(t, e2SubsId2, 0)
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)
xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler)
params = xappConn1.GetRESTSubsReqReportParams(subReqCount)
@@
-3326,6
+3343,8
@@
func TestRESTSubReqRetransmissionV5(t *testing.T) {
e2SubsId1 = xappConn1.WaitAnyRESTNotification(t)
assert.Equal(t, e2SubsId, e2SubsId1)
e2SubsId1 = xappConn1.WaitAnyRESTNotification(t)
assert.Equal(t, e2SubsId, e2SubsId1)
+ mainCtrl.WaitOngoingRequestMapEmpty()
+
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
e2SubsIds := []uint32{e2SubsId, e2SubsId2}
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
e2SubsIds := []uint32{e2SubsId, e2SubsId2}
@@
-3422,7
+3441,7
@@
func TestRESTSubReqRetransmissionV6(t *testing.T) {
restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params)
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)
// Send modified requst, this time with e2 subscriptions.
params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1)
@@
-3443,7
+3462,7
@@
func TestRESTSubReqRetransmissionV6(t *testing.T) {
e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend)
assert.NotEqual(t, e2SubsId2, 0)
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)
// Delete both e2 subscriptions
xappConn1.SendRESTSubsDelReq(t, &restSubId)
@@
-3457,7
+3476,7
@@
func TestRESTSubReqRetransmissionV6(t *testing.T) {
// fresh create.
restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params)
// fresh create.
restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params)
-
<-time.After(100 * time.Millisecond
)
+
mainCtrl.WaitOngoingRequestMapEmpty(
)
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
deleteSubscription(t, xappConn1, e2termConn1, &restSubId)
@@
-5253,12
+5272,9
@@
func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) {
<-time.After(time.Second * 1)
// Delete subscription 1, and wait until it has removed the first endpoint
<-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)
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
// 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")
mainCtrl.SimulateRestart(t)
xapp.Logger.Debug("mainCtrl.SimulateRestart done 2")