Andrea Campanella | 58454b9 | 2016-04-01 15:19:00 -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 | 58454b9 | 2016-04-01 15:19:00 -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.provider.snmp.device.impl; |
| 18 | |
| 19 | import com.btisystems.pronx.ems.core.snmp.ISnmpSession; |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame^] | 20 | import org.onosproject.alarm.DefaultAlarm; |
Andrea Campanella | 58454b9 | 2016-04-01 15:19:00 -0700 | [diff] [blame] | 21 | import org.onosproject.net.DeviceId; |
HIGUCHI Yuta | 1839bab | 2016-05-09 13:06:14 -0700 | [diff] [blame] | 22 | import org.onosproject.snmp.SnmpController; |
Andrea Campanella | 58454b9 | 2016-04-01 15:19:00 -0700 | [diff] [blame] | 23 | import org.onosproject.snmp.SnmpDevice; |
| 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 | 58454b9 | 2016-04-01 15:19:00 -0700 | [diff] [blame] | 27 | import java.util.Collection; |
HIGUCHI Yuta | bc9efc9 | 2016-05-16 20:48:26 -0700 | [diff] [blame] | 28 | import java.util.Map; |
| 29 | import java.util.concurrent.ConcurrentHashMap; |
Andrea Campanella | 58454b9 | 2016-04-01 15:19:00 -0700 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * Test Adapter for SnmpController API. |
| 33 | */ |
| 34 | public class SnmpControllerAdapter implements SnmpController { |
| 35 | |
HIGUCHI Yuta | bc9efc9 | 2016-05-16 20:48:26 -0700 | [diff] [blame] | 36 | protected Map<DeviceId, SnmpDevice> devices = new ConcurrentHashMap<>(); |
Andrea Campanella | 58454b9 | 2016-04-01 15:19:00 -0700 | [diff] [blame] | 37 | @Override |
| 38 | public Collection<SnmpDevice> getDevices() { |
| 39 | return devices.values(); |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public SnmpDevice getDevice(DeviceId deviceId) { |
| 44 | return devices.get(deviceId); |
| 45 | } |
| 46 | |
| 47 | @Override |
Laszlo Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 48 | public SnmpDevice getDevice(URI uri) { |
| 49 | return null; |
| 50 | } |
| 51 | |
| 52 | @Override |
Andrea Campanella | 58454b9 | 2016-04-01 15:19:00 -0700 | [diff] [blame] | 53 | public void removeDevice(DeviceId deviceId) { |
| 54 | devices.remove(deviceId); |
| 55 | } |
| 56 | |
| 57 | @Override |
Laszlo Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 58 | public void addDevice(SnmpDevice device) { |
| 59 | devices.put(device.deviceId(), device); |
| 60 | } |
| 61 | |
| 62 | @Override |
Andrea Campanella | 58454b9 | 2016-04-01 15:19:00 -0700 | [diff] [blame] | 63 | public ISnmpSession getSession(DeviceId deviceId) throws IOException { |
| 64 | return null; |
| 65 | } |
| 66 | |
| 67 | @Override |
| 68 | public DefaultAlarm buildWalkFailedAlarm(DeviceId deviceId) { |
| 69 | return null; |
| 70 | } |
| 71 | } |