Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
floodlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
croft1
floodlight
Commits
bbeb2ad7
Commit
bbeb2ad7
authored
12 years ago
by
Alex Reimers
Browse files
Options
Downloads
Patches
Plain Diff
FL-82 - Cleanup Forwarding to pay better attention to IRoutingDecisions.
parent
1bdce614
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
+53
-27
53 additions, 27 deletions
.../java/net/floodlightcontroller/forwarding/Forwarding.java
with
53 additions
and
27 deletions
src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
+
53
−
27
View file @
bbeb2ad7
...
...
@@ -17,7 +17,6 @@
package
net.floodlightcontroller.forwarding
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
...
...
@@ -60,40 +59,65 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule {
protected
static
Logger
log
=
LoggerFactory
.
getLogger
(
Forwarding
.
class
);
@Override
public
Command
processPacketInMessage
(
IOFSwitch
sw
,
OFPacketIn
pi
,
IRoutingDecision
decision
,
FloodlightContext
cntx
)
{
public
Command
processPacketInMessage
(
IOFSwitch
sw
,
OFPacketIn
pi
,
IRoutingDecision
decision
,
FloodlightContext
cntx
)
{
Ethernet
eth
=
IFloodlightProviderService
.
bcStore
.
get
(
cntx
,
IFloodlightProviderService
.
CONTEXT_PI_PAYLOAD
);
IFloodlightProviderService
.
CONTEXT_PI_PAYLOAD
);
// If a decision has been made we obey it
// otherwise we just forward
if
(
decision
!=
null
)
{
//log.info("Decision made for packet!");
if
(
decision
.
getRoutingAction
()
==
IRoutingDecision
.
RoutingAction
.
DROP
)
{
log
.
info
(
"dropping packet as per decision"
);
doDropFlow
(
sw
,
pi
,
decision
,
cntx
);
return
Command
.
CONTINUE
;
}
}
else
{
//log.info("No decision found!");
}
if
(
eth
.
isBroadcast
()
||
eth
.
isMulticast
())
{
// For now we treat multicast as broadcast
doFlood
(
sw
,
pi
,
cntx
);
if
(
log
.
isTraceEnabled
())
{
log
.
trace
(
"Forwaring decision={} was made for PacketIn={}"
,
decision
.
getRoutingAction
().
toString
(),
pi
);
}
switch
(
decision
.
getRoutingAction
())
{
case
NONE:
// don't do anything
return
Command
.
CONTINUE
;
case
FORWARD:
doForwardFlow
(
sw
,
pi
,
cntx
,
false
);
return
Command
.
CONTINUE
;
case
MULTICAST:
// treat as broadcast
doFlood
(
sw
,
pi
,
cntx
);
return
Command
.
CONTINUE
;
case
DROP:
doDropFlow
(
sw
,
pi
,
decision
,
cntx
);
return
Command
.
CONTINUE
;
default
:
log
.
error
(
"Unexpected decision made for this packet-in={}"
,
pi
,
decision
.
getRoutingAction
());
return
Command
.
CONTINUE
;
}
}
else
{
doForwardFlow
(
sw
,
pi
,
cntx
,
false
);
if
(
log
.
isTraceEnabled
())
{
log
.
trace
(
"No decision was made for PacketIn={}, forwarding"
,
pi
);
}
if
(
eth
.
isBroadcast
()
||
eth
.
isMulticast
())
{
// For now we treat multicast as broadcast
doFlood
(
sw
,
pi
,
cntx
);
}
else
{
doForwardFlow
(
sw
,
pi
,
cntx
,
false
);
}
}
return
Command
.
CONTINUE
;
}
protected
void
doDropFlow
(
IOFSwitch
sw
,
OFPacketIn
pi
,
IRoutingDecision
decision
,
FloodlightContext
cntx
)
{
// initialize match structure and populate it using the packet
OFMatch
match
=
new
OFMatch
();
match
.
loadFromPacket
(
pi
.
getPacketData
(),
pi
.
getInPort
());
if
(
decision
.
getWildcards
()
!=
null
)
{
match
.
setWildcards
(
decision
.
getWildcards
());
}
// Create flow-mod based on packet-in and src-switch
// initialize match structure and populate it using the packet
OFMatch
match
=
new
OFMatch
();
match
.
loadFromPacket
(
pi
.
getPacketData
(),
pi
.
getInPort
());
if
(
decision
.
getWildcards
()
!=
null
)
{
match
.
setWildcards
(
decision
.
getWildcards
());
}
// Create flow-mod based on packet-in and src-switch
OFFlowMod
fm
=
(
OFFlowMod
)
floodlightProvider
.
getOFMessageFactory
()
.
getMessage
(
OFType
.
FLOW_MOD
);
...
...
@@ -110,8 +134,10 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule {
.
setLengthU
(
OFFlowMod
.
MINIMUM_LENGTH
);
// +OFActionOutput.MINIMUM_LENGTH);
try
{
log
.
debug
(
"write drop flow-mod sw={} match={} flow-mod={}"
,
new
Object
[]
{
sw
,
match
,
fm
});
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"write drop flow-mod sw={} match={} flow-mod={}"
,
new
Object
[]
{
sw
,
match
,
fm
});
}
sw
.
write
(
fm
,
cntx
);
}
catch
(
IOException
e
)
{
log
.
error
(
"Failure writing drop flow mod"
,
e
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment