Merge "E2 reset request message model"
diff --git a/E2Manager/Dockerfile b/E2Manager/Dockerfile
old mode 100755
new mode 100644
index 4185d4a..d8810d4
--- a/E2Manager/Dockerfile
+++ b/E2Manager/Dockerfile
@@ -57,4 +57,5 @@
ENV RMR_SEED_RT=router.txt
ENV RMR_VCTL_FILE=/tmp/rmr.verbose
EXPOSE 3800
-CMD ["sh", "-c", "./main -port=$port"]
+CMD ["sh", "-c", "./main -port=$port -f /etc/config/log-level.yaml"]
+
diff --git a/E2Manager/app/main.go b/E2Manager/app/main.go
old mode 100755
new mode 100644
index f8510ea..58d20b5
--- a/E2Manager/app/main.go
+++ b/E2Manager/app/main.go
@@ -34,15 +34,21 @@
"e2mgr/services"
"e2mgr/services/rmrreceiver"
"e2mgr/services/rmrsender"
- "fmt"
+ //"fmt"
+ "flag"
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader"
"gerrit.o-ran-sc.org/r/ric-plt/sdlgo"
+ "github.com/spf13/viper"
+ "github.com/fsnotify/fsnotify"
"os"
"strconv"
)
const GeneralKeyDefaultValue = "{\"enableRic\":true}"
+const DEFAULT_CONFIG_FILE = "../resources/configuration.yaml"
+const DEFAULT_PORT = "8080"
+var Log *logger.Logger
func initKeys(logger *logger.Logger, sdl *sdlgo.SyncStorage) error {
ok, err := sdl.SetIfNotExists(common.GetRNibNamespace(), common.BuildGeneralConfigurationKey(), GeneralKeyDefaultValue)
@@ -61,53 +67,106 @@
return nil
}
+/**Dynamic log-level changes **/
+
+func loadConfig() {
+ viper.SetConfigFile(parseCmd())
+ if err := viper.ReadInConfig(); err != nil {
+ Log.Errorf("Error reading config file, %s", err)
+ }
+ Log.Infof("Using config file: %s\n", viper.ConfigFileUsed())
+ // Watch for config file changes and re-read data ...
+ watch()
+}
+func parseCmd() string {
+ var fileName *string
+ fileName = flag.String("f", DEFAULT_CONFIG_FILE, "Specify the configuration file.")
+ flag.String("port", DEFAULT_PORT, "Specify the port file.")
+ flag.Parse()
+
+ return *fileName
+}
+
+func watch() {
+ viper.WatchConfig()
+ viper.OnConfigChange(func(e fsnotify.Event) {
+ Log.Infof("config file changed %s", e.Name)
+ setLoglevel()
+ })
+}
+
+/*********MDC LOG CHNAGES ********/
+func setLoglevel() {
+ var loglevel int
+ if err := viper.UnmarshalKey("loglevel", &loglevel); err != nil {
+ Log.Errorf("Unmarshalling failed while reading %d", loglevel)
+ }
+
+ switch loglevel {
+ case 1:
+ Log.Infof("LOGLEVEL is set to ERROR\n")
+ case 2:
+ Log.Infof("LOGLEVEL is set to WARNING\n")
+ case 3:
+ Log.Infof("LOGLEVEL is set to INFO\n")
+ case 4:
+ Log.Infof("LOGLEVEL is set to DEBUG\n")
+ }
+ Log.SetLevel(loglevel)
+}
+
func main() {
config := configuration.ParseConfiguration()
- logLevel, _ := logger.LogLevelTokenToLevel(config.Logging.LogLevel)
- logger, err := logger.InitLogger(logLevel)
- if err != nil {
+ level := int8(4)
+ Log, _ = logger.InitLogger(level)
+ Log.SetFormat(0)
+ Log.SetMdc("e2mgr", "0.2.2")
+ /*if err != nil {
fmt.Printf("#app.main - failed to initialize logger, error: %s", err)
os.Exit(1)
- }
- logger.Infof("#app.main - Configuration %s", config)
+ }*/
+ Log.Infof("#app.main - Configuration %s", config)
+ loadConfig()
+
+ setLoglevel()
sdl := sdlgo.NewSyncStorage()
- err = initKeys(logger, sdl)
+ err := initKeys(Log, sdl)
if err != nil {
os.Exit(1)
}
defer sdl.Close()
- rnibDataService := services.NewRnibDataService(logger, config, reader.GetNewRNibReader(sdl), rNibWriter.GetRNibWriter(sdl, config.RnibWriter))
+ rnibDataService := services.NewRnibDataService(Log, config, reader.GetNewRNibReader(sdl), rNibWriter.GetRNibWriter(sdl, config.RnibWriter))
- ranListManager := managers.NewRanListManager(logger, rnibDataService)
+ ranListManager := managers.NewRanListManager(Log, rnibDataService)
err = ranListManager.InitNbIdentityMap()
if err != nil {
- logger.Errorf("#app.main - quit")
+ Log.Errorf("#app.main - quit")
os.Exit(1)
}
var msgImpl *rmrCgo.Context
- rmrMessenger := msgImpl.Init("tcp:"+strconv.Itoa(config.Rmr.Port), config.Rmr.MaxMsgSize, 0, logger)
- rmrSender := rmrsender.NewRmrSender(logger, rmrMessenger)
- e2tInstancesManager := managers.NewE2TInstancesManager(rnibDataService, logger)
- routingManagerClient := clients.NewRoutingManagerClient(logger, config, clients.NewHttpClient())
- ranAlarmService := services.NewRanAlarmService(logger, config)
- ranConnectStatusChangeManager := managers.NewRanConnectStatusChangeManager(logger, rnibDataService, ranListManager, ranAlarmService)
- e2tAssociationManager := managers.NewE2TAssociationManager(logger, rnibDataService, e2tInstancesManager, routingManagerClient, ranConnectStatusChangeManager)
- e2tShutdownManager := managers.NewE2TShutdownManager(logger, config, rnibDataService, e2tInstancesManager, e2tAssociationManager, ranConnectStatusChangeManager)
- e2tKeepAliveWorker := managers.NewE2TKeepAliveWorker(logger, rmrSender, e2tInstancesManager, e2tShutdownManager, config)
+ rmrMessenger := msgImpl.Init("tcp:"+strconv.Itoa(config.Rmr.Port), config.Rmr.MaxMsgSize, 0, Log)
+ rmrSender := rmrsender.NewRmrSender(Log, rmrMessenger)
+ e2tInstancesManager := managers.NewE2TInstancesManager(rnibDataService, Log)
+ routingManagerClient := clients.NewRoutingManagerClient(Log, config, clients.NewHttpClient())
+ ranAlarmService := services.NewRanAlarmService(Log, config)
+ ranConnectStatusChangeManager := managers.NewRanConnectStatusChangeManager(Log, rnibDataService, ranListManager, ranAlarmService)
+ e2tAssociationManager := managers.NewE2TAssociationManager(Log, rnibDataService, e2tInstancesManager, routingManagerClient, ranConnectStatusChangeManager)
+ e2tShutdownManager := managers.NewE2TShutdownManager(Log, config, rnibDataService, e2tInstancesManager, e2tAssociationManager, ranConnectStatusChangeManager)
+ e2tKeepAliveWorker := managers.NewE2TKeepAliveWorker(Log, rmrSender, e2tInstancesManager, e2tShutdownManager, config)
rmrNotificationHandlerProvider := rmrmsghandlerprovider.NewNotificationHandlerProvider()
- rmrNotificationHandlerProvider.Init(logger, config, rnibDataService, rmrSender, e2tInstancesManager, routingManagerClient, e2tAssociationManager, ranConnectStatusChangeManager, ranListManager)
+ rmrNotificationHandlerProvider.Init(Log, config, rnibDataService, rmrSender, e2tInstancesManager, routingManagerClient, e2tAssociationManager, ranConnectStatusChangeManager, ranListManager)
- notificationManager := notificationmanager.NewNotificationManager(logger, rmrNotificationHandlerProvider)
- rmrReceiver := rmrreceiver.NewRmrReceiver(logger, rmrMessenger, notificationManager)
+ notificationManager := notificationmanager.NewNotificationManager(Log, rmrNotificationHandlerProvider)
+ rmrReceiver := rmrreceiver.NewRmrReceiver(Log, rmrMessenger, notificationManager)
nodebValidator := managers.NewNodebValidator()
- updateEnbManager := managers.NewUpdateEnbManager(logger, rnibDataService, nodebValidator)
- updateGnbManager := managers.NewUpdateGnbManager(logger, rnibDataService, nodebValidator)
+ updateEnbManager := managers.NewUpdateEnbManager(Log, rnibDataService, nodebValidator)
+ updateGnbManager := managers.NewUpdateGnbManager(Log, rnibDataService, nodebValidator)
e2tInstancesManager.ResetKeepAliveTimestampsForAllE2TInstances()
@@ -116,10 +175,14 @@
go rmrReceiver.ListenAndHandle()
go e2tKeepAliveWorker.Execute()
- httpMsgHandlerProvider := httpmsghandlerprovider.NewIncomingRequestHandlerProvider(logger, rmrSender, config, rnibDataService, e2tInstancesManager, routingManagerClient, ranConnectStatusChangeManager, nodebValidator, updateEnbManager, updateGnbManager, ranListManager)
+ httpMsgHandlerProvider := httpmsghandlerprovider.NewIncomingRequestHandlerProvider(Log, rmrSender, config, rnibDataService, e2tInstancesManager, routingManagerClient, ranConnectStatusChangeManager, nodebValidator, updateEnbManager, updateGnbManager, ranListManager)
rootController := controllers.NewRootController(rnibDataService)
- nodebController := controllers.NewNodebController(logger, httpMsgHandlerProvider)
- e2tController := controllers.NewE2TController(logger, httpMsgHandlerProvider)
- symptomController := controllers.NewSymptomdataController(logger, httpMsgHandlerProvider, rnibDataService, ranListManager)
- _ = httpserver.Run(logger, config.Http.Port, rootController, nodebController, e2tController, symptomController)
+ nodebController := controllers.NewNodebController(Log, httpMsgHandlerProvider)
+ e2tController := controllers.NewE2TController(Log, httpMsgHandlerProvider)
+ symptomController := controllers.NewSymptomdataController(Log, httpMsgHandlerProvider, rnibDataService, ranListManager)
+ //fmt.Println("loadconfig called at last")
+ //loadConfig()
+ _ = httpserver.Run(Log, config.Http.Port, rootController, nodebController, e2tController, symptomController)
+ //fmt.Println("loadconfig called at last")
+ //loadConfig()
}
diff --git a/E2Manager/clients/routing_manager_client_test.go b/E2Manager/clients/routing_manager_client_test.go
index 686733e..31a4c7f 100644
--- a/E2Manager/clients/routing_manager_client_test.go
+++ b/E2Manager/clients/routing_manager_client_test.go
@@ -248,7 +248,8 @@
// TODO: extract to test_utils
func initLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.InfoLevel)
+ level := int8(1)
+ log, err := logger.InitLogger(level)
if err != nil {
t.Errorf("#delete_all_request_handler_test.TestHandleSuccessFlow - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/controllers/nodeb_controller_test.go b/E2Manager/controllers/nodeb_controller_test.go
index cd22cc6..713fcde 100644
--- a/E2Manager/controllers/nodeb_controller_test.go
+++ b/E2Manager/controllers/nodeb_controller_test.go
@@ -1701,7 +1701,8 @@
}
func initLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ log, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("#delete_all_request_handler_test.TestHandleSuccessFlow - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/controllers/root_controller_test.go b/E2Manager/controllers/root_controller_test.go
index 42d0bdf..a22f5d6 100644
--- a/E2Manager/controllers/root_controller_test.go
+++ b/E2Manager/controllers/root_controller_test.go
@@ -36,7 +36,8 @@
)
func setupNodebControllerTest(t *testing.T) (services.RNibDataService, *mocks.RnibReaderMock){
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#... - failed to initialize logger, error: %s", err)
}
@@ -91,4 +92,4 @@
writer := httptest.NewRecorder()
rc.HandleHealthCheckRequest(writer, nil)
assert.Equal(t, http.StatusInternalServerError, writer.Result().StatusCode)
-}
\ No newline at end of file
+}
diff --git a/E2Manager/controllers/symptomdata_controller.go b/E2Manager/controllers/symptomdata_controller.go
old mode 100755
new mode 100644
diff --git a/E2Manager/converters/endc_setup_failure_response_converter_test.go b/E2Manager/converters/endc_setup_failure_response_converter_test.go
index ac5aa52..2d9e991 100644
--- a/E2Manager/converters/endc_setup_failure_response_converter_test.go
+++ b/E2Manager/converters/endc_setup_failure_response_converter_test.go
@@ -35,7 +35,8 @@
*/
func TestUnpackEndcX2SetupFailureResponseAndExtract(t *testing.T) {
- logger, _ := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ logger, _ := logger.InitLogger(InfoLevel)
var testCases = []struct {
response string
diff --git a/E2Manager/converters/endc_setup_response_converter_test.go b/E2Manager/converters/endc_setup_response_converter_test.go
index d4b2848..1c57b00 100644
--- a/E2Manager/converters/endc_setup_response_converter_test.go
+++ b/E2Manager/converters/endc_setup_response_converter_test.go
@@ -35,7 +35,8 @@
*/
func TestUnpackEndcX2SetupResponseAndExtract(t *testing.T) {
- logger, _ := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(4)
+ logger, _ := logger.InitLogger(InfoLevel)
var testCases = []struct {
key *entities.GlobalNbId
diff --git a/E2Manager/converters/x2_setup_failure_response_converter_test.go b/E2Manager/converters/x2_setup_failure_response_converter_test.go
index 3f4cebd..2cdc940 100644
--- a/E2Manager/converters/x2_setup_failure_response_converter_test.go
+++ b/E2Manager/converters/x2_setup_failure_response_converter_test.go
@@ -35,7 +35,8 @@
*/
func TestUnpackX2SetupFailureResponseAndExtract(t *testing.T) {
- logger, _ := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ logger, _ := logger.InitLogger(InfoLevel)
var testCases = []struct {
response string
diff --git a/E2Manager/converters/x2_setup_response_converter_test.go b/E2Manager/converters/x2_setup_response_converter_test.go
index 739a412..81def40 100644
--- a/E2Manager/converters/x2_setup_response_converter_test.go
+++ b/E2Manager/converters/x2_setup_response_converter_test.go
@@ -35,7 +35,8 @@
*/
func TestUnpackX2SetupResponseAndExtract(t *testing.T) {
- logger, _ := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ logger, _ := logger.InitLogger(InfoLevel)
var testCases = []struct {
key *entities.GlobalNbId
diff --git a/E2Manager/converters/x2apPdu_asn1_unpacker.go b/E2Manager/converters/x2apPdu_asn1_unpacker.go
index 69e23aa..194711c 100644
--- a/E2Manager/converters/x2apPdu_asn1_unpacker.go
+++ b/E2Manager/converters/x2apPdu_asn1_unpacker.go
@@ -72,10 +72,10 @@
return nil, errors.New(fmt.Sprintf("unpacking error: %s", C.GoString(&errBuf[0])))
}
- if logger.DebugEnabled() {
+ //if logger.DebugEnabled() {
C.asn1_pdu_printer(pdu, C.size_t(len(errBuf)), &errBuf[0])
- logger.Debugf("#x2apPdu_asn1_unpacker.UnpackX2apPdu - PDU: %v packed size:%d", C.GoString(&errBuf[0]), packedBufferSize)
- }
+ //logger.Debugf("#x2apPdu_asn1_unpacker.UnpackX2apPdu - PDU: %v packed size:%d", C.GoString(&errBuf[0]), packedBufferSize)
+ //}
return pdu, nil
}
@@ -89,11 +89,11 @@
defer C.delete_pdu(pdu)
var refinedResponse = ""
- if logger.DebugEnabled() {
+ //if logger.DebugEnabled() {
buf := make([]C.char, 16*maxMessageBufferSize)
C.asn1_pdu_printer(pdu, C.size_t(len(buf)), &buf[0])
refinedResponse = C.GoString(&buf[0])
- }
+ //}
return &X2PduRefinedResponse{PduPrint: refinedResponse}, nil
}
diff --git a/E2Manager/converters/x2apPdu_asn1_unpacker_test.go b/E2Manager/converters/x2apPdu_asn1_unpacker_test.go
index c0119a4..6306022 100644
--- a/E2Manager/converters/x2apPdu_asn1_unpacker_test.go
+++ b/E2Manager/converters/x2apPdu_asn1_unpacker_test.go
@@ -35,7 +35,8 @@
*/
func TestUnpackX2apSetupResponse(t *testing.T) {
- logger, _ := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, _ := logger.InitLogger(DebugLevel)
wantPduAsStr := `SuccessfulOutcome ::= {
procedureCode: 6
@@ -108,7 +109,8 @@
/*unpacking error*/
func TestUnpackX2apSetupResponseUnpackError(t *testing.T) {
- logger, _ := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ logger, _ := logger.InitLogger(InfoLevel)
wantError := "unpacking error: #src/asn1codec_utils.c.unpack_pdu_aux - Failed to decode E2AP-PDU (consumed 0), error = 0 Success"
//--------------------2006002a
diff --git a/E2Manager/e2pdus/configuration_update_test.go b/E2Manager/e2pdus/configuration_update_test.go
index a4b40e4..86e27a5 100644
--- a/E2Manager/e2pdus/configuration_update_test.go
+++ b/E2Manager/e2pdus/configuration_update_test.go
@@ -31,7 +31,8 @@
)
func TestPrepareEndcConfigurationUpdateFailurePDU(t *testing.T) {
- _,err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel:= int8(3)
+ _,err := logger.InitLogger(InfoLevel)
if err!=nil{
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -49,7 +50,8 @@
}
func TestPrepareEndcConfigurationUpdateFailurePDUFailure(t *testing.T) {
- _, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel:= int8(3)
+ _, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -66,7 +68,8 @@
}
func TestPrepareX2EnbConfigurationUpdateFailurePDU(t *testing.T) {
- _,err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ _,err := logger.InitLogger(InfoLevel)
if err!=nil{
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -84,7 +87,8 @@
}
func TestPrepareX2EnbConfigurationUpdateFailurePDUFailure(t *testing.T) {
- _, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel:= int8(3)
+ _, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -101,7 +105,8 @@
}
func TestPrepareEndcConfigurationUpdateAckPDU(t *testing.T) {
- _,err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ _,err := logger.InitLogger(InfoLevel)
if err!=nil{
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -119,7 +124,8 @@
}
func TestPrepareEndcConfigurationUpdateAckPDUFailure(t *testing.T) {
- _, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ _, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -136,7 +142,8 @@
}
func TestPrepareX2EnbConfigurationUpdateAckPDU(t *testing.T) {
- _,err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel:= int8(3)
+ _,err := logger.InitLogger(InfoLevel)
if err!=nil{
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -154,7 +161,8 @@
}
func TestPrepareX2EnbConfigurationUpdateAckPDUFailure(t *testing.T) {
- _, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel:= int8(3)
+ _, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -168,4 +176,4 @@
if !strings.Contains(err.Error(), expected) {
t.Errorf("want :[%s], got: [%s]\n", expected, err)
}
-}
\ No newline at end of file
+}
diff --git a/E2Manager/e2pdus/x2_reset_known_causes_test.go b/E2Manager/e2pdus/x2_reset_known_causes_test.go
index 2988f40..8c3140d 100644
--- a/E2Manager/e2pdus/x2_reset_known_causes_test.go
+++ b/E2Manager/e2pdus/x2_reset_known_causes_test.go
@@ -29,7 +29,8 @@
)
func TestKnownCausesToX2ResetPDU(t *testing.T) {
- _, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ _, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -77,7 +78,8 @@
}
func TestKnownCausesToX2ResetPDUFailure(t *testing.T) {
- _, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ _, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -89,7 +91,8 @@
}
func TestPrepareX2ResetPDUsFailure(t *testing.T) {
- _, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ _, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/e2pdus/x2_reset_response_test.go b/E2Manager/e2pdus/x2_reset_response_test.go
index e91c7b1..b347dd9 100644
--- a/E2Manager/e2pdus/x2_reset_response_test.go
+++ b/E2Manager/e2pdus/x2_reset_response_test.go
@@ -29,7 +29,8 @@
)
func TestPrepareX2ResetResponsePDU(t *testing.T) {
- _,err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ _,err := logger.InitLogger(InfoLevel)
if err!=nil{
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -47,7 +48,8 @@
}
func TestPrepareX2ResetResponsePDUFailure(t *testing.T) {
- _, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel:= int8(3)
+ _, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("failed to initialize logger, error: %s", err)
}
@@ -61,4 +63,4 @@
if !strings.Contains(err.Error(), expected) {
t.Errorf("want :[%s], got: [%s]\n", expected, err)
}
-}
\ No newline at end of file
+}
diff --git a/E2Manager/go.mod b/E2Manager/go.mod
index 4d4899f..6294658 100644
--- a/E2Manager/go.mod
+++ b/E2Manager/go.mod
@@ -1,31 +1,43 @@
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/sdlgo v0.8.0
+ github.com/fsnotify/fsnotify v1.4.9
github.com/golang/protobuf v1.4.2
github.com/gorilla/mux v1.7.0
- github.com/kr/pretty v0.2.0 // indirect
github.com/magiconair/properties v1.8.1
+ github.com/pkg/errors v0.8.1
+ github.com/spf13/viper v1.4.0
+ github.com/stretchr/testify v1.5.1
+ gopkg.in/yaml.v2 v2.3.0
+)
+
+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/pkg/errors v0.8.1
+ 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/spf13/viper v1.4.0
github.com/stretchr/objx v0.2.0 // indirect
- github.com/stretchr/testify v1.5.1
- go.uber.org/multierr v1.2.0 // indirect
- go.uber.org/zap v1.11.0
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
- gopkg.in/yaml.v2 v2.3.0
+ k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
)
replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0
-go 1.13
+replace gerrit.o-ran-sc.org/r/com/golog => gerrit.o-ran-sc.org/r/com/golog.git v0.0.2
+
+go 1.18
diff --git a/E2Manager/go.sum b/E2Manager/go.sum
index 8dbfcaa..dfb0c4d 100644
--- a/E2Manager/go.sum
+++ b/E2Manager/go.sum
@@ -1,10 +1,9 @@
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 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.5 h1:RgbLxLgJcMQsm84NJI5q81PKRtgPk3j1VvMTWO5U9os=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.5/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=
@@ -14,14 +13,11 @@
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
-github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
-github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
-github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
@@ -34,7 +30,6 @@
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
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=
@@ -46,13 +41,11 @@
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=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
-github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
@@ -61,10 +54,8 @@
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
-github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
@@ -78,28 +69,23 @@
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
-github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
-github.com/julienschmidt/httprouter v1.2.0 h1:TDTW5Yz1mjftljbcKqRcrYhd4XeOoI98t+9HbQbYf7g=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
-github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
-github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
-github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.3.2 h1:mRS76wmkOn3KkKAyXDu42V+6ebnXWIztFSYGN7GeoRg=
github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
@@ -114,7 +100,6 @@
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.8.0 h1:Keo9qb7iRJs2voHvunFtuuYFsbWeOBh8/P9v/kVMFtw=
github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs=
@@ -128,42 +113,35 @@
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
-github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
-github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
-github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
-github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
-github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
-github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU=
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
-github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
@@ -171,18 +149,10 @@
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
-go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
-go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
-go.uber.org/multierr v1.2.0 h1:6I+W7f5VwC5SV9dNrZ3qXrDB9mD0dyGOi/ZJmYw03T4=
-go.uber.org/multierr v1.2.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
-go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
-go.uber.org/zap v1.11.0 h1:gSmpCfs+R47a4yQPAI4xJ0IPDLTRGXskm6UelqNXpqE=
-go.uber.org/zap v1.11.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
@@ -191,11 +161,9 @@
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
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-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=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -205,21 +173,17 @@
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/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-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/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/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=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
-golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -238,24 +202,21 @@
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
-gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-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.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/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk=
+k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
diff --git a/E2Manager/handlers/httpmsghandlers/delete_all_request_handler_test.go b/E2Manager/handlers/httpmsghandlers/delete_all_request_handler_test.go
index 4451788..9b949b6 100644
--- a/E2Manager/handlers/httpmsghandlers/delete_all_request_handler_test.go
+++ b/E2Manager/handlers/httpmsghandlers/delete_all_request_handler_test.go
@@ -686,7 +686,8 @@
}
func initLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ log, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#initLog test - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/handlers/httpmsghandlers/update_nodeb_request_handler_test.go b/E2Manager/handlers/httpmsghandlers/update_nodeb_request_handler_test.go
index 26bf3a6..7be5263 100644
--- a/E2Manager/handlers/httpmsghandlers/update_nodeb_request_handler_test.go
+++ b/E2Manager/handlers/httpmsghandlers/update_nodeb_request_handler_test.go
@@ -13,7 +13,8 @@
)
func setupUpdateNodebRequestHandlerTest(t *testing.T) ( *UpdateNodebRequestHandler, *mocks.RnibReaderMock, *mocks.RnibWriterMock){
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#... - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/handlers/rmrmsghandlers/e2_term_init_notification_handler_test.go b/E2Manager/handlers/rmrmsghandlers/e2_term_init_notification_handler_test.go
index b1b68ee..e2ce5d2 100644
--- a/E2Manager/handlers/rmrmsghandlers/e2_term_init_notification_handler_test.go
+++ b/E2Manager/handlers/rmrmsghandlers/e2_term_init_notification_handler_test.go
@@ -635,7 +635,8 @@
// TODO: extract to test_utils
func initLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ log, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("#delete_all_request_handler_test.TestHandleSuccessFlow - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go b/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go
index d612932..52ea11d 100644
--- a/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go
+++ b/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go
@@ -42,7 +42,8 @@
)
func setupLostConnectionHandlerTest(isSuccessfulHttpPost bool) (*RanLostConnectionHandler, *mocks.RnibReaderMock, *mocks.RnibWriterMock, *mocks.HttpClientMock) {
- logger, _ := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ logger, _ := logger.InitLogger(InfoLevel)
config := &configuration.Configuration{
RnibRetryIntervalMs: 10,
MaxRnibConnectionAttempts: 3,
diff --git a/E2Manager/handlers/rmrmsghandlers/setup_response_notification_handler_test.go b/E2Manager/handlers/rmrmsghandlers/setup_response_notification_handler_test.go
index b401cbb..b8918b4 100644
--- a/E2Manager/handlers/rmrmsghandlers/setup_response_notification_handler_test.go
+++ b/E2Manager/handlers/rmrmsghandlers/setup_response_notification_handler_test.go
@@ -79,7 +79,8 @@
}
func NewSetupResponseTestContext(manager managers.ISetupResponseManager) *setupResponseTestContext {
- logger, _ := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ logger, _ := logger.InitLogger(InfoLevel)
config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3}
readerMock := &mocks.RnibReaderMock{}
writerMock := &mocks.RnibWriterMock{}
diff --git a/E2Manager/handlers/rmrmsghandlers/x2_reset_response_handler_test.go b/E2Manager/handlers/rmrmsghandlers/x2_reset_response_handler_test.go
index 7a99903..fcc15dd 100644
--- a/E2Manager/handlers/rmrmsghandlers/x2_reset_response_handler_test.go
+++ b/E2Manager/handlers/rmrmsghandlers/x2_reset_response_handler_test.go
@@ -44,7 +44,8 @@
)
func initX2ResetResponseHandlerTest(t *testing.T) (X2ResetResponseHandler, *mocks.RnibReaderMock, *mocks.RmrMessengerMock) {
- log, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ log, err := logger.InitLogger(InfoLevel)
config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3}
if err != nil {
t.Errorf("#initX2ResetResponseHandlerTest - failed to initialize logger, error: %s", err)
diff --git a/E2Manager/httpserver/http_server.go b/E2Manager/httpserver/http_server.go
old mode 100755
new mode 100644
diff --git a/E2Manager/httpserver/http_server_test.go b/E2Manager/httpserver/http_server_test.go
old mode 100755
new mode 100644
index bbbdb14..7103ff8
--- a/E2Manager/httpserver/http_server_test.go
+++ b/E2Manager/httpserver/http_server_test.go
@@ -226,7 +226,8 @@
}
func initLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ log, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("#initLog test - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/logger/logger.go b/E2Manager/logger/logger.go
index 0cdfd2f..fabf80c 100644
--- a/E2Manager/logger/logger.go
+++ b/E2Manager/logger/logger.go
@@ -21,167 +21,55 @@
package logger
import (
- "fmt"
- "go.uber.org/zap"
- "go.uber.org/zap/zapcore"
- "strings"
+ mdclog "gerrit.o-ran-sc.org/r/com/golog"
"time"
)
type Logger struct {
- Logger *zap.Logger
+ logger *mdclog.MdcLogger
}
-// Copied from zap logger
-//
-// A Level is a logging priority. Higher levels are more important.
-type LogLevel int8
-
-const (
- // DebugLevel logs are typically voluminous, and are usually disabled in
- // production.
- DebugLevel LogLevel = iota - 1
- // InfoLevel is the default logging priority.
- InfoLevel
- // WarnLevel logs are more important than Info, but don't need individual
- // human review.
- WarnLevel
- // ErrorLevel logs are high-priority. If an application is running smoothly,
- // it shouldn't generate any error-level logs.
- ErrorLevel
- // DPanicLevel logs are particularly important errors. In development the
- // logger panics after writing the message.
- DPanicLevel
- // PanicLevel logs a message, then panics.
- PanicLevel
- // FatalLevel logs a message, then calls os.Exit(1).
- FatalLevel
-
- _minLevel = DebugLevel
- _maxLevel = FatalLevel
-)
-
-var logLevelTokenToLevel = map[string] LogLevel {
- "debug" : DebugLevel,
- "info": InfoLevel,
- "warn": WarnLevel,
- "error": ErrorLevel,
- "dpanic": DPanicLevel,
- "panic": PanicLevel,
- "fatal": FatalLevel,
+func InitLogger(loglevel int8 ) (*Logger, error) {
+ name := "e2mgr"
+ log ,err:= NewLogger(name)
+ return log,err
}
-func LogLevelTokenToLevel(level string) (LogLevel, bool) {
- if level, ok := logLevelTokenToLevel[strings.TrimSpace(strings.ToLower(level))];ok {
- return level, true
- }
- return _maxLevel+1, false
+func NewLogger(name string) (*Logger, error) {
+ l,err:= mdclog.InitLogger(name)
+ return &Logger{
+ logger: l,
+ },err
}
-func InitLogger(requested LogLevel) (*Logger, error) {
- var logger *zap.Logger
- var err error
- switch requested {
- case DebugLevel:
- logger, err = initLoggerByLevel(zapcore.DebugLevel)
- case InfoLevel:
- logger, err = initLoggerByLevel(zapcore.InfoLevel)
- case WarnLevel:
- logger, err = initLoggerByLevel(zapcore.WarnLevel)
- case ErrorLevel:
- logger, err = initLoggerByLevel(zapcore.ErrorLevel)
- case DPanicLevel:
- logger, err = initLoggerByLevel(zapcore.DPanicLevel)
- case PanicLevel:
- logger, err = initLoggerByLevel(zapcore.PanicLevel)
- case FatalLevel:
- logger, err = initLoggerByLevel(zapcore.FatalLevel)
- default:
- err = fmt.Errorf("Invalid logging Level :%d",requested)
- }
- if err != nil {
- return nil, err
- }
- return &Logger{Logger:logger}, nil
-
-}
-func(l *Logger)Sync() error {
- l.Debugf("#logger.Sync - Going to flush buffered log")
- return l.Logger.Sync()
+func (l *Logger) SetFormat(logMonitor int) {
+ l.logger.Mdclog_format_initialize(logMonitor)
}
-func (l *Logger)Infof(formatMsg string, a ...interface{}) {
- if l.InfoEnabled() {
- msg := fmt.Sprintf(formatMsg, a...)
- l.Logger.Info(msg, zap.Any("mdc", l.getTimeStampMdc()))
- }
+func (l *Logger) SetLevel(level int) {
+ l.logger.LevelSet(mdclog.Level(level))
}
-func (l *Logger)Debugf(formatMsg string, a ...interface{}) {
- if l.DebugEnabled(){
- msg := fmt.Sprintf(formatMsg, a...)
- l.Logger.Debug(msg, zap.Any("mdc", l.getTimeStampMdc()))
- }
+func (l *Logger) SetMdc(key string, value string) {
+ l.logger.MdcAdd(key, value)
}
-func (l *Logger)Errorf(formatMsg string, a ...interface{}) {
- msg := fmt.Sprintf(formatMsg, a...)
- l.Logger.Error(msg, zap.Any("mdc", l.getTimeStampMdc()))
+func (l *Logger) Errorf(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format(time.RFC3339))
+ l.logger.Error(pattern, args...)
}
-func (l *Logger)Warnf(formatMsg string, a ...interface{}) {
- msg := fmt.Sprintf(formatMsg, a...)
- l.Logger.Warn(msg, zap.Any("mdc", l.getTimeStampMdc()))
+func (l *Logger) Warnf(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format(time.RFC3339))
+ l.logger.Warning(pattern, args...)
}
-func (l *Logger) getTimeStampMdc() map[string]string {
- timeStr := time.Now().Format("2006-01-02 15:04:05.000")
- mdc := map[string]string{"time": timeStr}
- return mdc
+func (l *Logger) Infof(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format(time.RFC3339))
+ l.logger.Info(pattern, args...)
}
-func (l *Logger)InfoEnabled()bool{
- return l.Logger.Core().Enabled(zap.InfoLevel)
+func (l *Logger) Debugf(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format(time.RFC3339))
+ l.logger.Debug(pattern, args...)
}
-
-func (l *Logger)DebugEnabled()bool{
- return l.Logger.Core().Enabled(zap.DebugLevel)
-}
-
-func (l *Logger)DPanicf(formatMsg string, a ...interface{}) {
- msg := fmt.Sprintf(formatMsg, a...)
- l.Logger.DPanic(msg, zap.Any("mdc", l.getTimeStampMdc()))
-}
-
-func initLoggerByLevel(l zapcore.Level) (*zap.Logger, error) {
- cfg := zap.Config{
- Encoding: "json",
- Level: zap.NewAtomicLevelAt(l),
- OutputPaths: []string{"stdout"},
- ErrorOutputPaths: []string{"stderr"},
- EncoderConfig: zapcore.EncoderConfig{
- MessageKey: "msg",
-
- LevelKey: "crit",
- EncodeLevel: zapcore.CapitalLevelEncoder,
-
- TimeKey: "ts",
- EncodeTime: epochMillisIntegerTimeEncoder,
-
- CallerKey: "id",
- EncodeCaller: e2ManagerCallerEncoder,
- },
- }
- return cfg.Build()
-}
-
-func e2ManagerCallerEncoder(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) {
- enc.AppendString("E2Manager")
-}
-
-func epochMillisIntegerTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) {
- nanos := t.UnixNano()
- millis := int64(nanos) / int64(time.Millisecond)
- enc.AppendInt64(millis)
-}
-
diff --git a/E2Manager/logger/logger_test.go b/E2Manager/logger/logger_test.go
deleted file mode 100644
index d1d00d2..0000000
--- a/E2Manager/logger/logger_test.go
+++ /dev/null
@@ -1,293 +0,0 @@
-//
-// Copyright 2019 AT&T Intellectual Property
-// Copyright 2019 Nokia
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This source code is part of the near-RT RIC (RAN Intelligent Controller)
-// platform project (RICP).
-
-
-package logger
-
-import (
- "bytes"
- "github.com/stretchr/testify/assert"
- "go.uber.org/zap"
- "go.uber.org/zap/zapcore"
- "io"
- "os"
- "testing"
-)
-
-func TestInitDebugLoggerSuccess(t *testing.T) {
- log, err := InitLogger(DebugLevel)
- assert.Nil(t, err)
- assert.NotNil(t, log)
- assert.True(t, log.Logger.Core().Enabled(zap.DebugLevel))
-}
-
-func TestInitInfoLoggerSuccess(t *testing.T) {
- log, err := InitLogger(InfoLevel)
- assert.Nil(t, err)
- assert.NotNil(t, log)
- assert.True(t, log.Logger.Core().Enabled(zap.InfoLevel))
-}
-
-func TestInitWarnLoggerSuccess(t *testing.T) {
- log, err := InitLogger(WarnLevel)
- assert.Nil(t, err)
- assert.NotNil(t, log)
- assert.True(t, log.Logger.Core().Enabled(zap.WarnLevel))
-}
-
-func TestInitErrorLoggerSuccess(t *testing.T) {
- log, err := InitLogger(ErrorLevel)
- assert.Nil(t, err)
- assert.NotNil(t, log)
- assert.True(t, log.Logger.Core().Enabled(zap.ErrorLevel))
-}
-
-func TestInitDPanicLoggerSuccess(t *testing.T) {
- log, err := InitLogger(DPanicLevel)
- assert.Nil(t, err)
- assert.NotNil(t, log)
- assert.True(t, log.Logger.Core().Enabled(zap.DPanicLevel))
-}
-
-func TestInitPanicLoggerSuccess(t *testing.T) {
- log, err := InitLogger(PanicLevel)
- assert.Nil(t, err)
- assert.NotNil(t, log)
- assert.True(t, log.Logger.Core().Enabled(zap.PanicLevel))
-}
-
-func TestInitInfoLoggerFailure(t *testing.T) {
- log, err := InitLogger(99)
- assert.NotNil(t, err)
- assert.Nil(t, log)
-}
-
-func TestSyncSuccess(t *testing.T){
- logFile, err := os.Create("./loggerTest.txt")
- if err != nil{
- t.Errorf("logger_test.TestSyncSuccess - failed to create file, error: %s", err)
- }
- old := os.Stdout
- os.Stdout = logFile
- log, err := InitLogger(DebugLevel)
- if err != nil {
- t.Errorf("logger_test.TestSyncSuccess - failed to initialize logger, error: %s", err)
- }
- err = log.Sync()
- assert.Nil(t, err)
-
- os.Stdout = old
- logFile, err = os.Open("./loggerTest.txt")
- if err != nil{
- t.Errorf("logger_test.TestSyncSuccess - failed to open file, error: %s", err)
- }
- var buf bytes.Buffer
- _, err = io.Copy(&buf, logFile)
- if err != nil {
- t.Errorf("logger_test.TestSyncSuccess - failed to copy bytes, error: %s", err)
- }
- debugRecord,_ :=buf.ReadString('\n')
- errorRecord,_ :=buf.ReadString('\n')
-
- assert.NotEmpty(t, debugRecord)
- assert.Empty(t, errorRecord)
- err = os.Remove("./loggerTest.txt")
- if err != nil {
- t.Errorf("logger_test.TestSyncSuccess - failed to remove file, error: %s", err)
- }
-
-}
-
-func TestSyncFailure(t *testing.T){
- log, err := InitLogger(DebugLevel)
- err = log.Sync()
- assert.NotNil(t, err)
-}
-
-func TestDebugEnabledFalse(t *testing.T){
- entryNum, log := countRecords(InfoLevel, t)
- assert.False(t, log.DebugEnabled())
- assert.Equal(t,3, entryNum)
-}
-
-func TestDebugEnabledTrue(t *testing.T){
- entryNum, log := countRecords(DebugLevel, t)
- assert.True(t, log.DebugEnabled())
- assert.Equal(t,4, entryNum)
-}
-
-func TestDPanicfDebugLevel(t *testing.T){
- assert.True(t,validateRecordExists(DebugLevel, zap.DPanicLevel, t))
-}
-
-func TestDPanicfInfoLevel(t *testing.T){
- assert.True(t,validateRecordExists(InfoLevel, zap.DPanicLevel, t))
-}
-
-func TestErrorfDebugLevel(t *testing.T) {
- assert.True(t,validateRecordExists(DebugLevel, zap.ErrorLevel, t))
-}
-
-func TestErrorfInfoLevel(t *testing.T) {
- assert.True(t,validateRecordExists(InfoLevel, zap.ErrorLevel, t))
-}
-
-func TestInfofDebugLevel(t *testing.T) {
- assert.True(t,validateRecordExists(DebugLevel, zap.InfoLevel, t))
-}
-
-func TestInfofInfoLevel(t *testing.T) {
- assert.True(t,validateRecordExists(InfoLevel, zap.InfoLevel, t))
-}
-
-func TestDebugfDebugLevel(t *testing.T) {
- assert.True(t,validateRecordExists(DebugLevel, zap.DebugLevel, t))
-}
-
-func TestDebugfInfoLevel(t *testing.T) {
- assert.False(t,validateRecordExists(InfoLevel, zap.DebugLevel, t))
-}
-
-func TestInfofFatalLevel(t *testing.T) {
- assert.False(t,validateRecordExists(FatalLevel, zap.InfoLevel, t))
-}
-
-func TestDebugfFatalLevel(t *testing.T) {
- assert.False(t,validateRecordExists(FatalLevel, zap.DebugLevel, t))
-}
-
-func TestWarnfWarnLevel(t *testing.T) {
- assert.True(t,validateRecordExists(WarnLevel, zap.WarnLevel, t))
-}
-
-func TestWarnfDebugLevel(t *testing.T) {
- assert.True(t,validateRecordExists(DebugLevel, zap.WarnLevel, t))
-}
-
-func TestWarnfInfoLevel(t *testing.T) {
- assert.True(t,validateRecordExists(InfoLevel, zap.WarnLevel, t))
-}
-
-func TestWarnfFatalLevel(t *testing.T) {
- assert.False(t,validateRecordExists(FatalLevel, zap.WarnLevel, t))
-}
-
-func TestLogLevelTokenToLevel(t *testing.T) {
- level, ok := LogLevelTokenToLevel("deBug")
- assert.True(t, ok)
- assert.True(t, level == DebugLevel)
-
- level, ok = LogLevelTokenToLevel("infO")
- assert.True(t, ok)
- assert.True(t, level == InfoLevel)
-
- level, ok = LogLevelTokenToLevel("Warn")
- assert.True(t, ok)
- assert.True(t, level == WarnLevel)
-
- level, ok = LogLevelTokenToLevel("eRror")
- assert.True(t, ok)
- assert.True(t, level == ErrorLevel)
-
- level, ok = LogLevelTokenToLevel("Dpanic ")
- assert.True(t, ok)
- assert.True(t, level == DPanicLevel)
-
- level, ok = LogLevelTokenToLevel(" panic ")
- assert.True(t, ok)
- assert.True(t, level == PanicLevel)
-
- level, ok = LogLevelTokenToLevel("fatal")
- assert.True(t, ok)
- assert.True(t, level == FatalLevel)
-
- level, ok = LogLevelTokenToLevel("zzz")
- assert.False(t, ok)
- assert.True(t, level > FatalLevel)
-
-}
-func countRecords(logLevel LogLevel, t *testing.T) (int, *Logger){
- old := os.Stdout
- r, w, _ :=os.Pipe()
- os.Stdout = w
- log, err := InitLogger(logLevel)
- if err != nil {
- t.Errorf("logger_test.TestSyncFailure - failed to initialize logger, error: %s", err)
- }
- log.Infof("%v, %v, %v", 1, "abc", 0.1)
- log.Debugf("%v, %v, %v", 1, "abc", 0.1)
- log.Errorf("%v, %v, %v", 1, "abc", 0.1)
- log.DPanicf("%v, %v, %v", 1, "abc", 0.1)
- err = w.Close()
- if err != nil {
- t.Errorf("logger_test.TestSyncFailure - failed to close writer, error: %s", err)
- }
- os.Stdout = old
- var buf bytes.Buffer
- _, err = io.Copy(&buf, r)
- if err != nil {
- t.Errorf("logger_test.TestSyncFailure - failed to copy bytes, error: %s", err)
- }
- entryNum := 0
- s,_:= buf.ReadString('\n')
- for len(s) > 0{
- entryNum +=1
- s,_= buf.ReadString('\n')
- }
- return entryNum, log
-}
-
-func validateRecordExists(logLevel LogLevel, recordLevel zapcore.Level, t *testing.T) bool {
- old := os.Stdout
- r, w, _ :=os.Pipe()
- os.Stdout = w
- log, err := InitLogger(logLevel)
- if err != nil {
- t.Errorf("logger_test.TestSyncFailure - failed to initialize logger, error: %s", err)
- }
- switch recordLevel{
- case zap.DebugLevel:
- log.Debugf("%v, %v, %v", 1, "abc", 0.1)
- case zap.InfoLevel:
- log.Infof("%v, %v, %v", 1, "abc", 0.1)
- case zap.WarnLevel:
- log.Warnf("%v, %v, %v", 1, "abc", 0.1)
- case zap.ErrorLevel:
- log.Errorf("%v, %v, %v", 1, "abc", 0.1)
- case zap.DPanicLevel:
- log.DPanicf("%v, %v, %v", 1, "abc", 0.1)
- }
- err = w.Close()
- if err != nil {
- t.Errorf("logger_test.TestSyncFailure - failed to close writer, error: %s", err)
- }
- os.Stdout = old
- var buf bytes.Buffer
- _, err = io.Copy(&buf, r)
- if err != nil {
- t.Errorf("logger_test.TestSyncFailure - failed to copy bytes, error: %s", err)
- }
- entryNum := 0
- s,_:= buf.ReadString('\n')
- for len(s) > 0{
- entryNum +=1
- s,_= buf.ReadString('\n')
- }
- return entryNum == 1
-}
\ No newline at end of file
diff --git a/E2Manager/managers/e2_reset_status_change_manager_test.go b/E2Manager/managers/e2_reset_status_change_manager_test.go
index d09eb32..6a9241a 100644
--- a/E2Manager/managers/e2_reset_status_change_manager_test.go
+++ b/E2Manager/managers/e2_reset_status_change_manager_test.go
@@ -31,7 +31,8 @@
)
func initE2ResetStatusChangeTest(t *testing.T) (*logger.Logger, *mocks.RmrMessengerMock, *mocks.RnibReaderMock, *mocks.RnibWriterMock, *RanResetManager) {
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#... - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/managers/e2t_instances_manager_test.go b/E2Manager/managers/e2t_instances_manager_test.go
index 863bfe1..380ac05 100644
--- a/E2Manager/managers/e2t_instances_manager_test.go
+++ b/E2Manager/managers/e2t_instances_manager_test.go
@@ -39,7 +39,8 @@
const PodName = "som_ pod_name"
func initE2TInstancesManagerTest(t *testing.T) (*mocks.RnibReaderMock, *mocks.RnibWriterMock, *E2TInstancesManager) {
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#... - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/managers/e2t_keep_alive_worker_test.go b/E2Manager/managers/e2t_keep_alive_worker_test.go
index c15aedb..bd77572 100644
--- a/E2Manager/managers/e2t_keep_alive_worker_test.go
+++ b/E2Manager/managers/e2t_keep_alive_worker_test.go
@@ -36,7 +36,8 @@
)
func initE2TKeepAliveTest(t *testing.T) (*mocks.RmrMessengerMock, *mocks.RnibReaderMock, *mocks.RnibWriterMock, *mocks.E2TShutdownManagerMock, *E2TKeepAliveWorker) {
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#... - failed to initialize logger, error: %s", err)
}
@@ -202,4 +203,4 @@
rmrMessengerMock.AssertCalled(t, "SendMsg", req, false)
e2tShutdownManagerMock.AssertCalled(t, "Shutdown", e2tInstance1)
-}
\ No newline at end of file
+}
diff --git a/E2Manager/managers/notificationmanager/notification_manager_test.go b/E2Manager/managers/notificationmanager/notification_manager_test.go
index 9b9ffe5..4ca6ce9 100644
--- a/E2Manager/managers/notificationmanager/notification_manager_test.go
+++ b/E2Manager/managers/notificationmanager/notification_manager_test.go
@@ -86,7 +86,8 @@
// TODO: extract to test_utils
func initLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ log, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("#delete_all_request_handler_test.TestHandleSuccessFlow - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/managers/ran_connect_status_change_manager_test.go b/E2Manager/managers/ran_connect_status_change_manager_test.go
index 0c1cb0a..38b6746 100644
--- a/E2Manager/managers/ran_connect_status_change_manager_test.go
+++ b/E2Manager/managers/ran_connect_status_change_manager_test.go
@@ -36,7 +36,8 @@
const EventChannelForTest = "RAN_CONNECTION_STATUS_CHANGE"
func initRanConnectStatusChangeManagerTest(t *testing.T) (*mocks.RnibWriterMock, *mocks.RanListManagerMock, *mocks.RanAlarmServiceMock, *RanConnectStatusChangeManager) {
- log, err := logger.InitLogger(logger.DebugLevel)
+ Debug := int8(4)
+ log, err := logger.InitLogger(Debug)
if err != nil {
t.Errorf("#... - failed to initialize log, error: %s", err)
}
diff --git a/E2Manager/managers/ran_disconnection_manager_test.go b/E2Manager/managers/ran_disconnection_manager_test.go
index 0710849..9c87879 100644
--- a/E2Manager/managers/ran_disconnection_manager_test.go
+++ b/E2Manager/managers/ran_disconnection_manager_test.go
@@ -41,7 +41,8 @@
const e2tAddress = "10.10.2.15:9800"
func initRanLostConnectionTest(t *testing.T) (*logger.Logger, *mocks.RmrMessengerMock, *mocks.RnibReaderMock, *mocks.RnibWriterMock, *RanDisconnectionManager, *mocks.HttpClientMock) {
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#... - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/managers/ran_list_manager.go b/E2Manager/managers/ran_list_manager.go
old mode 100755
new mode 100644
diff --git a/E2Manager/managers/ran_list_manager_test.go b/E2Manager/managers/ran_list_manager_test.go
index a729f06..0ce1f52 100644
--- a/E2Manager/managers/ran_list_manager_test.go
+++ b/E2Manager/managers/ran_list_manager_test.go
@@ -32,7 +32,8 @@
)
func initRanListManagerTest(t *testing.T) (*mocks.RnibReaderMock, *mocks.RnibWriterMock, RanListManager) {
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Fatalf("#... - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/managers/ran_setup_manager_test.go b/E2Manager/managers/ran_setup_manager_test.go
index c2dbb35..a4cefef 100644
--- a/E2Manager/managers/ran_setup_manager_test.go
+++ b/E2Manager/managers/ran_setup_manager_test.go
@@ -38,7 +38,8 @@
)
func initRanSetupManagerTest(t *testing.T) (*mocks.RmrMessengerMock, *mocks.RnibWriterMock, *RanSetupManager) {
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#... - failed to initialize logger, error: %s", err)
}
@@ -211,7 +212,8 @@
}
func initLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ log, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("#initLog test - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/managers/ran_status_change_manager_test.go b/E2Manager/managers/ran_status_change_manager_test.go
index a0f497b..697a492 100644
--- a/E2Manager/managers/ran_status_change_manager_test.go
+++ b/E2Manager/managers/ran_status_change_manager_test.go
@@ -32,7 +32,8 @@
)
func initRanStatusChangeManagerTest(t *testing.T) (*logger.Logger, *mocks.RmrMessengerMock, *rmrsender.RmrSender) {
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Fatalf("#initStatusChangeManagerTest - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/managers/update_enb_manager.go b/E2Manager/managers/update_enb_manager.go
old mode 100755
new mode 100644
diff --git a/E2Manager/managers/update_enb_manager_test.go b/E2Manager/managers/update_enb_manager_test.go
index 1932cb3..268cb1d 100644
--- a/E2Manager/managers/update_enb_manager_test.go
+++ b/E2Manager/managers/update_enb_manager_test.go
@@ -11,7 +11,8 @@
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
)
func initUpdateEnbManagerTest(t *testing.T) (*UpdateEnbManager, *logger.Logger, services.RNibDataService, *NodebValidator) {
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#... - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/managers/update_gnb_manager_test.go b/E2Manager/managers/update_gnb_manager_test.go
index 56c02d4..2290db0 100644
--- a/E2Manager/managers/update_gnb_manager_test.go
+++ b/E2Manager/managers/update_gnb_manager_test.go
@@ -11,7 +11,8 @@
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
)
func initUpdateGnbManagerTest(t *testing.T) (*UpdateGnbManager, *logger.Logger, services.RNibDataService, *NodebValidator) {
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#... - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/mocks/e2t_symptomdata_mock.go b/E2Manager/mocks/e2t_symptomdata_mock.go
old mode 100755
new mode 100644
diff --git a/E2Manager/models/e2_request_message_test.go b/E2Manager/models/e2_request_message_test.go
index e7ca8c7..77cabdc 100644
--- a/E2Manager/models/e2_request_message_test.go
+++ b/E2Manager/models/e2_request_message_test.go
@@ -41,7 +41,8 @@
}
func TestGetMessageAsBytes(t *testing.T){
- log, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ log, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("#nodeb_controller_test.TestHandleRequestSuccess - failed to initialize logger, error: %s", err)
}
@@ -49,4 +50,4 @@
e2 := models.NewE2RequestMessage(transactionId, tests.RanIp, uint16(tests.Port), tests.RanName, tests.DummyPayload)
bytes := e2.GetMessageAsBytes(log)
assert.Equal(t, expectedMessageAsBytesHex, hex.EncodeToString(bytes))
-}
\ No newline at end of file
+}
diff --git a/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider_test.go b/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider_test.go
index db1915a..3f98e95 100644
--- a/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider_test.go
+++ b/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider_test.go
@@ -130,7 +130,8 @@
}
func initLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ log, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("#delete_all_request_handler_test.TestHandleSuccessFlow - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider_test.go b/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider_test.go
index 10b8995..735bc1a 100644
--- a/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider_test.go
+++ b/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider_test.go
@@ -159,7 +159,8 @@
// TODO: extract to test_utils
func initLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ log, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("#delete_all_request_handler_test.TestHandleSuccessFlow - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/rmrCgo/rmrCgoApi_test.go b/E2Manager/rmrCgo/rmrCgoApi_test.go
index b68aef6..399c2ea 100644
--- a/E2Manager/rmrCgo/rmrCgoApi_test.go
+++ b/E2Manager/rmrCgo/rmrCgoApi_test.go
@@ -130,7 +130,8 @@
}*/
func initLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ log, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#rmr_c_go_api_test.initLog - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/rmrCgo/rmrCgoUtils.go b/E2Manager/rmrCgo/rmrCgoUtils.go
index f26d168..64ff50f 100644
--- a/E2Manager/rmrCgo/rmrCgoUtils.go
+++ b/E2Manager/rmrCgo/rmrCgoUtils.go
@@ -105,9 +105,9 @@
//TODO: change to assert or return error
func (ctx *Context) checkContextInitialized() {
if ctx.RmrCtx == nil {
- if ctx.Logger != nil {
+ /*if ctx.Logger != nil {
ctx.Logger.DPanicf("#rmrCgoUtils.checkContextInitialized - The RMR router has not been initialized")
- }
+ }*/
panic("#rmrCgoUtils.checkContextInitialized - The RMR router has not been initialized. To initialize router please call Init() method")
}
}
diff --git a/E2Manager/services/ran_alarm_service_test.go b/E2Manager/services/ran_alarm_service_test.go
index b3d6274..cde13e8 100644
--- a/E2Manager/services/ran_alarm_service_test.go
+++ b/E2Manager/services/ran_alarm_service_test.go
@@ -10,8 +10,8 @@
func RanAlarmServiceTest(t *testing.T) (RanAlarmService, *logger.Logger, *configuration.Configuration) {
-
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#... - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/services/rmrreceiver/rmr_receiver_test.go b/E2Manager/services/rmrreceiver/rmr_receiver_test.go
index 72ae10a..2b1b38d 100644
--- a/E2Manager/services/rmrreceiver/rmr_receiver_test.go
+++ b/E2Manager/services/rmrreceiver/rmr_receiver_test.go
@@ -37,7 +37,8 @@
)
func TestListenAndHandle(t *testing.T) {
- log, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ log, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#rmr_service_test.TestListenAndHandle - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/services/rmrsender/rmr_sender_test.go b/E2Manager/services/rmrsender/rmr_sender_test.go
index a02beba..40f7517 100644
--- a/E2Manager/services/rmrsender/rmr_sender_test.go
+++ b/E2Manager/services/rmrsender/rmr_sender_test.go
@@ -154,7 +154,8 @@
// TODO: extract to test_utils
func initLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(3)
+ log, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Fatalf("#initLog - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/services/rnib_data_service_test.go b/E2Manager/services/rnib_data_service_test.go
index a505cb7..e78097a 100644
--- a/E2Manager/services/rnib_data_service_test.go
+++ b/E2Manager/services/rnib_data_service_test.go
@@ -37,7 +37,8 @@
}
func setupRnibDataServiceTestWithMaxAttempts(t *testing.T, maxAttempts int) (*rNibDataService, *mocks.RnibReaderMock, *mocks.RnibWriterMock) {
- logger, err := logger.InitLogger(logger.DebugLevel)
+ DebugLevel := int8(4)
+ logger, err := logger.InitLogger(DebugLevel)
if err != nil {
t.Errorf("#... - failed to initialize logger, error: %s", err)
}
diff --git a/E2Manager/tests/utils.go b/E2Manager/tests/utils.go
index 8b3ab95..edd3740 100644
--- a/E2Manager/tests/utils.go
+++ b/E2Manager/tests/utils.go
@@ -31,7 +31,8 @@
)
func InitLog(t *testing.T) *logger.Logger {
- log, err := logger.InitLogger(logger.InfoLevel)
+ InfoLevel := int8(1)
+ log, err := logger.InitLogger(InfoLevel)
if err != nil {
t.Errorf("#test.utils.InitLog - failed to initialize logger, error: %s", err)
}
diff --git a/tools/xappmock/logger/logger.go b/tools/xappmock/logger/logger.go
index 17acb4b..fabf80c 100644
--- a/tools/xappmock/logger/logger.go
+++ b/tools/xappmock/logger/logger.go
@@ -13,175 +13,63 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
// This source code is part of the near-RT RIC (RAN Intelligent Controller)
// platform project (RICP).
+
package logger
import (
- "fmt"
- "go.uber.org/zap"
- "go.uber.org/zap/zapcore"
- "strings"
+ mdclog "gerrit.o-ran-sc.org/r/com/golog"
"time"
)
type Logger struct {
- Logger *zap.Logger
+ logger *mdclog.MdcLogger
}
-// Copied from zap logger
-//
-// A Level is a logging priority. Higher levels are more important.
-type LogLevel int8
-
-const (
- // DebugLevel logs are typically voluminous, and are usually disabled in
- // production.
- DebugLevel LogLevel = iota - 1
- // InfoLevel is the default logging priority.
- InfoLevel
- // WarnLevel logs are more important than Info, but don't need individual
- // human review.
- WarnLevel
- // ErrorLevel logs are high-priority. If an application is running smoothly,
- // it shouldn't generate any error-level logs.
- ErrorLevel
- // DPanicLevel logs are particularly important errors. In development the
- // logger panics after writing the message.
- DPanicLevel
- // PanicLevel logs a message, then panics.
- PanicLevel
- // FatalLevel logs a message, then calls os.Exit(1).
- FatalLevel
-
- _minLevel = DebugLevel
- _maxLevel = FatalLevel
-)
-
-var logLevelTokenToLevel = map[string] LogLevel {
- "debug" : DebugLevel,
- "info": InfoLevel,
- "warn": WarnLevel,
- "error": ErrorLevel,
- "dpanic": DPanicLevel,
- "panic": PanicLevel,
- "fatal": FatalLevel,
+func InitLogger(loglevel int8 ) (*Logger, error) {
+ name := "e2mgr"
+ log ,err:= NewLogger(name)
+ return log,err
}
-func LogLevelTokenToLevel(level string) (LogLevel, bool) {
- if level, ok := logLevelTokenToLevel[strings.TrimSpace(strings.ToLower(level))];ok {
- return level, true
- }
- return _maxLevel+1, false
+func NewLogger(name string) (*Logger, error) {
+ l,err:= mdclog.InitLogger(name)
+ return &Logger{
+ logger: l,
+ },err
}
-func InitLogger(requested LogLevel) (*Logger, error) {
- var logger *zap.Logger
- var err error
- switch requested {
- case DebugLevel:
- logger, err = initLoggerByLevel(zapcore.DebugLevel)
- case InfoLevel:
- logger, err = initLoggerByLevel(zapcore.InfoLevel)
- case WarnLevel:
- logger, err = initLoggerByLevel(zapcore.WarnLevel)
- case ErrorLevel:
- logger, err = initLoggerByLevel(zapcore.ErrorLevel)
- case DPanicLevel:
- logger, err = initLoggerByLevel(zapcore.DPanicLevel)
- case PanicLevel:
- logger, err = initLoggerByLevel(zapcore.PanicLevel)
- case FatalLevel:
- logger, err = initLoggerByLevel(zapcore.FatalLevel)
- default:
- err = fmt.Errorf("Invalid logging Level :%d",requested)
- }
- if err != nil {
- return nil, err
- }
- return &Logger{Logger:logger}, nil
-
-}
-func(l *Logger)Sync() error {
- l.Debugf("#logger.Sync - Going to flush buffered log")
- return l.Logger.Sync()
+func (l *Logger) SetFormat(logMonitor int) {
+ l.logger.Mdclog_format_initialize(logMonitor)
}
-func (l *Logger)Infof(formatMsg string, a ...interface{}) {
- if l.InfoEnabled() {
- msg := fmt.Sprintf(formatMsg, a...)
- l.Logger.Info(msg, zap.Any("mdc", l.getTimeStampMdc()))
- }
+func (l *Logger) SetLevel(level int) {
+ l.logger.LevelSet(mdclog.Level(level))
}
-func (l *Logger)Debugf(formatMsg string, a ...interface{}) {
- if l.DebugEnabled(){
- msg := fmt.Sprintf(formatMsg, a...)
- l.Logger.Debug(msg, zap.Any("mdc", l.getTimeStampMdc()))
- }
+func (l *Logger) SetMdc(key string, value string) {
+ l.logger.MdcAdd(key, value)
}
-func (l *Logger)Errorf(formatMsg string, a ...interface{}) {
- msg := fmt.Sprintf(formatMsg, a...)
- l.Logger.Error(msg, zap.Any("mdc", l.getTimeStampMdc()))
+func (l *Logger) Errorf(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format(time.RFC3339))
+ l.logger.Error(pattern, args...)
}
-func (l *Logger)Warnf(formatMsg string, a ...interface{}) {
- msg := fmt.Sprintf(formatMsg, a...)
- l.Logger.Warn(msg, zap.Any("mdc", l.getTimeStampMdc()))
+func (l *Logger) Warnf(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format(time.RFC3339))
+ l.logger.Warning(pattern, args...)
}
-func (l *Logger) getTimeStampMdc() map[string]string {
- timeStr := time.Now().Format("2006-01-02 15:04:05.000")
- mdc := map[string]string{"time": timeStr}
- return mdc
+func (l *Logger) Infof(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format(time.RFC3339))
+ l.logger.Info(pattern, args...)
}
-func (l *Logger)InfoEnabled()bool{
- return l.Logger.Core().Enabled(zap.InfoLevel)
+func (l *Logger) Debugf(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format(time.RFC3339))
+ l.logger.Debug(pattern, args...)
}
-
-func (l *Logger)DebugEnabled()bool{
- return l.Logger.Core().Enabled(zap.DebugLevel)
-}
-
-func (l *Logger)DPanicf(formatMsg string, a ...interface{}) {
- msg := fmt.Sprintf(formatMsg, a...)
- l.Logger.DPanic(msg, zap.Any("mdc", l.getTimeStampMdc()))
-}
-
-func initLoggerByLevel(l zapcore.Level) (*zap.Logger, error) {
- cfg := zap.Config{
- Encoding: "json",
- Level: zap.NewAtomicLevelAt(l),
- OutputPaths: []string{"stdout"},
- ErrorOutputPaths: []string{"stderr"},
- EncoderConfig: zapcore.EncoderConfig{
- MessageKey: "msg",
-
- LevelKey: "crit",
- EncodeLevel: zapcore.CapitalLevelEncoder,
-
- TimeKey: "ts",
- EncodeTime: epochMillisIntegerTimeEncoder,
-
- CallerKey: "id",
- EncodeCaller: xAppMockCallerEncoder,
- },
- }
- return cfg.Build()
-}
-
-func xAppMockCallerEncoder(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) {
- enc.AppendString("xAppMock")
-}
-
-func epochMillisIntegerTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) {
- nanos := t.UnixNano()
- millis := int64(nanos) / int64(time.Millisecond)
- enc.AppendInt64(millis)
-}
-
diff --git a/tools/xappmock/main/xappmock.go b/tools/xappmock/main/xappmock.go
index 18c069e..d85d980 100644
--- a/tools/xappmock/main/xappmock.go
+++ b/tools/xappmock/main/xappmock.go
@@ -44,7 +44,8 @@
func main() {
- logLevel, _ := logger.LogLevelTokenToLevel("info")
+ //logLevel, _ := logger.LogLevelTokenToLevel("info")
+ logLevel := int8(1)
logger, err := logger.InitLogger(logLevel)
if err != nil {
fmt.Printf("#app.main - failed to initialize logger, error: %s", err)