2 // ========================LICENSE_START=================================
5 // Copyright (C) 2022: Nordix Foundation
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 // ========================LICENSE_END===================================
29 log "github.com/sirupsen/logrus"
30 "oransc.org/usecase/oduclosedloop/icsversion/internal/config"
31 sliceassurance "oransc.org/usecase/oduclosedloop/icsversion/internal/odusliceassurance"
34 var configuration *config.Configuration
35 var a sliceassurance.App
37 const TOPIC string = "/events/unauthenticated.VES_O_RAN_SC_HELLO_WORLD_PM_STREAMING_OUTPUT/myG/C1"
40 configuration = config.New()
42 log.SetLevel(configuration.LogLevel)
43 log.SetFormatter(&log.JSONFormatter{})
45 log.Debug("Using configuration: ", configuration)
47 if err := validateConfiguration(configuration); err != nil {
48 log.Fatalf("Unable to start consumer due to configuration error: %v", err)
51 a = sliceassurance.App{}
52 a.Initialize(configuration)
58 func validateConfiguration(configuration *config.Configuration) error {
59 if configuration.ConsumerHost == "" || configuration.ConsumerPort == 0 {
60 return fmt.Errorf("consumer host and port must be provided")
65 func keepConsumerAlive() {
66 exitSignal := make(chan os.Signal, 1)
67 signal.Notify(exitSignal, syscall.SIGINT, syscall.SIGTERM)