blob: f745565b570aa951e8d2e000a7748ae3279fec08 [file] [log] [blame]
Andrea Campanellac2d754b2016-03-29 17:51:07 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Andrea Campanellac2d754b2016-03-29 17:51:07 -07003 *
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
17package org.onosproject.snmp;
18
19import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
Laszlo Papp9655b182017-01-31 13:01:45 -080020import com.google.common.annotations.Beta;
21
Andrea Campanellac2d754b2016-03-29 17:51:07 -070022import org.onosproject.incubator.net.faultmanagement.alarm.DefaultAlarm;
23import org.onosproject.net.DeviceId;
24
25import java.io.IOException;
Laszlo Papp9655b182017-01-31 13:01:45 -080026import java.net.URI;
Andrea Campanellac2d754b2016-03-29 17:51:07 -070027import java.util.Collection;
28
29/**
30 * Snmp Controller.
31 */
Laszlo Papp9655b182017-01-31 13:01:45 -080032@Beta
Andrea Campanellac2d754b2016-03-29 17:51:07 -070033public interface SnmpController {
34
35 /**
36 * Return all the devices that this controller has notion of.
37 * @return Set of all Snmp devices
38 */
39 Collection<SnmpDevice> getDevices();
40
41 /**
42 * Gets a device for a specific deviceId.
43 * @param deviceId device id of the device
44 * @return SnmpDevice for given deviceId
45 */
46 SnmpDevice getDevice(DeviceId deviceId);
47
48 /**
Laszlo Papp9655b182017-01-31 13:01:45 -080049 * Gets a device for a specific host address.
50 *
51 * @param uri URI of the device
52 * @return SnmpDevice for given deviceId
53 */
54 SnmpDevice getDevice(URI uri);
55
56 /**
Andrea Campanellac2d754b2016-03-29 17:51:07 -070057 * Removes a specific device.
58 * @param deviceId device id of the device to be removed
59 */
60 void removeDevice(DeviceId deviceId);
61
62 /**
Laszlo Papp9655b182017-01-31 13:01:45 -080063 * Add a snmp device.
64 *
Andrea Campanellac2d754b2016-03-29 17:51:07 -070065 * @param device device to add to this controller
66 */
Laszlo Papp9655b182017-01-31 13:01:45 -080067 void addDevice(SnmpDevice device);
Andrea Campanellac2d754b2016-03-29 17:51:07 -070068
69 /**
70 * Gets an Instance of ISnmpSession for a specific device.
71 *
72 * @param deviceId device to retrieve the session for.
73 * @return ISnmp session.
74 * @throws IOException if the session can't be established.
Laszlo Papp9655b182017-01-31 13:01:45 -080075 * @deprecated 1.14.0 moved to snmp4j
Andrea Campanellac2d754b2016-03-29 17:51:07 -070076 */
Laszlo Papp9655b182017-01-31 13:01:45 -080077 @Deprecated
Andrea Campanellac2d754b2016-03-29 17:51:07 -070078 ISnmpSession getSession(DeviceId deviceId) throws IOException;
79
80 /**
81 * Creates an error alarm if the interaction with the device failed.
82 *
83 * @param deviceId the device with a failed interaction
84 * @return default alarm error
85 */
86 DefaultAlarm buildWalkFailedAlarm(DeviceId deviceId);
Laszlo Papp9655b182017-01-31 13:01:45 -080087
88
Andrea Campanellac2d754b2016-03-29 17:51:07 -070089}