(vNet) fix:introduce virtual network service adapter
Introduced virtual network servic (and amdin) service adapter as
a effort to refactor the test codes.
Change-Id: I4c809d90a76a9d8d636610ac6d5308693e2ab204
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkService.java b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkService.java
index 1c05a2b..da791de 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkService.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkService.java
@@ -21,11 +21,8 @@
import org.onosproject.event.ListenerService;
import org.onosproject.net.DeviceId;
-import java.util.HashSet;
import java.util.Set;
-import static com.google.common.base.Preconditions.checkNotNull;
-
/**
* Service for querying virtual network inventory.
*/
@@ -96,22 +93,8 @@
* @param virtualDevice the virtual device
* @return collection of the specified device's identifier
*/
- default Set<DeviceId> getPhysicalDevices(NetworkId networkId,
- VirtualDevice virtualDevice) {
- checkNotNull(networkId, "Network ID cannot be null");
- checkNotNull(virtualDevice, "Virtual device cannot be null");
- Set<VirtualPort> virtualPortSet =
- getVirtualPorts(networkId, virtualDevice.id());
- Set<DeviceId> physicalDeviceSet = new HashSet<>();
-
- virtualPortSet.forEach(virtualPort -> {
- if (virtualPort.realizedBy() != null) {
- physicalDeviceSet.add(virtualPort.realizedBy().deviceId());
- }
- });
-
- return physicalDeviceSet;
- }
+ Set<DeviceId> getPhysicalDevices(NetworkId networkId,
+ VirtualDevice virtualDevice);
/**
* Returns implementation of the specified service class for operating
diff --git a/incubator/api/src/test/java/org/onosproject/incubator/net/virtual/VirtualNetworkAdminServiceAdapter.java b/incubator/api/src/test/java/org/onosproject/incubator/net/virtual/VirtualNetworkAdminServiceAdapter.java
new file mode 100644
index 0000000..673d455
--- /dev/null
+++ b/incubator/api/src/test/java/org/onosproject/incubator/net/virtual/VirtualNetworkAdminServiceAdapter.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2017-present 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.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.HostId;
+import org.onosproject.net.HostLocation;
+import org.onosproject.net.PortNumber;
+
+import java.util.Set;
+
+/**
+ * Test adapter for virtual network admin service.
+ */
+public class VirtualNetworkAdminServiceAdapter
+ extends VirtualNetworkServiceAdapter
+ implements VirtualNetworkAdminService {
+
+ @Override
+ public void registerTenantId(TenantId tenantId) {
+
+ }
+
+ @Override
+ public void unregisterTenantId(TenantId tenantId) {
+
+ }
+
+ @Override
+ public Set<TenantId> getTenantIds() {
+ return null;
+ }
+
+ @Override
+ public VirtualNetwork createVirtualNetwork(TenantId tenantId) {
+ return null;
+ }
+
+ @Override
+ public void removeVirtualNetwork(NetworkId networkId) {
+
+ }
+
+ @Override
+ public VirtualDevice createVirtualDevice(NetworkId networkId, DeviceId deviceId) {
+ return null;
+ }
+
+ @Override
+ public void removeVirtualDevice(NetworkId networkId, DeviceId deviceId) {
+
+ }
+
+ @Override
+ public VirtualHost createVirtualHost(NetworkId networkId, HostId hostId,
+ MacAddress mac, VlanId vlan,
+ HostLocation location, Set<IpAddress> ips) {
+ return null;
+ }
+
+ @Override
+ public void removeVirtualHost(NetworkId networkId, HostId hostId) {
+
+ }
+
+ @Override
+ public VirtualLink createVirtualLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst) {
+ return null;
+ }
+
+ @Override
+ public void removeVirtualLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst) {
+
+ }
+
+ @Override
+ public VirtualPort createVirtualPort(NetworkId networkId, DeviceId deviceId,
+ PortNumber portNumber, ConnectPoint realizedBy) {
+ return null;
+ }
+
+ @Override
+ public void bindVirtualPort(NetworkId networkId, DeviceId deviceId,
+ PortNumber portNumber, ConnectPoint realizedBy) {
+
+ }
+
+ @Override
+ public void removeVirtualPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber) {
+
+ }
+}
diff --git a/incubator/api/src/test/java/org/onosproject/incubator/net/virtual/VirtualNetworkServiceAdapter.java b/incubator/api/src/test/java/org/onosproject/incubator/net/virtual/VirtualNetworkServiceAdapter.java
new file mode 100644
index 0000000..ebfd8da
--- /dev/null
+++ b/incubator/api/src/test/java/org/onosproject/incubator/net/virtual/VirtualNetworkServiceAdapter.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2017-present 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.onlab.osgi.ServiceDirectory;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.DeviceId;
+
+import java.util.Set;
+
+/**
+ * Test adapter for virtual network service.
+ */
+public abstract class VirtualNetworkServiceAdapter implements VirtualNetworkService {
+ @Override
+ public void addListener(VirtualNetworkListener listener) {
+
+ }
+
+ @Override
+ public void removeListener(VirtualNetworkListener listener) {
+
+ }
+
+ @Override
+ public Set<VirtualNetwork> getVirtualNetworks(TenantId tenantId) {
+ return null;
+ }
+
+ @Override
+ public Set<VirtualDevice> getVirtualDevices(NetworkId networkId) {
+ return null;
+ }
+
+ @Override
+ public Set<VirtualHost> getVirtualHosts(NetworkId networkId) {
+ return null;
+ }
+
+ @Override
+ public Set<VirtualLink> getVirtualLinks(NetworkId networkId) {
+ return null;
+ }
+
+ @Override
+ public Set<VirtualPort> getVirtualPorts(NetworkId networkId, DeviceId deviceId) {
+ return null;
+ }
+
+ @Override
+ public Set<DeviceId> getPhysicalDevices(NetworkId networkId, VirtualDevice virtualDevice) {
+ return null;
+ }
+
+ @Override
+ public <T> T get(NetworkId networkId, Class<T> serviceClass) {
+ return null;
+ }
+
+ @Override
+ public ServiceDirectory getServiceDirectory() {
+ return null;
+ }
+
+ @Override
+ public ApplicationId getVirtualNetworkApplicationId(NetworkId networkId) {
+ return null;
+ }
+}
diff --git a/incubator/api/src/test/java/org/onosproject/incubator/net/virtual/event/AbstractVirtualListenerManagerTest.java b/incubator/api/src/test/java/org/onosproject/incubator/net/virtual/event/AbstractVirtualListenerManagerTest.java
index a7363be..299d8cb 100644
--- a/incubator/api/src/test/java/org/onosproject/incubator/net/virtual/event/AbstractVirtualListenerManagerTest.java
+++ b/incubator/api/src/test/java/org/onosproject/incubator/net/virtual/event/AbstractVirtualListenerManagerTest.java
@@ -22,22 +22,14 @@
import org.junit.Before;
import org.junit.Test;
import org.onlab.osgi.ServiceDirectory;
-import org.onosproject.core.ApplicationId;
import org.onosproject.event.AbstractEvent;
import org.onosproject.event.Event;
import org.onosproject.event.EventDeliveryService;
import org.onosproject.event.EventListener;
import org.onosproject.event.EventSink;
import org.onosproject.incubator.net.virtual.NetworkId;
-import org.onosproject.incubator.net.virtual.TenantId;
-import org.onosproject.incubator.net.virtual.VirtualDevice;
-import org.onosproject.incubator.net.virtual.VirtualHost;
-import org.onosproject.incubator.net.virtual.VirtualLink;
-import org.onosproject.incubator.net.virtual.VirtualNetwork;
-import org.onosproject.incubator.net.virtual.VirtualNetworkListener;
import org.onosproject.incubator.net.virtual.VirtualNetworkService;
-import org.onosproject.incubator.net.virtual.VirtualPort;
-import org.onosproject.net.DeviceId;
+import org.onosproject.incubator.net.virtual.VirtualNetworkServiceAdapter;
import java.util.ArrayList;
import java.util.List;
@@ -254,7 +246,7 @@
}
}
- private class TestVirtualNetworkManager implements VirtualNetworkService {
+ private class TestVirtualNetworkManager extends VirtualNetworkServiceAdapter {
TestServiceDirectory serviceDirectory = new TestServiceDirectory();
public TestVirtualNetworkManager() {
@@ -262,54 +254,9 @@
}
@Override
- public Set<VirtualNetwork> getVirtualNetworks(TenantId tenantId) {
- return null;
- }
-
- @Override
- public Set<VirtualDevice> getVirtualDevices(NetworkId networkId) {
- return null;
- }
-
- @Override
- public Set<VirtualHost> getVirtualHosts(NetworkId networkId) {
- return null;
- }
-
- @Override
- public Set<VirtualLink> getVirtualLinks(NetworkId networkId) {
- return null;
- }
-
- @Override
- public Set<VirtualPort> getVirtualPorts(NetworkId networkId, DeviceId deviceId) {
- return null;
- }
-
- @Override
- public <T> T get(NetworkId networkId, Class<T> serviceClass) {
- return null;
- }
-
- @Override
public ServiceDirectory getServiceDirectory() {
return serviceDirectory;
}
-
- @Override
- public ApplicationId getVirtualNetworkApplicationId(NetworkId networkId) {
- return null;
- }
-
- @Override
- public void addListener(VirtualNetworkListener listener) {
-
- }
-
- @Override
- public void removeListener(VirtualNetworkListener listener) {
-
- }
}
private class TestServiceDirectory implements ServiceDirectory {
diff --git a/incubator/net/BUCK b/incubator/net/BUCK
index 9790bed..8801df3 100644
--- a/incubator/net/BUCK
+++ b/incubator/net/BUCK
@@ -8,6 +8,7 @@
]
TEST_DEPS = [
+ '//incubator/api:onos-incubator-api-tests',
'//lib:TEST_REST',
'//lib:TEST_ADAPTERS',
'//core/api:onos-api-tests',
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 ff3c696..96979f5 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
@@ -16,6 +16,7 @@
package org.onosproject.incubator.net.virtual.impl;
import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -361,6 +362,24 @@
return store.getPorts(networkId, deviceId);
}
+ @Override
+ public Set<DeviceId> getPhysicalDevices(NetworkId networkId,
+ VirtualDevice virtualDevice) {
+ checkNotNull(networkId, "Network ID cannot be null");
+ checkNotNull(virtualDevice, "Virtual device cannot be null");
+ Set<VirtualPort> virtualPortSet =
+ getVirtualPorts(networkId, virtualDevice.id());
+ Set<DeviceId> physicalDeviceSet = Sets.newConcurrentHashSet();
+
+ virtualPortSet.forEach(virtualPort -> {
+ if (virtualPort.realizedBy() != null) {
+ physicalDeviceSet.add(virtualPort.realizedBy().deviceId());
+ }
+ });
+
+ return physicalDeviceSet;
+ }
+
private final Map<ServiceKey, VnetService> networkServices = Maps.newConcurrentMap();
@Override
diff --git a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualFlowRuleProviderTest.java b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualFlowRuleProviderTest.java
index e268f32..01129af 100644
--- a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualFlowRuleProviderTest.java
+++ b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualFlowRuleProviderTest.java
@@ -21,25 +21,18 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreServiceAdapter;
import org.onosproject.core.DefaultApplicationId;
-import org.onosproject.core.IdGenerator;
import org.onosproject.incubator.net.virtual.DefaultVirtualDevice;
import org.onosproject.incubator.net.virtual.DefaultVirtualNetwork;
import org.onosproject.incubator.net.virtual.DefaultVirtualPort;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.TenantId;
import org.onosproject.incubator.net.virtual.VirtualDevice;
-import org.onosproject.incubator.net.virtual.VirtualHost;
import org.onosproject.incubator.net.virtual.VirtualLink;
import org.onosproject.incubator.net.virtual.VirtualNetwork;
-import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
-import org.onosproject.incubator.net.virtual.VirtualNetworkListener;
+import org.onosproject.incubator.net.virtual.VirtualNetworkAdminServiceAdapter;
import org.onosproject.incubator.net.virtual.VirtualPort;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultAnnotations;
@@ -49,8 +42,6 @@
import org.onosproject.net.DefaultPort;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.HostId;
-import org.onosproject.net.HostLocation;
import org.onosproject.net.Link;
import org.onosproject.net.Path;
import org.onosproject.net.Port;
@@ -76,7 +67,6 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
import static org.junit.Assert.assertEquals;
@@ -307,18 +297,6 @@
public ApplicationId registerApplication(String name) {
return new TestApplicationId(1, name);
}
-
- @Override
- public IdGenerator getIdGenerator(String topic) {
- return new IdGenerator() {
- private AtomicLong counter = new AtomicLong(0);
-
- @Override
- public long getNewId() {
- return counter.getAndIncrement();
- }
- };
- }
}
private static class TestApplicationId extends DefaultApplicationId {
@@ -328,12 +306,7 @@
}
private class TestVirtualNetworkAdminService
- implements VirtualNetworkAdminService {
-
- @Override
- public Set<VirtualNetwork> getVirtualNetworks(TenantId tenantId) {
- return null;
- }
+ extends VirtualNetworkAdminServiceAdapter {
@Override
public Set<VirtualDevice> getVirtualDevices(NetworkId networkId) {
@@ -341,11 +314,6 @@
}
@Override
- public Set<VirtualHost> getVirtualHosts(NetworkId networkId) {
- return null;
- }
-
- @Override
public Set<VirtualLink> getVirtualLinks(NetworkId networkId) {
return new HashSet<>();
}
@@ -357,112 +325,9 @@
}
@Override
- public <T> T get(NetworkId networkId, Class<T> serviceClass) {
- return null;
- }
-
- @Override
- public ServiceDirectory getServiceDirectory() {
- return null;
- }
-
- @Override
public ApplicationId getVirtualNetworkApplicationId(NetworkId networkId) {
return vAppId;
}
-
- @Override
- public void registerTenantId(TenantId tenantId) {
-
- }
-
- @Override
- public void unregisterTenantId(TenantId tenantId) {
-
- }
-
- @Override
- public Set<TenantId> getTenantIds() {
- return null;
- }
-
- @Override
- public VirtualNetwork createVirtualNetwork(TenantId tenantId) {
- return null;
- }
-
- @Override
- public void removeVirtualNetwork(NetworkId networkId) {
-
- }
-
- @Override
- public VirtualDevice createVirtualDevice(NetworkId networkId,
- DeviceId deviceId) {
- return null;
- }
-
- @Override
- public void removeVirtualDevice(NetworkId networkId, DeviceId deviceId) {
-
- }
-
- @Override
- public VirtualHost createVirtualHost(NetworkId networkId, HostId hostId,
- MacAddress mac, VlanId vlan,
- HostLocation location,
- Set<IpAddress> ips) {
- return null;
- }
-
- @Override
- public void removeVirtualHost(NetworkId networkId, HostId hostId) {
-
- }
-
- @Override
- public VirtualLink createVirtualLink(NetworkId networkId,
- ConnectPoint src, ConnectPoint dst) {
- return null;
- }
-
- @Override
- public void removeVirtualLink(NetworkId networkId,
- ConnectPoint src, ConnectPoint dst) {
-
- }
-
- @Override
- public VirtualPort createVirtualPort(NetworkId networkId,
- DeviceId deviceId,
- PortNumber portNumber,
- ConnectPoint realizedBy) {
- return null;
- }
-
- @Override
- public void bindVirtualPort(NetworkId networkId,
- DeviceId deviceId,
- PortNumber portNumber,
- ConnectPoint realizedBy) {
-
- }
-
- @Override
- public void removeVirtualPort(NetworkId networkId, DeviceId deviceId,
- PortNumber portNumber) {
-
- }
-
- @Override
- public void addListener(VirtualNetworkListener listener) {
-
- }
-
- @Override
- public void removeListener(VirtualNetworkListener listener) {
-
- }
}
private static class TestTopologyService extends TopologyServiceAdapter {
diff --git a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualPacketProviderTest.java b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualPacketProviderTest.java
index 32c6a30..42a3645 100644
--- a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualPacketProviderTest.java
+++ b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualPacketProviderTest.java
@@ -20,10 +20,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onlab.osgi.ServiceDirectory;
import org.onlab.packet.Ethernet;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreServiceAdapter;
@@ -34,11 +31,8 @@
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.TenantId;
import org.onosproject.incubator.net.virtual.VirtualDevice;
-import org.onosproject.incubator.net.virtual.VirtualHost;
-import org.onosproject.incubator.net.virtual.VirtualLink;
import org.onosproject.incubator.net.virtual.VirtualNetwork;
-import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
-import org.onosproject.incubator.net.virtual.VirtualNetworkListener;
+import org.onosproject.incubator.net.virtual.VirtualNetworkAdminServiceAdapter;
import org.onosproject.incubator.net.virtual.VirtualPort;
import org.onosproject.incubator.net.virtual.provider.AbstractVirtualProviderService;
import org.onosproject.incubator.net.virtual.provider.VirtualPacketProvider;
@@ -50,8 +44,6 @@
import org.onosproject.net.DefaultPort;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.HostId;
-import org.onosproject.net.HostLocation;
import org.onosproject.net.Link;
import org.onosproject.net.Port;
import org.onosproject.net.PortNumber;
@@ -263,7 +255,7 @@
}
private static class TestVirtualNetworkAdminService
- implements VirtualNetworkAdminService {
+ extends VirtualNetworkAdminServiceAdapter {
@Override
public Set<VirtualNetwork> getVirtualNetworks(TenantId tenantId) {
@@ -276,133 +268,22 @@
}
@Override
- public Set<VirtualHost> getVirtualHosts(NetworkId networkId) {
- return null;
- }
-
- @Override
- public Set<VirtualLink> getVirtualLinks(NetworkId networkId) {
- return null;
- }
-
- @Override
public Set<VirtualPort> getVirtualPorts(NetworkId networkId,
DeviceId deviceId) {
return ImmutableSet.of(VPORT1, VPORT2);
}
@Override
- public <T> T get(NetworkId networkId, Class<T> serviceClass) {
- return null;
- }
-
- @Override
- public ServiceDirectory getServiceDirectory() {
- return null;
- }
-
- @Override
- public ApplicationId getVirtualNetworkApplicationId(NetworkId networkId) {
- return null;
- }
-
- @Override
- public void registerTenantId(TenantId tenantId) {
-
- }
-
- @Override
- public void unregisterTenantId(TenantId tenantId) {
-
- }
-
- @Override
public Set<TenantId> getTenantIds() {
return ImmutableSet.of(TENANT_ID);
}
- @Override
- public VirtualNetwork createVirtualNetwork(TenantId tenantId) {
- return null;
- }
-
- @Override
- public void removeVirtualNetwork(NetworkId networkId) {
-
- }
-
- @Override
- public VirtualDevice createVirtualDevice(NetworkId networkId,
- DeviceId deviceId) {
- return null;
- }
-
- @Override
- public void removeVirtualDevice(NetworkId networkId, DeviceId deviceId) {
-
- }
-
- @Override
- public VirtualHost createVirtualHost(NetworkId networkId, HostId hostId,
- MacAddress mac, VlanId vlan,
- HostLocation location,
- Set<IpAddress> ips) {
- return null;
- }
-
- @Override
- public void removeVirtualHost(NetworkId networkId, HostId hostId) {
-
- }
-
- @Override
- public VirtualLink createVirtualLink(NetworkId networkId,
- ConnectPoint src, ConnectPoint dst) {
- return null;
- }
-
- @Override
- public void removeVirtualLink(NetworkId networkId,
- ConnectPoint src, ConnectPoint dst) {
-
- }
-
- @Override
- public VirtualPort createVirtualPort(NetworkId networkId,
- DeviceId deviceId,
- PortNumber portNumber,
- ConnectPoint realizedBy) {
- return null;
- }
-
- @Override
- public void bindVirtualPort(NetworkId networkId,
- DeviceId deviceId,
- PortNumber portNumber,
- ConnectPoint realizedBy) {
-
- }
-
- @Override
- public void removeVirtualPort(NetworkId networkId, DeviceId deviceId,
- PortNumber portNumber) {
-
- }
-
- @Override
- public void addListener(VirtualNetworkListener listener) {
-
- }
-
- @Override
- public void removeListener(VirtualNetworkListener listener) {
-
- }
}
private static class TestVirtualPacketProviderService
extends AbstractVirtualProviderService<VirtualPacketProvider>
implements VirtualPacketProviderService {
+
static List<PacketContext> requestedContext = new LinkedList();
static List<NetworkId> requestedNetworkId = new LinkedList();
@@ -411,11 +292,7 @@
return null;
}
- public NetworkId getRequestedNetworkId(int index) {
- return requestedNetworkId.get(index);
- }
-
- public PacketContext getRequestedPacketContext(int index) {
+ PacketContext getRequestedPacketContext(int index) {
return requestedContext.get(index);
}
@@ -439,15 +316,15 @@
requestedPacket.add(packet);
}
- public OutboundPacket getRequestedPacket(int index) {
+ OutboundPacket getRequestedPacket(int index) {
return requestedPacket.get(index);
}
- public int getRequestedPacketCount() {
+ int getRequestedPacketCount() {
return requestedPacket.size();
}
- public void sendTestPacketContext(PacketContext context) {
+ void sendTestPacketContext(PacketContext context) {
processor.process(context);
}
}