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-10 20:53:54 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8bf2e6bc4e18fadd2b7ea146529ca621c4efd9c2
8bf2e6bc
1 parent
8ccc0bf0
Added javadocs and separated trivial implementations into distinct packages.
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
128 additions
and
30 deletions
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManager.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/device/impl/SimpleDeviceManager.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/device/impl/SimpleDeviceStore.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleLinkManager.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/link/impl/SimpleLinkManager.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleLinkStore.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/link/impl/SimpleLinkStore.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/DefaultTopology.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/topology/impl/DefaultTopology.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyManager.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/topology/impl/SimpleTopologyManager.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyStore.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/topology/impl/SimpleTopologyStore.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/DefaultTopologyDescription.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/topology/provider/impl/DefaultTopologyDescription.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyProvider.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/topology/provider/impl/SimpleTopologyProvider.java
core/trivial/src/main/javadoc/org/onlab/onos/event/impl/package.html
core/trivial/src/main/javadoc/org/onlab/onos/impl/package.html
core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/impl/package.html → core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/device/impl/package.html
core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/host/impl/package.html
core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/link/impl/package.html
core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/topology/impl/package.html
core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/topology/provider/impl/package.html
core/trivial/src/test/java/org/onlab/onos/net/trivial/impl/TestEventDispatcher.java → core/trivial/src/test/java/org/onlab/onos/event/impl/TestEventDispatcher.java
core/trivial/src/test/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManagerTest.java → core/trivial/src/test/java/org/onlab/onos/net/trivial/device/impl/SimpleDeviceManagerTest.java
core/trivial/src/test/java/org/onlab/onos/net/trivial/impl/SimpleLinkManagerTest.java → core/trivial/src/test/java/org/onlab/onos/net/trivial/link/impl/SimpleLinkManagerTest.java
pom.xml
providers/of/link/src/main/java/org/onlab/onos/provider/of/link/impl/LinkDiscovery.java
providers/of/link/src/main/java/org/onlab/onos/provider/of/link/impl/OpenFlowLinkProvider.java
utils/misc/src/main/java/org/onlab/timer/Timer.java → utils/misc/src/main/java/org/onlab/util/Timer.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManager.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/
device/
impl/SimpleDeviceManager.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
device
.
impl
;
import
org.apache.felix.scr.annotations.Activate
;
import
org.apache.felix.scr.annotations.Component
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/
device/
impl/SimpleDeviceStore.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
device
.
impl
;
import
com.google.common.collect.ImmutableList
;
import
org.onlab.onos.net.DefaultDevice
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleLinkManager.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/
link/
impl/SimpleLinkManager.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
link
.
impl
;
import
static
com
.
google
.
common
.
base
.
Preconditions
.
checkNotNull
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleLinkStore.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/
link/
impl/SimpleLinkStore.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
link
.
impl
;
import
com.google.common.collect.HashMultimap
;
import
com.google.common.collect.ImmutableSet
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/DefaultTopology.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/
topology/
impl/DefaultTopology.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
topology
.
impl
;
import
org.onlab.onos.net.AbstractModel
;
import
org.onlab.onos.net.provider.ProviderId
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyManager.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/
topology/
impl/SimpleTopologyManager.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
topology
.
impl
;
import
org.apache.felix.scr.annotations.Activate
;
import
org.apache.felix.scr.annotations.Component
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyStore.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/
topology/
impl/SimpleTopologyStore.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
topology
.
impl
;
import
org.onlab.graph.Graph
;
import
org.onlab.onos.event.Event
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/DefaultTopologyDescription.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/
topology/provider/
impl/DefaultTopologyDescription.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
topology
.
provider
.
impl
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Multimap
;
import
com.google.common.collect.Sets
;
import
org.onlab.graph.AdjacencyListsGraph
;
import
org.onlab.graph.DijkstraGraphSearch
;
import
org.onlab.graph.Graph
;
import
org.onlab.graph.GraphPathSearch
;
import
org.onlab.graph.TarjanGraphSearch
;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.Device
;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.net.Link
;
import
org.onlab.onos.net.topology.ClusterId
;
import
org.onlab.onos.net.topology.DefaultTopologyCluster
;
import
org.onlab.onos.net.topology.LinkWeight
;
import
org.onlab.onos.net.topology.TopoEdge
;
import
org.onlab.onos.net.topology.TopoVertex
;
import
org.onlab.onos.net.topology.TopologyCluster
;
import
org.onlab.onos.net.topology.TopologyDescription
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Set
;
import
static
com
.
google
.
common
.
base
.
MoreObjects
.
toStringHelper
;
import
static
org
.
onlab
.
graph
.
GraphPathSearch
.
Result
;
import
static
org
.
onlab
.
graph
.
TarjanGraphSearch
.
SCCResult
;
import
static
org
.
onlab
.
onos
.
net
.
Link
.
Type
.
INDIRECT
;
/**
...
...
@@ -33,25 +39,32 @@ class DefaultTopologyDescription implements TopologyDescription {
private
static
final
GraphPathSearch
<
TopoVertex
,
TopoEdge
>
DIJKSTRA
=
new
DijkstraGraphSearch
<>();
private
static
final
TarjanGraphSearch
<
TopoVertex
,
TopoEdge
>
TARJAN
=
new
TarjanGraphSearch
<>();
private
final
long
nanos
;
private
final
Map
<
DeviceId
,
TopoVertex
>
vertexesById
=
Maps
.
newHashMap
();
private
final
Graph
<
TopoVertex
,
TopoEdge
>
graph
;
private
final
Map
<
DeviceId
,
Result
<
TopoVertex
,
TopoEdge
>>
results
;
private
final
Map
<
ClusterId
,
TopologyCluster
>
clusters
;
// private final Multimap<ClusterId, DeviceId> clusterDevices;
// private final Multimap<ClusterId, Link> clusterLinks;
// private final Map<DeviceId, TopologyCluster> deviceClusters;
// Secondary look-up indexes
private
Multimap
<
ClusterId
,
DeviceId
>
devicesByCluster
;
private
Multimap
<
ClusterId
,
Link
>
linksByCluster
;
private
Map
<
DeviceId
,
TopologyCluster
>
clustersByDevice
;
/**
* Creates a topology description to carry topology vitals to the core.
*
* @param nanos time in nanos of when the topology description was created
* @param devices collection of devices
* @param links
*/
DefaultTopologyDescription
(
long
nanos
,
Iterable
<
Device
>
devices
,
Iterable
<
Link
>
links
)
{
this
.
nanos
=
nanos
;
this
.
graph
=
buildGraph
(
devices
,
links
);
this
.
results
=
computeDefaultPaths
();
this
.
clusters
=
computeClusters
();
// this.clusterDevices = clusterDevices;
// this.clusterLinks = clusterLinks;
// this.deviceClusters = deviceClusters;
}
// Constructs the topology graph using the supplied devices and links.
...
...
@@ -99,9 +112,62 @@ class DefaultTopologyDescription implements TopologyDescription {
// Computes topology SCC clusters using Tarjan algorithm.
private
Map
<
ClusterId
,
TopologyCluster
>
computeClusters
()
{
Map
<
ClusterId
,
TopologyCluster
>
clusters
=
Maps
.
newHashMap
();
SCCResult
<
TopoVertex
,
TopoEdge
>
result
=
TARJAN
.
search
(
graph
,
new
NoIndirectLinksWeight
());
// Extract both vertexes and edges from the results; the lists form
// pairs along the same index.
List
<
Set
<
TopoVertex
>>
clusterVertexes
=
result
.
clusterVertexes
();
List
<
Set
<
TopoEdge
>>
clusterEdges
=
result
.
clusterEdges
();
// Scan over the lists and create a cluster from the results.
for
(
int
i
=
0
,
n
=
result
.
clusterCount
();
i
<
n
;
i
++)
{
Set
<
TopoVertex
>
vertexSet
=
clusterVertexes
.
get
(
i
);
Set
<
TopoEdge
>
edgeSet
=
clusterEdges
.
get
(
i
);
DefaultTopologyCluster
cluster
=
new
DefaultTopologyCluster
(
ClusterId
.
clusterId
(
i
),
vertexSet
.
size
(),
edgeSet
.
size
(),
findRoot
(
vertexSet
).
deviceId
());
findClusterDevices
(
vertexSet
,
cluster
);
findClusterLinks
(
edgeSet
,
cluster
);
}
return
clusters
;
}
// Scan through the set of cluster vertices and convert it to a set of
// device ids; register the cluster by device id as well.
private
void
findClusterDevices
(
Set
<
TopoVertex
>
vertexSet
,
DefaultTopologyCluster
cluster
)
{
Set
<
DeviceId
>
ids
=
new
HashSet
<>(
vertexSet
.
size
());
for
(
TopoVertex
v
:
vertexSet
)
{
DeviceId
deviceId
=
v
.
deviceId
();
devicesByCluster
.
put
(
cluster
.
id
(),
deviceId
);
clustersByDevice
.
put
(
deviceId
,
cluster
);
}
}
private
void
findClusterLinks
(
Set
<
TopoEdge
>
edgeSet
,
DefaultTopologyCluster
cluster
)
{
for
(
TopoEdge
e
:
edgeSet
)
{
linksByCluster
.
put
(
cluster
.
id
(),
e
.
link
());
}
}
// Finds the vertex whose device id is the lexicographical minimum in the
// specified set.
private
TopoVertex
findRoot
(
Set
<
TopoVertex
>
vertexSet
)
{
TopoVertex
minVertex
=
null
;
for
(
TopoVertex
vertex
:
vertexSet
)
{
if
(
minVertex
==
null
||
minVertex
.
deviceId
().
toString
()
.
compareTo
(
minVertex
.
deviceId
().
toString
())
<
0
)
{
minVertex
=
vertex
;
}
}
return
minVertex
;
}
// Fetches a vertex corresponding to the given connection point device.
private
TopoVertex
vertexOf
(
ConnectPoint
connectPoint
)
{
DeviceId
id
=
connectPoint
.
deviceId
();
...
...
@@ -232,7 +298,7 @@ class DefaultTopologyDescription implements TopologyDescription {
// Link weight for measuring link cost as hop count with indirect links
// being as expensive as traversing the entire graph to assume the worst.
private
class
HopCountLinkWeight
implements
LinkWeight
{
private
static
class
HopCountLinkWeight
implements
LinkWeight
{
private
final
int
indirectLinkCost
;
public
HopCountLinkWeight
(
int
indirectLinkCost
)
{
...
...
@@ -247,4 +313,12 @@ class DefaultTopologyDescription implements TopologyDescription {
}
}
// Link weight for preventing traversal over indirect links.
private
static
class
NoIndirectLinksWeight
implements
LinkWeight
{
@Override
public
double
weight
(
TopoEdge
edge
)
{
return
edge
.
link
().
type
()
==
INDIRECT
?
-
1
:
1
;
}
}
}
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyProvider.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/
topology/provider/
impl/SimpleTopologyProvider.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
topology
.
provider
.
impl
;
import
org.apache.felix.scr.annotations.Activate
;
import
org.apache.felix.scr.annotations.Component
;
...
...
core/trivial/src/main/javadoc/org/onlab/onos/event/impl/package.html
View file @
8bf2e6b
<body>
ONOS l
ocal event dispatching mechanism.
L
ocal event dispatching mechanism.
</body>
\ No newline at end of file
...
...
core/trivial/src/main/javadoc/org/onlab/onos/impl/package.html
View file @
8bf2e6b
<body>
ONOS
Core infrastructure implementations.
Core infrastructure implementations.
</body>
\ No newline at end of file
...
...
core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/impl/package.html
→
core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/
device/
impl/package.html
View file @
8bf2e6b
<body>
ONOS core implementation
s.
Core subsystem for tracking infrastructure device
s.
</body>
\ No newline at end of file
...
...
core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/host/impl/package.html
0 → 100644
View file @
8bf2e6b
<body>
Core subsystem for tracking edn-station hosts.
</body>
\ No newline at end of file
core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/link/impl/package.html
0 → 100644
View file @
8bf2e6b
<body>
Core subsystem for tracking infrastructure links.
</body>
\ No newline at end of file
core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/topology/impl/package.html
0 → 100644
View file @
8bf2e6b
<body>
Core subsystem for tracking consistent topology graph views.
</body>
\ No newline at end of file
core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/topology/provider/impl/package.html
0 → 100644
View file @
8bf2e6b
<body>
Built-in protocol-agnostic topology builder
&
provider.
</body>
\ No newline at end of file
core/trivial/src/test/java/org/onlab/onos/
net/trivial
/impl/TestEventDispatcher.java
→
core/trivial/src/test/java/org/onlab/onos/
event
/impl/TestEventDispatcher.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
event
.
impl
;
import
org.onlab.onos.event.DefaultEventSinkRegistry
;
import
org.onlab.onos.event.Event
;
...
...
core/trivial/src/test/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManagerTest.java
→
core/trivial/src/test/java/org/onlab/onos/net/trivial/
device/
impl/SimpleDeviceManagerTest.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
device
.
impl
;
import
org.junit.After
;
import
org.junit.Before
;
...
...
@@ -22,6 +22,7 @@ import org.onlab.onos.net.device.DeviceService;
import
org.onlab.onos.net.device.PortDescription
;
import
org.onlab.onos.net.provider.AbstractProvider
;
import
org.onlab.onos.net.provider.ProviderId
;
import
org.onlab.onos.event.impl.TestEventDispatcher
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
...
...
core/trivial/src/test/java/org/onlab/onos/net/trivial/impl/SimpleLinkManagerTest.java
→
core/trivial/src/test/java/org/onlab/onos/net/trivial/
link/
impl/SimpleLinkManagerTest.java
View file @
8bf2e6b
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
link
.
impl
;
import
com.google.common.collect.ImmutableSet
;
import
org.junit.After
;
...
...
@@ -21,6 +21,7 @@ import org.onlab.onos.net.link.LinkProviderService;
import
org.onlab.onos.net.link.LinkService
;
import
org.onlab.onos.net.provider.AbstractProvider
;
import
org.onlab.onos.net.provider.ProviderId
;
import
org.onlab.onos.event.impl.TestEventDispatcher
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
...
...
pom.xml
View file @
8bf2e6b
...
...
@@ -332,7 +332,7 @@
<group>
<title>
Core Subsystems
</title>
<packages>
org.onlab.onos.net.trivial.
impl
:org.onlab.onos.net.*.impl:org.onlab.onos.impl:org.onlab.onos.event.impl
org.onlab.onos.net.trivial.
*
:org.onlab.onos.net.*.impl:org.onlab.onos.impl:org.onlab.onos.event.impl
</packages>
</group>
<group>
...
...
providers/of/link/src/main/java/org/onlab/onos/provider/of/link/impl/LinkDiscovery.java
View file @
8bf2e6b
...
...
@@ -42,7 +42,7 @@ import org.onlab.onos.of.controller.OpenFlowSwitch;
import
org.onlab.packet.Ethernet
;
import
org.onlab.packet.ONLabLddp
;
import
org.onlab.packet.ONLabLddp.DPIDandPort
;
import
org.onlab.
timer
.Timer
;
import
org.onlab.
util
.Timer
;
import
org.projectfloodlight.openflow.protocol.OFFactory
;
import
org.projectfloodlight.openflow.protocol.OFMessage
;
import
org.projectfloodlight.openflow.protocol.OFPacketOut
;
...
...
providers/of/link/src/main/java/org/onlab/onos/provider/of/link/impl/OpenFlowLinkProvider.java
View file @
8bf2e6b
...
...
@@ -23,7 +23,7 @@ import org.onlab.onos.of.controller.OpenFlowController;
import
org.onlab.onos.of.controller.OpenFlowSwitchListener
;
import
org.onlab.onos.of.controller.PacketContext
;
import
org.onlab.onos.of.controller.PacketListener
;
import
org.onlab.
timer
.Timer
;
import
org.onlab.
util
.Timer
;
import
org.projectfloodlight.openflow.protocol.OFPortConfig
;
import
org.projectfloodlight.openflow.protocol.OFPortDesc
;
import
org.projectfloodlight.openflow.protocol.OFPortState
;
...
...
utils/misc/src/main/java/org/onlab/
timer
/Timer.java
→
utils/misc/src/main/java/org/onlab/
util
/Timer.java
View file @
8bf2e6b
package
org
.
onlab
.
timer
;
package
org
.
onlab
.
util
;
import
org.jboss.netty.util.HashedWheelTimer
;
/**
* Hashed-wheel timer singleton. Care must be taken to shutdown the timer
* only when the VM is ready to exit.
*/
public
final
class
Timer
{
private
Timer
()
{}
private
static
HashedWheelTimer
timer
;
// Ban public construction
private
Timer
()
{
}
/**
* Returns the singleton hashed-wheel timer.
*
* @return hashed-wheel timer
*/
public
static
HashedWheelTimer
getTimer
()
{
if
(
Timer
.
timer
==
null
)
{
Timer
.
timer
=
new
HashedWheelTimer
();
...
...
Please
register
or
login
to post a comment