blob: e51c699738754082837361c31a14b1ba1cca75e5 [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;
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +053019import java.util.concurrent.ConcurrentHashMap;
Phaneendra Mandab212bc92016-07-08 16:50:11 +053020import java.util.concurrent.ConcurrentMap;
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +053021
22import org.onlab.packet.IpAddress;
23import org.onosproject.net.DeviceId;
24import org.onosproject.vtnrsc.FixedIp;
25import org.onosproject.vtnrsc.TenantId;
Phaneendra Mandab212bc92016-07-08 16:50:11 +053026import org.onosproject.vtnrsc.TenantNetworkId;
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +053027import org.onosproject.vtnrsc.VirtualPort;
28import org.onosproject.vtnrsc.VirtualPortId;
Phaneendra Mandab212bc92016-07-08 16:50:11 +053029import org.onosproject.vtnrsc.virtualport.VirtualPortListener;
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +053030import org.onosproject.vtnrsc.virtualport.VirtualPortService;
31
32/**
33 * Provides implementation of the VirtualPort APIs.
34 */
Phaneendra Manda0f21ad62016-02-12 19:32:13 +053035public class VirtualPortAdapter implements VirtualPortService {
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +053036
37 protected ConcurrentMap<VirtualPortId, VirtualPort> vPortStore = new ConcurrentHashMap<>();
38
39 @Override
40 public boolean exists(VirtualPortId vPortId) {
41 return vPortStore.containsKey(vPortId);
42 }
43
44 @Override
45 public VirtualPort getPort(VirtualPortId vPortId) {
46 return vPortStore.get(vPortId);
47 }
48
49 @Override
50 public VirtualPort getPort(FixedIp fixedIP) {
51 return null;
52 }
53
54 @Override
55 public Collection<VirtualPort> getPorts() {
56 return null;
57 }
58
59 @Override
60 public Collection<VirtualPort> getPorts(TenantNetworkId networkId) {
61 return null;
62 }
63
64 @Override
65 public Collection<VirtualPort> getPorts(TenantId tenantId) {
66 return null;
67 }
68
69 @Override
70 public Collection<VirtualPort> getPorts(DeviceId deviceId) {
71 return null;
72 }
73
74 @Override
75 public VirtualPort getPort(TenantNetworkId networkId, IpAddress ipAddress) {
76 return null;
77 }
78
79 @Override
80 public boolean createPorts(Iterable<VirtualPort> vPorts) {
81 for (VirtualPort vPort : vPorts) {
82 vPortStore.put(vPort.portId(), vPort);
83 if (!vPortStore.containsKey(vPort.portId())) {
84 return false;
85 }
86 }
87 return true;
88 }
89
90 @Override
91 public boolean updatePorts(Iterable<VirtualPort> vPorts) {
92 return true;
93 }
94
95 @Override
96 public boolean removePorts(Iterable<VirtualPortId> vPortIds) {
97 return true;
98 }
Phaneendra Mandab212bc92016-07-08 16:50:11 +053099
100 @Override
101 public void addListener(VirtualPortListener listener) {
102 }
103
104 @Override
105 public void removeListener(VirtualPortListener listener) {
106 }
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +0530107}