blob: ba4fc0e2f2fac0ce91d9ba75f56fe74edf3ef8a0 [file] [log] [blame]
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
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;
Phaneendra Mandabd09d6e2016-07-15 19:47:51 +053023import org.onlab.packet.MacAddress;
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +053024import org.onosproject.net.DeviceId;
25import org.onosproject.vtnrsc.FixedIp;
26import org.onosproject.vtnrsc.TenantId;
Phaneendra Mandab212bc92016-07-08 16:50:11 +053027import org.onosproject.vtnrsc.TenantNetworkId;
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +053028import org.onosproject.vtnrsc.VirtualPort;
29import org.onosproject.vtnrsc.VirtualPortId;
Phaneendra Mandab212bc92016-07-08 16:50:11 +053030import org.onosproject.vtnrsc.virtualport.VirtualPortListener;
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +053031import org.onosproject.vtnrsc.virtualport.VirtualPortService;
32
33/**
34 * Provides implementation of the VirtualPort APIs.
35 */
Phaneendra Manda0f21ad62016-02-12 19:32:13 +053036public class VirtualPortAdapter implements VirtualPortService {
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +053037
38 protected ConcurrentMap<VirtualPortId, VirtualPort> vPortStore = new ConcurrentHashMap<>();
39
40 @Override
41 public boolean exists(VirtualPortId vPortId) {
42 return vPortStore.containsKey(vPortId);
43 }
44
45 @Override
46 public VirtualPort getPort(VirtualPortId vPortId) {
47 return vPortStore.get(vPortId);
48 }
49
50 @Override
51 public VirtualPort getPort(FixedIp fixedIP) {
52 return null;
53 }
54
55 @Override
Phaneendra Mandabd09d6e2016-07-15 19:47:51 +053056 public VirtualPort getPort(MacAddress mac) {
57 return null;
58 }
59
60 @Override
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +053061 public Collection<VirtualPort> getPorts() {
62 return null;
63 }
64
65 @Override
66 public Collection<VirtualPort> getPorts(TenantNetworkId networkId) {
67 return null;
68 }
69
70 @Override
71 public Collection<VirtualPort> getPorts(TenantId tenantId) {
72 return null;
73 }
74
75 @Override
76 public Collection<VirtualPort> getPorts(DeviceId deviceId) {
77 return null;
78 }
79
80 @Override
81 public VirtualPort getPort(TenantNetworkId networkId, IpAddress ipAddress) {
82 return null;
83 }
84
85 @Override
86 public boolean createPorts(Iterable<VirtualPort> vPorts) {
87 for (VirtualPort vPort : vPorts) {
88 vPortStore.put(vPort.portId(), vPort);
89 if (!vPortStore.containsKey(vPort.portId())) {
90 return false;
91 }
92 }
93 return true;
94 }
95
96 @Override
97 public boolean updatePorts(Iterable<VirtualPort> vPorts) {
98 return true;
99 }
100
101 @Override
102 public boolean removePorts(Iterable<VirtualPortId> vPortIds) {
103 return true;
104 }
Phaneendra Mandab212bc92016-07-08 16:50:11 +0530105
106 @Override
107 public void addListener(VirtualPortListener listener) {
108 }
109
110 @Override
111 public void removeListener(VirtualPortListener listener) {
112 }
Mahesh Poojary Huaweic3e5da32015-12-04 02:35:37 +0530113}