From: Idan Shalom Date: Mon, 6 Jul 2020 09:41:46 +0000 (+0000) Subject: [RIC-431] Add Enb | Configuration changes | Some refactoring | K8S yamls X-Git-Tag: R5_RC~59 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F15%2F4315%2F1;p=ric-plt%2Fe2mgr.git [RIC-431] Add Enb | Configuration changes | Some refactoring | K8S yamls Change-Id: Ie10d5ba743c7d9606f0366417acded8422cb4d61 Signed-off-by: Idan Shalom --- diff --git a/E2Manager/app/main.go b/E2Manager/app/main.go index 97ce5ab..cc38556 100644 --- a/E2Manager/app/main.go +++ b/E2Manager/app/main.go @@ -53,7 +53,7 @@ func main() { db := sdlgo.NewDatabase() sdl := sdlgo.NewSdlInstance("e2Manager", db) defer sdl.Close() - rnibDataService := services.NewRnibDataService(logger, config, reader.GetRNibReader(sdl), rNibWriter.GetRNibWriter(sdl)) + rnibDataService := services.NewRnibDataService(logger, config, reader.GetRNibReader(sdl), rNibWriter.GetRNibWriter(sdl, config.RnibWriter)) var msgImpl *rmrCgo.Context rmrMessenger := msgImpl.Init("tcp:"+strconv.Itoa(config.Rmr.Port), config.Rmr.MaxMsgSize, 0, logger) rmrSender := rmrsender.NewRmrSender(logger, rmrMessenger) @@ -63,7 +63,7 @@ func main() { routingManagerClient := clients.NewRoutingManagerClient(logger, config, clients.NewHttpClient()) ranListManager := managers.NewRanListManager(logger) ranAlarmService := services.NewRanAlarmService(logger, config) - ranConnectStatusChangeManager := managers.NewRanConnectStatusChangeManager(logger, rnibDataService,ranListManager, ranAlarmService) + ranConnectStatusChangeManager := managers.NewRanConnectStatusChangeManager(logger, rnibDataService, ranListManager, ranAlarmService) e2tAssociationManager := managers.NewE2TAssociationManager(logger, rnibDataService, e2tInstancesManager, routingManagerClient, ranConnectStatusChangeManager) e2tShutdownManager := managers.NewE2TShutdownManager(logger, config, rnibDataService, e2tInstancesManager, e2tAssociationManager, kubernetes, ranConnectStatusChangeManager) e2tKeepAliveWorker := managers.NewE2TKeepAliveWorker(logger, rmrSender, e2tInstancesManager, e2tShutdownManager, config) diff --git a/E2Manager/configuration/configuration.go b/E2Manager/configuration/configuration.go index f539c5d..8582edd 100644 --- a/E2Manager/configuration/configuration.go +++ b/E2Manager/configuration/configuration.go @@ -26,6 +26,11 @@ import ( "strconv" ) +type RnibWriterConfig struct { + StateChangeMessageChannel string + RanManipulationMessageChannel string +} + type Configuration struct { Logging struct { LogLevel string @@ -53,7 +58,7 @@ type Configuration struct { Mcc string Mnc string } - StateChangeMessageChannel string + RnibWriter RnibWriterConfig } func ParseConfiguration() *Configuration { @@ -81,7 +86,7 @@ func ParseConfiguration() *Configuration { config.KeepAliveDelayMs = viper.GetInt("KeepAliveDelayMs") config.E2TInstanceDeletionTimeoutMs = viper.GetInt("e2tInstanceDeletionTimeoutMs") config.populateGlobalRicIdConfig(viper.Sub("globalRicId")) - config.StateChangeMessageChannel = viper.GetString("stateChangeMessageChannel") + config.populateRnibWriterConfig(viper.Sub("rnibWriter")) return &config } @@ -114,6 +119,14 @@ func (c *Configuration) populateRoutingManagerConfig(rmConfig *viper.Viper) { c.RoutingManager.BaseUrl = rmConfig.GetString("baseUrl") } +func (c *Configuration) populateRnibWriterConfig(rnibWriterConfig *viper.Viper) { + if rnibWriterConfig == nil { + panic(fmt.Sprintf("#configuration.populateRnibWriterConfig - failed to populate Rnib Writer configuration: The entry 'rnibWriter' not found\n")) + } + c.RnibWriter.StateChangeMessageChannel = rnibWriterConfig.GetString("stateChangeMessageChannel") + c.RnibWriter.RanManipulationMessageChannel = rnibWriterConfig.GetString("ranManipulationMessageChannel") +} + func (c *Configuration) populateGlobalRicIdConfig(globalRicIdConfig *viper.Viper) { err := validateGlobalRicIdConfig(globalRicIdConfig) if err != nil { @@ -147,23 +160,22 @@ func validateGlobalRicIdConfig(globalRicIdConfig *viper.Viper) error { return err } - return nil } func validateMcc(mcc string) error { - if len(mcc) == 0{ + if len(mcc) == 0 { return errors.New("#configuration.validateMcc - mcc is missing or empty\n") } - if len(mcc) != 3{ + if len(mcc) != 3 { return errors.New("#configuration.validateMcc - mcc is not 3 digits\n") } mccInt, err := strconv.Atoi(mcc) - if err != nil{ + if err != nil { return errors.New("#configuration.validateMcc - mcc is not a number\n") } @@ -175,17 +187,17 @@ func validateMcc(mcc string) error { func validateMnc(mnc string) error { - if len(mnc) == 0{ + if len(mnc) == 0 { return errors.New("#configuration.validateMnc - mnc is missing or empty\n") } - if len(mnc) < 2 || len(mnc) >3 { + if len(mnc) < 2 || len(mnc) > 3 { return errors.New("#configuration.validateMnc - mnc is not 2 or 3 digits\n") } mncAsInt, err := strconv.Atoi(mnc) - if err != nil{ + if err != nil { return errors.New("#configuration.validateMnc - mnc is not a number\n") } @@ -196,9 +208,9 @@ func validateMnc(mnc string) error { return nil } -func validateRicId(ricId string) error{ +func validateRicId(ricId string) error { - if len(ricId) == 0{ + if len(ricId) == 0 { return errors.New("#configuration.validateRicId - ricId is missing or empty\n") } @@ -214,12 +226,11 @@ func validateRicId(ricId string) error{ return nil } - 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, "+ - "globalRicId: { ricId: %s, mcc: %s, mnc: %s}, StateChangeMessageChannel: %s", + "globalRicId: { ricId: %s, mcc: %s, mnc: %s}, rnibWriter: { stateChangeMessageChannel: %s, ranManipulationChannel: %s}", c.Logging.LogLevel, c.Http.Port, c.Rmr.Port, @@ -235,6 +246,7 @@ func (c *Configuration) String() string { c.GlobalRicId.RicId, c.GlobalRicId.Mcc, c.GlobalRicId.Mnc, - c.StateChangeMessageChannel, + c.RnibWriter.StateChangeMessageChannel, + c.RnibWriter.RanManipulationMessageChannel, ) } diff --git a/E2Manager/configuration/configuration_test.go b/E2Manager/configuration/configuration_test.go index 27fd1b4..8f5a411 100644 --- a/E2Manager/configuration/configuration_test.go +++ b/E2Manager/configuration/configuration_test.go @@ -17,7 +17,6 @@ // This source code is part of the near-RT RIC (RAN Intelligent Controller) // platform project (RICP). - package configuration import ( @@ -43,7 +42,8 @@ func TestParseConfigurationSuccess(t *testing.T) { assert.Equal(t, "AACCE", config.GlobalRicId.RicId) assert.Equal(t, "310", config.GlobalRicId.Mcc) assert.Equal(t, "411", config.GlobalRicId.Mnc) - assert.Equal(t, "RAN_CONNECTION_STATUS_CHANGE", config.StateChangeMessageChannel) + assert.Equal(t, "RAN_CONNECTION_STATUS_CHANGE", config.RnibWriter.StateChangeMessageChannel) + assert.Equal(t, "RAN_MANIPULATION", config.RnibWriter.RanManipulationMessageChannel) } func TestStringer(t *testing.T) { @@ -81,9 +81,9 @@ func TestRmrConfigNotFoundFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "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{}{"plmnId": "131014", "ricNearRtId": "556670"}, } buf, err := yaml.Marshal(yamlMap) @@ -111,9 +111,9 @@ func TestLoggingConfigNotFoundFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "http": map[string]interface{}{"port": 3800}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "http": map[string]interface{}{"port": 3800}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, "globalRicId": map[string]interface{}{"plmnId": "131014", "ricNearRtId": "556670"}, } buf, err := yaml.Marshal(yamlMap) @@ -142,9 +142,9 @@ func TestHttpConfigNotFoundFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, "globalRicId": map[string]interface{}{"plmnId": "131014", "ricNearRtId": "556670"}, } buf, err := yaml.Marshal(yamlMap) @@ -173,10 +173,10 @@ func TestRoutingManagerConfigNotFoundFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, - "globalRicId": map[string]interface{}{"mcc": 327, "mnc": 94, "ricId": "AACCE"}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, + "globalRicId": map[string]interface{}{"mcc": 327, "mnc": 94, "ricId": "AACCE"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -204,10 +204,10 @@ func TestGlobalRicIdConfigNotFoundFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -222,35 +222,35 @@ func TestGlobalRicIdConfigNotFoundFailure(t *testing.T) { } func TestEmptyRicIdFailure(t *testing.T) { -configPath := "../resources/configuration.yaml" -configPathTmp := "../resources/configuration.yaml_tmp" -err := os.Rename(configPath, configPathTmp) -if err != nil { -t.Errorf("#TestEmptyRicIdFailure - failed to rename configuration file: %s\n", configPath) -} -defer func() { -err = os.Rename(configPathTmp, configPath) -if err != nil { -t.Errorf("#TestEmptyRicIdFailure - failed to rename configuration file: %s\n", configPath) -} -}() -yamlMap := map[string]interface{}{ -"rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, -"logging": map[string]interface{}{"logLevel": "info"}, -"http": map[string]interface{}{"port": 3800}, -"globalRicId": map[string]interface{}{"mcc": "327", "mnc": "94", "ricId": ""}, -"routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, -} -buf, err := yaml.Marshal(yamlMap) -if err != nil { -t.Errorf("#TestEmptyRicIdFailure - failed to marshal configuration map\n") -} -err = ioutil.WriteFile("../resources/configuration.yaml", buf, 0644) -if err != nil { -t.Errorf("#TestEmptyRicIdFailure - failed to write configuration file: %s\n", configPath) -} -assert.PanicsWithValue(t, "#configuration.validateRicId - ricId is missing or empty\n", -func() { ParseConfiguration() }) + configPath := "../resources/configuration.yaml" + configPathTmp := "../resources/configuration.yaml_tmp" + err := os.Rename(configPath, configPathTmp) + if err != nil { + t.Errorf("#TestEmptyRicIdFailure - failed to rename configuration file: %s\n", configPath) + } + defer func() { + err = os.Rename(configPathTmp, configPath) + if err != nil { + t.Errorf("#TestEmptyRicIdFailure - failed to rename configuration file: %s\n", configPath) + } + }() + yamlMap := map[string]interface{}{ + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, + "globalRicId": map[string]interface{}{"mcc": "327", "mnc": "94", "ricId": ""}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + } + buf, err := yaml.Marshal(yamlMap) + if err != nil { + t.Errorf("#TestEmptyRicIdFailure - failed to marshal configuration map\n") + } + err = ioutil.WriteFile("../resources/configuration.yaml", buf, 0644) + if err != nil { + t.Errorf("#TestEmptyRicIdFailure - failed to write configuration file: %s\n", configPath) + } + assert.PanicsWithValue(t, "#configuration.validateRicId - ricId is missing or empty\n", + func() { ParseConfiguration() }) } func TestMissingRicIdFailure(t *testing.T) { @@ -267,11 +267,11 @@ func TestMissingRicIdFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "327", "mnc": "94"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -299,11 +299,11 @@ func TestNonHexRicIdFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "327", "mnc": "94", "ricId": "TEST1"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -331,11 +331,11 @@ func TestWrongRicIdLengthFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "327", "mnc": "94", "ricId": "AA43"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -363,11 +363,11 @@ func TestMccNotThreeDigitsFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "31", "mnc": "94", "ricId": "AA443"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -395,11 +395,11 @@ func TestMncLengthIsGreaterThanThreeDigitsFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "310", "mnc": "6794", "ricId": "AA443"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -427,11 +427,11 @@ func TestMncLengthIsLessThanTwoDigitsFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "310", "mnc": "4", "ricId": "AA443"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -459,11 +459,11 @@ func TestNegativeMncFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "310", "mnc": "-2", "ricId": "AA443"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -491,11 +491,11 @@ func TestNegativeMccFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "-31", "mnc": "222", "ricId": "AA443"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -523,11 +523,11 @@ func TestAlphaNumericMccFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "1W2", "mnc": "222", "ricId": "AA443"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -555,11 +555,11 @@ func TestAlphaNumericMncFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "111", "mnc": "2A8", "ricId": "AA443"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -587,11 +587,11 @@ func TestMissingMmcFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mnc": "94", "ricId": "AABB3"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -605,7 +605,6 @@ func TestMissingMmcFailure(t *testing.T) { func() { ParseConfiguration() }) } - func TestEmptyMmcFailure(t *testing.T) { configPath := "../resources/configuration.yaml" configPathTmp := "../resources/configuration.yaml_tmp" @@ -620,11 +619,11 @@ func TestEmptyMmcFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "", "mnc": "94", "ricId": "AABB3"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -652,11 +651,11 @@ func TestEmptyMncFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "111", "mnc": "", "ricId": "AABB3"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { @@ -684,11 +683,11 @@ func TestMissingMncFailure(t *testing.T) { } }() yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 3800}, + "rmr": map[string]interface{}{"port": 3801, "maxMsgSize": 4096}, + "logging": map[string]interface{}{"logLevel": "info"}, + "http": map[string]interface{}{"port": 3800}, "globalRicId": map[string]interface{}{"mcc": "111", "ricId": "AABB3"}, - "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, + "routingManager": map[string]interface{}{"baseUrl": "http://localhost:8080/ric/v1/handles/"}, } buf, err := yaml.Marshal(yamlMap) if err != nil { diff --git a/E2Manager/container-tag.yaml b/E2Manager/container-tag.yaml index e9c341b..e12ccfc 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.2.5 +tag: 5.2.6 diff --git a/E2Manager/controllers/nodeb_controller.go b/E2Manager/controllers/nodeb_controller.go index 5bc2a2c..a1f5b78 100644 --- a/E2Manager/controllers/nodeb_controller.go +++ b/E2Manager/controllers/nodeb_controller.go @@ -50,6 +50,7 @@ type INodebController interface { UpdateGnb(writer http.ResponseWriter, r *http.Request) GetNodebIdList(writer http.ResponseWriter, r *http.Request) SetGeneralConfiguration(writer http.ResponseWriter, r *http.Request) + AddEnb(writer http.ResponseWriter, r *http.Request) } type NodebController struct { @@ -67,7 +68,7 @@ func NewNodebController(logger *logger.Logger, handlerProvider *httpmsghandlerpr func (c *NodebController) GetNodebIdList(writer http.ResponseWriter, r *http.Request) { c.logger.Infof("[Client -> E2 Manager] #NodebController.GetNodebIdList - request: %v", c.prettifyRequest(r)) - c.handleRequest(writer, &r.Header, httpmsghandlerprovider.GetNodebIdListRequest, nil, false) + c.handleRequest(writer, &r.Header, httpmsghandlerprovider.GetNodebIdListRequest, nil, false, http.StatusOK) } func (c *NodebController) GetNodeb(writer http.ResponseWriter, r *http.Request) { @@ -75,7 +76,7 @@ func (c *NodebController) GetNodeb(writer http.ResponseWriter, r *http.Request) vars := mux.Vars(r) ranName := vars["ranName"] request := models.GetNodebRequest{RanName: ranName} - c.handleRequest(writer, &r.Header, httpmsghandlerprovider.GetNodebRequest, request, false) + c.handleRequest(writer, &r.Header, httpmsghandlerprovider.GetNodebRequest, request, false, http.StatusOK) } func (c *NodebController) UpdateGnb(writer http.ResponseWriter, r *http.Request) { @@ -93,7 +94,31 @@ func (c *NodebController) UpdateGnb(writer http.ResponseWriter, r *http.Request) request.Gnb = &gnb request.RanName = ranName - c.handleRequest(writer, &r.Header, httpmsghandlerprovider.UpdateGnbRequest, request, true) + c.handleRequest(writer, &r.Header, httpmsghandlerprovider.UpdateGnbRequest, request, true, http.StatusOK) +} + +func (c *NodebController) AddEnb(writer http.ResponseWriter, r *http.Request) { + c.logger.Infof("[Client -> E2 Manager] #NodebController.AddEnb - request: %v", c.prettifyRequest(r)) + + defer r.Body.Close() + body, err := ioutil.ReadAll(io.LimitReader(r.Body, LimitRequest)) + + if err != nil { + c.logger.Errorf("[Client -> E2 Manager] #NodebController.AddEnb - unable to read request body - error: %s", err) + c.handleErrorResponse(e2managererrors.NewInvalidJsonError(), writer) + return + } + + addEnbRequest := models.AddEnbRequest{} + err = json.Unmarshal(body, &addEnbRequest) + + if err != nil { + c.logger.Errorf("[Client -> E2 Manager] #NodebController.AddEnb - unable to unmarshal json - error: %s", err) + c.handleErrorResponse(e2managererrors.NewInvalidJsonError(), writer) + return + } + + c.handleRequest(writer, &r.Header, httpmsghandlerprovider.AddEnbRequest, &addEnbRequest, true, http.StatusCreated) } func (c *NodebController) SetGeneralConfiguration(writer http.ResponseWriter, r *http.Request) { @@ -101,15 +126,15 @@ func (c *NodebController) SetGeneralConfiguration(writer http.ResponseWriter, r request := models.GeneralConfigurationRequest{} - if !c.extractJsonBodyDisallowUnknownFields(r, &request, writer){ + if !c.extractJsonBodyDisallowUnknownFields(r, &request, writer) { return } - c.handleRequest(writer, &r.Header, httpmsghandlerprovider.SetGeneralConfigurationRequest, request, false) + c.handleRequest(writer, &r.Header, httpmsghandlerprovider.SetGeneralConfigurationRequest, request, false, http.StatusOK) } func (c *NodebController) Shutdown(writer http.ResponseWriter, r *http.Request) { c.logger.Infof("[Client -> E2 Manager] #NodebController.Shutdown - request: %v", c.prettifyRequest(r)) - c.handleRequest(writer, &r.Header, httpmsghandlerprovider.ShutdownRequest, nil, false) + c.handleRequest(writer, &r.Header, httpmsghandlerprovider.ShutdownRequest, nil, false, http.StatusNoContent) } func (c *NodebController) X2Reset(writer http.ResponseWriter, r *http.Request) { @@ -118,14 +143,15 @@ func (c *NodebController) X2Reset(writer http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) ranName := vars[ParamRanName] - if r.ContentLength > 0 && !c.extractJsonBody(r, &request, writer) { + if err := c.extractJsonBody(r, &request); err != nil { + c.handleErrorResponse(err, writer) return } request.RanName = ranName - c.handleRequest(writer, &r.Header, httpmsghandlerprovider.ResetRequest, request, false) + c.handleRequest(writer, &r.Header, httpmsghandlerprovider.ResetRequest, request, false, http.StatusNoContent) } -func (c *NodebController) extractRequestBodyToProto(r *http.Request, pb proto.Message , writer http.ResponseWriter) bool { +func (c *NodebController) extractRequestBodyToProto(r *http.Request, pb proto.Message, writer http.ResponseWriter) bool { defer r.Body.Close() err := jsonpb.Unmarshal(r.Body, pb) @@ -154,27 +180,25 @@ func (c *NodebController) extractJsonBodyDisallowUnknownFields(r *http.Request, return true } -func (c *NodebController) extractJsonBody(r *http.Request, request models.Request, writer http.ResponseWriter) bool { +func (c *NodebController) extractJsonBody(r *http.Request, request models.Request) error { defer r.Body.Close() body, err := ioutil.ReadAll(io.LimitReader(r.Body, LimitRequest)) if err != nil { c.logger.Errorf("[Client -> E2 Manager] #NodebController.extractJsonBody - unable to extract json body - error: %s", err) - c.handleErrorResponse(e2managererrors.NewInvalidJsonError(), writer) - return false + return e2managererrors.NewInvalidJsonError() } err = json.Unmarshal(body, &request) if err != nil { c.logger.Errorf("[Client -> E2 Manager] #NodebController.extractJsonBody - unable to extract json body - error: %s", err) - c.handleErrorResponse(e2managererrors.NewInvalidJsonError(), writer) - return false + return e2managererrors.NewInvalidJsonError() } - return true + return nil } -func (c *NodebController) handleRequest(writer http.ResponseWriter, header *http.Header, requestName httpmsghandlerprovider.IncomingRequest, request models.Request, validateRequestHeaders bool) { +func (c *NodebController) handleRequest(writer http.ResponseWriter, header *http.Header, requestName httpmsghandlerprovider.IncomingRequest, request models.Request, validateRequestHeaders bool, successStatusCode int) { if validateRequestHeaders { @@ -199,8 +223,8 @@ func (c *NodebController) handleRequest(writer http.ResponseWriter, header *http return } - if response == nil { - writer.WriteHeader(http.StatusNoContent) + if successStatusCode == http.StatusNoContent { + writer.WriteHeader(successStatusCode) c.logger.Infof("[E2 Manager -> Client] #NodebController.handleRequest - status response: %v", http.StatusNoContent) return } @@ -214,6 +238,7 @@ func (c *NodebController) handleRequest(writer http.ResponseWriter, header *http c.logger.Infof("[E2 Manager -> Client] #NodebController.handleRequest - response: %s", result) writer.Header().Set(ContentType, ApplicationJson) + writer.WriteHeader(successStatusCode) writer.Write(result) } diff --git a/E2Manager/controllers/nodeb_controller_test.go b/E2Manager/controllers/nodeb_controller_test.go index 4bcc708..78be089 100644 --- a/E2Manager/controllers/nodeb_controller_test.go +++ b/E2Manager/controllers/nodeb_controller_test.go @@ -56,13 +56,17 @@ const ( AssociatedE2TInstanceAddress = "10.0.2.15:38000" ValidationFailureJson = "{\"errorCode\":402,\"errorMessage\":\"Validation error\"}" ResourceNotFoundJson = "{\"errorCode\":404,\"errorMessage\":\"Resource not found\"}" + NodebExistsJson = "{\"errorCode\":406,\"errorMessage\":\"Nodeb already exists\"}" RnibErrorJson = "{\"errorCode\":500,\"errorMessage\":\"RNIB error\"}" InternalErrorJson = "{\"errorCode\":501,\"errorMessage\":\"Internal Server Error. Please try again later\"}" + AddEnbUrl = "/nodeb/enb" ) var ( ServedNrCellInformationRequiredFields = []string{"cellId", "choiceNrMode", "nrMode", "nrPci", "servedPlmns"} NrNeighbourInformationRequiredFields = []string{"nrCgi", "choiceNrMode", "nrMode", "nrPci"} + EnbRequiredFields = []string{"enbType", "servedCells"} + ServedCellRequiredFields = []string{"broadcastPlmns", "cellId", "choiceEutraMode", "eutraMode", "pci", "tac"} ) type controllerGetNodebTestContext struct { @@ -89,6 +93,12 @@ type updateGnbCellsParams struct { err error } +type saveNodebParams struct { + nodebInfo *entities.NodebInfo + nbIdentity *entities.NbIdentity + err error +} + type removeServedNrCellsParams struct { servedNrCells []*entities.ServedNRCell err error @@ -103,6 +113,14 @@ type controllerUpdateGnbTestContext struct { expectedJsonResponse string } +type controllerAddEnbTestContext struct { + getNodebInfoResult *getNodebInfoResult + saveNodebParams *saveNodebParams + requestBody map[string]interface{} + expectedStatusCode int + expectedJsonResponse string +} + func generateServedNrCells(cellIds ...string) []*entities.ServedNRCell { servedNrCells := []*entities.ServedNRCell{} @@ -161,6 +179,27 @@ func buildServedNrCellInformation(propToOmit string) map[string]interface{} { return ret } +func buildServedCell(propToOmit string) map[string]interface{} { + ret := map[string]interface{}{ + "cellId": "whatever", + "choiceEutraMode": map[string]interface{}{ + "fdd": map[string]interface{}{}, + }, + "eutraMode": 1, + "pci": 1, + "tac": "whatever3", + "broadcastPlmns": []interface{}{ + "whatever", + }, + } + + if len(propToOmit) != 0 { + delete(ret, propToOmit) + } + + return ret +} + func setupControllerTest(t *testing.T) (*NodebController, *mocks.RnibReaderMock, *mocks.RnibWriterMock, *mocks.RmrMessengerMock, *mocks.E2TInstancesManagerMock) { log := initLog(t) config := configuration.ParseConfiguration() @@ -281,29 +320,32 @@ func assertControllerUpdateGnb(t *testing.T, context *controllerUpdateGnbTestCon assert.Equal(t, context.expectedJsonResponse, string(bodyBytes)) readerMock.AssertExpectations(t) writerMock.AssertExpectations(t) +} - if context.getNodebInfoResult != nil { - readerMock.AssertNotCalled(t, "GetNodeb") - } - - if context.updateGnbCellsParams != nil { - writerMock.AssertNotCalled(t, "UpdateGnb") - } - - if context.removeServedNrCellsParams != nil { - writerMock.AssertNotCalled(t, "RemoveServedNrCells") - } +func assertControllerAddEnb(t *testing.T, context *controllerAddEnbTestContext, writer *httptest.ResponseRecorder, readerMock *mocks.RnibReaderMock, writerMock *mocks.RnibWriterMock) { + assert.Equal(t, context.expectedStatusCode, writer.Result().StatusCode) + bodyBytes, _ := ioutil.ReadAll(writer.Body) + assert.Equal(t, context.expectedJsonResponse, string(bodyBytes)) + readerMock.AssertExpectations(t) + writerMock.AssertExpectations(t) } func buildUpdateGnbRequest(context *controllerUpdateGnbTestContext) *http.Request { updateGnbUrl := fmt.Sprintf("/nodeb/%s/update", RanName) requestBody := getJsonRequestAsBuffer(context.requestBody) - req, _ := http.NewRequest(http.MethodGet, updateGnbUrl, requestBody) + req, _ := http.NewRequest(http.MethodPut, updateGnbUrl, requestBody) req.Header.Set("Content-Type", "application/json") req = mux.SetURLVars(req, map[string]string{"ranName": RanName}) return req } +func buildAddEnbRequest(context *controllerAddEnbTestContext) *http.Request { + requestBody := getJsonRequestAsBuffer(context.requestBody) + req, _ := http.NewRequest(http.MethodPost, AddEnbUrl, requestBody) + req.Header.Set("Content-Type", "application/json") + return req +} + func controllerUpdateGnbTestExecuter(t *testing.T, context *controllerUpdateGnbTestContext) { controller, readerMock, writerMock, _, _ := setupControllerTest(t) writer := httptest.NewRecorder() @@ -314,6 +356,42 @@ func controllerUpdateGnbTestExecuter(t *testing.T, context *controllerUpdateGnbT assertControllerUpdateGnb(t, context, writer, readerMock, writerMock) } +func activateControllerAddEnbMocks(context *controllerAddEnbTestContext, readerMock *mocks.RnibReaderMock, writerMock *mocks.RnibWriterMock, addEnbRequest *models.AddEnbRequest) { + if context.getNodebInfoResult != nil { + readerMock.On("GetNodeb", RanName).Return(context.getNodebInfoResult.nodebInfo, context.getNodebInfoResult.rnibError) + } + + if context.saveNodebParams != nil { + nodebInfo := entities.NodebInfo{ + RanName: addEnbRequest.RanName, + Ip: addEnbRequest.Ip, + Port: addEnbRequest.Port, + GlobalNbId: addEnbRequest.GlobalNbId, + Configuration: &entities.NodebInfo_Enb{Enb: addEnbRequest.Enb}, + ConnectionStatus: entities.ConnectionStatus_DISCONNECTED, + } + + nbIdentity := entities.NbIdentity{InventoryName: addEnbRequest.RanName, GlobalNbId: addEnbRequest.GlobalNbId} + + writerMock.On("SaveNodeb",&nbIdentity, &nodebInfo).Return(context.saveNodebParams.err) + } +} + +func controllerAddEnbTestExecuter(t *testing.T, context *controllerAddEnbTestContext) { + controller, readerMock, writerMock, _, _ := setupControllerTest(t) + writer := httptest.NewRecorder() + r := buildAddEnbRequest(context) + defer r.Body.Close() + body, _ := ioutil.ReadAll(io.LimitReader(r.Body, LimitRequest)) + + addEnbRequest := models.AddEnbRequest{} + + _ = json.Unmarshal(body, &addEnbRequest) + activateControllerAddEnbMocks(context, readerMock, writerMock, &addEnbRequest) + controller.AddEnb(writer, buildAddEnbRequest(context)) + assertControllerAddEnb(t, context, writer, readerMock, writerMock) +} + func TestControllerUpdateGnbEmptyServedNrCells(t *testing.T) { context := controllerUpdateGnbTestContext{ getNodebInfoResult: nil, @@ -600,6 +678,35 @@ func TestControllerUpdateGnbSuccess(t *testing.T) { controllerUpdateGnbTestExecuter(t, &context) } +func TestControllerAddEnbSuccess(t *testing.T) { + context := controllerAddEnbTestContext{ + saveNodebParams: &saveNodebParams{ + err: nil, + }, + getNodebInfoResult: &getNodebInfoResult{ + nodebInfo: nil, + rnibError: common.NewResourceNotFoundError("#reader.GetNodeb - Not found Error"), + }, + requestBody: map[string]interface{}{ + "ranName": RanName, + "globalNbId": map[string]interface{}{ + "plmnId": "whatever", + "nbId": "whatever2", + }, + "enb": map[string]interface{}{ + "enbType": 1, + "servedCells": []interface{}{ + buildServedCell(""), + }, + }, + }, + expectedStatusCode: http.StatusCreated, + expectedJsonResponse: "{\"ranName\":\"test\",\"connectionStatus\":\"DISCONNECTED\",\"globalNbId\":{\"plmnId\":\"whatever\",\"nbId\":\"whatever2\"},\"enb\":{\"enbType\":\"MACRO_ENB\",\"servedCells\":[{\"pci\":1,\"cellId\":\"whatever\",\"tac\":\"whatever3\",\"broadcastPlmns\":[\"whatever\"],\"choiceEutraMode\":{\"fdd\":{}},\"eutraMode\":\"FDD\"}]}}", + } + + controllerAddEnbTestExecuter(t, &context) +} + func getJsonRequestAsBuffer(requestJson map[string]interface{}) *bytes.Buffer { b := new(bytes.Buffer) _ = json.NewEncoder(b).Encode(requestJson) @@ -699,7 +806,7 @@ func TestHeaderValidationFailed(t *testing.T) { header := &http.Header{} - controller.handleRequest(writer, header, httpmsghandlerprovider.ShutdownRequest, nil, true) + controller.handleRequest(writer, header, httpmsghandlerprovider.ShutdownRequest, nil, true, 0) var errorResponse = parseJsonRequest(t, writer.Body) err := e2managererrors.NewHeaderValidationError() @@ -848,12 +955,13 @@ func TestX2ResetHandleSuccessfulRequestedDefault(t *testing.T) { // no body b := new(bytes.Buffer) + data4Req := map[string]interface{}{} + _ = json.NewEncoder(b).Encode(data4Req) req, _ := http.NewRequest("PUT", "https://localhost:3800/nodeb-reset", b) req = mux.SetURLVars(req, map[string]string{"ranName": ranName}) controller.X2Reset(writer, req) assert.Equal(t, http.StatusNoContent, writer.Result().StatusCode) - } func TestX2ResetHandleFailureInvalidBody(t *testing.T) { diff --git a/E2Manager/e2managererrors/nodeb_exists_error.go b/E2Manager/e2managererrors/nodeb_exists_error.go new file mode 100644 index 0000000..0f33745 --- /dev/null +++ b/E2Manager/e2managererrors/nodeb_exists_error.go @@ -0,0 +1,38 @@ +// +// 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 e2managererrors + +type NodebExistsError struct { + *BaseError +} + +func NewNodebExistsError() *NodebExistsError { + return &NodebExistsError{ + &BaseError{ + Code: 406, + Message: "Nodeb already exists", + }, + } +} + +func (e *NodebExistsError) Error() string { + return e.Message +} diff --git a/E2Manager/handlers/httpmsghandlers/add_enb_request_handler.go b/E2Manager/handlers/httpmsghandlers/add_enb_request_handler.go new file mode 100644 index 0000000..c8615a4 --- /dev/null +++ b/E2Manager/handlers/httpmsghandlers/add_enb_request_handler.go @@ -0,0 +1,205 @@ +// +// 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 httpmsghandlers + +import ( + "e2mgr/e2managererrors" + "e2mgr/logger" + "e2mgr/models" + "e2mgr/services" + "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common" + "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" + "github.com/pkg/errors" +) + +type AddEnbRequestHandler struct { + logger *logger.Logger + rNibDataService services.RNibDataService +} + +func NewAddEnbRequestHandler(logger *logger.Logger, rNibDataService services.RNibDataService) *AddEnbRequestHandler { + return &AddEnbRequestHandler{ + logger: logger, + rNibDataService: rNibDataService, + } +} + +func (h *AddEnbRequestHandler) Handle(request models.Request) (models.IResponse, error) { + + addEnbRequest := request.(*models.AddEnbRequest) + + h.logger.Infof("#AddEnbRequestHandler.Handle - Ran name: %s", addEnbRequest.RanName) + + err := h.validateRequestBody(addEnbRequest) + + if err != nil { + h.logger.Errorf("#AddEnbRequestHandler.Handle - validation failure: %s is a mandatory field and cannot be empty", err) + return nil, e2managererrors.NewRequestValidationError() + } + + _, err = h.rNibDataService.GetNodeb(addEnbRequest.RanName) + + if err == nil { + h.logger.Errorf("#AddEnbRequestHandler.Handle - RAN name: %s - RAN already exists. quit", addEnbRequest.RanName) + return nil, e2managererrors.NewNodebExistsError() + } + + _, ok := err.(*common.ResourceNotFoundError) + if !ok { + h.logger.Errorf("#AddEnbRequestHandler.Handle - RAN name: %s - failed to get nodeb entity from RNIB. Error: %s", addEnbRequest.RanName, err) + return nil, e2managererrors.NewRnibDbError() + } + + nbIdentity := h.createNbIdentity(addEnbRequest) + nodebInfo := h.createNodebInfo(addEnbRequest) + + err = h.rNibDataService.SaveNodeb(nbIdentity, nodebInfo) + + if err != nil { + h.logger.Errorf("#AddEnbRequestHandler.Handle - RAN name: %s - failed to save nodeb entity in RNIB. Error: %s", addEnbRequest.RanName, err) + return nil, e2managererrors.NewRnibDbError() + } + + return models.NewAddEnbResponse(nodebInfo), nil +} + +func (h *AddEnbRequestHandler) createNodebInfo(addEnbRequest *models.AddEnbRequest) *entities.NodebInfo { + nodebInfo := entities.NodebInfo{ + RanName: addEnbRequest.RanName, + Ip: addEnbRequest.Ip, + Port: addEnbRequest.Port, + GlobalNbId: addEnbRequest.GlobalNbId, + Configuration: &entities.NodebInfo_Enb{Enb: addEnbRequest.Enb}, + ConnectionStatus: entities.ConnectionStatus_DISCONNECTED, + } + + return &nodebInfo +} + +func (h *AddEnbRequestHandler) createNbIdentity(addEnbRequest *models.AddEnbRequest) *entities.NbIdentity { + nbIdentity := entities.NbIdentity{ + GlobalNbId: addEnbRequest.GlobalNbId, + InventoryName: addEnbRequest.RanName, + } + + return &nbIdentity +} + +func (h *AddEnbRequestHandler) validateRequestBody(addEnbRequest *models.AddEnbRequest) error { + + if addEnbRequest.RanName == "" { + return errors.New("ranName") + } + + if addEnbRequest.GlobalNbId == nil { + return errors.New("globalNbId") + } + + if err := isGlobalNbIdValid(addEnbRequest.GlobalNbId); err != nil { + return err + } + + if addEnbRequest.Enb == nil { + return errors.New("enb") + } + + if err := isEnbValid(addEnbRequest.Enb); err != nil { + return err + } + + return nil +} + +func isGlobalNbIdValid(globalNbId *entities.GlobalNbId) error { + if globalNbId.PlmnId == "" { + return errors.New("globalNbId.plmnId") + } + + if globalNbId.NbId == "" { + return errors.New("globalNbId.nbId") + } + + return nil +} + +func isEnbValid(enb *entities.Enb) error { + if enb.EnbType == entities.EnbType_UNKNOWN_ENB_TYPE { + return errors.New("enb.enbType") + } + + if enb.ServedCells == nil || len(enb.ServedCells) == 0 { + return errors.New("enb.servedCells") + } + + for _, servedCell := range enb.ServedCells { + err := isServedCellValid(servedCell) + + if err != nil { + return err + } + } + + return nil +} + +func isServedCellValid(servedCell *entities.ServedCellInfo) error { + + if servedCell.CellId == "" { + return errors.New("servedCell.cellId") + } + + if servedCell.EutraMode == entities.Eutra_UNKNOWN { + return errors.New("servedCell.eutraMode") + } + + if servedCell.Tac == "" { + return errors.New("servedCell.tac") + } + + if servedCell.BroadcastPlmns == nil || len(servedCell.BroadcastPlmns) == 0 { + return errors.New("servedCell.broadcastPlmns") + } + + if servedCell.ChoiceEutraMode == nil { + return errors.New("servedCell.choiceEutraMode") + } + + return isChoiceEutraModeValid(servedCell.ChoiceEutraMode) +} + +func isChoiceEutraModeValid(choiceEutraMode *entities.ChoiceEUTRAMode) error { + if choiceEutraMode.Fdd != nil { + return isFddInfoValid(choiceEutraMode.Fdd) + } + + if choiceEutraMode.Tdd != nil { + return isTddInfoValid(choiceEutraMode.Tdd) + } + + return errors.New("servedCell.fdd / servedCell.tdd") +} + +func isTddInfoValid(tdd *entities.TddInfo) error { + return nil +} + +func isFddInfoValid(fdd *entities.FddInfo) error { + return nil +} diff --git a/E2Manager/handlers/httpmsghandlers/delete_all_request_handler_test.go b/E2Manager/handlers/httpmsghandlers/delete_all_request_handler_test.go index 9cdcf04..bc5bba9 100644 --- a/E2Manager/handlers/httpmsghandlers/delete_all_request_handler_test.go +++ b/E2Manager/handlers/httpmsghandlers/delete_all_request_handler_test.go @@ -47,7 +47,7 @@ const BaseRMUrl = "http://10.10.2.15:12020/routingmanager" func setupDeleteAllRequestHandlerTest(t *testing.T) (*DeleteAllRequestHandler, *mocks.RnibReaderMock, *mocks.RnibWriterMock, *mocks.RmrMessengerMock, *mocks.HttpClientMock) { log := initLog(t) - config := &configuration.Configuration{StateChangeMessageChannel: "RAN_CONNECTION_STATUS_CHANGE"} + config := &configuration.Configuration{RnibWriter: configuration.RnibWriterConfig{ StateChangeMessageChannel: "RAN_CONNECTION_STATUS_CHANGE"}} config.BigRedButtonTimeoutSec = 1 config.RoutingManager.BaseUrl = BaseRMUrl diff --git a/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler_test.go b/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler_test.go index 199d7e1..1bbf66f 100644 --- a/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler_test.go +++ b/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler_test.go @@ -455,7 +455,9 @@ func TestE2SetupRequestNotificationHandler_ConvertTo20BitStringError(t *testing. config := &configuration.Configuration{ RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, - StateChangeMessageChannel: StateChangeMessageChannel, + RnibWriter: configuration.RnibWriterConfig{ + StateChangeMessageChannel: StateChangeMessageChannel, + }, GlobalRicId: struct { RicId string Mcc string @@ -522,7 +524,9 @@ func initMocks(t *testing.T) (*E2SetupRequestNotificationHandler, *mocks.RnibRea config := &configuration.Configuration{ RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, - StateChangeMessageChannel: StateChangeMessageChannel, + RnibWriter: configuration.RnibWriterConfig{ + StateChangeMessageChannel: StateChangeMessageChannel, + }, GlobalRicId: struct { RicId string Mcc string diff --git a/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go b/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go index 644ce7a..f3cfc49 100644 --- a/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go +++ b/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go @@ -44,7 +44,9 @@ func setupLostConnectionHandlerTest(isSuccessfulHttpPost bool) (*RanLostConnecti config := &configuration.Configuration{ RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, - StateChangeMessageChannel: StateChangeMessageChannel, + RnibWriter: configuration.RnibWriterConfig { + StateChangeMessageChannel: StateChangeMessageChannel, + }, } readerMock := &mocks.RnibReaderMock{} diff --git a/E2Manager/httpserver/http_server.go b/E2Manager/httpserver/http_server.go index 320acd0..10df4ee 100644 --- a/E2Manager/httpserver/http_server.go +++ b/E2Manager/httpserver/http_server.go @@ -29,7 +29,7 @@ import ( func Run(log *logger.Logger, port int, rootController controllers.IRootController, nodebController controllers.INodebController, e2tController controllers.IE2TController) error { - router := mux.NewRouter(); + router := mux.NewRouter() initializeRoutes(router, rootController, nodebController, e2tController) addr := fmt.Sprintf(":%d", port) @@ -47,6 +47,7 @@ func initializeRoutes(router *mux.Router, rootController controllers.IRootContro rr := r.PathPrefix("/nodeb").Subrouter() rr.HandleFunc("/ids", nodebController.GetNodebIdList).Methods(http.MethodGet) rr.HandleFunc("/{ranName}", nodebController.GetNodeb).Methods(http.MethodGet) + rr.HandleFunc("/enb", nodebController.AddEnb).Methods(http.MethodPost) rr.HandleFunc("/{ranName}/update", nodebController.UpdateGnb).Methods(http.MethodPut) rr.HandleFunc("/shutdown", nodebController.Shutdown).Methods(http.MethodPut) rr.HandleFunc("/parameters", nodebController.SetGeneralConfiguration).Methods(http.MethodPut) diff --git a/E2Manager/managers/e2t_association_manager_test.go b/E2Manager/managers/e2t_association_manager_test.go index 0e78b7d..1264769 100644 --- a/E2Manager/managers/e2t_association_manager_test.go +++ b/E2Manager/managers/e2t_association_manager_test.go @@ -45,7 +45,7 @@ const ( func initE2TAssociationManagerTest(t *testing.T) (*E2TAssociationManager, *mocks.RnibReaderMock, *mocks.RnibWriterMock, *mocks.HttpClientMock) { log := initLog(t) - config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, StateChangeMessageChannel: StateChangeMessageChannel} + config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, RnibWriter: configuration.RnibWriterConfig{ StateChangeMessageChannel: StateChangeMessageChannel}} readerMock := &mocks.RnibReaderMock{} writerMock := &mocks.RnibWriterMock{} diff --git a/E2Manager/managers/e2t_shutdown_manager_test.go b/E2Manager/managers/e2t_shutdown_manager_test.go index af3f2a0..0a1d00d 100644 --- a/E2Manager/managers/e2t_shutdown_manager_test.go +++ b/E2Manager/managers/e2t_shutdown_manager_test.go @@ -46,7 +46,7 @@ const E2TAddress3 = "10.10.2.17:9800" func initE2TShutdownManagerTest(t *testing.T) (*E2TShutdownManager, *mocks.RnibReaderMock, *mocks.RnibWriterMock, *mocks.HttpClientMock, *KubernetesManager) { log := initLog(t) - config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, E2TInstanceDeletionTimeoutMs: 15000, StateChangeMessageChannel: "RAN_CONNECTION_STATUS_CHANGE"} + config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, E2TInstanceDeletionTimeoutMs: 15000, RnibWriter: configuration.RnibWriterConfig{StateChangeMessageChannel: "RAN_CONNECTION_STATUS_CHANGE"}} readerMock := &mocks.RnibReaderMock{} writerMock := &mocks.RnibWriterMock{} @@ -58,7 +58,7 @@ func initE2TShutdownManagerTest(t *testing.T) (*E2TShutdownManager, *mocks.RnibR ranListManager := NewRanListManager(log) ranAlarmService := services.NewRanAlarmService(log, config) - ranConnectStatusChangeManager := NewRanConnectStatusChangeManager(log, rnibDataService,ranListManager, ranAlarmService) + ranConnectStatusChangeManager := NewRanConnectStatusChangeManager(log, rnibDataService, ranListManager, ranAlarmService) associationManager := NewE2TAssociationManager(log, rnibDataService, e2tInstancesManager, rmClient, ranConnectStatusChangeManager) //kubernetesManager := initKubernetesManagerTest(t) @@ -71,7 +71,7 @@ func initE2TShutdownManagerTest(t *testing.T) (*E2TShutdownManager, *mocks.RnibR } func TestShutdownSuccess1OutOf3Instances(t *testing.T) { - shutdownManager, readerMock, writerMock, httpClientMock,_ := initE2TShutdownManagerTest(t) + shutdownManager, readerMock, writerMock, httpClientMock, _ := initE2TShutdownManagerTest(t) e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName) e2tInstance1.State = entities.Active @@ -84,14 +84,14 @@ func TestShutdownSuccess1OutOf3Instances(t *testing.T) { e2tInstance3.AssociatedRanList = []string{"test4"} writerMock.On("SaveE2TInstance", mock.MatchedBy(func(e2tInstance *entities.E2TInstance) bool { return e2tInstance.Address == E2TAddress && e2tInstance.State == entities.ToBeDeleted })).Return(nil) - nodeb1 := &entities.NodebInfo{RanName:"test1", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb1 := &entities.NodebInfo{RanName: "test1", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test1").Return(nodeb1, nil) - nodeb2 := &entities.NodebInfo{RanName:"test2", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_SHUTTING_DOWN, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb2 := &entities.NodebInfo{RanName: "test2", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_SHUTTING_DOWN, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test2").Return(nodeb2, nil) - nodeb5 := &entities.NodebInfo{RanName:"test5", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb5 := &entities.NodebInfo{RanName: "test5", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test5").Return(nodeb5, nil) - e2tAddresses := []string{E2TAddress, E2TAddress2,E2TAddress3} + e2tAddresses := []string{E2TAddress, E2TAddress2, E2TAddress3} readerMock.On("GetE2TAddresses").Return(e2tAddresses, nil) data := models.NewRoutingManagerDeleteRequestModel(E2TAddress, e2tInstance1.AssociatedRanList, nil) @@ -101,7 +101,7 @@ func TestShutdownSuccess1OutOf3Instances(t *testing.T) { httpClientMock.On("Delete", "e2t", "application/json", body).Return(&http.Response{StatusCode: http.StatusCreated, Body: respBody}, nil) writerMock.On("RemoveE2TInstance", E2TAddress).Return(nil) - writerMock.On("SaveE2TAddresses", []string{E2TAddress2,E2TAddress3}).Return(nil) + writerMock.On("SaveE2TAddresses", []string{E2TAddress2, E2TAddress3}).Return(nil) /*** nodeb 1 ***/ nodeb1connected := *nodeb1 @@ -142,7 +142,7 @@ func TestShutdownSuccess1OutOf3Instances(t *testing.T) { } func TestShutdownSuccess1InstanceWithoutRans(t *testing.T) { - shutdownManager, readerMock, writerMock, httpClientMock,_ := initE2TShutdownManagerTest(t) + shutdownManager, readerMock, writerMock, httpClientMock, _ := initE2TShutdownManagerTest(t) e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName) e2tInstance1.State = entities.Active @@ -168,16 +168,16 @@ func TestShutdownSuccess1InstanceWithoutRans(t *testing.T) { } func TestShutdownSuccess1Instance2Rans(t *testing.T) { - shutdownManager, readerMock, writerMock, httpClientMock,_ := initE2TShutdownManagerTest(t) + shutdownManager, readerMock, writerMock, httpClientMock, _ := initE2TShutdownManagerTest(t) e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName) e2tInstance1.State = entities.Active e2tInstance1.AssociatedRanList = []string{"test1", "test2"} writerMock.On("SaveE2TInstance", mock.MatchedBy(func(e2tInstance *entities.E2TInstance) bool { return e2tInstance.Address == E2TAddress && e2tInstance.State == entities.ToBeDeleted })).Return(nil) - nodeb1 := &entities.NodebInfo{RanName:"test1", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb1 := &entities.NodebInfo{RanName: "test1", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test1").Return(nodeb1, nil) - nodeb2 := &entities.NodebInfo{RanName:"test2", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_DISCONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb2 := &entities.NodebInfo{RanName: "test2", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_DISCONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test2").Return(nodeb2, nil) data := models.NewRoutingManagerDeleteRequestModel(E2TAddress, []string{"test1", "test2"}, nil) @@ -219,7 +219,7 @@ func TestShutdownSuccess1Instance2Rans(t *testing.T) { } func TestShutdownE2tInstanceAlreadyBeingDeleted(t *testing.T) { - shutdownManager, readerMock, writerMock, httpClientMock,_ := initE2TShutdownManagerTest(t) + shutdownManager, readerMock, writerMock, httpClientMock, _ := initE2TShutdownManagerTest(t) e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName) e2tInstance1.State = entities.ToBeDeleted @@ -235,7 +235,7 @@ func TestShutdownE2tInstanceAlreadyBeingDeleted(t *testing.T) { } func TestShutdownFailureMarkInstanceAsToBeDeleted(t *testing.T) { - shutdownManager, readerMock, writerMock, httpClientMock,_ := initE2TShutdownManagerTest(t) + shutdownManager, readerMock, writerMock, httpClientMock, _ := initE2TShutdownManagerTest(t) e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName) e2tInstance1.State = entities.Active @@ -251,7 +251,7 @@ func TestShutdownFailureMarkInstanceAsToBeDeleted(t *testing.T) { } func TestShutdownFailureRoutingManagerError(t *testing.T) { - shutdownManager, readerMock, writerMock, httpClientMock,_ := initE2TShutdownManagerTest(t) + shutdownManager, readerMock, writerMock, httpClientMock, _ := initE2TShutdownManagerTest(t) e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName) e2tInstance1.State = entities.Active @@ -264,14 +264,14 @@ func TestShutdownFailureRoutingManagerError(t *testing.T) { e2tInstance3.AssociatedRanList = []string{"test4"} writerMock.On("SaveE2TInstance", mock.MatchedBy(func(e2tInstance *entities.E2TInstance) bool { return e2tInstance.Address == E2TAddress && e2tInstance.State == entities.ToBeDeleted })).Return(nil) - nodeb1 := &entities.NodebInfo{RanName:"test1", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb1 := &entities.NodebInfo{RanName: "test1", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test1").Return(nodeb1, nil) - nodeb2 := &entities.NodebInfo{RanName:"test2", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_SHUTTING_DOWN, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb2 := &entities.NodebInfo{RanName: "test2", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_SHUTTING_DOWN, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test2").Return(nodeb2, nil) - nodeb5 := &entities.NodebInfo{RanName:"test5", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb5 := &entities.NodebInfo{RanName: "test5", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test5").Return(nodeb5, nil) - e2tAddresses := []string{E2TAddress, E2TAddress2,E2TAddress3} + e2tAddresses := []string{E2TAddress, E2TAddress2, E2TAddress3} readerMock.On("GetE2TAddresses").Return(e2tAddresses, nil) data := models.NewRoutingManagerDeleteRequestModel(E2TAddress, e2tInstance1.AssociatedRanList, nil) @@ -281,7 +281,7 @@ func TestShutdownFailureRoutingManagerError(t *testing.T) { httpClientMock.On("Delete", "e2t", "application/json", body).Return(&http.Response{StatusCode: http.StatusBadRequest, Body: respBody}, nil) writerMock.On("RemoveE2TInstance", E2TAddress).Return(nil) - writerMock.On("SaveE2TAddresses", []string{E2TAddress2,E2TAddress3}).Return(nil) + writerMock.On("SaveE2TAddresses", []string{E2TAddress2, E2TAddress3}).Return(nil) /*** nodeb 1 connected ***/ nodeb1connected := *nodeb1 @@ -322,14 +322,14 @@ func TestShutdownFailureRoutingManagerError(t *testing.T) { } func TestShutdownFailureInClearNodebsAssociation(t *testing.T) { - shutdownManager, readerMock, writerMock, httpClientMock,_ := initE2TShutdownManagerTest(t) + shutdownManager, readerMock, writerMock, httpClientMock, _ := initE2TShutdownManagerTest(t) e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName) e2tInstance1.State = entities.Active e2tInstance1.AssociatedRanList = []string{"test1", "test2"} writerMock.On("SaveE2TInstance", mock.MatchedBy(func(e2tInstance *entities.E2TInstance) bool { return e2tInstance.Address == E2TAddress && e2tInstance.State == entities.ToBeDeleted })).Return(nil) - nodeb1 := &entities.NodebInfo{RanName:"test1", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb1 := &entities.NodebInfo{RanName: "test1", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test1").Return(nodeb1, nil) nodeb1new := *nodeb1 @@ -350,14 +350,14 @@ func TestShutdownFailureInClearNodebsAssociation(t *testing.T) { } func TestShutdownFailureInClearNodebsAssociation_UpdateConnectionStatus(t *testing.T) { - shutdownManager, readerMock, writerMock, httpClientMock,_ := initE2TShutdownManagerTest(t) + shutdownManager, readerMock, writerMock, httpClientMock, _ := initE2TShutdownManagerTest(t) e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName) e2tInstance1.State = entities.Active e2tInstance1.AssociatedRanList = []string{"test1", "test2"} writerMock.On("SaveE2TInstance", mock.MatchedBy(func(e2tInstance *entities.E2TInstance) bool { return e2tInstance.Address == E2TAddress && e2tInstance.State == entities.ToBeDeleted })).Return(nil) - nodeb1 := &entities.NodebInfo{RanName:"test1", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb1 := &entities.NodebInfo{RanName: "test1", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test1").Return(nodeb1, nil) nodeb1new := *nodeb1 @@ -373,14 +373,14 @@ func TestShutdownFailureInClearNodebsAssociation_UpdateConnectionStatus(t *testi } func TestShutdownResourceNotFoundErrorInGetNodeb(t *testing.T) { - shutdownManager, readerMock, writerMock, httpClientMock,_ := initE2TShutdownManagerTest(t) + shutdownManager, readerMock, writerMock, httpClientMock, _ := initE2TShutdownManagerTest(t) e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName) e2tInstance1.State = entities.Active e2tInstance1.AssociatedRanList = []string{"test1", "test2"} writerMock.On("SaveE2TInstance", mock.MatchedBy(func(e2tInstance *entities.E2TInstance) bool { return e2tInstance.Address == E2TAddress && e2tInstance.State == entities.ToBeDeleted })).Return(nil) - nodeb1 := &entities.NodebInfo{RanName:"test1", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb1 := &entities.NodebInfo{RanName: "test1", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test1").Return(nodeb1, nil) var nodeb2 *entities.NodebInfo readerMock.On("GetNodeb", "test2").Return(nodeb2, common.NewResourceNotFoundError("for testing")) @@ -403,7 +403,7 @@ func TestShutdownResourceNotFoundErrorInGetNodeb(t *testing.T) { } func TestShutdownResourceGeneralErrorInGetNodeb(t *testing.T) { - shutdownManager, readerMock, writerMock, httpClientMock,_ := initE2TShutdownManagerTest(t) + shutdownManager, readerMock, writerMock, httpClientMock, _ := initE2TShutdownManagerTest(t) e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName) e2tInstance1.State = entities.Active @@ -412,7 +412,7 @@ func TestShutdownResourceGeneralErrorInGetNodeb(t *testing.T) { var nodeb1 *entities.NodebInfo readerMock.On("GetNodeb", "test1").Return(nodeb1, common.NewInternalError(fmt.Errorf("for testing"))) - nodeb2 := &entities.NodebInfo{RanName:"test2", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_DISCONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb2 := &entities.NodebInfo{RanName: "test2", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_DISCONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test2").Return(nodeb2, nil) data := models.NewRoutingManagerDeleteRequestModel(E2TAddress, []string{"test1", "test2"}, nil) @@ -444,7 +444,7 @@ func TestShutdownResourceGeneralErrorInGetNodeb(t *testing.T) { } func TestShutdownFailureInRemoveE2TInstance(t *testing.T) { - shutdownManager, readerMock, writerMock, httpClientMock,_ := initE2TShutdownManagerTest(t) + shutdownManager, readerMock, writerMock, httpClientMock, _ := initE2TShutdownManagerTest(t) e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName) e2tInstance1.State = entities.Active @@ -457,11 +457,11 @@ func TestShutdownFailureInRemoveE2TInstance(t *testing.T) { e2tInstance3.AssociatedRanList = []string{"test4"} writerMock.On("SaveE2TInstance", mock.MatchedBy(func(e2tInstance *entities.E2TInstance) bool { return e2tInstance.Address == E2TAddress && e2tInstance.State == entities.ToBeDeleted })).Return(nil) - nodeb1 := &entities.NodebInfo{RanName:"test1", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb1 := &entities.NodebInfo{RanName: "test1", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test1").Return(nodeb1, nil) - nodeb2 := &entities.NodebInfo{RanName:"test2", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_SHUTTING_DOWN, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb2 := &entities.NodebInfo{RanName: "test2", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_SHUTTING_DOWN, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test2").Return(nodeb2, nil) - nodeb5 := &entities.NodebInfo{RanName:"test5", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST} + nodeb5 := &entities.NodebInfo{RanName: "test5", AssociatedE2TInstanceAddress: E2TAddress, ConnectionStatus: entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol: entities.E2ApplicationProtocol_X2_SETUP_REQUEST} readerMock.On("GetNodeb", "test5").Return(nodeb5, nil) data := models.NewRoutingManagerDeleteRequestModel(E2TAddress, e2tInstance1.AssociatedRanList, nil) @@ -508,4 +508,4 @@ func TestShutdownFailureInRemoveE2TInstance(t *testing.T) { readerMock.AssertExpectations(t) writerMock.AssertExpectations(t) httpClientMock.AssertExpectations(t) -} \ No newline at end of file +} diff --git a/E2Manager/managers/ran_connect_status_change_manager_test.go b/E2Manager/managers/ran_connect_status_change_manager_test.go index b9295e3..33e611e 100644 --- a/E2Manager/managers/ran_connect_status_change_manager_test.go +++ b/E2Manager/managers/ran_connect_status_change_manager_test.go @@ -38,7 +38,11 @@ func initRanConnectStatusChangeManagerTest(t *testing.T) (*mocks.RnibWriterMock, if err != nil { t.Errorf("#... - failed to initialize log, error: %s", err) } - config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, StateChangeMessageChannel: EventChannelForTest} + config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, + RnibWriter: configuration.RnibWriterConfig{ + StateChangeMessageChannel: EventChannelForTest, + }, + } readerMock := &mocks.RnibReaderMock{} writerMock := &mocks.RnibWriterMock{} @@ -55,7 +59,7 @@ func TestChangeStatusSuccessNewRan(t *testing.T) { origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_UNKNOWN_CONNECTION_STATUS} updatedNodebInfo := *origNodebInfo updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED - writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil) + writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName+"_"+CONNECTED_RAW_EVENT).Return(nil) ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil) ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(nil) err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED) @@ -101,7 +105,7 @@ func TestChangeStatusSuccessEventConnected(t *testing.T) { origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_DISCONNECTED} updatedNodebInfo := *origNodebInfo updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED - writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil) + writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName+"_"+CONNECTED_RAW_EVENT).Return(nil) ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil) ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(nil) err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED) @@ -117,7 +121,7 @@ func TestChangeStatusSuccessEventDisconnected(t *testing.T) { origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_CONNECTED} updatedNodebInfo := *origNodebInfo updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED - writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + DISCONNECTED_RAW_EVENT).Return(nil) + writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName+"_"+DISCONNECTED_RAW_EVENT).Return(nil) ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil) ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(nil) err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_DISCONNECTED) @@ -147,7 +151,7 @@ func TestChangeStatusRnibErrorEventConnected(t *testing.T) { origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_DISCONNECTED} updatedNodebInfo := *origNodebInfo updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED - writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(common.NewInternalError(errors.New("Error"))) + writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName+"_"+CONNECTED_RAW_EVENT).Return(common.NewInternalError(errors.New("Error"))) err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED) assert.NotNil(t, err) writerMock.AssertExpectations(t) @@ -176,7 +180,7 @@ func TestChangeStatusRanAlarmServiceErrorEventConnected(t *testing.T) { origNodebInfo := &entities.NodebInfo{RanName: ranName, ConnectionStatus: entities.ConnectionStatus_DISCONNECTED} updatedNodebInfo := *origNodebInfo updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED - writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil) + writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName+"_"+CONNECTED_RAW_EVENT).Return(nil) ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil) ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(common.NewInternalError(errors.New("Error"))) err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED) @@ -184,4 +188,4 @@ func TestChangeStatusRanAlarmServiceErrorEventConnected(t *testing.T) { writerMock.AssertExpectations(t) ranListManagerMock.AssertExpectations(t) ranAlarmServiceMock.AssertExpectations(t) -} \ No newline at end of file +} diff --git a/E2Manager/mocks/nodeb_controller_mock.go b/E2Manager/mocks/nodeb_controller_mock.go index 11130b3..31499ef 100644 --- a/E2Manager/mocks/nodeb_controller_mock.go +++ b/E2Manager/mocks/nodeb_controller_mock.go @@ -61,24 +61,16 @@ func (c *NodebControllerMock) X2Reset(writer http.ResponseWriter, r *http.Reques c.Called() } -func (c *NodebControllerMock) X2Setup(writer http.ResponseWriter, r *http.Request) { - writer.Header().Set("Content-Type", "application/json") - writer.WriteHeader(http.StatusOK) - - c.Called() -} - -func (c *NodebControllerMock) EndcSetup(writer http.ResponseWriter, r *http.Request) { +func (c *NodebControllerMock) UpdateGnb(writer http.ResponseWriter, r *http.Request) { writer.Header().Set("Content-Type", "application/json") writer.WriteHeader(http.StatusOK) c.Called() } -func (c *NodebControllerMock) UpdateGnb(writer http.ResponseWriter, r *http.Request) { +func (c *NodebControllerMock) AddEnb(writer http.ResponseWriter, r *http.Request) { writer.Header().Set("Content-Type", "application/json") writer.WriteHeader(http.StatusOK) - c.Called() } @@ -87,4 +79,4 @@ func (c *NodebControllerMock) SetGeneralConfiguration(writer http.ResponseWriter writer.WriteHeader(http.StatusOK) c.Called() -} \ No newline at end of file +} diff --git a/E2Manager/models/add_enb_request.go b/E2Manager/models/add_enb_request.go new file mode 100644 index 0000000..a15c94b --- /dev/null +++ b/E2Manager/models/add_enb_request.go @@ -0,0 +1,74 @@ +// +// 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 models + +import ( + "encoding/json" + "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" + "github.com/golang/protobuf/jsonpb" +) + +type AddEnbRawRequest struct { + RanName string + GlobalNbId json.RawMessage + Ip string + Port uint32 + Enb json.RawMessage +} + +type AddEnbRequest struct { + RanName string + GlobalNbId *entities.GlobalNbId + Ip string + Port uint32 + Enb *entities.Enb +} + +func (r *AddEnbRequest) UnmarshalJSON(data []byte) error { + addEnbRawRequest := AddEnbRawRequest{} + err := json.Unmarshal(data, &addEnbRawRequest) + + if err != nil { + return err + } + + r.RanName = addEnbRawRequest.RanName + r.Ip = addEnbRawRequest.Ip + r.Port = addEnbRawRequest.Port + + globalNbId := entities.GlobalNbId{} + err = jsonpb.UnmarshalString(string(addEnbRawRequest.GlobalNbId), &globalNbId) + + if err != nil { + return err + } + + r.GlobalNbId = &globalNbId + + enb := entities.Enb{} + err = jsonpb.UnmarshalString(string(addEnbRawRequest.Enb), &enb) + + if err != nil { + return err + } + + r.Enb = &enb + return nil +} \ No newline at end of file diff --git a/E2Manager/models/add_enb_response.go b/E2Manager/models/add_enb_response.go new file mode 100644 index 0000000..656d60e --- /dev/null +++ b/E2Manager/models/add_enb_response.go @@ -0,0 +1,47 @@ +// +// 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 models + +import ( + "e2mgr/e2managererrors" + "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" + "github.com/golang/protobuf/jsonpb" +) + +type AddEnbResponse struct { + nodebInfo *entities.NodebInfo +} + +func NewAddEnbResponse(nodebInfo *entities.NodebInfo) *AddEnbResponse { + return &AddEnbResponse{ + nodebInfo: nodebInfo, + } +} + +func (response *AddEnbResponse) Marshal() ([]byte, error) { + m := jsonpb.Marshaler{} + result, err := m.MarshalToString(response.nodebInfo) + + if err != nil { + return nil, e2managererrors.NewInternalError() + } + + return []byte(result), nil +} diff --git a/E2Manager/models/update_gnb_response.go b/E2Manager/models/update_gnb_response.go index 59131e5..949eb76 100644 --- a/E2Manager/models/update_gnb_response.go +++ b/E2Manager/models/update_gnb_response.go @@ -44,5 +44,4 @@ func (response *UpdateGnbResponse) Marshal() ([]byte, error) { } return []byte(result), nil - } diff --git a/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider.go b/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider.go index cb4ed18..07aa8e4 100644 --- a/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider.go +++ b/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider.go @@ -40,6 +40,7 @@ const ( GetNodebIdListRequest IncomingRequest = "GetNodebIdListRequest" GetE2TInstancesRequest IncomingRequest = "GetE2TInstancesRequest" UpdateGnbRequest IncomingRequest = "UpdateGnbRequest" + AddEnbRequest IncomingRequest = "AddEnbRequest" ) type IncomingRequestHandlerProvider struct { @@ -67,6 +68,7 @@ func initRequestHandlerMap(logger *logger.Logger, rmrSender *rmrsender.RmrSender GetNodebIdListRequest: httpmsghandlers.NewGetNodebIdListRequestHandler(logger, rNibDataService), GetE2TInstancesRequest: httpmsghandlers.NewGetE2TInstancesRequestHandler(logger, e2tInstancesManager), UpdateGnbRequest: httpmsghandlers.NewUpdateGnbRequestHandler(logger, rNibDataService), + AddEnbRequest: httpmsghandlers.NewAddEnbRequestHandler(logger, rNibDataService), } } diff --git a/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider_test.go b/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider_test.go index 4be6e4f..d6795a0 100644 --- a/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider_test.go +++ b/E2Manager/providers/httpmsghandlerprovider/incoming_request_handler_provider_test.go @@ -46,7 +46,7 @@ func getRmrSender(rmrMessengerMock *mocks.RmrMessengerMock, log *logger.Logger) func setupTest(t *testing.T) *IncomingRequestHandlerProvider { rmrMessengerMock := &mocks.RmrMessengerMock{} log := initLog(t) - config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3} + config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, RnibWriter: configuration.RnibWriterConfig{StateChangeMessageChannel: "RAN_CONNECTION_STATUS_CHANGE", RanManipulationMessageChannel: "RAN_MANIPULATION"}} config.RoutingManager.BaseUrl = "http://10.10.2.15:12020/routingmanager" readerMock := &mocks.RnibReaderMock{} writerMock := &mocks.RnibWriterMock{} diff --git a/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider_test.go b/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider_test.go index 0f22280..a1410e9 100644 --- a/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider_test.go +++ b/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider_test.go @@ -43,7 +43,7 @@ import ( func initTestCase(t *testing.T) (*logger.Logger, *configuration.Configuration, services.RNibDataService, *rmrsender.RmrSender, managers.IE2TInstancesManager, clients.IRoutingManagerClient, *managers.E2TAssociationManager, managers.IRanConnectStatusChangeManager) { logger := initLog(t) - config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3} + config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, RnibWriter: configuration.RnibWriterConfig{StateChangeMessageChannel: "RAN_CONNECTION_STATUS_CHANGE", RanManipulationMessageChannel: "RAN_MANIPULATION"}} readerMock := &mocks.RnibReaderMock{} writerMock := &mocks.RnibWriterMock{} diff --git a/E2Manager/rNibWriter/rNibWriter.go b/E2Manager/rNibWriter/rNibWriter.go index 3186d70..71913bf 100644 --- a/E2Manager/rNibWriter/rNibWriter.go +++ b/E2Manager/rNibWriter/rNibWriter.go @@ -20,6 +20,7 @@ package rNibWriter import ( + "e2mgr/configuration" "encoding/json" "fmt" "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common" @@ -27,10 +28,16 @@ import ( "github.com/golang/protobuf/proto" ) -const E2TAddressesKey = "E2TAddresses" +const ( + E2TAddressesKey = "E2TAddresses" + RanAddedEvent = "ADDED" + RanUpdatedEvent = "UPDATED" + RanDeletedEvent = "DELETED" +) type rNibWriterInstance struct { - sdl common.ISdlInstance + sdl common.ISdlInstance + rnibWriterConfig configuration.RnibWriterConfig } /* @@ -53,11 +60,10 @@ type RNibWriter interface { GetRNibWriter returns reference to RNibWriter */ -func GetRNibWriter(sdl common.ISdlInstance) RNibWriter { - return &rNibWriterInstance{sdl: sdl} +func GetRNibWriter(sdl common.ISdlInstance, rnibWriterConfig configuration.RnibWriterConfig) RNibWriter { + return &rNibWriterInstance{sdl: sdl, rnibWriterConfig: rnibWriterConfig} } - func (w *rNibWriterInstance) RemoveServedNrCells(inventoryName string, servedNrCells []*entities.ServedNRCell) error { cellKeysToRemove := buildCellKeysToRemove(inventoryName, servedNrCells) err := w.sdl.Remove(cellKeysToRemove) @@ -86,22 +92,30 @@ SaveNodeb saves nodeB entity data in the redis DB according to the specified dat func (w *rNibWriterInstance) SaveNodeb(nbIdentity *entities.NbIdentity, entity *entities.NodebInfo) error { isNotEmptyIdentity := isNotEmpty(nbIdentity) - if isNotEmptyIdentity && entity.GetNodeType() == entities.Node_UNKNOWN { + nodeType := entity.GetNodeType() + + if isNotEmptyIdentity && nodeType == entities.Node_UNKNOWN { return common.NewValidationError(fmt.Sprintf("#rNibWriter.saveNodeB - Unknown responding node type, entity: %v", entity)) } + data, err := proto.Marshal(entity) + if err != nil { return common.NewInternalError(err) } + var pairs []interface{} key, rNibErr := common.ValidateAndBuildNodeBNameKey(nbIdentity.InventoryName) + if rNibErr != nil { return rNibErr } + pairs = append(pairs, key, data) if isNotEmptyIdentity { - key, rNibErr = common.ValidateAndBuildNodeBIdKey(entity.GetNodeType().String(), nbIdentity.GlobalNbId.GetPlmnId(), nbIdentity.GlobalNbId.GetNbId()) + + key, rNibErr = common.ValidateAndBuildNodeBIdKey(nodeType.String(), nbIdentity.GlobalNbId.GetPlmnId(), nbIdentity.GlobalNbId.GetNbId()) if rNibErr != nil { return rNibErr } @@ -114,13 +128,20 @@ func (w *rNibWriterInstance) SaveNodeb(nbIdentity *entities.NbIdentity, entity * return rNibErr } } + if entity.GetGnb() != nil { pairs, rNibErr = appendGnbCells(nbIdentity.InventoryName, entity.GetGnb().GetServedNrCells(), pairs) if rNibErr != nil { return rNibErr } } - err = w.sdl.Set(pairs) + + if nodeType == entities.Node_ENB { + err = w.sdl.SetAndPublish([]string{w.rnibWriterConfig.RanManipulationMessageChannel, fmt.Sprintf("%s_%s", entity.RanName, RanAddedEvent)}, pairs) + } else { + err = w.sdl.Set(pairs) + } + if err != nil { return common.NewInternalError(err) } @@ -141,10 +162,13 @@ func (w *rNibWriterInstance) SaveNodeb(nbIdentity *entities.NbIdentity, entity * } nbIdData, err := proto.Marshal(nbIdentity) + if err != nil { return common.NewInternalError(err) } - err = w.sdl.AddMember(entity.GetNodeType().String(), nbIdData) + + err = w.sdl.AddMember(nodeType.String(), nbIdData) + if err != nil { return common.NewInternalError(err) } @@ -419,4 +443,4 @@ func appendGnbCells(inventoryName string, cells []*entities.ServedNRCell, pairs func isNotEmpty(nbIdentity *entities.NbIdentity) bool { return nbIdentity.GlobalNbId != nil && nbIdentity.GlobalNbId.PlmnId != "" && nbIdentity.GlobalNbId.NbId != "" -} \ No newline at end of file +} diff --git a/E2Manager/rNibWriter/rNibWriter_test.go b/E2Manager/rNibWriter/rNibWriter_test.go index ec21c3f..618eb4b 100644 --- a/E2Manager/rNibWriter/rNibWriter_test.go +++ b/E2Manager/rNibWriter/rNibWriter_test.go @@ -20,6 +20,7 @@ package rNibWriter import ( + "e2mgr/configuration" "e2mgr/mocks" "encoding/json" "errors" @@ -33,13 +34,14 @@ import ( ) var namespace = "namespace" + const ( RanName = "test" ) func initSdlInstanceMock(namespace string) (w RNibWriter, sdlInstanceMock *mocks.MockSdlInstance) { sdlInstanceMock = new(mocks.MockSdlInstance) - w = GetRNibWriter(sdlInstanceMock) + w = GetRNibWriter(sdlInstanceMock, configuration.RnibWriterConfig{StateChangeMessageChannel: "RAN_CONNECTION_STATUS_CHANGE", RanManipulationMessageChannel: "RAN_MANIPULATION"}) return } @@ -256,6 +258,7 @@ func TestSaveEnb(t *testing.T) { ranName := "RAN:" + name w, sdlInstanceMock := initSdlInstanceMock(namespace) nb := entities.NodebInfo{} + nb.RanName = name nb.NodeType = entities.Node_ENB nb.ConnectionStatus = 1 nb.Ip = "localhost" @@ -281,7 +284,7 @@ func TestSaveEnb(t *testing.T) { setExpected = append(setExpected, fmt.Sprintf("CELL:%s", cell.GetCellId()), cellData) setExpected = append(setExpected, fmt.Sprintf("PCI:%s:%02x", name, cell.GetPci()), cellData) - sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e) + sdlInstanceMock.On("SetAndPublish", []string{"RAN_MANIPULATION", name + "_" + RanAddedEvent}, []interface{}{setExpected}).Return(e) nbIdData, err := proto.Marshal(&entities.NbIdentity{InventoryName: name}) if err != nil { @@ -748,7 +751,7 @@ func TestUpdateNodebInfoOnConnectionStatusInversionSuccess(t *testing.T) { nbId := "4a952a0a" channelName := "RAN_CONNECT_STATE_CHANGE" eventName := inventoryName + "_" + "CONNECTED" - w, sdlInstanceMock := initSdlInstanceMock(namespace) + w, sdlInstanceMock := initSdlInstanceMock(namespace) nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId) data, err := proto.Marshal(nodebInfo) if err != nil { @@ -827,7 +830,7 @@ func TestSaveGeneralConfiguration(t *testing.T) { configuration := &entities.GeneralConfiguration{} configuration.EnableRic = true - sdlInstanceMock.On("Set",[]interface{}{[]interface{}{key, []byte(configurationData)}}).Return(nil) + sdlInstanceMock.On("Set", []interface{}{[]interface{}{key, []byte(configurationData)}}).Return(nil) rNibErr := w.SaveGeneralConfiguration(configuration) assert.Nil(t, rNibErr) @@ -844,7 +847,7 @@ func TestSaveGeneralConfigurationDbError(t *testing.T) { expectedErr := errors.New("expected error") - sdlInstanceMock.On("Set",[]interface{}{[]interface{}{key, []byte(configurationData)}}).Return(expectedErr) + sdlInstanceMock.On("Set", []interface{}{[]interface{}{key, []byte(configurationData)}}).Return(expectedErr) rNibErr := w.SaveGeneralConfiguration(configuration) assert.NotNil(t, rNibErr) diff --git a/E2Manager/resources/configuration.yaml b/E2Manager/resources/configuration.yaml index 6beba8f..468b6d2 100644 --- a/E2Manager/resources/configuration.yaml +++ b/E2Manager/resources/configuration.yaml @@ -6,7 +6,7 @@ rmr: port: 3801 maxMsgSize: 65536 routingManager: - baseUrl: http://10.0.2.15:12020/ric/v1/handles/ + baseUrl: http://10.0.2.15:31000/ric/v1/handles/ notificationResponseBuffer: 100 bigRedButtonTimeoutSec: 5 maxRnibConnectionAttempts: 3 @@ -18,4 +18,6 @@ globalRicId: ricId: "AACCE" mcc: "310" mnc: "411" -stateChangeMessageChannel: RAN_CONNECTION_STATUS_CHANGE \ No newline at end of file +rnibWriter: + stateChangeMessageChannel: RAN_CONNECTION_STATUS_CHANGE + ranManipulationMessageChannel: RAN_MANIPULATION \ No newline at end of file diff --git a/E2Manager/router.txt b/E2Manager/router.txt index 6f54f44..b8f7ed3 100644 --- a/E2Manager/router.txt +++ b/E2Manager/router.txt @@ -1,8 +1,8 @@ newrt|start -rte|10060|10.0.2.15:38000 -rte|10360|10.0.2.15:38000 -rte|10070|10.0.2.15:38000 -rte|10071|10.0.2.15:38000 +rte|10060|10.0.2.15:30500 +rte|10360|10.0.2.15:30500 +rte|10070|10.0.2.15:30500 +rte|10071|10.0.2.15:30500 rte|10061|10.0.2.15:3801 rte|10361|10.0.2.15:3801 rte|10062|10.0.2.15:3801 @@ -10,19 +10,16 @@ rte|10362|10.0.2.15:3801 rte|1080|10.0.2.15:3801 rte|10020|10.0.2.15:3801 rte|10370|10.0.2.15:3801 -rte|10371|10.0.2.15:38000 -rte|10372|10.0.2.15:38000 +rte|10371|10.0.2.15:30500 +rte|10372|10.0.2.15:30500 rte|10080|10.0.2.15:3801 -rte|10081|10.0.2.15:38000 -rte|10082|10.0.2.15:38000 -rte|1090|10.0.2.15:38000 -rte|1200|10.0.2.15:4801 -rte|1210|10.0.2.15:4801 -rte|1220|10.0.2.15:4801 -rte|10090|10.0.2.15:38000 -rte|1101|10.0.2.15:38000 -rte|12002|10.0.2.15:38000 -rte|12003|10.0.2.15:38000 -mse|12002,10.0.2.15:38000|-1|gnb:208-092-303030 -mse|12003,10.0.2.15:38000|-1|gnb:208-092-303030 +rte|10081|10.0.2.15:30500 +rte|10082|10.0.2.15:30500 +rte|1090|10.0.2.15:30500 +rte|10090|10.0.2.15:30500 +rte|1101|10.0.2.15:30500 +rte|12002|10.0.2.15:30500 +rte|12003|10.0.2.15:30500 +mse|12002,10.0.2.15:30500|-1|gnb:208-092-303030 +mse|12003,10.0.2.15:30500|-1|gnb:208-092-303030 newrt|end diff --git a/E2Manager/services/rnib_data_service.go b/E2Manager/services/rnib_data_service.go index 5e3df8d..902466d 100644 --- a/E2Manager/services/rnib_data_service.go +++ b/E2Manager/services/rnib_data_service.go @@ -55,22 +55,22 @@ type RNibDataService interface { } type rNibDataService struct { - logger *logger.Logger - rnibReader reader.RNibReader - rnibWriter rNibWriter.RNibWriter - maxAttempts int - retryInterval time.Duration - stateChangeMessageChannel string + logger *logger.Logger + rnibReader reader.RNibReader + rnibWriter rNibWriter.RNibWriter + maxAttempts int + retryInterval time.Duration + rnibWriterConfig configuration.RnibWriterConfig } func NewRnibDataService(logger *logger.Logger, config *configuration.Configuration, rnibReader reader.RNibReader, rnibWriter rNibWriter.RNibWriter) *rNibDataService { return &rNibDataService{ - logger: logger, - rnibReader: rnibReader, - rnibWriter: rnibWriter, - maxAttempts: config.MaxRnibConnectionAttempts, - retryInterval: time.Duration(config.RnibRetryIntervalMs) * time.Millisecond, - stateChangeMessageChannel: config.StateChangeMessageChannel, + logger: logger, + rnibReader: rnibReader, + rnibWriter: rnibWriter, + maxAttempts: config.MaxRnibConnectionAttempts, + retryInterval: time.Duration(config.RnibRetryIntervalMs) * time.Millisecond, + rnibWriterConfig: config.RnibWriter, } } @@ -304,10 +304,10 @@ func (w *rNibDataService) PingRnib() bool { } func (w *rNibDataService) UpdateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, event string) error { - w.logger.Infof("#RnibDataService.UpdateNodebInfoOnConnectionStatusInversion - stateChangeMessageChannel: %s, event: %s, nodebInfo: %s", w.stateChangeMessageChannel, event, nodebInfo) + w.logger.Infof("#RnibDataService.UpdateNodebInfoOnConnectionStatusInversion - stateChangeMessageChannel: %s, event: %s, nodebInfo: %s", w.rnibWriterConfig.StateChangeMessageChannel, event, nodebInfo) err := w.retry("UpdateNodebInfoOnConnectionStatusInversion", func() (err error) { - err = w.rnibWriter.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, w.stateChangeMessageChannel, event) + err = w.rnibWriter.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, w.rnibWriterConfig.StateChangeMessageChannel, event) return }) diff --git a/E2Manager/services/rnib_data_service_test.go b/E2Manager/services/rnib_data_service_test.go index f6529e3..ddc6540 100644 --- a/E2Manager/services/rnib_data_service_test.go +++ b/E2Manager/services/rnib_data_service_test.go @@ -33,8 +33,6 @@ import ( "testing" ) -const CHANNEL_NAME = "channel" - func setupRnibDataServiceTest(t *testing.T) (*rNibDataService, *mocks.RnibReaderMock, *mocks.RnibWriterMock) { return setupRnibDataServiceTestWithMaxAttempts(t, 3) } @@ -45,7 +43,7 @@ func setupRnibDataServiceTestWithMaxAttempts(t *testing.T, maxAttempts int) (*rN t.Errorf("#... - failed to initialize logger, error: %s", err) } - config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: maxAttempts, StateChangeMessageChannel: CHANNEL_NAME} + config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: maxAttempts, RnibWriter: configuration.RnibWriterConfig{RanManipulationMessageChannel: "RAN_MANIPULATION", StateChangeMessageChannel: "RAN_CONNECTION_STATUS_CHANGE"}} readerMock := &mocks.RnibReaderMock{} @@ -264,7 +262,7 @@ func TestSuccessfulUpdateNodebInfoOnConnectionStatusInversion(t *testing.T) { event := "event" nodebInfo := &entities.NodebInfo{} - writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", nodebInfo, CHANNEL_NAME, event).Return(nil) + writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", nodebInfo, "RAN_CONNECTION_STATUS_CHANGE", event).Return(nil) rnibDataService.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, event) writerMock.AssertNumberOfCalls(t, "UpdateNodebInfoOnConnectionStatusInversion", 1) @@ -276,7 +274,7 @@ func TestConnFailureUpdateNodebInfoOnConnectionStatusInversion(t *testing.T) { nodebInfo := &entities.NodebInfo{} mockErr := &common.InternalError{Err: &net.OpError{Err: fmt.Errorf("connection error")}} - writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", nodebInfo, CHANNEL_NAME, event).Return(mockErr) + writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", nodebInfo, "RAN_CONNECTION_STATUS_CHANGE", event).Return(mockErr) rnibDataService.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, event) writerMock.AssertNumberOfCalls(t, "UpdateNodebInfoOnConnectionStatusInversion", 3) diff --git a/tools/cm_e2mgr_ide/e2t_env.yaml b/tools/cm_e2mgr_ide/e2t_env.yaml new file mode 100644 index 0000000..62509dc --- /dev/null +++ b/tools/cm_e2mgr_ide/e2t_env.yaml @@ -0,0 +1,30 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 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. # +################################################################################ + +apiVersion: v1 +kind: ConfigMap +metadata: + name: configmap-ricplt-e2term-env-alpha +data: + RMR_SRC_ID: service-ricplt-e2term-rmr-alpha.ricplt + SERVICE_RICPLT_E2TERM_RMR_ALPHA_SERVICE_HOST: "10.0.2.15" + RMR_RTG_SVC: "4561" + RMR_VCTL_FILE: "/tmp/rmr_verbose" + sctp: "36422" + nano: "30500" + print: "1" + volume: /data/outgoing/ diff --git a/tools/cm_e2mgr_ide/rtmgr_config.yaml b/tools/cm_e2mgr_ide/rtmgr_config.yaml new file mode 100644 index 0000000..148a34c --- /dev/null +++ b/tools/cm_e2mgr_ide/rtmgr_config.yaml @@ -0,0 +1,116 @@ +# +#================================================================================== +# Copyright (c) 2019 AT&T Intellectual Property. +# Copyright (c) 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. +#================================================================================== +# +# +# Abstract: Configuration values for the routing manager +# Date: 29 May 2019 +# +apiVersion: v1 +kind: ConfigMap +metadata: + name: configmap-ricplt-rtmgr-rtmgrcfg +data: + # FQDN and port info of the platform components for routing manager to form + # and distribute corresponding routes to them + rtmgrcfg: | + "PlatformComponents": + - + "name": "SUBMAN" + "fqdn": "service-ricplt-submgr-rmr.ricplt" + "port": 4560 + - + "name": "E2MAN" + "fqdn": "10.0.2.15" + "port": 3801 + - + "name": "RSM" + "fqdn": "service-ricplt-rsm-rmr.ricplt" + "port": 4801 + - + "name": "A1MEDIATOR" + "fqdn": "service-ricplt-a1mediator-rmr.ricplt" + "port": 4562 + "XMURL": + "http://service-ricplt-appmgr-http:8080/ric/v1/xapps" + "E2MURL": + "http://10.0.2.15:3800/v1/e2t/list" + "RTFILE": + "/db/rt.json" + "CFGFILE": + "/cfg/rtmgr-config.yaml" + "RPE": + "rmrpush" + "SBI": + "nngpush" + "SBIURL": + "0.0.0.0" + "NBI": + "httpRESTful" + "NBIURL": + "http://10.0.2.15:31000" + "SDL": + "file" + "local": + "host": ":8080" + "logger": + "level": 4 + "rmr": + "protPort": "tcp:31500" + "maxSize": 4096 + "numWorkers": 1 + "threadType": 1 + "maxrecord": 50 + "PlatformRoutes": [ + { 'messagetype': 'RIC_SUB_REQ', 'senderendpoint': 'SUBMAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_SUB_DEL_REQ', 'senderendpoint': 'SUBMAN', 'subscriptionid': -1,'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_SUB_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'SUBMAN', 'meid': ''}, + { 'messagetype': 'RIC_SUB_DEL_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'SUBMAN', 'meid': ''}, + { 'messagetype': 'RIC_SUB_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'SUBMAN', 'meid': ''}, + { 'messagetype': 'RIC_SUB_DEL_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'SUBMAN', 'meid': ''}, + { 'messagetype': 'RIC_X2_SETUP_REQ', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_X2_RESET', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_X2_RESET_RESP', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_ENDC_X2_SETUP_REQ', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_ENB_CONF_UPDATE_ACK', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_ENB_CONF_UPDATE_FAILURE', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_ENDC_CONF_UPDATE_ACK', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_ENDC_CONF_UPDATE_FAILURE', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_E2_SETUP_REQ', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'E2_TERM_INIT', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_X2_SETUP_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_X2_SETUP_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_X2_RESET', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_X2_RESET_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ENDC_X2_SETUP_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ENDC_X2_SETUP_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ENDC_CONF_UPDATE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_SCTP_CONNECTION_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ERROR_INDICATION', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ENB_CONF_UPDATE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ENB_LOAD_INFORMATION', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'E2_TERM_KEEP_ALIVE_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RAN_CONNECTED', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': 'RSM', 'meid': ''}, + { 'messagetype': 'RAN_RESTARTED', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': 'RSM', 'meid': ''}, + { 'messagetype': 'RAN_RECONFIGURED', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': 'RSM', 'meid': ''}, + { 'messagetype': 'RIC_RES_STATUS_REQ', 'senderendpoint': 'RSM', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_RES_STATUS_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'RSM', 'meid': ''}, + { 'messagetype': 'RIC_RES_STATUS_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'RSM', 'meid': ''}, + { 'messagetype': 'A1_POLICY_QUERY', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'A1MEDIATOR', 'meid': ''}, + { 'messagetype': 'A1_POLICY_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'A1MEDIATOR', 'meid': ''}, + ] + diff --git a/tools/cm_e2mgr_ide/rtmgr_env.yaml b/tools/cm_e2mgr_ide/rtmgr_env.yaml new file mode 100644 index 0000000..a18e2f6 --- /dev/null +++ b/tools/cm_e2mgr_ide/rtmgr_env.yaml @@ -0,0 +1,26 @@ +############################################################################### +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 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. # +################################################################################ +apiVersion: v1 +kind: ConfigMap +metadata: + name: configmap-ricplt-rtmgr-env +data: + RMR_SEED_RT: /uta_rtg_ric.rt + RMR_RTG_SVC: "32000" + CFGFILE: /cfg/rtmgr-config.yaml + RMR_SRC_ID: 10.0.2.15 + XMURL: http://service-ricplt-appmgr-http:8080/ric/v1/xapps diff --git a/tools/cm_e2mgr_k8s/e2t_env.yaml b/tools/cm_e2mgr_k8s/e2t_env.yaml new file mode 100644 index 0000000..cb3f7c4 --- /dev/null +++ b/tools/cm_e2mgr_k8s/e2t_env.yaml @@ -0,0 +1,30 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 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. # +################################################################################ + +apiVersion: v1 +kind: ConfigMap +metadata: + name: configmap-ricplt-e2term-env-alpha +data: + RMR_SRC_ID: service-ricplt-e2term-rmr-alpha.ricplt + RMR_RTG_SVC: "4561" + RMR_SEED_RT: "router.txt" + RMR_VCTL_FILE: "/tmp/rmr_verbose" + sctp: "36422" + nano: "38000" + print: "1" + volume: /data/outgoing/ diff --git a/tools/cm_e2mgr_k8s/rtmgr_config.yaml b/tools/cm_e2mgr_k8s/rtmgr_config.yaml new file mode 100644 index 0000000..ecdd2d5 --- /dev/null +++ b/tools/cm_e2mgr_k8s/rtmgr_config.yaml @@ -0,0 +1,116 @@ +# +#================================================================================== +# Copyright (c) 2019 AT&T Intellectual Property. +# Copyright (c) 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. +#================================================================================== +# +# +# Abstract: Configuration values for the routing manager +# Date: 29 May 2019 +# +apiVersion: v1 +kind: ConfigMap +metadata: + name: configmap-ricplt-rtmgr-rtmgrcfg +data: + # FQDN and port info of the platform components for routing manager to form + # and distribute corresponding routes to them + rtmgrcfg: | + "PlatformComponents": + - + "name": "SUBMAN" + "fqdn": "service-ricplt-submgr-rmr.ricplt" + "port": 4560 + - + "name": "E2MAN" + "fqdn": "service-ricplt-e2mgr-rmr.ricplt" + "port": 3801 + - + "name": "RSM" + "fqdn": "service-ricplt-rsm-rmr.ricplt" + "port": 4801 + - + "name": "A1MEDIATOR" + "fqdn": "service-ricplt-a1mediator-rmr.ricplt" + "port": 4562 + "XMURL": + "http://service-ricplt-appmgr-http:8080/ric/v1/xapps" + "E2MURL": + "http://service-ricplt-e2mgr-http:3800/v1/e2t/list" + "RTFILE": + "/db/rt.json" + "CFGFILE": + "/cfg/rtmgr-config.yaml" + "RPE": + "rmrpush" + "SBI": + "nngpush" + "SBIURL": + "0.0.0.0" + "NBI": + "httpRESTful" + "NBIURL": + "http://service-ricplt-rtmgr-http:3800" + "SDL": + "file" + "local": + "host": ":8080" + "logger": + "level": 4 + "rmr": + "protPort": "tcp:4560" + "maxSize": 4096 + "numWorkers": 1 + "threadType": 1 + "maxrecord": 50 + "PlatformRoutes": [ + { 'messagetype': 'RIC_SUB_REQ', 'senderendpoint': 'SUBMAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_SUB_DEL_REQ', 'senderendpoint': 'SUBMAN', 'subscriptionid': -1,'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_SUB_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'SUBMAN', 'meid': ''}, + { 'messagetype': 'RIC_SUB_DEL_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'SUBMAN', 'meid': ''}, + { 'messagetype': 'RIC_SUB_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'SUBMAN', 'meid': ''}, + { 'messagetype': 'RIC_SUB_DEL_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'SUBMAN', 'meid': ''}, + { 'messagetype': 'RIC_X2_SETUP_REQ', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_X2_RESET', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_X2_RESET_RESP', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_ENDC_X2_SETUP_REQ', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_ENB_CONF_UPDATE_ACK', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_ENB_CONF_UPDATE_FAILURE', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_ENDC_CONF_UPDATE_ACK', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_ENDC_CONF_UPDATE_FAILURE', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_E2_SETUP_REQ', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'E2_TERM_INIT', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_X2_SETUP_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_X2_SETUP_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_X2_RESET', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_X2_RESET_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ENDC_X2_SETUP_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ENDC_X2_SETUP_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ENDC_CONF_UPDATE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_SCTP_CONNECTION_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ERROR_INDICATION', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ENB_CONF_UPDATE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RIC_ENB_LOAD_INFORMATION', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'E2_TERM_KEEP_ALIVE_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'E2MAN', 'meid': ''}, + { 'messagetype': 'RAN_CONNECTED', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': 'RSM', 'meid': ''}, + { 'messagetype': 'RAN_RESTARTED', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': 'RSM', 'meid': ''}, + { 'messagetype': 'RAN_RECONFIGURED', 'senderendpoint': 'E2MAN', 'subscriptionid': -1, 'endpoint': 'RSM', 'meid': ''}, + { 'messagetype': 'RIC_RES_STATUS_REQ', 'senderendpoint': 'RSM', 'subscriptionid': -1, 'endpoint': '', 'meid': '%meid'}, + { 'messagetype': 'RIC_RES_STATUS_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'RSM', 'meid': ''}, + { 'messagetype': 'RIC_RES_STATUS_FAILURE', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'RSM', 'meid': ''}, + { 'messagetype': 'A1_POLICY_QUERY', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'A1MEDIATOR', 'meid': ''}, + { 'messagetype': 'A1_POLICY_RESP', 'senderendpoint': '', 'subscriptionid': -1, 'endpoint': 'A1MEDIATOR', 'meid': ''}, + ] + diff --git a/tools/cm_e2mgr_k8s/rtmgr_env.yaml b/tools/cm_e2mgr_k8s/rtmgr_env.yaml new file mode 100644 index 0000000..5370e89 --- /dev/null +++ b/tools/cm_e2mgr_k8s/rtmgr_env.yaml @@ -0,0 +1,26 @@ +############################################################################### +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 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. # +################################################################################ +apiVersion: v1 +kind: ConfigMap +metadata: + name: configmap-ricplt-rtmgr-env +data: + RMR_SEED_RT: /uta_rtg_ric.rt + RMR_RTG_SVC: "4561" + CFGFILE: /cfg/rtmgr-config.yaml + RMR_SRC_ID: service-ricplt-rtmgr-rmr.ricplt + XMURL: http://service-ricplt-appmgr-http:8080/ric/v1/xapps diff --git a/tools/gnbe2-oran-simu/charts/ric-common-3.3.2.tgz b/tools/gnbe2-oran-simu/charts/ric-common-3.3.2.tgz new file mode 100644 index 0000000..8a5e1d8 Binary files /dev/null and b/tools/gnbe2-oran-simu/charts/ric-common-3.3.2.tgz differ diff --git "a/tools/k8s_svc_nodeports/\\" "b/tools/k8s_svc_nodeports/\\" new file mode 100644 index 0000000..33c58f5 --- /dev/null +++ "b/tools/k8s_svc_nodeports/\\" @@ -0,0 +1,22 @@ +# Please edit the object below. Lines beginning with a '#' will be ignored, +# and an empty file will abort the edit. If an error occurs while saving this file will be +# reopened with the relevant failures. +# +apiVersion: v1 +data: + RMR_RTG_SVC: "4561" + RMR_SRC_ID: service-ricplt-e2term-rmr-alpha.ricplt + RMR_VCTL_FILE: /tmp/rmr_verbose + nano: "30500" + print: "1" + sctp: "36422" + volume: /data/outgoing/ + SERVICE_RICPLT_E2TERM_RMR_ALPHA_SERVICE_HOST: "10.0.2.15" +kind: ConfigMap +metadata: + creationTimestamp: "2020-06-29T11:02:03Z" + name: configmap-ricplt-e2term-env-alpha + namespace: ricplt + resourceVersion: "1503723" + selfLink: /api/v1/namespaces/ricplt/configmaps/configmap-ricplt-e2term-env-alpha + uid: e0f50ef9-8690-4a48-a9ff-f3c747f9fdd5 diff --git a/tools/k8s_svc_nodeports/svc_dbaas.yaml b/tools/k8s_svc_nodeports/svc_dbaas.yaml new file mode 100644 index 0000000..d80fa6e --- /dev/null +++ b/tools/k8s_svc_nodeports/svc_dbaas.yaml @@ -0,0 +1,39 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 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. # +################################################################################ +# +apiVersion: v1 +kind: Service +metadata: + name: service-ricplt-dbaas-node-port + namespace: ricplt + labels: + app: ricplt-dbaas + chart: dbass-2.0.0 + release: r4-dbaas + heritage: Tiller +spec: + type: NodePort + ports: + - port: 6379 + nodePort: 30000 + protocol: "TCP" + targetPort: 6379 + name: "dbass-node-port" + selector: + app: ricplt-dbaas + release: r4-dbaas + diff --git a/tools/k8s_svc_nodeports/svc_e2t_rmr_tcp.yaml b/tools/k8s_svc_nodeports/svc_e2t_rmr_tcp.yaml new file mode 100644 index 0000000..042c8e9 --- /dev/null +++ b/tools/k8s_svc_nodeports/svc_e2t_rmr_tcp.yaml @@ -0,0 +1,39 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 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. # +################################################################################ +# +apiVersion: v1 +kind: Service +metadata: + name: service-ricplt-e2term-rmr-alpha-nodeport + namespace: ricplt + labels: + app: ricplt-e2term + chart: e2term-3.0.0 + release: r4-e2term + heritage: Tiller +spec: + type: NodePort + ports: + - port: 30500 + nodePort: 30500 + protocol: "TCP" + targetPort: 30500 + name: "e2term-rmr-tcp-nodeport" + selector: + app: ricplt-e2term + release: r4-e2term + diff --git a/tools/k8s_svc_nodeports/svc_rtmgr_http.yaml b/tools/k8s_svc_nodeports/svc_rtmgr_http.yaml new file mode 100644 index 0000000..59f2209 --- /dev/null +++ b/tools/k8s_svc_nodeports/svc_rtmgr_http.yaml @@ -0,0 +1,39 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 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. # +################################################################################ +# +apiVersion: v1 +kind: Service +metadata: + name: service-ricplt-rtmgr-http-nodeport + namespace: ricplt + labels: + app: ricplt-rtmgr + chart: rtmgr-3.0.0 + release: r4-rtmgr + heritage: Tiller +spec: + type: NodePort + ports: + - port: 31000 + nodePort: 31000 + protocol: "TCP" + targetPort: 31000 + name: "rtmgr-http-nodeport" + selector: + app: ricplt-rtmgr + release: r4-rtmgr + diff --git a/tools/k8s_svc_nodeports/svc_rtmgr_rmr.yaml b/tools/k8s_svc_nodeports/svc_rtmgr_rmr.yaml new file mode 100644 index 0000000..8ff607e --- /dev/null +++ b/tools/k8s_svc_nodeports/svc_rtmgr_rmr.yaml @@ -0,0 +1,45 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 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. # +################################################################################ +# +apiVersion: v1 +kind: Service +metadata: + name: service-ricplt-rtmgr-rmr-nodeport + namespace: ricplt + labels: + app: ricplt-rtmgr + chart: rtmgr-3.0.0 + release: r4-rtmgr + heritage: Tiller +spec: + type: NodePort + ports: + - port: 31500 + nodePort: 31500 + protocol: "TCP" + targetPort: 31500 + name: "rtmgr-rmr-nodeport" + - port: 32000 + nodePort: 32000 + protocol: "TCP" + targetPort: 32000 + name: "rtmgr-rmr-route-nodeport" + + selector: + app: ricplt-rtmgr + release: r4-rtmgr +