Delete all subscriptions for the Ran when Ran is under reset state.
Signed-off-by: naman.gupta <naman.gupta@samsung.com>
Change-Id: I86c488c67c1dc20cfdd958ad65d0ad67a5390be3
require (
gerrit.o-ran-sc.org/r/ric-plt/e2ap v0.0.0-00010101000000-000000000000
- gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1
+ gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.8
gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.8.0
gerrit.o-ran-sc.org/r/ric-plt/xapp-frame v0.0.0-00010101000000-000000000000
github.com/go-openapi/runtime v0.19.4
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1 h1:8Z60JRsPgcS1Ona4fEh6d0/03nLq1WHoZcNnBsni5+g=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1/go.mod h1:YaQ+XEI4PcAoISxp9wUpUr2TP0J7JihpQTD0G1Lpd4A=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.8/go.mod h1:8NTND7RCHfHPQtx1xk9oclqF/7usqDAX9aYBzt3Hynk=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.1 h1:BG3kste8PLVTG0m8CRB/VP2tAV5JImKueBGuOsUNcR8=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.1/go.mod h1:zX8rW6YEsagHrRGVW5YO50Ku/Csrpzsuvblhr4DbYi4=
gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0 h1:H7GtCRC+pGn6oOxYalUZr7LinQX5jQCVa+ConX7PB5Q=
import (
"encoding/json"
"fmt"
- "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
"strings"
"sync"
+
+ "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
)
type XappRnibIf struct {
delete(e.NbIdMap, nbId)
e.control.registry.DeleteAllE2Subscriptions(nbId, e.control)
}
+ } else if strings.Contains(events[0], "_UNDER_RESET") {
+ xapp.Logger.Debug("NotificationCb UNDER_RESET len(nbId) == 0 ")
+ e.control.UpdateCounter(cE2StateUnderReset)
+ nbId, err := ExtractNbiIdFromString(events[0])
+ if err != nil {
+ xapp.Logger.Error("NotificationCb _UNDER_RESET %v ", err)
+ return
+ }
+ xapp.Logger.Debug("E2 Under Reset. NbId=%s", nbId)
+ if _, ok := e.NbIdMap[nbId]; ok {
+ e.control.registry.DeleteAllE2Subscriptions(nbId, e.control)
+ }
}
}
} else if strings.Contains(s, "_DISCONNECTED") {
splitStringTbl := strings.Split(s, "_DISCONNECTED")
nbId = splitStringTbl[0]
+ } else if strings.Contains(s, "_UNDER_RESET") {
+ splitStringTbl := strings.Split(s, "_UNDER_RESET")
+ nbId = splitStringTbl[0]
}
if len(nbId) == 0 {
return "", fmt.Errorf("ExtractNbiIdFromString(): len(nbId) == 0 ")
xappRnibMock.CreateGnb("gnb_369_11105_aaaaa3", entities.ConnectionStatus_SHUTTING_DOWN)
xappRnibMock.CreateGnb("gnb_369_11105_aaaaa3", entities.ConnectionStatus_SHUT_DOWN)
xappRnibMock.CreateGnb("gnb_369_11105_aaaaa3", entities.ConnectionStatus_DISCONNECTED)
+ xappRnibMock.CreateGnb("gnb_369_11105_aaaaa3", entities.ConnectionStatus_UNDER_RESET)
mainCtrl.c.e2IfState.ReadE2ConfigurationFromRnib()
mainCtrl.c.e2IfState.SubscribeChannels()
if err := xappRnibMock.XappRnibStoreAndPublish("RAN_CONNECTION_STATUS_CHANGE", "gnb_369_11105_aaaaa3_DISCONNECTED", "key1", "data1"); err != nil {
t.Errorf("XappRnibStoreAndPublish failed: %v", err)
}
+ if err := xappRnibMock.XappRnibStoreAndPublish("RAN_CONNECTION_STATUS_CHANGE", "gnb_369_11105_aaaaa3_UNDER_RESET", "key1", "data1"); err != nil {
+ t.Errorf("XappRnibStoreAndPublish failed: %v", err)
+ }
}
func (x *XappRnibMock) CreateGnb(gnbId string, connectionStatus entities.ConnectionStatus) {
connectionStatus = entities.ConnectionStatus_SHUT_DOWN
splitStringTbl := strings.Split(s, "_SHUT_DOWN")
nbId = splitStringTbl[0]
+ } else if strings.Contains(s, "_UNDER_RESET") {
+ connectionStatus = entities.ConnectionStatus_UNDER_RESET
+ splitStringTbl := strings.Split(s, "_UNDER_RESET")
+ nbId = splitStringTbl[0]
} else {
return "", 0, fmt.Errorf("XappRnibMock: Invalid connection status. %s", s)
}
cSDLRemoveFailure string = "SDLRemoveFailure"
cE2StateChangedToUp string = "E2StateChangedToUp"
cE2StateChangedToDown string = "E2StateChangedToDown"
+ cE2StateUnderReset string = "E2StateChangedToUnderReset"
)
func GetMetricsOpts() []xapp.CounterOpts {
// E2 interface state counters
{Name: cE2StateChangedToUp, Help: "The total number of E2 interface change connected state"},
{Name: cE2StateChangedToDown, Help: "The total number of E2 interface change disconnected state"},
+ {Name: cE2StateUnderReset, Help: "The total number of E2 interface change under reset state"},
}
}
Counter{cSDLRemoveFailure, 1},
Counter{cE2StateChangedToUp, 1},
Counter{cE2StateChangedToDown, 1},
+ Counter{cE2StateUnderReset, 1},
})
mainCtrl.c.UpdateCounter(cSubReqFromXapp)
mainCtrl.c.UpdateCounter(cSDLRemoveFailure)
mainCtrl.c.UpdateCounter(cE2StateChangedToUp)
mainCtrl.c.UpdateCounter(cE2StateChangedToDown)
+ mainCtrl.c.UpdateCounter(cE2StateUnderReset)
mainCtrl.VerifyCounterValues(t)
}