X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fe2if_state.go;fp=pkg%2Fcontrol%2Fe2if_state.go;h=e8ceef2f045af2e4bddd8389f49ce9fe53672874;hb=7dbc4adf49cd8f07f45c2412c47eb2829b8161f9;hp=5f7eb353360fdab9b050f2b047ed3c6054644948;hpb=fc67b036d8944c372715b7306f892d2ddfb4684f;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/e2if_state.go b/pkg/control/e2if_state.go index 5f7eb35..e8ceef2 100644 --- a/pkg/control/e2if_state.go +++ b/pkg/control/e2if_state.go @@ -49,14 +49,16 @@ func CreateXappRnibIfInstance() XappRnibInterface { } type E2IfState struct { - mutex sync.Mutex - control *Control - NbIdMap map[string]string + mutex sync.Mutex + control *Control + NbIdMap map[string]string + NbIdStatusMap map[string]string } func (e *E2IfState) Init(c *Control) { e.control = c e.NbIdMap = make(map[string]string, 0) + e.NbIdStatusMap = make(map[string]string, 0) e.ReadE2ConfigurationFromRnib() err := e.SubscribeChannels() if err != nil { @@ -106,6 +108,7 @@ func (e *E2IfState) NotificationCb(ch string, events ...string) { } xapp.Logger.Debug("E2 CONNECTED. NbId=%s", nbId) e.NbIdMap[nbId] = nbId + e.NbIdStatusMap[nbId] = "CONNECTED" } else if strings.Contains(events[0], "_DISCONNECTED") { e.control.UpdateCounter(cE2StateChangedToDown) nbId, err := ExtractNbiIdFromString(events[0]) @@ -115,6 +118,7 @@ func (e *E2IfState) NotificationCb(ch string, events ...string) { } xapp.Logger.Debug("E2 DISCONNECTED. NbId=%s", nbId) if _, ok := e.NbIdMap[nbId]; ok { + e.NbIdStatusMap[nbId] = "DISCONNECTED" delete(e.NbIdMap, nbId) e.control.registry.DeleteAllE2Subscriptions(nbId, e.control) } @@ -126,6 +130,7 @@ func (e *E2IfState) NotificationCb(ch string, events ...string) { xapp.Logger.Error("NotificationCb _UNDER_RESET %v ", err) return } + e.NbIdStatusMap[nbId] = "UNDER_RESET" xapp.Logger.Debug("E2 Under Reset. NbId=%s", nbId) if _, ok := e.NbIdMap[nbId]; ok { e.control.registry.DeleteAllE2Subscriptions(nbId, e.control) @@ -195,6 +200,15 @@ func (e *E2IfState) IsE2ConnectionUp(nbId *string) bool { } } +func (e *E2IfState) IsE2ConnectionUnderReset(nbId *string) bool { + + if status := e.NbIdStatusMap[*nbId]; status == "UNDER_RESET" { + return true + } else { + return false + } +} + func ExtractNbiIdFromString(s string) (string, error) { // Expected string formats are below