From f52319be7df4b8cce5f9aef8c51e35add3003987 Mon Sep 17 00:00:00 2001 From: Rahul Banerji Date: Tue, 1 Sep 2020 16:46:15 +0530 Subject: [PATCH] [RIC-287] New Handler: Handle Ran List Object - to solve Race Condition Change-Id: Ibee3f761cd5cd0056247d71b8f2e91f14279b092 Signed-off-by: Rahul Banerji --- E2Manager/container-tag.yaml | 2 +- E2Manager/go.mod | 12 ++++---- E2Manager/go.sum | 46 +++++++++++++++++++------------ E2Manager/managers/ran_list_manager.go | 47 ++++++++++++++++++++++++++++++++ E2Manager/mocks/ran_list_manager_mock.go | 16 +++++++++++ E2Manager/services/rnib_data_service.go | 10 +++++++ 6 files changed, 107 insertions(+), 26 deletions(-) diff --git a/E2Manager/container-tag.yaml b/E2Manager/container-tag.yaml index b309729..d4430fd 100644 --- a/E2Manager/container-tag.yaml +++ b/E2Manager/container-tag.yaml @@ -1,4 +1,4 @@ # The Jenkins job requires a tag to build the Docker image. # Global-JJB script assumes this file is in the repo root. --- -tag: 5.4.8 +tag: 5.4.9 diff --git a/E2Manager/go.mod b/E2Manager/go.mod index 344bac4..c0213f9 100644 --- a/E2Manager/go.mod +++ b/E2Manager/go.mod @@ -1,13 +1,14 @@ module e2mgr require ( - gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.47 - gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.47 - gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.47 + gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.48 + gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.48 + gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.48 gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.5.2 github.com/golang/protobuf v1.4.2 github.com/gorilla/mux v1.7.0 github.com/magiconair/properties v1.8.1 + github.com/onsi/ginkgo v1.14.0 // indirect github.com/pelletier/go-toml v1.5.0 // indirect github.com/pkg/errors v0.8.1 github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -16,11 +17,8 @@ require ( github.com/stretchr/testify v1.4.0 go.uber.org/multierr v1.2.0 // indirect go.uber.org/zap v1.11.0 - golang.org/x/net v0.0.0-20191021144547-ec77196f6094 // indirect - golang.org/x/sys v0.0.0-20191105231009-c1f44814a5cd // indirect - golang.org/x/text v0.3.2 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect - gopkg.in/yaml.v2 v2.2.8 + gopkg.in/yaml.v2 v2.3.0 ) replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.5.2 diff --git a/E2Manager/go.sum b/E2Manager/go.sum index 6cea29b..b117c2a 100644 --- a/E2Manager/go.sum +++ b/E2Manager/go.sum @@ -1,10 +1,10 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.47 h1:ANQeff4O93le30a0pLrN51feB+jMTCSQZ1txzlGodZU= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.47/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.47 h1:wIiT6TjsCHBw1J9ro9FcjtnU6R9TPHPPFrIzc7LejQM= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.47/go.mod h1:YaQ+XEI4PcAoISxp9wUpUr2TP0J7JihpQTD0G1Lpd4A= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.47 h1:jMK6IoI7ibAzV96WtVDo4BJzENUYAQ3Y47kqdNgW0Ts= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.47/go.mod h1:cicCB/v15pTNovRNhyL6MBEHCwNsF/RU8xBc5vdoA7k= +gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.48 h1:gPM24V9fheL+VPAADqPVR16tpyTxVuROJfpkcZJp4KY= +gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.48/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes= +gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.48 h1:py36QUO+1NwPtUD/aQdF+Lzm/aK6Fg5UoF19Fys7GR0= +gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.48/go.mod h1:YaQ+XEI4PcAoISxp9wUpUr2TP0J7JihpQTD0G1Lpd4A= +gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.48 h1:uMHAAmBhJku8MoCqoc7mluTPgb/OXjjZauCiAM4yV48= +gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.48/go.mod h1:sj8NXrAPE8qw/8DvussZp7e0q8RAbAwC2gQGKK3la0k= gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.5.2 h1:UK7awyRKIkVdokWvvkYvazlg3EWIfMnIqCcJxTnLlDA= gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.5.2/go.mod h1:y2WhrCvdLkAKdH+ySdHSOSehACJkTMyZghCGVcqoZzc= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= @@ -31,12 +31,14 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 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-redis/redis v6.15.3+incompatible h1:NZ0O90AhLSvSrvLZ/S9h7D4kl1mW2PrKyxL7MyBKO2g= -github.com/go-redis/redis v6.15.3+incompatible/go.mod h1:W2YCLaZryXHirdd9QqwkiVUxCQsrx8SbLq9Uqk7JS7A= +github.com/go-redis/redis v6.15.2+incompatible h1:9SpNVG76gr6InJGxoZ6IuuxaCOQwDAhzyXg+Bs+0Sb4= +github.com/go-redis/redis v6.15.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= @@ -93,12 +95,16 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.5.0 h1:5BakdOZdtKJ1FFk6QdL8iSGrMWsXgchNJcrnarjbmJQ= @@ -172,8 +178,8 @@ golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20191021144547-ec77196f6094 h1:5O4U9trLjNpuhpynaDsqwCk+Tw6seqJz1EbqbnzHrc8= -golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -187,8 +193,12 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20191105231009-c1f44814a5cd h1:3x5uuvBgE6oaXJjCOvpCC1IpgJogqQ+PqGGU3ZxAgII= -golang.org/x/sys v0.0.0-20191105231009-c1f44814a5cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7NkNAQs+6Q8b9WEB/F4= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= @@ -230,6 +240,6 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= -gopkg.in/yaml.v2 v2.2.8/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= diff --git a/E2Manager/managers/ran_list_manager.go b/E2Manager/managers/ran_list_manager.go index a0c9b07..8ffa411 100755 --- a/E2Manager/managers/ran_list_manager.go +++ b/E2Manager/managers/ran_list_manager.go @@ -25,6 +25,7 @@ import ( "e2mgr/services" "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" "sync" + "time" ) type ranListManagerInstance struct { @@ -40,6 +41,9 @@ type RanListManager interface { UpdateNbIdentityConnectionStatus(nodeType entities.Node_Type, ranName string, connectionStatus entities.ConnectionStatus) error RemoveNbIdentity(nodeType entities.Node_Type, ranName string) error GetNbIdentityList() []*entities.NbIdentity + UpdateHealthcheckTimeStampReceived(oldRRanName string) (*entities.NbIdentity, *entities.NbIdentity) + UpdateHealthcheckTimeStampSent(oldRRanName string) (*entities.NbIdentity, *entities.NbIdentity) + UpdateNbIdentities(nodeType entities.Node_Type, oldNbIdentities []*entities.NbIdentity, newNbIdentities []*entities.NbIdentity) error } func NewRanListManager(logger *logger.Logger, rnibDataService services.RNibDataService) RanListManager { @@ -101,6 +105,8 @@ func (m *ranListManagerInstance) UpdateNbIdentityConnectionStatus(nodeType entit GlobalNbId: oldNbIdentity.GlobalNbId, InventoryName: ranName, ConnectionStatus: connectionStatus, + HealthCheckTimestampSent: oldNbIdentity.HealthCheckTimestampSent, + HealthCheckTimestampReceived: oldNbIdentity.HealthCheckTimestampReceived, } m.nbIdentityMap[ranName] = newNbIdentity @@ -147,3 +153,44 @@ func (m *ranListManagerInstance) GetNbIdentityList() []*entities.NbIdentity { return nbIds } + +func (m *ranListManagerInstance) UpdateHealthcheckTimeStampSent(oldRRanName string) (*entities.NbIdentity, *entities.NbIdentity){ + currentTimeStamp := time.Now().UnixNano() + oldNbIdentity := m.nbIdentityMap[oldRRanName] + + newNbIdentity := &entities.NbIdentity{ + GlobalNbId: oldNbIdentity.GlobalNbId, + InventoryName: oldNbIdentity.InventoryName, + ConnectionStatus: oldNbIdentity.ConnectionStatus, + HealthCheckTimestampSent: currentTimeStamp, + HealthCheckTimestampReceived: oldNbIdentity.HealthCheckTimestampReceived, + } + + m.nbIdentityMap[oldNbIdentity.InventoryName] = newNbIdentity + return oldNbIdentity, newNbIdentity +} + +func (m *ranListManagerInstance) UpdateHealthcheckTimeStampReceived(oldRRanName string) (*entities.NbIdentity, *entities.NbIdentity){ + currentTimeStamp := time.Now().UnixNano() + oldNbIdentity := m.nbIdentityMap[oldRRanName] + + newNbIdentity := &entities.NbIdentity{ + GlobalNbId: oldNbIdentity.GlobalNbId, + InventoryName: oldNbIdentity.InventoryName, + ConnectionStatus: oldNbIdentity.ConnectionStatus, + HealthCheckTimestampSent: oldNbIdentity.HealthCheckTimestampSent, + HealthCheckTimestampReceived: currentTimeStamp, + } + + m.nbIdentityMap[oldNbIdentity.InventoryName] = newNbIdentity + return oldNbIdentity, newNbIdentity +} + +func (m *ranListManagerInstance) UpdateNbIdentities(nodeType entities.Node_Type, oldNbIdentities []*entities.NbIdentity, newNbIdentities []*entities.NbIdentity) error { + m.mux.Lock() + defer m.mux.Unlock() + + err:= m.rnibDataService.UpdateNbIdentities(nodeType, oldNbIdentities, newNbIdentities) + + return err +} diff --git a/E2Manager/mocks/ran_list_manager_mock.go b/E2Manager/mocks/ran_list_manager_mock.go index 9606070..4153681 100644 --- a/E2Manager/mocks/ran_list_manager_mock.go +++ b/E2Manager/mocks/ran_list_manager_mock.go @@ -59,3 +59,19 @@ func (m *RanListManagerMock) GetNbIdentityList() []*entities.NbIdentity { args := m.Called() return args.Get(0).([]*entities.NbIdentity) } + +func (m *RanListManagerMock) UpdateHealthcheckTimeStampSent(oldRRanName string) (*entities.NbIdentity, *entities.NbIdentity){ + args := m.Called(oldRRanName) + return args.Get(0).(*entities.NbIdentity), args.Get(1).(*entities.NbIdentity) +} + +func (m *RanListManagerMock) UpdateHealthcheckTimeStampReceived(oldRRanName string) (*entities.NbIdentity, *entities.NbIdentity){ + args := m.Called(oldRRanName) + return args.Get(0).(*entities.NbIdentity), args.Get(1).(*entities.NbIdentity) +} + +func (m *RanListManagerMock) UpdateNbIdentities(nodeType entities.Node_Type, oldNbIdentities []*entities.NbIdentity, newNbIdentities []*entities.NbIdentity) error{ + args:= m.Called(nodeType, oldNbIdentities, newNbIdentities) + return args.Error(0) +} + diff --git a/E2Manager/services/rnib_data_service.go b/E2Manager/services/rnib_data_service.go index c053171..359e29b 100644 --- a/E2Manager/services/rnib_data_service.go +++ b/E2Manager/services/rnib_data_service.go @@ -60,6 +60,7 @@ type RNibDataService interface { RemoveNbIdentity(nodeType entities.Node_Type, nbIdentity *entities.NbIdentity) error AddEnb(nodebInfo *entities.NodebInfo) error UpdateNbIdentity(nodeType entities.Node_Type, oldNbIdentities *entities.NbIdentity, newNbIdentities *entities.NbIdentity) error + UpdateNbIdentities(nodeType entities.Node_Type, oldNbIdentities []*entities.NbIdentity, newNbIdentities []*entities.NbIdentity) error } type rNibDataService struct { @@ -402,6 +403,15 @@ func (w *rNibDataService) UpdateNbIdentity(nodeType entities.Node_Type, oldNbIde return err } +func (w *rNibDataService) UpdateNbIdentities(nodeType entities.Node_Type, oldNbIdentities []*entities.NbIdentity, newNbIdentities []*entities.NbIdentity) error { + err := w.retry("UpdateNbIdentities", func() (err error) { + err = w.rnibWriter.UpdateNbIdentities(nodeType, oldNbIdentities, newNbIdentities) + return + }) + + return err +} + func (w *rNibDataService) retry(rnibFunc string, f func() error) (err error) { attempts := w.maxAttempts -- 2.16.6