Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
tom
2014-09-16 15:50:27 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
61359e9cd3e416e1a796db489d78e86896cfcd23
61359e9c
1 parent
43526fcc
Added a slew of adapters to shorten the tests and to allow them to be used in more upcoming tests.
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
369 additions
and
140 deletions
core/api/src/test/java/org/onlab/onos/net/device/DeviceServiceAdapter.java
core/api/src/test/java/org/onlab/onos/net/host/HostServiceAdapter.java
core/api/src/test/java/org/onlab/onos/net/link/LinkServiceAdapter.java
core/api/src/test/java/org/onlab/onos/net/topology/TopologyServiceAdapter.java
of/api/src/test/java/org/onlab/onos/of/controller/OpenflowControllerAdapter.java
pom.xml
providers/of/host/src/test/java/org/onlab/onos/provider/of/host/impl/OpenFlowHostProviderTest.java
providers/of/pom.xml
core/api/src/test/java/org/onlab/onos/net/device/DeviceServiceAdapter.java
0 → 100644
View file @
61359e9
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
)
{
}
}
core/api/src/test/java/org/onlab/onos/net/host/HostServiceAdapter.java
0 → 100644
View file @
61359e9
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
)
{
}
}
core/api/src/test/java/org/onlab/onos/net/link/LinkServiceAdapter.java
0 → 100644
View file @
61359e9
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
)
{
}
}
core/api/src/test/java/org/onlab/onos/net/topology/TopologyServiceAdapter.java
0 → 100644
View file @
61359e9
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
)
{
}
}
of/api/src/test/java/org/onlab/onos/of/controller/OpenflowControllerAdapter.java
0 → 100644
View file @
61359e9
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
)
{
}
}
pom.xml
View file @
61359e9
...
...
@@ -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>
...
...
providers/of/host/src/test/java/org/onlab/onos/provider/of/host/impl/OpenFlowHostProviderTest.java
View file @
61359e9
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
{
...
...
providers/of/pom.xml
View file @
61359e9
...
...
@@ -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>
...
...
Please
register
or
login
to post a comment