return
}
- if strings.Contains(events[0], "_CONNECTED") {
+ if strings.Contains(events[0], "_CONNECTED") && !strings.Contains(events[0], "_CONNECTED_SETUP_FAILED") {
+ e.control.UpdateCounter(cE2StateChangedToUp)
nbId, err := ExtractNbiIdFromString(events[0])
if err != nil {
xapp.Logger.Error("NotificationCb CONNECTED len(nbId) == 0 ")
xapp.Logger.Debug("E2 CONNECTED. NbId=%s", nbId)
e.NbIdMap[nbId] = nbId
} else if strings.Contains(events[0], "_DISCONNECTED") {
+ e.control.UpdateCounter(cE2StateChangedToDown)
nbId, err := ExtractNbiIdFromString(events[0])
if err != nil {
xapp.Logger.Error("NotificationCb DISCONNECTED len(nbId) == 0 ")
if e.isNodeBActive(nbIdentity.InventoryName) == false {
if _, ok := e.NbIdMap[nbIdentity.InventoryName]; ok {
delete(e.NbIdMap, nbIdentity.InventoryName)
- e.control.UpdateCounter(cE2StateChangedToDown)
xapp.Logger.Debug("E2 connection DISCONNETED: %v", nbIdentity.InventoryName)
// Delete all subscriptions related to InventoryName/nbId
if _, ok := e.NbIdMap[nbIdentity.InventoryName]; !ok {
e.NbIdMap[nbIdentity.InventoryName] = nbIdentity.InventoryName
- e.control.UpdateCounter(cE2StateChangedToDown)
xapp.Logger.Debug("E2 connection CONNECTED: %v", nbIdentity.InventoryName)
}
}
}
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")