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-24 15:16:55 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c78acee3d109de8383a59d1408fb207bc89484b3
c78acee3
1 parent
f80c9729
Enahnced topology and flow stores to extend general store.
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
90 additions
and
13 deletions
core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleStore.java
core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleStoreDelegate.java
core/api/src/main/java/org/onlab/onos/net/topology/TopologyStore.java
core/api/src/main/java/org/onlab/onos/net/topology/TopologyStoreDelegate.java
core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java
core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
core/net/src/main/java/org/onlab/onos/net/link/impl/LinkManager.java
core/net/src/main/java/org/onlab/onos/net/topology/impl/TopologyManager.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleFlowRuleStore.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyStore.java
core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleStore.java
View file @
c78acee
package
org
.
onlab
.
onos
.
net
.
flow
;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.store.Store
;
/**
* Manages inventory of flow rules; not intended for direct use.
*/
public
interface
FlowRuleStore
{
public
interface
FlowRuleStore
extends
Store
<
FlowRuleEvent
,
FlowRuleStoreDelegate
>
{
/**
* Returns the flow entries associated with a device.
...
...
core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleStoreDelegate.java
0 → 100644
View file @
c78acee
package
org
.
onlab
.
onos
.
net
.
flow
;
import
org.onlab.onos.store.StoreDelegate
;
/**
* Flow rule store delegate abstraction.
*/
public
interface
FlowRuleStoreDelegate
extends
StoreDelegate
<
FlowRuleEvent
>
{
}
core/api/src/main/java/org/onlab/onos/net/topology/TopologyStore.java
View file @
c78acee
...
...
@@ -6,6 +6,7 @@ import org.onlab.onos.net.DeviceId;
import
org.onlab.onos.net.Link
;
import
org.onlab.onos.net.Path
;
import
org.onlab.onos.net.provider.ProviderId
;
import
org.onlab.onos.store.Store
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -13,7 +14,7 @@ import java.util.Set;
/**
* Manages inventory of topology snapshots; not intended for direct use.
*/
public
interface
TopologyStore
{
public
interface
TopologyStore
extends
Store
<
TopologyEvent
,
TopologyStoreDelegate
>
{
/**
* Returns the current topology snapshot.
...
...
core/api/src/main/java/org/onlab/onos/net/topology/TopologyStoreDelegate.java
0 → 100644
View file @
c78acee
package
org
.
onlab
.
onos
.
net
.
topology
;
import
org.onlab.onos.store.StoreDelegate
;
/**
* Topology store delegate abstraction.
*/
public
interface
TopologyStoreDelegate
extends
StoreDelegate
<
TopologyEvent
>
{
}
core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java
View file @
c78acee
...
...
@@ -60,7 +60,7 @@ public class DeviceManager
private
DeviceStoreDelegate
delegate
=
new
InternalStoreDelegate
();
private
final
MastershipListener
mastershipListener
=
new
In
ner
MastershipListener
();
private
final
MastershipListener
mastershipListener
=
new
In
ternal
MastershipListener
();
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
protected
DeviceStore
store
;
...
...
@@ -244,7 +244,7 @@ public class DeviceManager
}
// Intercepts mastership events
private
class
In
ner
MastershipListener
implements
MastershipListener
{
private
class
In
ternal
MastershipListener
implements
MastershipListener
{
@Override
public
void
event
(
MastershipEvent
event
)
{
// FIXME: for now we're taking action only on becoming master
...
...
core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
View file @
c78acee
...
...
@@ -27,6 +27,8 @@ import org.onlab.onos.net.flow.FlowRuleProviderRegistry;
import
org.onlab.onos.net.flow.FlowRuleProviderService
;
import
org.onlab.onos.net.flow.FlowRuleService
;
import
org.onlab.onos.net.flow.FlowRuleStore
;
import
org.onlab.onos.net.flow.FlowRuleStoreDelegate
;
import
org.onlab.onos.net.host.HostStoreDelegate
;
import
org.onlab.onos.net.provider.AbstractProviderRegistry
;
import
org.onlab.onos.net.provider.AbstractProviderService
;
import
org.slf4j.Logger
;
...
...
@@ -48,6 +50,8 @@ implements FlowRuleService, FlowRuleProviderRegistry {
private
final
AbstractListenerRegistry
<
FlowRuleEvent
,
FlowRuleListener
>
listenerRegistry
=
new
AbstractListenerRegistry
<>();
private
FlowRuleStoreDelegate
delegate
=
new
InternalStoreDelegate
();
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
protected
FlowRuleStore
store
;
...
...
@@ -59,12 +63,14 @@ implements FlowRuleService, FlowRuleProviderRegistry {
@Activate
public
void
activate
()
{
store
.
setDelegate
(
delegate
);
eventDispatcher
.
addSink
(
FlowRuleEvent
.
class
,
listenerRegistry
);
log
.
info
(
"Started"
);
}
@Deactivate
public
void
deactivate
()
{
store
.
unsetDelegate
(
delegate
);
eventDispatcher
.
removeSink
(
FlowRuleEvent
.
class
);
log
.
info
(
"Stopped"
);
}
...
...
@@ -196,4 +202,11 @@ implements FlowRuleService, FlowRuleProviderRegistry {
}
}
// Store delegate to re-post events emitted from the store.
private
class
InternalStoreDelegate
implements
FlowRuleStoreDelegate
{
@Override
public
void
notify
(
FlowRuleEvent
event
)
{
eventDispatcher
.
post
(
event
);
}
}
}
...
...
core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
View file @
c78acee
package
org
.
onlab
.
onos
.
net
.
host
.
impl
;
import
static
com
.
google
.
common
.
base
.
Preconditions
.
checkNotNull
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.util.Set
;
import
org.apache.felix.scr.annotations.Activate
;
import
org.apache.felix.scr.annotations.Component
;
import
org.apache.felix.scr.annotations.Deactivate
;
...
...
@@ -26,6 +21,7 @@ import org.onlab.onos.net.host.HostProviderRegistry;
import
org.onlab.onos.net.host.HostProviderService
;
import
org.onlab.onos.net.host.HostService
;
import
org.onlab.onos.net.host.HostStore
;
import
org.onlab.onos.net.host.HostStoreDelegate
;
import
org.onlab.onos.net.host.PortAddresses
;
import
org.onlab.onos.net.provider.AbstractProviderRegistry
;
import
org.onlab.onos.net.provider.AbstractProviderService
;
...
...
@@ -35,6 +31,11 @@ import org.onlab.packet.MacAddress;
import
org.onlab.packet.VlanId
;
import
org.slf4j.Logger
;
import
java.util.Set
;
import
static
com
.
google
.
common
.
base
.
Preconditions
.
checkNotNull
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
/**
* Provides basic implementation of the host SB & NB APIs.
*/
...
...
@@ -50,6 +51,8 @@ public class HostManager
private
final
AbstractListenerRegistry
<
HostEvent
,
HostListener
>
listenerRegistry
=
new
AbstractListenerRegistry
<>();
private
HostStoreDelegate
delegate
=
new
InternalStoreDelegate
();
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
protected
HostStore
store
;
...
...
@@ -59,12 +62,14 @@ public class HostManager
@Activate
public
void
activate
()
{
store
.
setDelegate
(
delegate
);
eventDispatcher
.
addSink
(
HostEvent
.
class
,
listenerRegistry
);
log
.
info
(
"Started"
);
}
@Deactivate
public
void
deactivate
()
{
store
.
unsetDelegate
(
delegate
);
eventDispatcher
.
removeSink
(
HostEvent
.
class
);
log
.
info
(
"Stopped"
);
}
...
...
@@ -219,4 +224,11 @@ public class HostManager
}
}
// Store delegate to re-post events emitted from the store.
private
class
InternalStoreDelegate
implements
HostStoreDelegate
{
@Override
public
void
notify
(
HostEvent
event
)
{
post
(
event
);
}
}
}
...
...
core/net/src/main/java/org/onlab/onos/net/link/impl/LinkManager.java
View file @
c78acee
...
...
@@ -28,6 +28,7 @@ import org.onlab.onos.net.link.LinkProviderRegistry;
import
org.onlab.onos.net.link.LinkProviderService
;
import
org.onlab.onos.net.link.LinkService
;
import
org.onlab.onos.net.link.LinkStore
;
import
org.onlab.onos.net.link.LinkStoreDelegate
;
import
org.onlab.onos.net.provider.AbstractProviderRegistry
;
import
org.onlab.onos.net.provider.AbstractProviderService
;
import
org.slf4j.Logger
;
...
...
@@ -52,7 +53,9 @@ public class LinkManager
protected
final
AbstractListenerRegistry
<
LinkEvent
,
LinkListener
>
listenerRegistry
=
new
AbstractListenerRegistry
<>();
private
final
DeviceListener
deviceListener
=
new
InnerDeviceListener
();
private
LinkStoreDelegate
delegate
=
new
InternalStoreDelegate
();
private
final
DeviceListener
deviceListener
=
new
InternalDeviceListener
();
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
protected
LinkStore
store
;
...
...
@@ -65,6 +68,7 @@ public class LinkManager
@Activate
public
void
activate
()
{
store
.
setDelegate
(
delegate
);
eventDispatcher
.
addSink
(
LinkEvent
.
class
,
listenerRegistry
);
deviceService
.
addListener
(
deviceListener
);
log
.
info
(
"Started"
);
...
...
@@ -72,6 +76,7 @@ public class LinkManager
@Deactivate
public
void
deactivate
()
{
store
.
unsetDelegate
(
delegate
);
eventDispatcher
.
removeSink
(
LinkEvent
.
class
);
deviceService
.
removeListener
(
deviceListener
);
log
.
info
(
"Stopped"
);
...
...
@@ -154,7 +159,7 @@ public class LinkManager
// Auxiliary interceptor for device remove events to prune links that
// are associated with the removed device or its port.
private
class
In
ner
DeviceListener
implements
DeviceListener
{
private
class
In
ternal
DeviceListener
implements
DeviceListener
{
@Override
public
void
event
(
DeviceEvent
event
)
{
if
(
event
.
type
()
==
DeviceEvent
.
Type
.
DEVICE_REMOVED
)
{
...
...
@@ -236,4 +241,11 @@ public class LinkManager
}
}
// Store delegate to re-post events emitted from the store.
private
class
InternalStoreDelegate
implements
LinkStoreDelegate
{
@Override
public
void
notify
(
LinkEvent
event
)
{
post
(
event
);
}
}
}
...
...
core/net/src/main/java/org/onlab/onos/net/topology/impl/TopologyManager.java
View file @
c78acee
...
...
@@ -28,6 +28,7 @@ import org.onlab.onos.net.topology.TopologyProviderRegistry;
import
org.onlab.onos.net.topology.TopologyProviderService
;
import
org.onlab.onos.net.topology.TopologyService
;
import
org.onlab.onos.net.topology.TopologyStore
;
import
org.onlab.onos.net.topology.TopologyStoreDelegate
;
import
org.slf4j.Logger
;
import
java.util.List
;
...
...
@@ -56,6 +57,8 @@ public class TopologyManager
private
final
AbstractListenerRegistry
<
TopologyEvent
,
TopologyListener
>
listenerRegistry
=
new
AbstractListenerRegistry
<>();
private
TopologyStoreDelegate
delegate
=
new
InternalStoreDelegate
();
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
protected
TopologyStore
store
;
...
...
@@ -65,12 +68,14 @@ public class TopologyManager
@Activate
public
void
activate
()
{
store
.
setDelegate
(
delegate
);
eventDispatcher
.
addSink
(
TopologyEvent
.
class
,
listenerRegistry
);
log
.
info
(
"Started"
);
}
@Deactivate
public
void
deactivate
()
{
store
.
unsetDelegate
(
delegate
);
eventDispatcher
.
removeSink
(
TopologyEvent
.
class
);
log
.
info
(
"Stopped"
);
}
...
...
@@ -188,4 +193,11 @@ public class TopologyManager
}
}
// Store delegate to re-post events emitted from the store.
private
class
InternalStoreDelegate
implements
TopologyStoreDelegate
{
@Override
public
void
notify
(
TopologyEvent
event
)
{
eventDispatcher
.
post
(
event
);
}
}
}
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleFlowRuleStore.java
View file @
c78acee
...
...
@@ -13,6 +13,8 @@ import org.onlab.onos.net.flow.FlowRule;
import
org.onlab.onos.net.flow.FlowRuleEvent
;
import
org.onlab.onos.net.flow.FlowRuleEvent.Type
;
import
org.onlab.onos.net.flow.FlowRuleStore
;
import
org.onlab.onos.net.flow.FlowRuleStoreDelegate
;
import
org.onlab.onos.store.AbstractStore
;
import
org.slf4j.Logger
;
import
com.google.common.collect.ArrayListMultimap
;
...
...
@@ -24,7 +26,9 @@ import com.google.common.collect.Multimap;
*/
@Component
(
immediate
=
true
)
@Service
public
class
SimpleFlowRuleStore
implements
FlowRuleStore
{
public
class
SimpleFlowRuleStore
extends
AbstractStore
<
FlowRuleEvent
,
FlowRuleStoreDelegate
>
implements
FlowRuleStore
{
private
final
Logger
log
=
getLogger
(
getClass
());
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyStore.java
View file @
c78acee
...
...
@@ -18,6 +18,8 @@ import org.onlab.onos.net.topology.TopologyCluster;
import
org.onlab.onos.net.topology.TopologyEvent
;
import
org.onlab.onos.net.topology.TopologyGraph
;
import
org.onlab.onos.net.topology.TopologyStore
;
import
org.onlab.onos.net.topology.TopologyStoreDelegate
;
import
org.onlab.onos.store.AbstractStore
;
import
org.slf4j.Logger
;
import
java.util.List
;
...
...
@@ -31,7 +33,9 @@ import static org.slf4j.LoggerFactory.getLogger;
*/
@Component
(
immediate
=
true
)
@Service
public
class
SimpleTopologyStore
implements
TopologyStore
{
public
class
SimpleTopologyStore
extends
AbstractStore
<
TopologyEvent
,
TopologyStoreDelegate
>
implements
TopologyStore
{
private
final
Logger
log
=
getLogger
(
getClass
());
...
...
Please
register
or
login
to post a comment