Mahesh Poojary Huawei | c3e5da3 | 2015-12-04 02:35:37 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Mahesh Poojary Huawei | c3e5da3 | 2015-12-04 02:35:37 +0530 | [diff] [blame] | 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; |
Mahesh Poojary Huawei | c3e5da3 | 2015-12-04 02:35:37 +0530 | [diff] [blame] | 19 | import java.util.concurrent.ConcurrentHashMap; |
Phaneendra Manda | b212bc9 | 2016-07-08 16:50:11 +0530 | [diff] [blame] | 20 | import java.util.concurrent.ConcurrentMap; |
Mahesh Poojary Huawei | c3e5da3 | 2015-12-04 02:35:37 +0530 | [diff] [blame] | 21 | |
| 22 | import org.onlab.packet.IpAddress; |
Phaneendra Manda | bd09d6e | 2016-07-15 19:47:51 +0530 | [diff] [blame] | 23 | import org.onlab.packet.MacAddress; |
Mahesh Poojary Huawei | c3e5da3 | 2015-12-04 02:35:37 +0530 | [diff] [blame] | 24 | import org.onosproject.net.DeviceId; |
| 25 | import org.onosproject.vtnrsc.FixedIp; |
| 26 | import org.onosproject.vtnrsc.TenantId; |
Phaneendra Manda | b212bc9 | 2016-07-08 16:50:11 +0530 | [diff] [blame] | 27 | import org.onosproject.vtnrsc.TenantNetworkId; |
Mahesh Poojary Huawei | c3e5da3 | 2015-12-04 02:35:37 +0530 | [diff] [blame] | 28 | import org.onosproject.vtnrsc.VirtualPort; |
| 29 | import org.onosproject.vtnrsc.VirtualPortId; |
Phaneendra Manda | b212bc9 | 2016-07-08 16:50:11 +0530 | [diff] [blame] | 30 | import org.onosproject.vtnrsc.virtualport.VirtualPortListener; |
Mahesh Poojary Huawei | c3e5da3 | 2015-12-04 02:35:37 +0530 | [diff] [blame] | 31 | import org.onosproject.vtnrsc.virtualport.VirtualPortService; |
| 32 | |
| 33 | /** |
| 34 | * Provides implementation of the VirtualPort APIs. |
| 35 | */ |
Phaneendra Manda | 0f21ad6 | 2016-02-12 19:32:13 +0530 | [diff] [blame] | 36 | public class VirtualPortAdapter implements VirtualPortService { |
Mahesh Poojary Huawei | c3e5da3 | 2015-12-04 02:35:37 +0530 | [diff] [blame] | 37 | |
| 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 Manda | bd09d6e | 2016-07-15 19:47:51 +0530 | [diff] [blame] | 56 | public VirtualPort getPort(MacAddress mac) { |
| 57 | return null; |
| 58 | } |
| 59 | |
| 60 | @Override |
Mahesh Poojary Huawei | c3e5da3 | 2015-12-04 02:35:37 +0530 | [diff] [blame] | 61 | 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 Manda | b212bc9 | 2016-07-08 16:50:11 +0530 | [diff] [blame] | 105 | |
| 106 | @Override |
| 107 | public void addListener(VirtualPortListener listener) { |
| 108 | } |
| 109 | |
| 110 | @Override |
| 111 | public void removeListener(VirtualPortListener listener) { |
| 112 | } |
Mahesh Poojary Huawei | c3e5da3 | 2015-12-04 02:35:37 +0530 | [diff] [blame] | 113 | } |