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
alshabib
2014-09-16 15:58:01 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
57044ba82c74a814bc0cd131883414681e011418
57044ba8
1 parent
7b795499
initial flow rule provider
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
150 additions
and
17 deletions
core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleProvider.java
core/api/src/main/java/org/onlab/onos/net/flow/criteria/package-info.java
core/api/src/main/java/org/onlab/onos/net/flow/instructions/package-info.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/flow/impl/SimpleFlowRuleManager.java
of/api/src/main/java/org/onlab/onos/of/controller/OpenFlowSwitchEvent.java
providers/of/pom.xml
core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleProvider.java
View file @
57044ba
...
...
@@ -17,6 +17,15 @@ public interface FlowRuleProvider extends Provider {
*/
void
applyFlowRule
(
FlowRule
...
flowRules
);
/**
* Instructs the provider to remove the specified flow rules to their
* respective devices.
* @param flowRules one or more flow rules
* throws SomeKindOfException that indicates which ones were applied and
* which ones failed
*/
void
removeFlowRule
(
FlowRule
...
flowRules
);
/**
* Returns the collection of flow entries currently applied on the given
...
...
core/api/src/main/java/org/onlab/onos/net/flow/criteria/package-info.java
0 → 100644
View file @
57044ba
/**
* Traffic selection criteria model.
*/
package
org
.
onlab
.
onos
.
net
.
flow
.
criteria
;
core/api/src/main/java/org/onlab/onos/net/flow/instructions/package-info.java
0 → 100644
View file @
57044ba
/**
* Traffic treatment model.
*/
package
org
.
onlab
.
onos
.
net
.
flow
.
instructions
;
core/trivial/src/main/java/org/onlab/onos/net/trivial/flow/impl/SimpleFlowRuleManager.java
0 → 100644
View file @
57044ba
package
org
.
onlab
.
onos
.
net
.
trivial
.
flow
.
impl
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
org.apache.felix.scr.annotations.Activate
;
import
org.apache.felix.scr.annotations.Component
;
import
org.apache.felix.scr.annotations.Deactivate
;
import
org.apache.felix.scr.annotations.Reference
;
import
org.apache.felix.scr.annotations.ReferenceCardinality
;
import
org.apache.felix.scr.annotations.Service
;
import
org.onlab.onos.event.AbstractListenerRegistry
;
import
org.onlab.onos.event.EventDeliveryService
;
import
org.onlab.onos.net.Device
;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.net.device.DeviceService
;
import
org.onlab.onos.net.flow.FlowEntry
;
import
org.onlab.onos.net.flow.FlowRule
;
import
org.onlab.onos.net.flow.FlowRuleEvent
;
import
org.onlab.onos.net.flow.FlowRuleListener
;
import
org.onlab.onos.net.flow.FlowRuleProvider
;
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.provider.AbstractProviderRegistry
;
import
org.onlab.onos.net.provider.AbstractProviderService
;
import
org.slf4j.Logger
;
@Component
(
immediate
=
true
)
@Service
public
class
SimpleFlowRuleManager
extends
AbstractProviderRegistry
<
FlowRuleProvider
,
FlowRuleProviderService
>
implements
FlowRuleService
,
FlowRuleProviderRegistry
{
private
final
Logger
log
=
getLogger
(
getClass
());
private
final
AbstractListenerRegistry
<
FlowRuleEvent
,
FlowRuleListener
>
listenerRegistry
=
new
AbstractListenerRegistry
<>();
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
private
EventDeliveryService
eventDispatcher
;
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
private
DeviceService
deviceService
;
@Activate
public
void
activate
()
{
eventDispatcher
.
addSink
(
FlowRuleEvent
.
class
,
listenerRegistry
);
log
.
info
(
"Started"
);
}
@Deactivate
public
void
deactivate
()
{
eventDispatcher
.
removeSink
(
FlowRuleEvent
.
class
);
log
.
info
(
"Stopped"
);
}
@Override
public
Iterable
<
FlowEntry
>
getFlowEntries
(
DeviceId
deviceId
)
{
//TODO: store rules somewhere and return them here
return
null
;
}
@Override
public
void
applyFlowRules
(
FlowRule
...
flowRules
)
{
for
(
int
i
=
0
;
i
<
flowRules
.
length
;
i
++)
{
FlowRule
f
=
flowRules
[
0
];
final
Device
device
=
deviceService
.
getDevice
(
f
.
deviceId
());
final
FlowRuleProvider
frp
=
getProvider
(
device
.
providerId
());
//TODO: store rules somewhere
frp
.
applyFlowRule
(
f
);
}
}
@Override
public
void
removeFlowRules
(
FlowRule
...
flowRules
)
{
for
(
int
i
=
0
;
i
<
flowRules
.
length
;
i
++)
{
FlowRule
f
=
flowRules
[
0
];
final
Device
device
=
deviceService
.
getDevice
(
f
.
deviceId
());
final
FlowRuleProvider
frp
=
getProvider
(
device
.
providerId
());
//TODO: remove stored rules from wherever they are
frp
.
removeFlowRule
(
f
);
}
}
@Override
public
void
addListener
(
FlowRuleListener
listener
)
{
listenerRegistry
.
addListener
(
listener
);
}
@Override
public
void
removeListener
(
FlowRuleListener
listener
)
{
listenerRegistry
.
removeListener
(
listener
);
}
@Override
protected
FlowRuleProviderService
createProviderService
(
FlowRuleProvider
provider
)
{
return
new
InternalFlowRuleProviderService
(
provider
);
}
private
class
InternalFlowRuleProviderService
extends
AbstractProviderService
<
FlowRuleProvider
>
implements
FlowRuleProviderService
{
protected
InternalFlowRuleProviderService
(
FlowRuleProvider
provider
)
{
super
(
provider
);
}
@Override
public
void
flowRemoved
(
FlowRule
flowRule
)
{
// TODO Auto-generated method stub
}
@Override
public
void
flowMissing
(
FlowRule
flowRule
)
{
// TODO Auto-generated method stub
}
@Override
public
void
flowAdded
(
FlowRule
flowRule
)
{
// TODO Auto-generated method stub
}
}
}
of/api/src/main/java/org/onlab/onos/of/controller/OpenFlowSwitchEvent.java
deleted
100644 → 0
View file @
7b79549
package
org
.
onlab
.
onos
.
of
.
controller
;
/**
* Meta events that can happen at a switch.
*
*/
public
enum
OpenFlowSwitchEvent
{
/**
* The switch connected.
*/
SWITCH_CONNECTED
,
/**
* The switch disconnected.
*/
SWITCH_DISCONNECTED
}
providers/of/pom.xml
View file @
57044ba
...
...
@@ -21,6 +21,7 @@
<module>
link
</module>
<module>
host
</module>
<module>
packet
</module>
<module>
flow
</module>
</modules>
<dependencies>
...
...
Please
register
or
login
to post a comment