blob: cfc36ec9b20ce06ea6cdd0101532be9805d95be9 [file] [log] [blame]
kmcpeakeb172d5f2015-12-10 11:30:43 +00001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
kmcpeakeb172d5f2015-12-10 11:30:43 +00003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.faultmanagement.alarms.gui;
17
18import java.util.Map;
19import java.util.Set;
20import org.onosproject.cli.AbstractShellCommand;
21import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
22import org.onosproject.incubator.net.faultmanagement.alarm.AlarmId;
23import org.onosproject.incubator.net.faultmanagement.alarm.AlarmService;
24import org.onosproject.net.DeviceId;
25
26/**
27 *
28 * Utility for invoking on alarm service.
29 */
30public final class AlarmServiceUtil {
31
32 static Alarm lookupAlarm(AlarmId alarmId) {
33 return alarmService().getAlarm(alarmId);
34 }
35
36 static Set<Alarm> lookUpAlarms() {
37 return alarmService().getAlarms();
38 }
39
40 static Set<Alarm> lookUpAlarms(DeviceId deviceId) {
41 return alarmService().getAlarms(deviceId);
42 }
43
44 static Map<Alarm.SeverityLevel, Long> lookUpAlarmCounts(DeviceId deviceId) {
45 return alarmService().getAlarmCounts(deviceId);
46 }
47
48 static Map<Alarm.SeverityLevel, Long> lookUpAlarmCounts() {
49 return alarmService().getAlarmCounts();
50 }
51
52 private static AlarmService alarmService() {
53 return AbstractShellCommand.get(AlarmService.class);
54 }
55
56 private AlarmServiceUtil() {
57 }
58}