fahadnaeemkhan | 4b6731a | 2017-10-18 11:13:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 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 | |
Jeff Groom | 725ed54 | 2018-04-07 14:41:30 -0600 | [diff] [blame] | 17 | package org.onosproject.drivers.ciena.waveserver.rest; |
fahadnaeemkhan | 4b6731a | 2017-10-18 11:13:02 -0700 | [diff] [blame] | 18 | |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame^] | 19 | import org.onosproject.alarm.Alarm; |
| 20 | import org.onosproject.alarm.AlarmConsumer; |
fahadnaeemkhan | 4b6731a | 2017-10-18 11:13:02 -0700 | [diff] [blame] | 21 | import org.onosproject.net.driver.AbstractHandlerBehaviour; |
| 22 | import org.slf4j.Logger; |
| 23 | |
| 24 | import java.util.List; |
| 25 | |
| 26 | import static org.slf4j.LoggerFactory.getLogger; |
| 27 | |
| 28 | /** |
| 29 | * Ciena Wave Server Alarm Consumer. |
| 30 | */ |
| 31 | public class CienaWaveServerAlarmConsumer extends AbstractHandlerBehaviour implements AlarmConsumer { |
| 32 | CienaRestDevice restCiena; |
| 33 | |
| 34 | private final Logger log = getLogger(getClass()); |
| 35 | |
| 36 | @Override |
| 37 | public List<Alarm> consumeAlarms() { |
| 38 | try { |
| 39 | restCiena = new CienaRestDevice(handler()); |
| 40 | } catch (NullPointerException e) { |
| 41 | log.error("unable to create CienaRestDevice:\n", e); |
| 42 | return null; |
| 43 | } |
| 44 | return restCiena.getAlarms(); |
| 45 | } |
| 46 | } |