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-09 14:57:15 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ddf02db91275e7a10a5db0999b167032f214daf6
ddf02db9
1 parent
8faf1638
clean packet context
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
of/api/src/main/java/org/onlab/onos/of/controller/DefaultPacketContext.java
of/api/src/main/java/org/onlab/onos/of/controller/DefaultPacketContext.java
View file @
ddf02db
...
...
@@ -6,6 +6,7 @@ import org.onlab.packet.Ethernet;
import
org.projectfloodlight.openflow.protocol.OFPacketIn
;
import
org.projectfloodlight.openflow.protocol.OFPacketOut
;
import
org.projectfloodlight.openflow.protocol.action.OFAction
;
import
org.projectfloodlight.openflow.protocol.action.OFActionOutput
;
import
org.projectfloodlight.openflow.types.OFBufferId
;
import
org.projectfloodlight.openflow.types.OFPort
;
...
...
@@ -36,21 +37,26 @@ public final class DefaultPacketContext implements PacketContext {
}
@Override
public
void
build
(
OFPort
outPort
)
{
public
synchronized
void
build
(
OFPort
outPort
)
{
if
(
isBuilt
)
{
return
;
}
OFPacketOut
.
Builder
builder
=
sw
.
factory
().
buildPacketOut
();
OFAction
act
=
buildOutput
(
outPort
.
getPortNumber
());
pktout
=
builder
.
setXid
(
pktin
.
getXid
())
.
setBufferId
(
pktin
.
getBufferId
())
.
setActions
(
Collections
.
singletonList
(
act
))
.
build
();
isBuilt
=
true
;
}
@Override
public
void
build
(
Ethernet
ethFrame
,
OFPort
outPort
)
{
public
synchronized
void
build
(
Ethernet
ethFrame
,
OFPort
outPort
)
{
if
(
isBuilt
)
{
return
;
}
OFPacketOut
.
Builder
builder
=
sw
.
factory
().
buildPacketOut
();
OFAction
act
=
sw
.
factory
().
actions
()
.
buildOutput
()
.
setPort
(
OFPort
.
of
(
outPort
.
getPortNumber
()))
.
build
();
OFAction
act
=
buildOutput
(
outPort
.
getPortNumber
());
pktout
=
builder
.
setXid
(
pktin
.
getXid
())
.
setBufferId
(
OFBufferId
.
NO_BUFFER
)
.
setActions
(
Collections
.
singletonList
(
act
))
...
...
@@ -85,4 +91,12 @@ public final class DefaultPacketContext implements PacketContext {
return
pktin
.
getData
().
clone
();
}
private
OFActionOutput
buildOutput
(
Integer
port
)
{
OFActionOutput
act
=
sw
.
factory
().
actions
()
.
buildOutput
()
.
setPort
(
OFPort
.
of
(
port
))
.
build
();
return
act
;
}
}
...
...
Please
register
or
login
to post a comment