jcc | d869723 | 2015-05-05 14:42:23 +0800 | [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.provider.tunnel; |
| 17 | |
| 18 | import static org.slf4j.LoggerFactory.getLogger; |
| 19 | |
| 20 | import org.apache.felix.scr.annotations.Activate; |
| 21 | import org.apache.felix.scr.annotations.Component; |
| 22 | import org.apache.felix.scr.annotations.Deactivate; |
| 23 | import org.apache.felix.scr.annotations.Reference; |
| 24 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 25 | import org.apache.felix.scr.annotations.Service; |
| 26 | import org.onosproject.cfg.ComponentConfigService; |
| 27 | import org.onosproject.net.ElementId; |
| 28 | import org.onosproject.net.Path; |
| 29 | import org.onosproject.net.provider.AbstractProvider; |
| 30 | import org.onosproject.net.provider.ProviderId; |
Thomas Vachuska | bf916ea | 2015-05-20 18:24:34 -0700 | [diff] [blame] | 31 | import org.onosproject.incubator.net.tunnel.Tunnel; |
| 32 | import org.onosproject.incubator.net.tunnel.TunnelDescription; |
| 33 | import org.onosproject.incubator.net.tunnel.TunnelId; |
| 34 | import org.onosproject.incubator.net.tunnel.TunnelProvider; |
| 35 | import org.onosproject.incubator.net.tunnel.TunnelProviderRegistry; |
| 36 | import org.onosproject.incubator.net.tunnel.TunnelProviderService; |
jcc | d869723 | 2015-05-05 14:42:23 +0800 | [diff] [blame] | 37 | import org.osgi.service.component.ComponentContext; |
| 38 | import org.slf4j.Logger; |
| 39 | |
| 40 | /** |
| 41 | * Provider of a fake network environment, i.e. devices, links, hosts, etc. To |
| 42 | * be used for benchmarking only. |
| 43 | */ |
| 44 | @Component(immediate = true) |
| 45 | @Service |
| 46 | public class DefaultTunnelProvider extends AbstractProvider |
| 47 | implements TunnelProvider { |
| 48 | |
| 49 | private static final Logger log = getLogger(DefaultTunnelProvider.class); |
| 50 | |
| 51 | static final String PROVIDER_ID = "org.onosproject.provider.tunnel.default"; |
| 52 | |
| 53 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 54 | protected ComponentConfigService cfgService; |
| 55 | |
| 56 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 57 | protected TunnelProviderRegistry tunnelProviderRegistry; |
| 58 | |
| 59 | TunnelProviderService service; |
| 60 | |
| 61 | /** |
| 62 | * Creates a Tunnel provider. |
| 63 | */ |
| 64 | public DefaultTunnelProvider() { |
| 65 | super(new ProviderId("default", PROVIDER_ID)); |
| 66 | } |
| 67 | |
| 68 | @Activate |
| 69 | public void activate(ComponentContext context) { |
jcc | d869723 | 2015-05-05 14:42:23 +0800 | [diff] [blame] | 70 | service = tunnelProviderRegistry.register(this); |
| 71 | log.info("Started"); |
| 72 | } |
| 73 | |
| 74 | @Deactivate |
| 75 | public void deactivate(ComponentContext context) { |
jcc | d869723 | 2015-05-05 14:42:23 +0800 | [diff] [blame] | 76 | tunnelProviderRegistry.unregister(this); |
| 77 | log.info("Stopped"); |
| 78 | } |
| 79 | |
| 80 | @Override |
| 81 | public void setupTunnel(Tunnel tunnel, Path path) { |
| 82 | // TODO Auto-generated method stub |
| 83 | |
| 84 | } |
| 85 | |
| 86 | @Override |
| 87 | public void setupTunnel(ElementId srcElement, Tunnel tunnel, Path path) { |
| 88 | // TODO Auto-generated method stub |
| 89 | |
| 90 | } |
| 91 | |
| 92 | @Override |
| 93 | public void releaseTunnel(Tunnel tunnel) { |
| 94 | // TODO Auto-generated method stub |
| 95 | |
| 96 | } |
| 97 | |
| 98 | @Override |
| 99 | public void releaseTunnel(ElementId srcElement, Tunnel tunnel) { |
| 100 | // TODO Auto-generated method stub |
| 101 | |
| 102 | } |
| 103 | |
| 104 | @Override |
| 105 | public void updateTunnel(Tunnel tunnel, Path path) { |
| 106 | // TODO Auto-generated method stub |
| 107 | |
| 108 | } |
| 109 | |
| 110 | @Override |
| 111 | public void updateTunnel(ElementId srcElement, Tunnel tunnel, Path path) { |
| 112 | // TODO Auto-generated method stub |
| 113 | |
| 114 | } |
| 115 | |
| 116 | @Override |
| 117 | public TunnelId tunnelAdded(TunnelDescription tunnel) { |
| 118 | return service.tunnelAdded(tunnel); |
| 119 | } |
| 120 | |
| 121 | @Override |
| 122 | public void tunnelRemoved(TunnelDescription tunnel) { |
| 123 | service.tunnelRemoved(tunnel); |
| 124 | } |
| 125 | |
| 126 | @Override |
| 127 | public void tunnelUpdated(TunnelDescription tunnel) { |
| 128 | service.tunnelUpdated(tunnel); |
| 129 | } |
| 130 | |
samuel | 7a5691a | 2015-05-23 00:36:32 +0800 | [diff] [blame^] | 131 | @Override |
| 132 | public Tunnel tunnelQueryById(TunnelId tunnelId) { |
| 133 | return service.tunnelQueryById(tunnelId); |
| 134 | } |
| 135 | |
jcc | d869723 | 2015-05-05 14:42:23 +0800 | [diff] [blame] | 136 | } |