import (
"errors"
"fmt"
- "github.com/spf13/viper"
"strconv"
+
+ "github.com/spf13/viper"
)
type RnibWriterConfig struct {
KeepAliveResponseTimeoutMs int
KeepAliveDelayMs int
E2TInstanceDeletionTimeoutMs int
+ E2ResetTimeOutSec int
GlobalRicId struct {
RicId string
Mcc string
config.KeepAliveResponseTimeoutMs = viper.GetInt("keepAliveResponseTimeoutMs")
config.KeepAliveDelayMs = viper.GetInt("KeepAliveDelayMs")
config.E2TInstanceDeletionTimeoutMs = viper.GetInt("e2tInstanceDeletionTimeoutMs")
+ //E2ResetTimeOutSec : timeout expiry threshold required for handling reset and thus the time for which the nodeb is under reset connection state.
+ config.E2ResetTimeOutSec = viper.GetInt("e2ResetTimeOutSec")
config.populateGlobalRicIdConfig(viper.Sub("globalRicId"))
config.populateRnibWriterConfig(viper.Sub("rnibWriter"))
return &config
func (c *Configuration) String() string {
return fmt.Sprintf("{logging.logLevel: %s, http.port: %d, rmr: { port: %d, maxMsgSize: %d}, routingManager.baseUrl: %s, "+
"notificationResponseBuffer: %d, bigRedButtonTimeoutSec: %d, maxRnibConnectionAttempts: %d, "+
- "rnibRetryIntervalMs: %d, keepAliveResponseTimeoutMs: %d, keepAliveDelayMs: %d, e2tInstanceDeletionTimeoutMs: %d, "+
+ "rnibRetryIntervalMs: %d, keepAliveResponseTimeoutMs: %d, keepAliveDelayMs: %d, e2tInstanceDeletionTimeoutMs: %d,e2ResetTimeOutSec: %d,"+
"globalRicId: { ricId: %s, mcc: %s, mnc: %s}, rnibWriter: { stateChangeMessageChannel: %s, ranManipulationChannel: %s}",
c.Logging.LogLevel,
c.Http.Port,
c.KeepAliveResponseTimeoutMs,
c.KeepAliveDelayMs,
c.E2TInstanceDeletionTimeoutMs,
+ c.E2ResetTimeOutSec,
c.GlobalRicId.RicId,
c.GlobalRicId.Mcc,
c.GlobalRicId.Mnc,
package configuration
import (
- "github.com/stretchr/testify/assert"
- "gopkg.in/yaml.v2"
"io/ioutil"
"os"
"testing"
+
+ "github.com/stretchr/testify/assert"
+ "gopkg.in/yaml.v2"
)
func TestParseConfigurationSuccess(t *testing.T) {
assert.Equal(t, 4500, config.KeepAliveResponseTimeoutMs)
assert.Equal(t, 1500, config.KeepAliveDelayMs)
assert.Equal(t, 15000, config.E2TInstanceDeletionTimeoutMs)
+ assert.Equal(t, 10, config.E2ResetTimeOutSec)
assert.NotNil(t, config.GlobalRicId)
assert.Equal(t, "AACCE", config.GlobalRicId.RicId)
assert.Equal(t, "310", config.GlobalRicId.Mcc)
"logging": map[string]interface{}{"logLevel": "info"},
"http": map[string]interface{}{"port": 3800},
"routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"},
- "globalRicId": map[string]interface{}{"mcc": 327, "mnc": 94, "ricId": "AACCE"},
+ "globalRicId": map[string]interface{}{"mcc": 327, "mnc": 94, "ricId": "AACCE"},
}
buf, err := yaml.Marshal(yamlMap)
if err != nil {
package rmrmsghandlers\r
\r
import (\r
+ "e2mgr/configuration"\r
"e2mgr/logger"\r
"e2mgr/models"\r
"e2mgr/services"\r
"e2mgr/utils"\r
+ "time"\r
+\r
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"\r
)\r
\r
type E2ResetRequestNotificationHandler struct {\r
logger *logger.Logger\r
rnibDataService services.RNibDataService\r
+ config *configuration.Configuration\r
}\r
\r
-func NewE2ResetRequestNotificationHandler(logger *logger.Logger, rnibDataService services.RNibDataService) *E2ResetRequestNotificationHandler {\r
+func NewE2ResetRequestNotificationHandler(logger *logger.Logger, rnibDataService services.RNibDataService, config *configuration.Configuration) *E2ResetRequestNotificationHandler {\r
return &E2ResetRequestNotificationHandler{\r
logger: logger,\r
rnibDataService: rnibDataService,\r
+ config: config,\r
}\r
}\r
\r
e.logger.Debugf("#E2ResetRequestNotificationHandler.Handle - nodeB entity under reset state. RanName %s, ConnectionStatus %s", nodebInfo.RanName, nodebInfo.ConnectionStatus)\r
\r
e.logger.Infof(E2ResetRequestLogInfoElapsedTime, utils.ElapsedTime(request.StartTime))\r
+\r
+ e.waitfortimertimeout(request)\r
+\r
+ nodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED\r
+\r
+ err = e.rnibDataService.UpdateNodebInfoAndPublish(nodebInfo)\r
+\r
+ if err != nil {\r
+ e.logger.Errorf("#E2ResetRequestNotificationHandler.Handle - failed to update connection status of nodeB entity. RanName: %s. Error: %s", request.RanName, err.Error())\r
+ }\r
+\r
+ e.logger.Debugf("#E2ResetRequestNotificationHandler.Handle - nodeB entity connected state. RanName %s, ConnectionStatus %s", nodebInfo.RanName, nodebInfo.ConnectionStatus)\r
+\r
}\r
\r
func (e *E2ResetRequestNotificationHandler) getNodebInfo(ranName string) (*entities.NodebInfo, error) {\r
}\r
return nodebInfo, err\r
}\r
+\r
+func (e *E2ResetRequestNotificationHandler) waitfortimertimeout(request *models.NotificationRequest) {\r
+ timeout := e.config.E2ResetTimeOutSec\r
+ for {\r
+ timeElapsed := utils.ElapsedTime(request.StartTime)\r
+ e.logger.Infof(E2ResetRequestLogInfoElapsedTime, utils.ElapsedTime(request.StartTime))\r
+ if int(timeElapsed) > timeout {\r
+ break\r
+ }\r
+ time.Sleep(time.Duration(timeout/100) * time.Millisecond)\r
+ }\r
+}\r
"e2mgr/services"\r
"e2mgr/tests"\r
"e2mgr/utils"\r
+ "testing"\r
+\r
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"\r
"github.com/stretchr/testify/mock"\r
- "testing"\r
)\r
\r
const (\r
readerMock := &mocks.RnibReaderMock{}\r
writerMock := &mocks.RnibWriterMock{}\r
rnibDataService := services.NewRnibDataService(logger, config, readerMock, writerMock)\r
- handler := NewE2ResetRequestNotificationHandler(logger, rnibDataService)\r
+ handler := NewE2ResetRequestNotificationHandler(logger, rnibDataService, config)\r
return handler, readerMock, writerMock\r
}\r
\r
e2SetupRequestNotificationHandler := rmrmsghandlers.NewE2SetupRequestNotificationHandler(logger, config, e2tInstancesManager, rmrSender, rnibDataService, e2tAssociationManager, ranConnectStatusChangeManager, ranListManager)
ricServiceUpdateHandler := rmrmsghandlers.NewRicServiceUpdateHandler(logger, rmrSender, rnibDataService, ranListManager)
ricE2nodeConfigUpdateHandler := rmrmsghandlers.NewE2nodeConfigUpdateNotificationHandler(logger, rnibDataService, rmrSender)
- e2ResetRequestNotificationHandler := rmrmsghandlers.NewE2ResetRequestNotificationHandler(logger, rnibDataService)
+ e2ResetRequestNotificationHandler := rmrmsghandlers.NewE2ResetRequestNotificationHandler(logger, rnibDataService, config)
provider.Register(rmrCgo.RIC_X2_SETUP_RESP, x2SetupResponseHandler)
provider.Register(rmrCgo.RIC_X2_SETUP_FAILURE, x2SetupFailureResponseHandler)
{rmrCgo.RIC_X2_RESET, rmrmsghandlers.NewX2ResetRequestNotificationHandler(logger, rnibDataService, ranStatusChangeManager, rmrSender)},
{rmrCgo.RIC_SERVICE_UPDATE, rmrmsghandlers.NewRicServiceUpdateHandler(logger, rmrSender, rnibDataService, ranListManager)},
{rmrCgo.RIC_E2NODE_CONFIG_UPDATE, rmrmsghandlers.NewE2nodeConfigUpdateNotificationHandler(logger, rnibDataService, rmrSender)},
+ {rmrCgo.RIC_E2_RESET_REQ, rmrmsghandlers.NewE2ResetRequestNotificationHandler(logger, rnibDataService, config)},
}
for _, tc := range testCases {
keepAliveResponseTimeoutMs: 4500
keepAliveDelayMs: 1500
e2tInstanceDeletionTimeoutMs: 15000
+e2ResetTimeOutSec: 10
globalRicId:
ricId: "AACCE"
mcc: "310"