blob: cc2c265365ac068146e25688d005c18208c0ebd5 [file] [log] [blame]
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +05303 *
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.sfc.util;
17
18import java.util.Collection;
19import java.util.concurrent.ConcurrentMap;
20import java.util.concurrent.ConcurrentHashMap;
21
22import org.onlab.packet.IpAddress;
23import org.onosproject.net.DeviceId;
24import org.onosproject.vtnrsc.FixedIp;
25import org.onosproject.vtnrsc.TenantId;
26import org.onosproject.vtnrsc.VirtualPort;
27import org.onosproject.vtnrsc.VirtualPortId;
28import org.onosproject.vtnrsc.TenantNetworkId;
29import org.onosproject.vtnrsc.virtualport.VirtualPortService;
30
31/**
32 * Provides implementation of the VirtualPort APIs.
33 */
Phaneendra Manda0f21ad62016-02-12 19:32:13 +053034public class VirtualPortAdapter implements VirtualPortService {
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +053035
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}