Avantika-Huawei | 9e848e8 | 2016-09-01 12:12:42 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 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 | package org.onosproject.pcelabelstore.util; |
| 17 | |
| 18 | import java.util.LinkedList; |
| 19 | import java.util.List; |
| 20 | |
| 21 | import org.onosproject.net.device.DeviceListener; |
| 22 | import org.onosproject.net.device.PortStatistics; |
| 23 | import org.onosproject.net.Device; |
| 24 | import org.onosproject.net.Device.Type; |
| 25 | import org.onosproject.net.DeviceId; |
| 26 | import org.onosproject.net.MastershipRole; |
| 27 | import org.onosproject.net.Port; |
| 28 | import org.onosproject.net.PortNumber; |
| 29 | import org.onosproject.net.device.DeviceService; |
| 30 | |
| 31 | /** |
| 32 | * Test fixture for the device service. |
| 33 | */ |
| 34 | public class MockDeviceService implements DeviceService { |
| 35 | private List<Device> devices = new LinkedList<>(); |
| 36 | private DeviceListener listener; |
| 37 | |
| 38 | /** |
| 39 | * Adds a new device. |
| 40 | * |
| 41 | * @param dev device to be added |
| 42 | */ |
| 43 | public void addDevice(Device dev) { |
| 44 | devices.add(dev); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Removes the specified device. |
| 49 | * |
| 50 | * @param dev device to be removed |
| 51 | */ |
| 52 | public void removeDevice(Device dev) { |
| 53 | devices.remove(dev); |
| 54 | } |
| 55 | |
| 56 | @Override |
| 57 | public Device getDevice(DeviceId deviceId) { |
| 58 | for (Device dev : devices) { |
| 59 | if (dev.id().equals(deviceId)) { |
| 60 | return dev; |
| 61 | } |
| 62 | } |
| 63 | return null; |
| 64 | } |
| 65 | |
| 66 | @Override |
| 67 | public Iterable<Device> getAvailableDevices() { |
| 68 | return devices; |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public void addListener(DeviceListener listener) { |
| 73 | this.listener = listener; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Get the listener. |
| 78 | */ |
| 79 | public DeviceListener getListener() { |
| 80 | return listener; |
| 81 | } |
| 82 | |
| 83 | @Override |
| 84 | public void removeListener(DeviceListener listener) { |
| 85 | // TODO Auto-generated method stub |
| 86 | |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | public int getDeviceCount() { |
| 91 | // TODO Auto-generated method stub |
| 92 | return 0; |
| 93 | } |
| 94 | |
| 95 | @Override |
| 96 | public Iterable<Device> getDevices() { |
| 97 | // TODO Auto-generated method stub |
| 98 | return null; |
| 99 | } |
| 100 | |
| 101 | @Override |
| 102 | public Iterable<Device> getDevices(Type type) { |
| 103 | // TODO Auto-generated method stub |
| 104 | return null; |
| 105 | } |
| 106 | |
| 107 | @Override |
| 108 | public Iterable<Device> getAvailableDevices(Type type) { |
| 109 | // TODO Auto-generated method stub |
| 110 | return null; |
| 111 | } |
| 112 | |
| 113 | @Override |
| 114 | public MastershipRole getRole(DeviceId deviceId) { |
| 115 | // TODO Auto-generated method stub |
| 116 | return null; |
| 117 | } |
| 118 | |
| 119 | @Override |
| 120 | public List<Port> getPorts(DeviceId deviceId) { |
| 121 | // TODO Auto-generated method stub |
| 122 | return null; |
| 123 | } |
| 124 | |
| 125 | @Override |
| 126 | public List<PortStatistics> getPortStatistics(DeviceId deviceId) { |
| 127 | // TODO Auto-generated method stub |
| 128 | return null; |
| 129 | } |
| 130 | |
| 131 | @Override |
| 132 | public List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId) { |
| 133 | // TODO Auto-generated method stub |
| 134 | return null; |
| 135 | } |
| 136 | |
| 137 | @Override |
| 138 | public Port getPort(DeviceId deviceId, PortNumber portNumber) { |
| 139 | // TODO Auto-generated method stub |
| 140 | return null; |
| 141 | } |
| 142 | |
| 143 | @Override |
| 144 | public boolean isAvailable(DeviceId deviceId) { |
| 145 | // TODO Auto-generated method stub |
| 146 | return false; |
| 147 | } |
Saurav Das | d5ec9e9 | 2017-01-17 10:40:18 -0800 | [diff] [blame] | 148 | |
| 149 | @Override |
| 150 | public String localStatus(DeviceId deviceId) { |
| 151 | // TODO Auto-generated method stub |
| 152 | return null; |
| 153 | } |
Avantika-Huawei | 9e848e8 | 2016-09-01 12:12:42 +0530 | [diff] [blame] | 154 | } |