Adding vnet provider and related interfaces.
Change-Id: I72820a7dd77ad09ba7bb63f1aa8dfdf12b382030
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProvider.java b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProvider.java
new file mode 100644
index 0000000..8e5b19a
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProvider.java
@@ -0,0 +1,31 @@
+package org.onosproject.incubator.net.virtual;
+
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.provider.Provider;
+
+/**
+ * Entity capable of providing traffic isolation constructs for use in
+ * implementation of virtual devices and virtual links.
+ */
+public interface VirtualNetworkProvider extends Provider {
+
+ /**
+ * Creates a network tunnel for all traffic from the specified source
+ * connection point to the indicated destination connection point.
+ *
+ * @param networkId virtual network identifier
+ * @param src source connection point
+ * @param dst destination connection point
+ */
+ TunnelId createTunnel(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
+
+ /**
+ * Destroys the specified network tunnel.
+ *
+ * @param networkId virtual network identifier
+ * @param tunnelId tunnel identifier
+ */
+ void destroyTunnel(NetworkId networkId, TunnelId tunnelId);
+
+}
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderRegistry.java b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderRegistry.java
new file mode 100644
index 0000000..4e89316
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderRegistry.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2014 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.incubator.net.virtual;
+
+import org.onosproject.net.provider.ProviderRegistry;
+
+/**
+ * Abstraction of a virtual network provider registry.
+ */
+public interface VirtualNetworkProviderRegistry
+ extends ProviderRegistry<VirtualNetworkProvider, VirtualNetworkProviderService> {
+}
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderService.java b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderService.java
new file mode 100644
index 0000000..cba933c
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderService.java
@@ -0,0 +1,11 @@
+package org.onosproject.incubator.net.virtual;
+
+import org.onosproject.net.provider.ProviderService;
+
+/**
+ * Service through which virtual network providers can inject information into
+ * the core.
+ */
+public interface VirtualNetworkProviderService extends ProviderService<VirtualNetworkProvider> {
+ // TODO: Add methods for notification of core about damaged tunnels, etc.
+}
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkManager.java
index 55bb630..fe9f884 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkManager.java
@@ -21,7 +21,6 @@
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
-import org.onosproject.event.AbstractListenerManager;
import org.onosproject.incubator.net.tunnel.TunnelId;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.TenantId;
@@ -31,6 +30,9 @@
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
import org.onosproject.incubator.net.virtual.VirtualNetworkEvent;
import org.onosproject.incubator.net.virtual.VirtualNetworkListener;
+import org.onosproject.incubator.net.virtual.VirtualNetworkProvider;
+import org.onosproject.incubator.net.virtual.VirtualNetworkProviderRegistry;
+import org.onosproject.incubator.net.virtual.VirtualNetworkProviderService;
import org.onosproject.incubator.net.virtual.VirtualNetworkService;
import org.onosproject.incubator.net.virtual.VirtualNetworkStore;
import org.onosproject.incubator.net.virtual.VirtualNetworkStoreDelegate;
@@ -39,6 +41,8 @@
import org.onosproject.net.DeviceId;
import org.onosproject.net.Port;
import org.onosproject.net.PortNumber;
+import org.onosproject.net.provider.AbstractListenerProviderRegistry;
+import org.onosproject.net.provider.AbstractProviderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,8 +56,9 @@
@Component(immediate = true)
@Service
public class VirtualNetworkManager
- extends AbstractListenerManager<VirtualNetworkEvent, VirtualNetworkListener>
- implements VirtualNetworkService, VirtualNetworkAdminService {
+ extends AbstractListenerProviderRegistry<VirtualNetworkEvent, VirtualNetworkListener,
+ VirtualNetworkProvider, VirtualNetworkProviderService>
+ implements VirtualNetworkService, VirtualNetworkAdminService, VirtualNetworkProviderRegistry {
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -67,7 +72,7 @@
private VirtualNetworkStoreDelegate delegate = new InternalStoreDelegate();
- // TODO: figure out how to coordinate "implementation" of a virtual network
+ // TODO: figure out how to coordinate "implementation" of a virtual network in a cluster
@Activate
protected void activate() {
@@ -191,6 +196,21 @@
return null;
}
+ @Override
+ protected VirtualNetworkProviderService createProviderService(VirtualNetworkProvider provider) {
+ return new InternalVirtualNetworkProviderService(provider);
+ }
+
+ // Service issued to registered virtual network providers so that they
+ // can interact with the core.
+ private class InternalVirtualNetworkProviderService
+ extends AbstractProviderService<VirtualNetworkProvider>
+ implements VirtualNetworkProviderService {
+ InternalVirtualNetworkProviderService(VirtualNetworkProvider provider) {
+ super(provider);
+ }
+ }
+
// Auxiliary store delegate to receive notification about changes in
// the virtual network configuration store state - by the store itself.
private class InternalStoreDelegate implements VirtualNetworkStoreDelegate {