X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=alarm%2Ftypes.go;h=3f55aeddb0aef3ef10ddb59537438cbc0cb34775;hb=1af83f4494d0fa17f2c59acc5bc43bb7d14cee59;hp=149671a37123ee48f3b92e1481c062bf1fa7c3c0;hpb=541eb50ea18ab50528420dfe724fa3d12dc24914;p=ric-plt%2Falarm-go.git diff --git a/alarm/types.go b/alarm/types.go index 149671a..3f55aed 100755 --- a/alarm/types.go +++ b/alarm/types.go @@ -23,6 +23,8 @@ package alarm import ( "sync" "unsafe" + "os" + "fmt" ) import "C" @@ -68,8 +70,8 @@ type AlarmMessage struct { } type AlarmConfigParams struct { - MaxActiveAlarms int `json:"maxactivealarms"` - MaxAlarmHistory int `json:"maxalarmhistory"` + MaxActiveAlarms int `json:"maxactivealarms"` + MaxAlarmHistory int `json:"maxalarmhistory"` } // RICAlarm is an alarm instance @@ -89,61 +91,29 @@ const ( // Temp alarm constants & definitions const ( - RIC_RT_DISTRIBUTION_FAILED int = 8004 - TCP_CONNECTIVITY_LOST_TO_DBAAS int = 8005 - E2_CONNECTIVITY_LOST_TO_GNODEB int = 8006 - E2_CONNECTIVITY_LOST_TO_ENODEB int = 8007 - ACTIVE_ALARM_EXCEED_MAX_THRESHOLD int = 8008 + RIC_RT_DISTRIBUTION_FAILED int = 8004 + TCP_CONNECTIVITY_LOST_TO_DBAAS int = 8005 + E2_CONNECTIVITY_LOST_TO_GNODEB int = 8006 + E2_CONNECTIVITY_LOST_TO_ENODEB int = 8007 + ACTIVE_ALARM_EXCEED_MAX_THRESHOLD int = 8008 ALARM_HISTORY_EXCEED_MAX_THRESHOLD int = 8009 ) type AlarmDefinition struct { - AlarmId int - AlarmText string - EventType string - OperationInstructions string + AlarmId int `json:"alarmId"` + AlarmText string `json:"alarmText"` + EventType string `json:"eventType"` + OperationInstructions string `json:"operationInstructions"` + RaiseDelay int `json:"raiseDelay"` + ClearDelay int `json:"clearDelay"` + TimeToLive int `json:"timeToLive"` } -var RICAlarmDefinitions = map[int]AlarmDefinition{ - RIC_RT_DISTRIBUTION_FAILED: { - AlarmId: RIC_RT_DISTRIBUTION_FAILED, - AlarmText: "RIC ROUTING TABLE DISTRIBUTION FAILED", - EventType: "Processing error", - OperationInstructions: "Not defined", - }, - TCP_CONNECTIVITY_LOST_TO_DBAAS: { - AlarmId: TCP_CONNECTIVITY_LOST_TO_DBAAS, - AlarmText: "TCP CONNECTIVITY LOST TO DBAAS", - EventType: "Communication error", - OperationInstructions: "Not defined", - }, - E2_CONNECTIVITY_LOST_TO_GNODEB: { - AlarmId: E2_CONNECTIVITY_LOST_TO_GNODEB, - AlarmText: "E2 CONNECTIVITY LOST TO G-NODEB", - EventType: "Communication error", - OperationInstructions: "Not defined", - }, - E2_CONNECTIVITY_LOST_TO_ENODEB: { - AlarmId: E2_CONNECTIVITY_LOST_TO_ENODEB, - AlarmText: "E2 CONNECTIVITY LOST TO E-NODEB", - EventType: "Communication error", - OperationInstructions: "Not defined", - }, - ACTIVE_ALARM_EXCEED_MAX_THRESHOLD: { - AlarmId: ACTIVE_ALARM_EXCEED_MAX_THRESHOLD, - AlarmText: "ACTIVE ALARM EXCEED MAX THRESHOLD", - EventType: "Warning", - OperationInstructions: "Not defined", - }, - ALARM_HISTORY_EXCEED_MAX_THRESHOLD: { - AlarmId: ALARM_HISTORY_EXCEED_MAX_THRESHOLD, - AlarmText: "ALARM HISTORY EXCEED MAX THRESHOLD", - EventType: "Warning", - OperationInstructions: "Not defined", - }, -} +var RICAlarmDefinitions map[int]*AlarmDefinition +var RICPerfAlarmObjects map[int]*Alarm -const ( - ALARM_MANAGER_HTTP_URL string = "http://service-ricplt-alarmmanager-http.ricplt:8080" - ALARM_MANAGER_RMR_URL string = "service-ricplt-alarmmanager-rmr.ricplt:4560" +var ( + namespace = os.Getenv("PLT_NAMESPACE") + ALARM_MANAGER_HTTP_URL string = fmt.Sprintf("http://service-%s-alarmmanager-http.%s:8080", namespace, namespace) + ALARM_MANAGER_RMR_URL string = fmt.Sprintf("service-%s-alarmmanager-rmr.%s:4560", namespace, namespace) )