blob: c1a67673298e062242b508812a0fba85572315fc [file] [log] [blame]
fahadnaeemkhan4b6731a2017-10-18 11:13:02 -07001/*
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 Groom725ed542018-04-07 14:41:30 -060017package org.onosproject.drivers.ciena.waveserver.rest;
fahadnaeemkhan4b6731a2017-10-18 11:13:02 -070018
19import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
20import org.onosproject.incubator.net.faultmanagement.alarm.AlarmConsumer;
21import org.onosproject.net.driver.AbstractHandlerBehaviour;
22import org.slf4j.Logger;
23
24import java.util.List;
25
26import static org.slf4j.LoggerFactory.getLogger;
27
28/**
29 * Ciena Wave Server Alarm Consumer.
30 */
31public 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}