blob: 679b8c9ca336bb74d20416e86e215dbddd739db7 [file] [log] [blame]
David K. Bainbridge1a10d622018-05-07 12:32:27 -07001/*
2 * Copyright 2018-present Open Networking Foundation
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 */
16package org.onosproject.drivers.netconf;
17
18import java.util.ArrayList;
19import java.util.List;
20import java.util.stream.Collectors;
21
22import org.onosproject.net.Device;
23import org.onosproject.net.Device.Type;
24import org.onosproject.net.DeviceId;
25import org.onosproject.net.MastershipRole;
26import org.onosproject.net.Port;
27import org.onosproject.net.PortNumber;
28import org.onosproject.net.device.DeviceListener;
29import org.onosproject.net.device.DeviceService;
30import org.onosproject.net.device.PortStatistics;
31
32public class MockDeviceService implements DeviceService {
33
34 private List<Device> devices = new ArrayList<Device>();
35
36 public void addDevice(Device device) {
37 if (!devices.contains(device)) {
38 devices.add(device);
39 }
40 }
41
42 @Override
43 public void addListener(DeviceListener listener) {
44 // TODO Auto-generated method stub
45
46 }
47
48 @Override
49 public void removeListener(DeviceListener listener) {
50 // TODO Auto-generated method stub
51
52 }
53
54 @Override
55 public int getDeviceCount() {
56 return devices.size();
57 }
58
59 @Override
60 public Iterable<Device> getDevices() {
61 return new ArrayList<Device>(devices);
62 }
63
64 @Override
65 public Iterable<Device> getDevices(Type type) {
66 return devices.stream().filter(d -> d.type() == type).collect(Collectors.toList());
67 }
68
69 @Override
70 public Iterable<Device> getAvailableDevices() {
71 return new ArrayList<Device>(devices);
72 }
73
74 @Override
75 public Iterable<Device> getAvailableDevices(Type type) {
76 return devices.stream().filter(d -> d.type() == type).collect(Collectors.toList());
77 }
78
79 @Override
80 public Device getDevice(DeviceId deviceId) {
81 // TODO Auto-generated method stub
82 return null;
83 }
84
85 @Override
86 public MastershipRole getRole(DeviceId deviceId) {
87 // TODO Auto-generated method stub
88 return null;
89 }
90
91 @Override
92 public List<Port> getPorts(DeviceId deviceId) {
93 // TODO Auto-generated method stub
94 return null;
95 }
96
97 @Override
98 public List<PortStatistics> getPortStatistics(DeviceId deviceId) {
99 // TODO Auto-generated method stub
100 return null;
101 }
102
103 @Override
104 public List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId) {
105 // TODO Auto-generated method stub
106 return null;
107 }
108
109 @Override
110 public Port getPort(DeviceId deviceId, PortNumber portNumber) {
111 // TODO Auto-generated method stub
112 return null;
113 }
114
115 @Override
116 public boolean isAvailable(DeviceId deviceId) {
117 // TODO Auto-generated method stub
118 return false;
119 }
120
121 @Override
122 public String localStatus(DeviceId deviceId) {
123 // TODO Auto-generated method stub
124 return null;
125 }
126
127 @Override
128 public long getLastUpdatedInstant(DeviceId deviceId) {
129 // TODO Auto-generated method stub
130 return 0;
131 }
132
133}