blob: f367b68c7ade8719876a2bdcac08c1f5b4dc9fe1 [file] [log] [blame]
Andrea Campanella58454b92016-04-01 15:19:00 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Andrea Campanella58454b92016-04-01 15:19:00 -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.provider.snmp.device.impl;
18
19import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
20import org.onosproject.incubator.net.faultmanagement.alarm.DefaultAlarm;
21import org.onosproject.net.DeviceId;
HIGUCHI Yuta1839bab2016-05-09 13:06:14 -070022import org.onosproject.snmp.SnmpController;
Andrea Campanella58454b92016-04-01 15:19:00 -070023import org.onosproject.snmp.SnmpDevice;
24
25import java.io.IOException;
Andrea Campanella58454b92016-04-01 15:19:00 -070026import java.util.Collection;
HIGUCHI Yutabc9efc92016-05-16 20:48:26 -070027import java.util.Map;
28import java.util.concurrent.ConcurrentHashMap;
Andrea Campanella58454b92016-04-01 15:19:00 -070029
30/**
31 * Test Adapter for SnmpController API.
32 */
33public class SnmpControllerAdapter implements SnmpController {
34
HIGUCHI Yutabc9efc92016-05-16 20:48:26 -070035 protected Map<DeviceId, SnmpDevice> devices = new ConcurrentHashMap<>();
Andrea Campanella58454b92016-04-01 15:19:00 -070036 @Override
37 public Collection<SnmpDevice> getDevices() {
38 return devices.values();
39 }
40
41 @Override
42 public SnmpDevice getDevice(DeviceId deviceId) {
43 return devices.get(deviceId);
44 }
45
46 @Override
47 public void removeDevice(DeviceId deviceId) {
48 devices.remove(deviceId);
49 }
50
51 @Override
52 public void addDevice(DeviceId deviceId, SnmpDevice snmpDevice) {
HIGUCHI Yuta1839bab2016-05-09 13:06:14 -070053 devices.put(deviceId, snmpDevice);
Andrea Campanella58454b92016-04-01 15:19:00 -070054 }
55
56 @Override
57 public ISnmpSession getSession(DeviceId deviceId) throws IOException {
58 return null;
59 }
60
61 @Override
62 public DefaultAlarm buildWalkFailedAlarm(DeviceId deviceId) {
63 return null;
64 }
65}