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
2015-06-08 18:15:05 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b32cefe7cef8afa639ab86efbf9ff32c382443d7
b32cefe7
1 parent
7a5431e0
adding igmp rule
Change-Id: I0eaeb55861eb3f9f273a3b67fa7b0eaa98b0210e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
drivers/src/main/java/org/onosproject/driver/pipeline/OLTPipeline.java
drivers/src/main/java/org/onosproject/driver/pipeline/OLTPipeline.java
View file @
b32cefe
...
...
@@ -16,12 +16,15 @@
package
org
.
onosproject
.
driver
.
pipeline
;
import
org.onlab.osgi.ServiceDirectory
;
import
org.onlab.packet.Ethernet
;
import
org.onosproject.core.ApplicationId
;
import
org.onosproject.net.DeviceId
;
import
org.onosproject.net.PortNumber
;
import
org.onosproject.net.behaviour.Pipeliner
;
import
org.onosproject.net.behaviour.PipelinerContext
;
import
org.onosproject.net.driver.AbstractHandlerBehaviour
;
import
org.onosproject.net.flow.DefaultFlowRule
;
import
org.onosproject.net.flow.DefaultTrafficSelector
;
import
org.onosproject.net.flow.DefaultTrafficTreatment
;
import
org.onosproject.net.flow.FlowRule
;
import
org.onosproject.net.flow.FlowRuleOperations
;
...
...
@@ -49,12 +52,44 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
private
FlowRuleService
flowRuleService
;
private
DeviceId
deviceId
;
private
boolean
done
=
false
;
@Override
public
void
init
(
DeviceId
deviceId
,
PipelinerContext
context
)
{
this
.
serviceDirectory
=
context
.
directory
();
this
.
deviceId
=
deviceId
;
flowRuleService
=
serviceDirectory
.
get
(
FlowRuleService
.
class
);
}
private
boolean
installIGMPRule
(
ApplicationId
appId
,
boolean
done
)
{
if
(
done
)
{
return
done
;
}
TrafficSelector
selector
=
DefaultTrafficSelector
.
builder
()
.
matchInPort
(
PortNumber
.
portNumber
(
1
))
.
matchEthType
(
Ethernet
.
TYPE_IPV4
)
.
matchIPProtocol
((
byte
)
2
).
build
();
TrafficTreatment
treatment
=
DefaultTrafficTreatment
.
builder
()
.
punt
().
build
();
FlowRule
rule
=
DefaultFlowRule
.
builder
()
.
forDevice
(
deviceId
)
.
fromApp
(
appId
)
.
withTreatment
(
treatment
)
.
withSelector
(
selector
)
.
makePermanent
()
.
withPriority
(
0
)
.
build
();
FlowRuleOperations
.
Builder
flowBuilder
=
FlowRuleOperations
.
builder
();
flowRuleService
.
apply
(
flowBuilder
.
add
(
rule
).
build
());
return
true
;
}
@Override
...
...
@@ -64,6 +99,7 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
@Override
public
void
forward
(
ForwardingObjective
fwd
)
{
done
=
installIGMPRule
(
fwd
.
appId
(),
done
);
FlowRuleOperations
.
Builder
flowBuilder
=
FlowRuleOperations
.
builder
();
if
(
fwd
.
flag
()
!=
ForwardingObjective
.
Flag
.
VERSATILE
)
{
...
...
Please
register
or
login
to post a comment