tom

Added a slew of adapters to shorten the tests and to allow them to be used in more upcoming tests.

package org.onlab.onos.net.device;
import org.onlab.onos.net.Device;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.MastershipRole;
import org.onlab.onos.net.Port;
import org.onlab.onos.net.PortNumber;
import java.util.List;
/**
* Test adapter for device service.
*/
public class DeviceServiceAdapter implements DeviceService {
@Override
public int getDeviceCount() {
return 0;
}
@Override
public Iterable<Device> getDevices() {
return null;
}
@Override
public Device getDevice(DeviceId deviceId) {
return null;
}
@Override
public MastershipRole getRole(DeviceId deviceId) {
return null;
}
@Override
public List<Port> getPorts(DeviceId deviceId) {
return null;
}
@Override
public Port getPort(DeviceId deviceId, PortNumber portNumber) {
return null;
}
@Override
public boolean isAvailable(DeviceId deviceId) {
return false;
}
@Override
public void addListener(DeviceListener listener) {
}
@Override
public void removeListener(DeviceListener listener) {
}
}
package org.onlab.onos.net.host;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.Host;
import org.onlab.onos.net.HostId;
import org.onlab.packet.IPAddress;
import org.onlab.packet.MACAddress;
import org.onlab.packet.VLANID;
import java.util.Set;
/**
* Test adapter for host service.
*/
public class HostServiceAdapter implements HostService {
@Override
public int getHostCount() {
return 0;
}
@Override
public Iterable<Host> getHosts() {
return null;
}
@Override
public Host getHost(HostId hostId) {
return null;
}
@Override
public Set<Host> getHostsByVlan(VLANID vlanId) {
return null;
}
@Override
public Set<Host> getHostsByMac(MACAddress mac) {
return null;
}
@Override
public Set<Host> getHostsByIp(IPAddress ip) {
return null;
}
@Override
public Set<Host> getConnectedHosts(ConnectPoint connectPoint) {
return null;
}
@Override
public Set<Host> getConnectedHosts(DeviceId deviceId) {
return null;
}
@Override
public void addListener(HostListener listener) {
}
@Override
public void removeListener(HostListener listener) {
}
}
package org.onlab.onos.net.link;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.Link;
import java.util.Set;
/**
* Test adapter for link service.
*/
public class LinkServiceAdapter implements LinkService {
@Override
public int getLinkCount() {
return 0;
}
@Override
public Iterable<Link> getLinks() {
return null;
}
@Override
public Set<Link> getDeviceLinks(DeviceId deviceId) {
return null;
}
@Override
public Set<Link> getDeviceEgressLinks(DeviceId deviceId) {
return null;
}
@Override
public Set<Link> getDeviceIngressLinks(DeviceId deviceId) {
return null;
}
@Override
public Set<Link> getLinks(ConnectPoint connectPoint) {
return null;
}
@Override
public Set<Link> getEgressLinks(ConnectPoint connectPoint) {
return null;
}
@Override
public Set<Link> getIngressLinks(ConnectPoint connectPoint) {
return null;
}
@Override
public Link getLink(ConnectPoint src, ConnectPoint dst) {
return null;
}
@Override
public void addListener(LinkListener listener) {
}
@Override
public void removeListener(LinkListener listener) {
}
}
package org.onlab.onos.net.topology;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.Link;
import org.onlab.onos.net.Path;
import java.util.Set;
/**
* Test adapter for topology service.
*/
public class TopologyServiceAdapter implements TopologyService {
@Override
public Topology currentTopology() {
return null;
}
@Override
public boolean isLatest(Topology topology) {
return false;
}
@Override
public TopologyGraph getGraph(Topology topology) {
return null;
}
@Override
public Set<TopologyCluster> getClusters(Topology topology) {
return null;
}
@Override
public TopologyCluster getCluster(Topology topology, ClusterId clusterId) {
return null;
}
@Override
public Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster) {
return null;
}
@Override
public Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster) {
return null;
}
@Override
public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst) {
return null;
}
@Override
public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst, LinkWeight weight) {
return null;
}
@Override
public boolean isInfrastructure(Topology topology, ConnectPoint connectPoint) {
return false;
}
@Override
public boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint) {
return false;
}
@Override
public void addListener(TopologyListener listener) {
}
@Override
public void removeListener(TopologyListener listener) {
}
}
package org.onlab.onos.of.controller;
import org.projectfloodlight.openflow.protocol.OFMessage;
/**
* Test adapter for the OpenFlow controller interface.
*/
public class OpenflowControllerAdapter implements OpenFlowController {
@Override
public Iterable<OpenFlowSwitch> getSwitches() {
return null;
}
@Override
public Iterable<OpenFlowSwitch> getMasterSwitches() {
return null;
}
@Override
public Iterable<OpenFlowSwitch> getEqualSwitches() {
return null;
}
@Override
public OpenFlowSwitch getSwitch(Dpid dpid) {
return null;
}
@Override
public OpenFlowSwitch getMasterSwitch(Dpid dpid) {
return null;
}
@Override
public OpenFlowSwitch getEqualSwitch(Dpid dpid) {
return null;
}
@Override
public void addListener(OpenFlowSwitchListener listener) {
}
@Override
public void removeListener(OpenFlowSwitchListener listener) {
}
@Override
public void addPacketListener(int priority, PacketListener listener) {
}
@Override
public void removePacketListener(PacketListener listener) {
}
@Override
public void write(Dpid dpid, OFMessage msg) {
}
@Override
public void processPacket(Dpid dpid, OFMessage msg) {
}
@Override
public void setRole(Dpid dpid, RoleState role) {
}
}
......@@ -144,10 +144,24 @@
</dependency>
<dependency>
<groupId>org.onlab.onos</groupId>
<artifactId>onos-of-api</artifactId>
<artifactId>onos-api</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.onlab.onos</groupId>
<artifactId>onos-of-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onlab.onos</groupId>
<artifactId>onos-of-api</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
......
package org.onlab.onos.provider.of.host.impl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.util.Set;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.HostId;
import org.onlab.onos.net.Link;
import org.onlab.onos.net.Path;
import org.onlab.onos.net.host.HostDescription;
import org.onlab.onos.net.host.HostProvider;
import org.onlab.onos.net.host.HostProviderRegistry;
import org.onlab.onos.net.host.HostProviderService;
import org.onlab.onos.net.provider.AbstractProviderService;
import org.onlab.onos.net.provider.ProviderId;
import org.onlab.onos.net.topology.ClusterId;
import org.onlab.onos.net.topology.LinkWeight;
import org.onlab.onos.net.topology.Topology;
import org.onlab.onos.net.topology.TopologyCluster;
import org.onlab.onos.net.topology.TopologyGraph;
import org.onlab.onos.net.topology.TopologyListener;
import org.onlab.onos.net.topology.TopologyService;
import org.onlab.onos.net.topology.TopologyServiceAdapter;
import org.onlab.onos.of.controller.Dpid;
import org.onlab.onos.of.controller.OpenFlowController;
import org.onlab.onos.of.controller.OpenFlowPacketContext;
import org.onlab.onos.of.controller.OpenFlowSwitch;
import org.onlab.onos.of.controller.OpenFlowSwitchListener;
import org.onlab.onos.of.controller.OpenflowControllerAdapter;
import org.onlab.onos.of.controller.PacketListener;
import org.onlab.onos.of.controller.RoleState;
import org.onlab.packet.ARP;
import org.onlab.packet.Ethernet;
import org.onlab.packet.MACAddress;
......@@ -41,6 +24,10 @@ import org.onlab.packet.VLANID;
import org.projectfloodlight.openflow.protocol.OFMessage;
import org.projectfloodlight.openflow.types.OFPort;
import java.util.Set;
import static org.junit.Assert.*;
public class OpenFlowHostProviderTest {
private static final Integer INPORT = 10;
......@@ -145,124 +132,22 @@ public class OpenFlowHostProviderTest {
}
private class TestController implements OpenFlowController {
private class TestController extends OpenflowControllerAdapter {
PacketListener pktListener;
@Override
public Iterable<OpenFlowSwitch> getSwitches() {
return null;
}
@Override
public Iterable<OpenFlowSwitch> getMasterSwitches() {
return null;
}
@Override
public Iterable<OpenFlowSwitch> getEqualSwitches() {
return null;
}
@Override
public OpenFlowSwitch getSwitch(Dpid dpid) {
return null;
}
@Override
public OpenFlowSwitch getMasterSwitch(Dpid dpid) {
return null;
}
@Override
public OpenFlowSwitch getEqualSwitch(Dpid dpid) {
return null;
}
@Override
public void addListener(OpenFlowSwitchListener listener) {
}
@Override
public void removeListener(OpenFlowSwitchListener listener) {
}
@Override
public void addPacketListener(int priority, PacketListener listener) {
pktListener = listener;
}
@Override
public void removePacketListener(PacketListener listener) {
}
@Override
public void write(Dpid dpid, OFMessage msg) {
}
@Override
public void processPacket(Dpid dpid, OFMessage msg) {
OpenFlowPacketContext ctx =
new TestPacketContext(dpid);
OpenFlowPacketContext ctx = new TestPacketContext(dpid);
pktListener.handlePacket(ctx);
}
@Override
public void setRole(Dpid dpid, RoleState role) {
}
}
private class TestTopologyService implements TopologyService {
@Override
public Topology currentTopology() {
return null;
}
@Override
public boolean isLatest(Topology topology) {
return false;
}
@Override
public TopologyGraph getGraph(Topology topology) {
return null;
}
@Override
public Set<TopologyCluster> getClusters(Topology topology) {
return null;
}
@Override
public TopologyCluster getCluster(Topology topology, ClusterId clusterId) {
return null;
}
@Override
public Set<DeviceId> getClusterDevices(Topology topology,
TopologyCluster cluster) {
return null;
}
@Override
public Set<Link> getClusterLinks(Topology topology,
TopologyCluster cluster) {
return null;
}
@Override
public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst) {
return null;
}
@Override
public Set<Path> getPaths(Topology topology, DeviceId src,
DeviceId dst, LinkWeight weight) {
return null;
}
private class TestTopologyService extends TopologyServiceAdapter {
@Override
public boolean isInfrastructure(Topology topology,
ConnectPoint connectPoint) {
......@@ -272,21 +157,6 @@ public class OpenFlowHostProviderTest {
}
return false;
}
@Override
public boolean isBroadcastPoint(Topology topology,
ConnectPoint connectPoint) {
return false;
}
@Override
public void addListener(TopologyListener listener) {
}
@Override
public void removeListener(TopologyListener listener) {
}
}
private class TestPacketContext implements OpenFlowPacketContext {
......
......@@ -28,6 +28,19 @@
<groupId>org.onlab.onos</groupId>
<artifactId>onos-of-api</artifactId>
</dependency>
<dependency>
<groupId>org.onlab.onos</groupId>
<artifactId>onos-of-api</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.onlab.onos</groupId>
<artifactId>onos-api</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>
</project>
......