d5d3fc53336d33dda24670578760e6e5e9dafe09
[ric-plt/rtmgr.git] / pkg / rtmgr / rtmgr.go
1 /*
2 ==================================================================================
3   Copyright (c) 2019 AT&T Intellectual Property.
4   Copyright (c) 2019 Nokia
5
6    Licensed under the Apache License, Version 2.0 (the "License");
7    you may not use this file except in compliance with the License.
8    You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12    Unless required by applicable law or agreed to in writing, software
13    distributed under the License is distributed on an "AS IS" BASIS,
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    See the License for the specific language governing permissions and
16    limitations under the License.
17 ==================================================================================
18 */
19 /*
20   Mnemonic:     rtmgr/rtmgr.go
21   Abstract:     Containes RTMGR (Routing Manager) module's generic variables and functions
22   Date:         26 March 2019
23 */
24
25 package rtmgr
26
27 import (
28         "github.com/jcelliott/lumber"
29 )
30
31 var (
32         //TODO: temporary solution
33         // CamelCase Message Types are for being able to test with old fashioned admin controll xApps
34         MESSAGETYPES = map[string]string{
35                 "HandoverPreparation":              "0",
36                 "HandoverCancel":                   "1",
37                 "LoadIndication":                   "2",
38                 "ErrorIndication":                  "3",
39                 "SNStatusTransfer":                 "4",
40                 "UEContextRelease":                 "5",
41                 "X2Setup":                          "6",
42                 "Reset":                            "7",
43                 "RIC_X2_SETUP":                     "10000",
44                 "RIC_X2_RESPONSE":                  "10001",
45                 "RIC_X2_RESOURCE_STATUS_REQUEST":   "10002",
46                 "RIC_X2_RESOURCE_STATUS_RESPONSE":  "10003",
47                 "RIC_X2_LOAD_INFORMATION":          "10004",
48                 "RIC_E2_TERMINATION_HC_REQUEST":    "10005",
49                 "RIC_E2_TERMINATION_HC_RESPONSE":   "10006",
50                 "RIC_E2_MANAGER_HC_REQUEST":        "10007",
51                 "RIC_E2_MANAGER_HC_RESPONSE":       "10008",
52                 "RIC_CONTROL_XAPP_CONFIG_REQUEST":  "100000",
53                 "RIC_CONTROL_XAPP_CONFIG_RESPONSE": "100001",
54         }
55         Logger = lumber.NewConsoleLogger(lumber.INFO)
56 )
57
58 func SetLogLevel(loglevel string) {
59         switch loglevel {
60         case "INFO":
61                 Logger.Level(lumber.INFO)
62         case "WARN":
63                 Logger.Level(lumber.WARN)
64         case "ERROR":
65                 Logger.Level(lumber.ERROR)
66         case "DEBUG":
67                 Logger.Info("debugmode")
68                 Logger.Level(lumber.DEBUG)
69         }
70 }