X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=inline;f=pkg%2Fxapp%2Falarm.go;fp=pkg%2Fxapp%2Falarm.go;h=0000000000000000000000000000000000000000;hb=3fd54d11c9f548f1ebea30133e5198eb49511e55;hp=0e6f637f89d3117b2f81ddf0db2f3daccb0c0c23;hpb=2f9d1a1259f88552a2b6e9db6e1ea236aef7a2d2;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/xapp/alarm.go b/pkg/xapp/alarm.go deleted file mode 100755 index 0e6f637..0000000 --- a/pkg/xapp/alarm.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -================================================================================== - Copyright (c) 2020 AT&T Intellectual Property. - Copyright (c) 2020 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. -================================================================================== -*/ - -package xapp - -import ( - "gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm" - "os" -) - -type AlarmClient struct { - alarmer *alarm.RICAlarm -} - -// NewAlarmClient returns a new AlarmClient. -func NewAlarmClient(moId, appId string) *AlarmClient { - if moId == "" { - moId = "RIC" - if hostname, err := os.Hostname(); err == nil { - moId = hostname - } - } - - if appId == "" { - appId = os.Args[0] - } - - alarmInstance, err := alarm.InitAlarm(moId, appId) - if err == nil { - return &AlarmClient{ - alarmer: alarmInstance, - } - } - return nil -} - -func (c *AlarmClient) Raise(sp int, severity alarm.Severity, identifyingInfo, additionalInfo string) error { - alarmData := c.alarmer.NewAlarm(sp, severity, identifyingInfo, additionalInfo) - return c.alarmer.Raise(alarmData) -} - -func (c *AlarmClient) Clear(sp int, severity alarm.Severity, identifyingInfo, additionalInfo string) error { - alarmData := c.alarmer.NewAlarm(sp, severity, identifyingInfo, additionalInfo) - return c.alarmer.Clear(alarmData) -} - -func (c *AlarmClient) Reraise(sp int, severity alarm.Severity, identifyingInfo, additionalInfo string) error { - alarmData := c.alarmer.NewAlarm(sp, severity, identifyingInfo, additionalInfo) - return c.alarmer.Reraise(alarmData) -} - -func (c *AlarmClient) ClearAll() error { - return c.alarmer.ClearAll() -}