Andrea Campanella | c2d754b | 2016-03-29 17:51:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Andrea Campanella | c2d754b | 2016-03-29 17:51:07 -0700 | [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 | |
| 17 | package org.onosproject.snmp; |
| 18 | |
| 19 | import com.btisystems.pronx.ems.core.snmp.ISnmpSession; |
Laszlo Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 20 | import com.google.common.annotations.Beta; |
| 21 | |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame] | 22 | import org.onosproject.alarm.DefaultAlarm; |
Andrea Campanella | c2d754b | 2016-03-29 17:51:07 -0700 | [diff] [blame] | 23 | import org.onosproject.net.DeviceId; |
| 24 | |
| 25 | import java.io.IOException; |
Laszlo Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 26 | import java.net.URI; |
Andrea Campanella | c2d754b | 2016-03-29 17:51:07 -0700 | [diff] [blame] | 27 | import java.util.Collection; |
| 28 | |
| 29 | /** |
| 30 | * Snmp Controller. |
| 31 | */ |
Laszlo Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 32 | @Beta |
Andrea Campanella | c2d754b | 2016-03-29 17:51:07 -0700 | [diff] [blame] | 33 | public 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 Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 49 | * 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 Campanella | c2d754b | 2016-03-29 17:51:07 -0700 | [diff] [blame] | 57 | * Removes a specific device. |
| 58 | * @param deviceId device id of the device to be removed |
| 59 | */ |
| 60 | void removeDevice(DeviceId deviceId); |
| 61 | |
| 62 | /** |
Laszlo Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 63 | * Add a snmp device. |
| 64 | * |
Andrea Campanella | c2d754b | 2016-03-29 17:51:07 -0700 | [diff] [blame] | 65 | * @param device device to add to this controller |
| 66 | */ |
Laszlo Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 67 | void addDevice(SnmpDevice device); |
Andrea Campanella | c2d754b | 2016-03-29 17:51:07 -0700 | [diff] [blame] | 68 | |
| 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 Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 75 | * @deprecated 1.14.0 moved to snmp4j |
Andrea Campanella | c2d754b | 2016-03-29 17:51:07 -0700 | [diff] [blame] | 76 | */ |
Laszlo Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 77 | @Deprecated |
Andrea Campanella | c2d754b | 2016-03-29 17:51:07 -0700 | [diff] [blame] | 78 | 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 Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 87 | |
| 88 | |
Andrea Campanella | c2d754b | 2016-03-29 17:51:07 -0700 | [diff] [blame] | 89 | } |