kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 3 | * |
| 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 | */ |
| 16 | package org.onosproject.faultmanagement.alarms.gui; |
| 17 | |
| 18 | import java.util.Map; |
| 19 | import java.util.Set; |
| 20 | import org.onosproject.cli.AbstractShellCommand; |
| 21 | import org.onosproject.incubator.net.faultmanagement.alarm.Alarm; |
| 22 | import org.onosproject.incubator.net.faultmanagement.alarm.AlarmId; |
| 23 | import org.onosproject.incubator.net.faultmanagement.alarm.AlarmService; |
| 24 | import org.onosproject.net.DeviceId; |
| 25 | |
| 26 | /** |
| 27 | * |
| 28 | * Utility for invoking on alarm service. |
| 29 | */ |
| 30 | public 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 | } |