diff options
Diffstat (limited to 'framework/src/onos/providers/ovsdb/tunnel')
4 files changed, 0 insertions, 368 deletions
diff --git a/framework/src/onos/providers/ovsdb/tunnel/pom.xml b/framework/src/onos/providers/ovsdb/tunnel/pom.xml deleted file mode 100644 index 455b1747..00000000 --- a/framework/src/onos/providers/ovsdb/tunnel/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0"?> -<!-- - ~ Copyright 2015 Open Networking Laboratory - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" - xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos-ovsdb-providers</artifactId> - <version>1.4.0-rc1</version> - </parent> - - <artifactId>onos-ovsdb-provider-tunnel</artifactId> - <packaging>bundle</packaging> - - <dependencies> - <dependency> - <groupId>org.easymock</groupId> - <artifactId>easymock</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - -</project> diff --git a/framework/src/onos/providers/ovsdb/tunnel/src/main/java/org/onosproject/ovsdb/provider/tunnel/OvsdbTunnelProvider.java b/framework/src/onos/providers/ovsdb/tunnel/src/main/java/org/onosproject/ovsdb/provider/tunnel/OvsdbTunnelProvider.java deleted file mode 100644 index 244e6fe0..00000000 --- a/framework/src/onos/providers/ovsdb/tunnel/src/main/java/org/onosproject/ovsdb/provider/tunnel/OvsdbTunnelProvider.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.provider.tunnel; - -import static org.slf4j.LoggerFactory.getLogger; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onosproject.incubator.net.tunnel.Tunnel; -import org.onosproject.incubator.net.tunnel.TunnelDescription; -import org.onosproject.incubator.net.tunnel.TunnelId; -import org.onosproject.incubator.net.tunnel.TunnelProvider; -import org.onosproject.incubator.net.tunnel.TunnelProviderRegistry; -import org.onosproject.incubator.net.tunnel.TunnelProviderService; -import org.onosproject.incubator.net.tunnel.TunnelService; -import org.onosproject.net.ElementId; -import org.onosproject.net.Path; -import org.onosproject.net.provider.AbstractProvider; -import org.onosproject.net.provider.ProviderId; -import org.slf4j.Logger; - -/** - * Provider which uses when tunnel added/removed. - */ -@Component(immediate = true) -@Service -public class OvsdbTunnelProvider extends AbstractProvider - implements TunnelProvider { - private final Logger log = getLogger(getClass()); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected TunnelProviderRegistry providerRegistry; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected TunnelService tunnelService; - - private TunnelProviderService providerService; - - @Activate - public void activate() { - providerService = providerRegistry.register(this); - log.info("Started"); - } - - @Deactivate - public void deactivate() { - providerRegistry.unregister(this); - providerService = null; - log.info("Stopped"); - } - - public OvsdbTunnelProvider() { - super(new ProviderId("ovsdb", "org.onosproject.ovsdb.provider.tunnel")); - } - - @Override - public void setupTunnel(Tunnel tunnel, Path path) { - // TODO: This will be implemented later. - } - - @Override - public void setupTunnel(ElementId srcElement, Tunnel tunnel, Path path) { - // TODO: This will be implemented later. - } - - @Override - public void releaseTunnel(Tunnel tunnel) { - // TODO: This will be implemented later. - } - - @Override - public void releaseTunnel(ElementId srcElement, Tunnel tunnel) { - // TODO: This will be implemented later. - } - - @Override - public void updateTunnel(Tunnel tunnel, Path path) { - // TODO: This will be implemented later. - } - - @Override - public void updateTunnel(ElementId srcElement, Tunnel tunnel, Path path) { - // TODO: This will be implemented later. - } - - @Override - public TunnelId tunnelAdded(TunnelDescription tunnel) { - return providerService.tunnelAdded(tunnel); - } - - @Override - public void tunnelRemoved(TunnelDescription tunnel) { - providerService.tunnelRemoved(tunnel); - } - - @Override - public void tunnelUpdated(TunnelDescription tunnel) { - providerService.tunnelUpdated(tunnel); - } - - @Override - public Tunnel tunnelQueryById(TunnelId tunnelId) { - // TODO: This will be implemented later. - return null; - } -} diff --git a/framework/src/onos/providers/ovsdb/tunnel/src/main/java/org/onosproject/ovsdb/provider/tunnel/package-info.java b/framework/src/onos/providers/ovsdb/tunnel/src/main/java/org/onosproject/ovsdb/provider/tunnel/package-info.java deleted file mode 100644 index 4f8a1095..00000000 --- a/framework/src/onos/providers/ovsdb/tunnel/src/main/java/org/onosproject/ovsdb/provider/tunnel/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - *Provider that uses ovsdb controller as a means of infrastructure tunnel discovery. - * - */ -package org.onosproject.ovsdb.provider.tunnel;
\ No newline at end of file diff --git a/framework/src/onos/providers/ovsdb/tunnel/src/test/java/org/onosproject/ovsdb/provider/tunnel/OvsdbTunnelProviderTest.java b/framework/src/onos/providers/ovsdb/tunnel/src/test/java/org/onosproject/ovsdb/provider/tunnel/OvsdbTunnelProviderTest.java deleted file mode 100644 index 3d1549e5..00000000 --- a/framework/src/onos/providers/ovsdb/tunnel/src/test/java/org/onosproject/ovsdb/provider/tunnel/OvsdbTunnelProviderTest.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.ovsdb.provider.tunnel; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.incubator.net.tunnel.DefaultTunnelDescription; -import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint; -import org.onosproject.incubator.net.tunnel.Tunnel; -import org.onosproject.incubator.net.tunnel.TunnelDescription; -import org.onosproject.incubator.net.tunnel.TunnelEndPoint; -import org.onosproject.incubator.net.tunnel.TunnelId; -import org.onosproject.incubator.net.tunnel.TunnelName; -import org.onosproject.incubator.net.tunnel.TunnelProvider; -import org.onosproject.incubator.net.tunnel.TunnelProviderRegistry; -import org.onosproject.incubator.net.tunnel.TunnelProviderService; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DefaultAnnotations; -import org.onosproject.net.DefaultLink; -import org.onosproject.net.DefaultPath; -import org.onosproject.net.Link; -import org.onosproject.net.SparseAnnotations; -import org.onosproject.net.provider.AbstractProviderService; -import org.onosproject.net.provider.ProviderId; - -/** - * Test for ovsdb tunnel provider. - */ -public class OvsdbTunnelProviderTest { - private final OvsdbTunnelProvider provider = new OvsdbTunnelProvider(); - private final TestTunnelRegistry tunnelRegistry = new TestTunnelRegistry(); - private TestTunnelProviderService providerService; - - @Before - public void setUp() { - provider.providerRegistry = tunnelRegistry; - provider.activate(); - } - - @Test - public void basics() { - assertNotNull("registration expected", providerService); - assertEquals("incorrect provider", provider, providerService.provider()); - } - - @Test - public void testTunnelAdded() { - TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf("192.168.1.1")); - TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf("192.168.1.3")); - SparseAnnotations annotations = DefaultAnnotations.builder() - .set("bandwidth", "1024").build(); - Link link = new DefaultLink( - this.provider.id(), - ConnectPoint.deviceConnectPoint("192.168.2.3/20"), - ConnectPoint.deviceConnectPoint("192.168.2.4/30"), - Link.Type.DIRECT); - List<Link> links = new ArrayList<Link>(); - links.add(link); - TunnelDescription tunnel = new DefaultTunnelDescription( - TunnelId.valueOf("1234"), - src, - dst, - Tunnel.Type.VXLAN, - new DefaultGroupId(0), - this.provider.id(), - TunnelName.tunnelName("tunnel12"), - new DefaultPath(this.provider.id(), links, 0.3), - annotations); - provider.tunnelAdded(tunnel); - assertEquals(1, providerService.tunnelSet.size()); - } - - @Test - public void testTunnelRemoved() { - TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf("192.168.1.1")); - TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf("192.168.1.3")); - SparseAnnotations annotations = DefaultAnnotations.builder() - .set("bandwidth", "1024").build(); - Link link = new DefaultLink( - this.provider.id(), - ConnectPoint.deviceConnectPoint("192.168.2.3/20"), - ConnectPoint.deviceConnectPoint("192.168.2.4/30"), - Link.Type.DIRECT); - List<Link> links = new ArrayList<Link>(); - links.add(link); - TunnelDescription tunnel = new DefaultTunnelDescription( - TunnelId.valueOf("1234"), - src, - dst, - Tunnel.Type.VXLAN, - new DefaultGroupId(0), - this.provider.id(), - TunnelName.tunnelName("tunnel1"), - new DefaultPath(this.provider.id(), links, 0.3), - annotations); - provider.tunnelRemoved(tunnel); - assertEquals(0, providerService.tunnelSet.size()); - } - - @After - public void tearDown() { - provider.deactivate(); - provider.providerRegistry = null; - } - - private class TestTunnelRegistry implements TunnelProviderRegistry { - - @Override - public TunnelProviderService register(TunnelProvider provider) { - providerService = new TestTunnelProviderService(provider); - return providerService; - } - - @Override - public void unregister(TunnelProvider provider) { - - } - - @Override - public Set<ProviderId> getProviders() { - return null; - } - - } - - private class TestTunnelProviderService - extends AbstractProviderService<TunnelProvider> - implements TunnelProviderService { - Set<TunnelDescription> tunnelSet = new HashSet<TunnelDescription>(); - - protected TestTunnelProviderService(TunnelProvider provider) { - super(provider); - } - - @Override - public TunnelId tunnelAdded(TunnelDescription tunnel) { - tunnelSet.add(tunnel); - return null; - } - - @Override - public void tunnelRemoved(TunnelDescription tunnel) { - tunnelSet.remove(tunnel); - } - - @Override - public void tunnelUpdated(TunnelDescription tunnel) { - - } - - @Override - public Tunnel tunnelQueryById(TunnelId tunnelId) { - return null; - } - - } -} |