Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39: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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.device; |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 17 | |
Bri Prebilic Cole | 09e464b | 2015-01-07 17:13:54 -0800 | [diff] [blame] | 18 | import com.google.common.collect.FluentIterable; |
HIGUCHI Yuta | 5bb99a4 | 2015-03-19 16:52:15 -0700 | [diff] [blame] | 19 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 20 | import org.onosproject.net.Device; |
samuel | 738dfaf | 2015-07-11 11:08:57 +0800 | [diff] [blame] | 21 | import org.onosproject.net.Device.Type; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 22 | import org.onosproject.net.DeviceId; |
| 23 | import org.onosproject.net.MastershipRole; |
| 24 | import org.onosproject.net.Port; |
| 25 | import org.onosproject.net.PortNumber; |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 26 | |
HIGUCHI Yuta | 5bb99a4 | 2015-03-19 16:52:15 -0700 | [diff] [blame] | 27 | import java.util.Collections; |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 28 | import java.util.List; |
| 29 | |
| 30 | /** |
| 31 | * Test adapter for device service. |
| 32 | */ |
| 33 | public class DeviceServiceAdapter implements DeviceService { |
| 34 | @Override |
| 35 | public int getDeviceCount() { |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | @Override |
| 40 | public Iterable<Device> getDevices() { |
HIGUCHI Yuta | 5bb99a4 | 2015-03-19 16:52:15 -0700 | [diff] [blame] | 41 | return Collections.emptyList(); |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | @Override |
Yuta HIGUCHI | f1f2ac0 | 2014-11-26 14:02:22 -0800 | [diff] [blame] | 45 | public Iterable<Device> getAvailableDevices() { |
| 46 | return FluentIterable.from(getDevices()) |
Sho SHIMIZU | 7462641 | 2015-09-11 11:46:27 -0700 | [diff] [blame] | 47 | .filter(input -> isAvailable(input.id())); |
Yuta HIGUCHI | f1f2ac0 | 2014-11-26 14:02:22 -0800 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | @Override |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 51 | public Device getDevice(DeviceId deviceId) { |
| 52 | return null; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public MastershipRole getRole(DeviceId deviceId) { |
HIGUCHI Yuta | 5bb99a4 | 2015-03-19 16:52:15 -0700 | [diff] [blame] | 57 | return MastershipRole.NONE; |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public List<Port> getPorts(DeviceId deviceId) { |
HIGUCHI Yuta | 5bb99a4 | 2015-03-19 16:52:15 -0700 | [diff] [blame] | 62 | return Collections.emptyList(); |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | @Override |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 66 | public List<PortStatistics> getPortStatistics(DeviceId deviceId) { |
| 67 | return null; |
| 68 | } |
| 69 | |
| 70 | @Override |
Dusan Pajin | 11ff4a8 | 2015-08-20 18:03:05 +0200 | [diff] [blame] | 71 | public List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId) { |
| 72 | return null; |
| 73 | } |
| 74 | |
| 75 | @Override |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 76 | public Port getPort(DeviceId deviceId, PortNumber portNumber) { |
| 77 | return null; |
| 78 | } |
| 79 | |
| 80 | @Override |
| 81 | public boolean isAvailable(DeviceId deviceId) { |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | @Override |
| 86 | public void addListener(DeviceListener listener) { |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | public void removeListener(DeviceListener listener) { |
| 91 | } |
| 92 | |
samuel | 738dfaf | 2015-07-11 11:08:57 +0800 | [diff] [blame] | 93 | @Override |
| 94 | public Iterable<Device> getDevices(Type type) { |
| 95 | return Collections.emptyList(); |
| 96 | } |
| 97 | |
| 98 | @Override |
| 99 | public Iterable<Device> getAvailableDevices(Type type) { |
| 100 | return Collections.emptyList(); |
| 101 | } |
| 102 | |
tom | 61359e9 | 2014-09-16 15:50:27 -0700 | [diff] [blame] | 103 | } |