Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame^] | 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.incubator.store.virtual.impl; |
| 17 | |
| 18 | import org.apache.felix.scr.annotations.Activate; |
| 19 | import org.apache.felix.scr.annotations.Component; |
| 20 | import org.apache.felix.scr.annotations.Deactivate; |
| 21 | import org.apache.felix.scr.annotations.Service; |
| 22 | import org.onosproject.incubator.net.tunnel.TunnelId; |
| 23 | import org.onosproject.incubator.net.virtual.DefaultVirtualDevice; |
| 24 | import org.onosproject.incubator.net.virtual.DefaultVirtualNetwork; |
| 25 | import org.onosproject.incubator.net.virtual.NetworkId; |
| 26 | import org.onosproject.incubator.net.virtual.TenantId; |
| 27 | import org.onosproject.incubator.net.virtual.VirtualDevice; |
| 28 | import org.onosproject.incubator.net.virtual.VirtualLink; |
| 29 | import org.onosproject.incubator.net.virtual.VirtualNetwork; |
| 30 | import org.onosproject.incubator.net.virtual.VirtualNetworkEvent; |
| 31 | import org.onosproject.incubator.net.virtual.VirtualNetworkStore; |
| 32 | import org.onosproject.incubator.net.virtual.VirtualNetworkStoreDelegate; |
| 33 | import org.onosproject.incubator.net.virtual.VirtualPort; |
| 34 | import org.onosproject.net.ConnectPoint; |
| 35 | import org.onosproject.net.DeviceId; |
| 36 | import org.onosproject.net.Port; |
| 37 | import org.onosproject.net.PortNumber; |
| 38 | import org.onosproject.store.AbstractStore; |
| 39 | import org.slf4j.Logger; |
| 40 | |
| 41 | import java.util.Set; |
| 42 | |
| 43 | import static org.slf4j.LoggerFactory.getLogger; |
| 44 | |
| 45 | /** |
| 46 | * Implementation of the network store. |
| 47 | */ |
| 48 | @Component(immediate = true) |
| 49 | @Service |
| 50 | public class DistributedVirtualNetworkStore |
| 51 | extends AbstractStore<VirtualNetworkEvent, VirtualNetworkStoreDelegate> |
| 52 | implements VirtualNetworkStore { |
| 53 | |
| 54 | private final Logger log = getLogger(getClass()); |
| 55 | |
| 56 | // TODO: track tenants by ID |
| 57 | // TODO: track networks by ID and by tenants |
| 58 | // TODO: track devices by network ID and device ID |
| 59 | // TODO: track devices by network ID |
| 60 | // TODO: setup block allocator for network IDs |
| 61 | |
| 62 | // TODO: notify delegate |
| 63 | |
| 64 | @Activate |
| 65 | public void activate() { |
| 66 | log.info("Started"); |
| 67 | } |
| 68 | |
| 69 | @Deactivate |
| 70 | public void deactivate() { |
| 71 | log.info("Stopped"); |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public void addTenantId(TenantId tenantId) { |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public void removeTenantId(TenantId tenantId) { |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | public Set<TenantId> getTenantIds() { |
| 84 | return null; |
| 85 | } |
| 86 | |
| 87 | @Override |
| 88 | public VirtualNetwork addNetwork(TenantId tenantId) { |
| 89 | return new DefaultVirtualNetwork(genNetworkId(), tenantId); |
| 90 | } |
| 91 | |
| 92 | private NetworkId genNetworkId() { |
| 93 | return NetworkId.networkId(0); // TODO: use a block allocator |
| 94 | } |
| 95 | |
| 96 | |
| 97 | @Override |
| 98 | public void removeNetwork(NetworkId networkId) { |
| 99 | } |
| 100 | |
| 101 | @Override |
| 102 | public VirtualDevice addDevice(NetworkId networkId, DeviceId deviceId) { |
| 103 | return new DefaultVirtualDevice(networkId, deviceId); |
| 104 | } |
| 105 | |
| 106 | @Override |
| 107 | public void removeDevice(NetworkId networkId, DeviceId deviceId) { |
| 108 | } |
| 109 | |
| 110 | @Override |
| 111 | public VirtualLink addLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst, TunnelId realizedBy) { |
| 112 | return null; |
| 113 | } |
| 114 | |
| 115 | @Override |
| 116 | public void removeLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst) { |
| 117 | } |
| 118 | |
| 119 | @Override |
| 120 | public VirtualPort addPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber, Port realizedBy) { |
| 121 | return null; |
| 122 | } |
| 123 | |
| 124 | @Override |
| 125 | public void removePort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber) { |
| 126 | } |
| 127 | |
| 128 | @Override |
| 129 | public Set<VirtualNetwork> getNetworks(TenantId tenantId) { |
| 130 | return null; |
| 131 | } |
| 132 | |
| 133 | @Override |
| 134 | public Set<VirtualDevice> getDevices(NetworkId networkId) { |
| 135 | return null; |
| 136 | } |
| 137 | |
| 138 | @Override |
| 139 | public Set<VirtualLink> getLinks(NetworkId networkId) { |
| 140 | return null; |
| 141 | } |
| 142 | |
| 143 | @Override |
| 144 | public Set<VirtualPort> getPorts(NetworkId networkId, DeviceId deviceId) { |
| 145 | return null; |
| 146 | } |
| 147 | } |