YuanyouZhang | 6683a07 | 2015-07-22 17:38:31 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
YuanyouZhang | 6683a07 | 2015-07-22 17:38:31 +0800 | [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.ovsdb.provider.tunnel; |
| 17 | |
YuanyouZhang | 6683a07 | 2015-07-22 17:38:31 +0800 | [diff] [blame] | 18 | import org.onosproject.incubator.net.tunnel.Tunnel; |
| 19 | import org.onosproject.incubator.net.tunnel.TunnelDescription; |
| 20 | import org.onosproject.incubator.net.tunnel.TunnelId; |
| 21 | import org.onosproject.incubator.net.tunnel.TunnelProvider; |
| 22 | import org.onosproject.incubator.net.tunnel.TunnelProviderRegistry; |
| 23 | import org.onosproject.incubator.net.tunnel.TunnelProviderService; |
YuanyouZhang | 6683a07 | 2015-07-22 17:38:31 +0800 | [diff] [blame] | 24 | import org.onosproject.net.ElementId; |
| 25 | import org.onosproject.net.Path; |
| 26 | import org.onosproject.net.provider.AbstractProvider; |
| 27 | import org.onosproject.net.provider.ProviderId; |
Ray Milkey | d84f89b | 2018-08-17 14:54:17 -0700 | [diff] [blame] | 28 | import org.osgi.service.component.annotations.Activate; |
| 29 | import org.osgi.service.component.annotations.Component; |
| 30 | import org.osgi.service.component.annotations.Deactivate; |
| 31 | import org.osgi.service.component.annotations.Reference; |
| 32 | import org.osgi.service.component.annotations.ReferenceCardinality; |
YuanyouZhang | 6683a07 | 2015-07-22 17:38:31 +0800 | [diff] [blame] | 33 | import org.slf4j.Logger; |
| 34 | |
Ray Milkey | d84f89b | 2018-08-17 14:54:17 -0700 | [diff] [blame] | 35 | import static org.slf4j.LoggerFactory.getLogger; |
| 36 | |
YuanyouZhang | 6683a07 | 2015-07-22 17:38:31 +0800 | [diff] [blame] | 37 | /** |
| 38 | * Provider which uses when tunnel added/removed. |
| 39 | */ |
Ray Milkey | d84f89b | 2018-08-17 14:54:17 -0700 | [diff] [blame] | 40 | @Component(immediate = true, service = TunnelProvider.class) |
YuanyouZhang | 6683a07 | 2015-07-22 17:38:31 +0800 | [diff] [blame] | 41 | public class OvsdbTunnelProvider extends AbstractProvider |
| 42 | implements TunnelProvider { |
| 43 | private final Logger log = getLogger(getClass()); |
| 44 | |
Ray Milkey | d84f89b | 2018-08-17 14:54:17 -0700 | [diff] [blame] | 45 | @Reference(cardinality = ReferenceCardinality.MANDATORY) |
YuanyouZhang | 6683a07 | 2015-07-22 17:38:31 +0800 | [diff] [blame] | 46 | protected TunnelProviderRegistry providerRegistry; |
| 47 | |
YuanyouZhang | 6683a07 | 2015-07-22 17:38:31 +0800 | [diff] [blame] | 48 | private TunnelProviderService providerService; |
| 49 | |
| 50 | @Activate |
| 51 | public void activate() { |
| 52 | providerService = providerRegistry.register(this); |
| 53 | log.info("Started"); |
| 54 | } |
| 55 | |
| 56 | @Deactivate |
| 57 | public void deactivate() { |
| 58 | providerRegistry.unregister(this); |
| 59 | providerService = null; |
| 60 | log.info("Stopped"); |
| 61 | } |
| 62 | |
| 63 | public OvsdbTunnelProvider() { |
| 64 | super(new ProviderId("ovsdb", "org.onosproject.ovsdb.provider.tunnel")); |
| 65 | } |
| 66 | |
| 67 | @Override |
| 68 | public void setupTunnel(Tunnel tunnel, Path path) { |
| 69 | // TODO: This will be implemented later. |
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | public void setupTunnel(ElementId srcElement, Tunnel tunnel, Path path) { |
| 74 | // TODO: This will be implemented later. |
| 75 | } |
| 76 | |
| 77 | @Override |
| 78 | public void releaseTunnel(Tunnel tunnel) { |
| 79 | // TODO: This will be implemented later. |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | public void releaseTunnel(ElementId srcElement, Tunnel tunnel) { |
| 84 | // TODO: This will be implemented later. |
| 85 | } |
| 86 | |
| 87 | @Override |
| 88 | public void updateTunnel(Tunnel tunnel, Path path) { |
| 89 | // TODO: This will be implemented later. |
| 90 | } |
| 91 | |
| 92 | @Override |
| 93 | public void updateTunnel(ElementId srcElement, Tunnel tunnel, Path path) { |
| 94 | // TODO: This will be implemented later. |
| 95 | } |
| 96 | |
| 97 | @Override |
| 98 | public TunnelId tunnelAdded(TunnelDescription tunnel) { |
| 99 | return providerService.tunnelAdded(tunnel); |
| 100 | } |
| 101 | |
| 102 | @Override |
| 103 | public void tunnelRemoved(TunnelDescription tunnel) { |
| 104 | providerService.tunnelRemoved(tunnel); |
| 105 | } |
| 106 | |
| 107 | @Override |
| 108 | public void tunnelUpdated(TunnelDescription tunnel) { |
| 109 | providerService.tunnelUpdated(tunnel); |
| 110 | } |
| 111 | |
| 112 | @Override |
| 113 | public Tunnel tunnelQueryById(TunnelId tunnelId) { |
| 114 | // TODO: This will be implemented later. |
| 115 | return null; |
| 116 | } |
| 117 | } |