Committed by
Thomas Vachuska
[ONOS-3162] Test stub on VirtualPortManager
Change-Id: I2ca92c53cdb42120c3a647a3e9723ca800f7c58b
Showing
1 changed file
with
98 additions
and
0 deletions
1 | +/* | ||
2 | + * Copyright 2015 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.sfc.util; | ||
17 | + | ||
18 | +import java.util.Collection; | ||
19 | +import java.util.concurrent.ConcurrentMap; | ||
20 | +import java.util.concurrent.ConcurrentHashMap; | ||
21 | + | ||
22 | +import org.onlab.packet.IpAddress; | ||
23 | +import org.onosproject.net.DeviceId; | ||
24 | +import org.onosproject.vtnrsc.FixedIp; | ||
25 | +import org.onosproject.vtnrsc.TenantId; | ||
26 | +import org.onosproject.vtnrsc.VirtualPort; | ||
27 | +import org.onosproject.vtnrsc.VirtualPortId; | ||
28 | +import org.onosproject.vtnrsc.TenantNetworkId; | ||
29 | +import org.onosproject.vtnrsc.virtualport.VirtualPortService; | ||
30 | + | ||
31 | +/** | ||
32 | + * Provides implementation of the VirtualPort APIs. | ||
33 | + */ | ||
34 | +public class VirtualPortManagerTestImpl implements VirtualPortService { | ||
35 | + | ||
36 | + protected ConcurrentMap<VirtualPortId, VirtualPort> vPortStore = new ConcurrentHashMap<>(); | ||
37 | + | ||
38 | + @Override | ||
39 | + public boolean exists(VirtualPortId vPortId) { | ||
40 | + return vPortStore.containsKey(vPortId); | ||
41 | + } | ||
42 | + | ||
43 | + @Override | ||
44 | + public VirtualPort getPort(VirtualPortId vPortId) { | ||
45 | + return vPortStore.get(vPortId); | ||
46 | + } | ||
47 | + | ||
48 | + @Override | ||
49 | + public VirtualPort getPort(FixedIp fixedIP) { | ||
50 | + return null; | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public Collection<VirtualPort> getPorts() { | ||
55 | + return null; | ||
56 | + } | ||
57 | + | ||
58 | + @Override | ||
59 | + public Collection<VirtualPort> getPorts(TenantNetworkId networkId) { | ||
60 | + return null; | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public Collection<VirtualPort> getPorts(TenantId tenantId) { | ||
65 | + return null; | ||
66 | + } | ||
67 | + | ||
68 | + @Override | ||
69 | + public Collection<VirtualPort> getPorts(DeviceId deviceId) { | ||
70 | + return null; | ||
71 | + } | ||
72 | + | ||
73 | + @Override | ||
74 | + public VirtualPort getPort(TenantNetworkId networkId, IpAddress ipAddress) { | ||
75 | + return null; | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + public boolean createPorts(Iterable<VirtualPort> vPorts) { | ||
80 | + for (VirtualPort vPort : vPorts) { | ||
81 | + vPortStore.put(vPort.portId(), vPort); | ||
82 | + if (!vPortStore.containsKey(vPort.portId())) { | ||
83 | + return false; | ||
84 | + } | ||
85 | + } | ||
86 | + return true; | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public boolean updatePorts(Iterable<VirtualPort> vPorts) { | ||
91 | + return true; | ||
92 | + } | ||
93 | + | ||
94 | + @Override | ||
95 | + public boolean removePorts(Iterable<VirtualPortId> vPortIds) { | ||
96 | + return true; | ||
97 | + } | ||
98 | +} |
-
Please register or login to post a comment