RIC-11565:Add support for Multiple E2 Nodes: CU/DU for the case having same GNBId 65/11565/7
authorGunja Rastogi <gunja.rastogi@capgemini.com>
Mon, 7 Aug 2023 12:00:06 +0000 (12:00 +0000)
committerczichy <thoralf.czichy@nokia.com>
Tue, 22 Aug 2023 12:55:49 +0000 (15:55 +0300)
Change-Id: I6a115642748e2a5acfbe012f37ef8a124879ef99
Signed-off-by: Gunja Rastogi <gunja.rastogi@capgemini.com>
E2Manager/go.mod
E2Manager/go.sum
E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go
E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler_test.go
E2Manager/models/e2_setup_request_message.go
E2Manager/rNibWriter/rNibWriter.go
E2Manager/rNibWriter/rNibWriter_test.go

index 6294658..a46916b 100644 (file)
@@ -2,9 +2,9 @@ module e2mgr
 
 require (
        gerrit.o-ran-sc.org/r/com/golog v0.0.2
-       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common 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/nodeb-rnib.git/reader v1.2.1
+       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.9
+       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.9
+       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.9
        gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.8.0
        github.com/fsnotify/fsnotify v1.4.9
        github.com/golang/protobuf v1.4.2
@@ -17,21 +17,15 @@ require (
 )
 
 require (
-       github.com/davecgh/go-spew v1.1.1 // indirect
-       github.com/go-redis/redis v6.15.9+incompatible // indirect
-       github.com/hashicorp/hcl v1.0.0 // indirect
        github.com/kr/pretty v0.2.0 // indirect
        github.com/mitchellh/mapstructure v1.3.2 // indirect
        github.com/pelletier/go-toml v1.8.0 // indirect
-       github.com/pmezard/go-difflib v1.0.0 // indirect
        github.com/spf13/afero v1.2.2 // indirect
        github.com/spf13/cast v1.3.1 // indirect
        github.com/spf13/jwalterweatherman v1.1.0 // indirect
        github.com/spf13/pflag v1.0.5 // indirect
        github.com/stretchr/objx v0.2.0 // indirect
        golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 // indirect
-       golang.org/x/text v0.3.2 // indirect
-       google.golang.org/protobuf v1.23.0 // indirect
        gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
        k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
 )
index dfb0c4d..714200b 100644 (file)
@@ -1,13 +1,14 @@
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 gerrit.o-ran-sc.org/r/com/golog.git v0.0.2 h1:Ix6SgFuzd6yW6Ur6+qDlGhDO65UYs8PiIkeAL1VaQ2o=
 gerrit.o-ran-sc.org/r/com/golog.git v0.0.2/go.mod h1:A7hUL52YQSO4dFIZNcj76XQ09C9PftAe3LyL7kqBnok=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1 h1:3FFbXx55BODThXfyWAiz6cPXVELXFICDQUmJi13EoxM=
-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/go.mod h1:YaQ+XEI4PcAoISxp9wUpUr2TP0J7JihpQTD0G1Lpd4A=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.8 h1:9KLAcDI20l0lYsIbfzlVRMwWLU6iflJkgqG1FxmvcPM=
-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/nodeb-rnib.git/common v1.2.7/go.mod h1:JVNvaD61QI8E1HZNznKw8U8XjIg8W5N1FGTtyirW2iI=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.9 h1:NC0UEFpoj0IEafiuFZx4Kk3eDChhmwGjdAv2nkHTlMo=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.9/go.mod h1:JVNvaD61QI8E1HZNznKw8U8XjIg8W5N1FGTtyirW2iI=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.7/go.mod h1:8NTND7RCHfHPQtx1xk9oclqF/7usqDAX9aYBzt3Hynk=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.9 h1:ixfXB3f75PU4DRFF/JdLKnTqQ/ITjPgv2Ew7O4jqnJw=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.9/go.mod h1:8NTND7RCHfHPQtx1xk9oclqF/7usqDAX9aYBzt3Hynk=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.9 h1:Ex7J8QOjP9jvog7yV/PrWRupbA4X0w8Ili24MI0OwPA=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.9/go.mod h1:B02VX2P9GIozb8YyN1e7yzE24Mn9CHWeJ42TZNzGdjw=
 gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0 h1:H7GtCRC+pGn6oOxYalUZr7LinQX5jQCVa+ConX7PB5Q=
 gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0/go.mod h1:KCHu4JkWnw2Ro6P747wU9S2t7zxFLmBNCiYvGZo3CHo=
 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
@@ -37,6 +38,7 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
+github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
 github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
 github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
 github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
@@ -218,5 +220,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
 gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
 k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk=
 k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
index 90f8fc6..9dde134 100644 (file)
@@ -2,6 +2,7 @@
 // Copyright 2019 AT&T Intellectual Property
 // Copyright 2019 Nokia
 // Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved.
+// Copyright 2023 Capgemini
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -385,6 +386,18 @@ func (h *E2SetupRequestNotificationHandler) buildNodebInfo(ranName string, e2tAd
        }
        nodebInfo.GetGnb().NodeConfigs = e2NodeConfig
 
+       if nodebInfo.NodeType == entities.Node_GNB {
+               h.logger.Debugf("#E2SetupRequestNotificationHandler buildNodebInfo - entities.Node_GNB %d", entities.Node_GNB)
+
+               gnbNodetype := h.setGnbNodeType(request)
+               h.logger.Debugf("#E2SetupRequestNotificationHandler buildNodebInfo -gnbNodetype %s", gnbNodetype)
+               nodebInfo.GnbNodeType = gnbNodetype
+               nodebInfo.CuUpId = request.GetCuupId()
+               nodebInfo.DuId = request.GetDuId()
+               h.logger.Debugf("#E2SetupRequestNotificationHandler buildNodebInfo -cuupid%s", request.GetCuupId())
+               h.logger.Debugf("#E2SetupRequestNotificationHandler buildNodebInfo -duid %s", request.GetDuId())
+       }
+
        ranFuncs := request.ExtractRanFunctionsList()
 
        if ranFuncs != nil {
@@ -394,6 +407,24 @@ func (h *E2SetupRequestNotificationHandler) buildNodebInfo(ranName string, e2tAd
        return nodebInfo, nil
 }
 
+
+func (h *E2SetupRequestNotificationHandler) setGnbNodeType(setupRequest *models.E2SetupRequestMessage) string {
+       gnbNodetype := "gNB"
+          /*Note: Deployment where CU-UP and DU are combined
+         (but do not include the CP-CP) and have a single E2 connection
+          is not supported. The combination of CU-CP, CU-UP, and DU will be
+          treated as a single gNB and expect it to have only the
+          global gNB ID in its E2 Setup ID*/
+       if setupRequest.GetCuupId() != "" && setupRequest.GetDuId() != "" {
+               gnbNodetype = "gNB"
+       } else if setupRequest.GetCuupId() != "" {
+               gnbNodetype = "gNB_CU_UP"
+       } else if setupRequest.GetDuId() != "" {
+               gnbNodetype = "gNB_DU"
+       }
+       return gnbNodetype
+}
+
 func (h *E2SetupRequestNotificationHandler) setNodeTypeAndConfiguration(nodebInfo *entities.NodebInfo) error {
        for k, v := range gnbTypesMap {
                if strings.HasPrefix(nodebInfo.RanName, k) {
index f03a1c4..1f790a6 100644 (file)
@@ -2,6 +2,7 @@
 // Copyright 2019 AT&T Intellectual Property
 // Copyright 2019 Nokia
 // Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+// Copyright 2023 Capgemini
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -459,12 +460,21 @@ func getExpectedGnbNodebForNewRan(payload []byte) *entities.NodebInfo {
        pipInd := bytes.IndexByte(payload, '|')
        setupRequest := &models.E2SetupRequestMessage{}
        _ = xml.Unmarshal(utils.NormalizeXml(payload[pipInd+1:]), &setupRequest.E2APPDU)
+       gnbNodetype := "gNB_CU_UP"
+       if setupRequest.GetCuupId() != "" && setupRequest.GetCuupId() != "0" && setupRequest.GetDuId() != "" && setupRequest.GetDuId() != "0" {
+               gnbNodetype = "gNB_CU_UP"
+       } else if setupRequest.GetCuupId() != "" && setupRequest.GetCuupId() != "0" {
+               gnbNodetype = "gNB_CU_UP"
+       } else if setupRequest.GetDuId() != "" && setupRequest.GetDuId() != "0" {
+               gnbNodetype = "gNB_DU"
+       }
 
        nodeb := &entities.NodebInfo{
                AssociatedE2TInstanceAddress: e2tInstanceFullAddress,
                RanName:                      gnbNodebRanName,
                SetupFromNetwork:             true,
                NodeType:                     entities.Node_GNB,
+               GnbNodeType:                  gnbNodetype,
                Configuration: &entities.NodebInfo_Gnb{
                        Gnb: &entities.Gnb{
                                GnbType:      entities.GnbType_GNB,
@@ -476,6 +486,8 @@ func getExpectedGnbNodebForNewRan(payload []byte) *entities.NodebInfo {
                        PlmnId: setupRequest.GetPlmnId(),
                        NbId:   setupRequest.GetNbId(),
                },
+               CuUpId:  setupRequest.GetCuupId(),
+               DuId:    setupRequest.GetDuId(),
        }
 
        return nodeb
index 420d5fd..949a59b 100644 (file)
@@ -2,6 +2,7 @@
 // Copyright 2019 AT&T Intellectual Property
 // Copyright 2019 Nokia
 // Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+// Copyright 2023 Capgemini
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -37,6 +38,8 @@ type Gnb struct {
                        GnbID string `xml:"gnb-ID"`
                } `xml:"gnb-id"`
        } `xml:"global-gNB-ID"`
+       GNBCUUPID string `xml:"gNB-CU-UP-ID"`
+       GNBDUID   string `xml:"gNB-DU-ID"`
 }
 
 type EnGnb struct {
@@ -607,6 +610,23 @@ func (m *E2SetupRequestMessage) GetPlmnId() string {
        return ""
 }
 
+func (m *E2SetupRequestMessage) GetCuupId() string {
+       globalE2NodeId := m.getGlobalE2NodeId()
+       if id := globalE2NodeId.GNB.GNBCUUPID; id != "" {
+               return m.trimSpaces(id)
+       }
+       return ""
+
+}
+
+func (m *E2SetupRequestMessage) GetDuId() string {
+       globalE2NodeId := m.getGlobalE2NodeId()
+       if id := globalE2NodeId.GNB.GNBDUID; id != "" {
+               return m.trimSpaces(id)
+       }
+       return ""
+}
+
 func (m *E2SetupRequestMessage) getInnerEnbId(enbId EnbId) string {
 
        if id := enbId.HomeEnbId; id != "" {
index d107f55..fdc1aaf 100644 (file)
@@ -1,6 +1,7 @@
 //
 // Copyright 2019 AT&T Intellectual Property
 // Copyright 2019 Nokia
+// Copyright 2023 Capgemini
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -153,7 +154,7 @@ func (w *rNibWriterInstance) SaveNodeb(nodebInfo *entities.NodebInfo) error {
 
        if nodebInfo.GlobalNbId != nil {
 
-               key, rNibErr = common.ValidateAndBuildNodeBIdKey(nodebInfo.GetNodeType().String(), nodebInfo.GlobalNbId.GetPlmnId(), nodebInfo.GlobalNbId.GetNbId())
+               key, rNibErr = common.ValidateAndBuildNodeBIdKey(nodebInfo.GetNodeType().String(), nodebInfo.GlobalNbId.GetPlmnId(), nodebInfo.GlobalNbId.GetNbId(),nodebInfo.GetCuUpId(),nodebInfo.GetDuId())
                if rNibErr != nil {
                        return rNibErr
                }
@@ -202,7 +203,7 @@ func (w *rNibWriterInstance) AddEnb(nodebInfo *entities.NodebInfo) error {
 
        if nodebInfo.GlobalNbId != nil {
 
-               key, rNibErr = common.ValidateAndBuildNodeBIdKey(nodebInfo.GetNodeType().String(), nodebInfo.GlobalNbId.GetPlmnId(), nodebInfo.GlobalNbId.GetNbId())
+               key, rNibErr = common.ValidateAndBuildNodeBIdKey(nodebInfo.GetNodeType().String(), nodebInfo.GlobalNbId.GetPlmnId(), nodebInfo.GlobalNbId.GetNbId(),nodebInfo.GetCuUpId(),nodebInfo.GetDuId())
                if rNibErr != nil {
                        return rNibErr
                }
@@ -323,7 +324,7 @@ func buildUpdateNodebInfoPairs(nodebInfo *entities.NodebInfo) ([]interface{}, er
                return []interface{}{}, rNibErr
        }
 
-       nodebIdKey, buildNodebIdKeyError := common.ValidateAndBuildNodeBIdKey(nodebInfo.GetNodeType().String(), nodebInfo.GlobalNbId.GetPlmnId(), nodebInfo.GlobalNbId.GetNbId())
+       nodebIdKey, buildNodebIdKeyError := common.ValidateAndBuildNodeBIdKey(nodebInfo.GetNodeType().String(), nodebInfo.GlobalNbId.GetPlmnId(), nodebInfo.GlobalNbId.GetNbId(),nodebInfo.GetCuUpId(),nodebInfo.GetDuId())
 
        data, err := proto.Marshal(nodebInfo)
 
@@ -351,7 +352,7 @@ func (w *rNibWriterInstance) buildRemoveEnbKeys(nodebInfo *entities.NodebInfo) (
 
        keys = append(keys, nodebNameKey)
 
-       nodebIdKey, buildNodebIdKeyError := common.ValidateAndBuildNodeBIdKey(nodebInfo.GetNodeType().String(), nodebInfo.GlobalNbId.GetPlmnId(), nodebInfo.GlobalNbId.GetNbId())
+       nodebIdKey, buildNodebIdKeyError := common.ValidateAndBuildNodeBIdKey(nodebInfo.GetNodeType().String(), nodebInfo.GlobalNbId.GetPlmnId(), nodebInfo.GlobalNbId.GetNbId(),nodebInfo.GetCuUpId(),nodebInfo.GetDuId())
 
        if buildNodebIdKeyError == nil {
                keys = append(keys, nodebIdKey)
index 81183b7..ecdd9d6 100644 (file)
@@ -1,6 +1,7 @@
 //
 // Copyright 2019 AT&T Intellectual Property
 // Copyright 2019 Nokia
+// Copyright 2023 Capgemini
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -201,7 +202,7 @@ func getUpdateEnbCellsSetExpected(t *testing.T, nodebInfo *entities.NodebInfo, s
        }
 
        nodebNameKey, _ := common.ValidateAndBuildNodeBNameKey(nodebInfo.RanName)
-       nodebIdKey, _ := common.ValidateAndBuildNodeBIdKey(nodebInfo.NodeType.String(), nodebInfo.GlobalNbId.PlmnId, nodebInfo.GlobalNbId.NbId)
+       nodebIdKey, _ := common.ValidateAndBuildNodeBIdKey(nodebInfo.NodeType.String(), nodebInfo.GlobalNbId.PlmnId, nodebInfo.GlobalNbId.NbId,nodebInfo.CuUpId,nodebInfo.DuId)
        setExpected := []interface{}{nodebNameKey, nodebInfoData, nodebIdKey, nodebInfoData}
 
        for _, cell := range servedCells {
@@ -229,7 +230,7 @@ func getUpdateGnbCellsSetExpected(t *testing.T, nodebInfo *entities.NodebInfo, s
        }
 
        nodebNameKey, _ := common.ValidateAndBuildNodeBNameKey(nodebInfo.RanName)
-       nodebIdKey, _ := common.ValidateAndBuildNodeBIdKey(nodebInfo.NodeType.String(), nodebInfo.GlobalNbId.PlmnId, nodebInfo.GlobalNbId.NbId)
+       nodebIdKey, _ := common.ValidateAndBuildNodeBIdKey(nodebInfo.NodeType.String(), nodebInfo.GlobalNbId.PlmnId, nodebInfo.GlobalNbId.NbId,nodebInfo.CuUpId,nodebInfo.DuId)
        setExpected := []interface{}{nodebNameKey, nodebInfoData, nodebIdKey, nodebInfoData}
 
        for _, v := range servedNrCells {
@@ -1178,7 +1179,7 @@ func getUpdateEnbSetExpected(t *testing.T, nodebInfo *entities.NodebInfo, served
        }
 
        nodebNameKey, _ := common.ValidateAndBuildNodeBNameKey(nodebInfo.RanName)
-       nodebIdKey, _ := common.ValidateAndBuildNodeBIdKey(nodebInfo.NodeType.String(), nodebInfo.GlobalNbId.PlmnId, nodebInfo.GlobalNbId.NbId)
+       nodebIdKey, _ := common.ValidateAndBuildNodeBIdKey(nodebInfo.NodeType.String(), nodebInfo.GlobalNbId.PlmnId, nodebInfo.GlobalNbId.NbId,nodebInfo.CuUpId,nodebInfo.DuId)
        setExpected := []interface{}{nodebNameKey, nodebInfoData, nodebIdKey, nodebInfoData}
 
        for _, v := range servedCells {