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
7fd1aaa6
Commit
7fd1aaa6
authored
12 years ago
by
Gregor Maier
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Move ForwardingTest to correct package."
This reverts commit f10162148b078c25020ea3523981765c42bef2c7.
parent
457ddf1f
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/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java
+9
-145
9 additions, 145 deletions
...a/net/floodlightcontroller/forwarding/ForwardingTest.java
with
9 additions
and
145 deletions
src/test/java/net/floodlightcontroller/
rout
ing/ForwardingTest.java
→
src/test/java/net/floodlightcontroller/
forward
ing/ForwardingTest.java
+
9
−
145
View file @
7fd1aaa6
...
...
@@ -15,12 +15,11 @@
* under the License.
**/
package
net.floodlightcontroller.
rout
ing
;
package
net.floodlightcontroller.
forward
ing
;
import
static
org
.
easymock
.
EasyMock
.*;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -110,13 +109,13 @@ public class ForwardingTest extends FloodlightTestCase {
FloodlightTestModuleLoader fml = new FloodlightTestModuleLoader();
fml.setupModules(mods, mockedServices);
mockFloodlightProvider =
(MockFloodlightProvider) fml.getModuleByName(MockFloodlightProvider.class);
(MockFloodlightProvider) fml.getModuleByName(MockFloodlightProvider.class);
deviceManager =
(MockDeviceManager) fml.getModuleByName(MockDeviceManager.class);
(MockDeviceManager) fml.getModuleByName(MockDeviceManager.class);
threadPool =
(MockThreadPoolService) fml.getModuleByName(MockThreadPoolService.class);
(MockThreadPoolService) fml.getModuleByName(MockThreadPoolService.class);
forwarding =
(Forwarding) fml.getModuleByName(Forwarding.class);
(Forwarding) fml.getModuleByName(Forwarding.class);
*/
mockFloodlightProvider
=
getMockFloodlightProvider
();
forwarding
=
new
Forwarding
();
...
...
@@ -179,10 +178,10 @@ public class ForwardingTest extends FloodlightTestCase {
OFMatch
.
OFPFW_NW_DST_ALL
|
OFMatch
.
OFPFW_NW_TOS
;
expect
(
sw1
.
getAttribute
(
IOFSwitch
.
PROP_FASTWILDCARDS
)).
andReturn
(
fastWildcards
).
anyTimes
();
expect
(
sw1
.
getAttribute
(
IOFSwitch
.
PROP_FASTWILDCARDS
)).
andReturn
(
(
Integer
)
fastWildcards
).
anyTimes
();
expect
(
sw1
.
hasAttribute
(
IOFSwitch
.
PROP_SUPPORTS_OFPP_TABLE
)).
andReturn
(
true
).
anyTimes
();
expect
(
sw2
.
getAttribute
(
IOFSwitch
.
PROP_FASTWILDCARDS
)).
andReturn
(
fastWildcards
).
anyTimes
();
expect
(
sw2
.
getAttribute
(
IOFSwitch
.
PROP_FASTWILDCARDS
)).
andReturn
(
(
Integer
)
fastWildcards
).
anyTimes
();
expect
(
sw2
.
hasAttribute
(
IOFSwitch
.
PROP_SUPPORTS_OFPP_TABLE
)).
andReturn
(
true
).
anyTimes
();
// Load the switch map
...
...
@@ -215,8 +214,8 @@ public class ForwardingTest extends FloodlightTestCase {
packetIn
=
((
OFPacketIn
)
mockFloodlightProvider
.
getOFMessageFactory
().
getMessage
(
OFType
.
PACKET_IN
))
.
setBufferId
(-
1
)
.
setInPort
((
short
)
1
)
.
setBufferId
(
0x4242
)
.
setPacketData
(
testPacketSerialized
)
.
setReason
(
OFPacketInReason
.
NO_MATCH
)
.
setTotalLength
((
short
)
testPacketSerialized
.
length
);
...
...
@@ -232,7 +231,6 @@ public class ForwardingTest extends FloodlightTestCase {
packetOut
.
setActions
(
poactions
)
.
setActionsLength
((
short
)
OFActionOutput
.
MINIMUM_LENGTH
)
.
setPacketData
(
testPacketSerialized
)
.
setBufferId
(
OFPacketOut
.
BUFFER_ID_NONE
)
.
setLengthU
(
OFPacketOut
.
MINIMUM_LENGTH
+
packetOut
.
getActionsLength
()+
testPacketSerialized
.
length
);
...
...
@@ -249,7 +247,6 @@ public class ForwardingTest extends FloodlightTestCase {
packetOutFlooded
.
setActions
(
poactions
)
.
setActionsLength
((
short
)
OFActionOutput
.
MINIMUM_LENGTH
)
.
setPacketData
(
testPacketSerialized
)
.
setBufferId
(
OFPacketOut
.
BUFFER_ID_NONE
)
.
setLengthU
(
OFPacketOut
.
MINIMUM_LENGTH
+
packetOutFlooded
.
getActionsLength
()+
testPacketSerialized
.
length
);
...
...
@@ -519,138 +516,5 @@ public class ForwardingTest extends FloodlightTestCase {
forwarding
.
receive
(
sw1
,
this
.
packetIn
,
cntx
);
verify
(
sw1
,
sw2
,
routingEngine
);
}
@Test
public
void
testPushPacketIPacket
()
throws
Exception
{
FloodlightContext
cntx
=
new
FloodlightContext
();
short
inPort
=
1
;
short
outPort
=
2
;
int
bufferId
=
0x42
;
// Craft the packet out we expect.
OFPacketOut
po
=
(
OFPacketOut
)
mockFloodlightProvider
.
getOFMessageFactory
()
.
getMessage
(
OFType
.
PACKET_OUT
);
po
.
setInPort
(
inPort
);
List
<
OFAction
>
actions
=
Collections
.
singletonList
(
(
OFAction
)
new
OFActionOutput
(
outPort
,
(
short
)
0xffff
));
po
.
setActions
(
actions
)
.
setActionsLength
((
short
)
OFActionOutput
.
MINIMUM_LENGTH
);
short
poLength
=
(
short
)
(
po
.
getActionsLength
()
+
OFPacketOut
.
MINIMUM_LENGTH
);
po
.
setLength
(
poLength
);
// TEST1: we want to use the bufferId. Packet payload should be
// ignored.
po
.
setBufferId
(
bufferId
);
reset
(
sw1
);
expect
(
sw1
.
getStringId
())
.
andReturn
(
"00:00:00:00:00:00:00:01"
).
anyTimes
();
expect
(
sw1
.
getId
()).
andReturn
(
1L
).
anyTimes
();
sw1
.
write
(
po
,
cntx
);
expectLastCall
().
once
();
replay
(
sw1
);
forwarding
.
pushPacket
(
testPacket
,
sw1
,
bufferId
,
inPort
,
outPort
,
cntx
,
false
);
verify
(
sw1
);
// TEST2: do not use buffer Id but also don't set a packet payload.
// nothing should happen.
po
.
setBufferId
(
OFPacketOut
.
BUFFER_ID_NONE
);
reset
(
sw1
);
replay
(
sw1
);
forwarding
.
pushPacket
(
null
,
sw1
,
OFPacketOut
.
BUFFER_ID_NONE
,
inPort
,
outPort
,
cntx
,
false
);
verify
(
sw1
);
// TEST3: we want to use the bufferId.
po
.
setBufferId
(
OFPacketOut
.
BUFFER_ID_NONE
);
po
.
setPacketData
(
testPacketSerialized
);
poLength
+=
testPacketSerialized
.
length
;
po
.
setLength
(
poLength
);
reset
(
sw1
);
expect
(
sw1
.
getStringId
())
.
andReturn
(
"00:00:00:00:00:00:00:01"
).
anyTimes
();
expect
(
sw1
.
getId
()).
andReturn
(
1L
).
anyTimes
();
sw1
.
write
(
po
,
cntx
);
expectLastCall
().
once
();
replay
(
sw1
);
forwarding
.
pushPacket
(
testPacket
,
sw1
,
OFPacketOut
.
BUFFER_ID_NONE
,
inPort
,
outPort
,
cntx
,
false
);
verify
(
sw1
);
}
@Test
public
void
testPushPacketPacketIn
()
throws
Exception
{
short
inPort
=
1
;
short
outPort
=
2
;
int
bufferId
=
0x42
;
packetIn
.
setInPort
(
inPort
);
packetIn
.
setBufferId
(
bufferId
);
// Craft the packet out we expect.
OFPacketOut
po
=
(
OFPacketOut
)
mockFloodlightProvider
.
getOFMessageFactory
()
.
getMessage
(
OFType
.
PACKET_OUT
);
po
.
setInPort
(
inPort
);
List
<
OFAction
>
actions
=
Collections
.
singletonList
(
(
OFAction
)
new
OFActionOutput
(
outPort
,
(
short
)
0xffff
));
po
.
setActions
(
actions
)
.
setActionsLength
((
short
)
OFActionOutput
.
MINIMUM_LENGTH
);
short
poLength
=
(
short
)
(
po
.
getActionsLength
()
+
OFPacketOut
.
MINIMUM_LENGTH
);
po
.
setLength
(
poLength
);
// TEST1: we want to use the bufferId. Packet payload should be
// ignored.
po
.
setBufferId
(
bufferId
);
reset
(
sw1
);
expect
(
sw1
.
getStringId
())
.
andReturn
(
"00:00:00:00:00:00:00:01"
).
anyTimes
();
expect
(
sw1
.
getId
()).
andReturn
(
1L
).
anyTimes
();
sw1
.
write
(
po
,
cntx
);
expectLastCall
().
once
();
replay
(
sw1
);
forwarding
.
pushPacket
(
sw1
,
packetIn
,
true
,
outPort
,
cntx
);
verify
(
sw1
);
// TEST2: we do NOT want to use the bufferId. Packet payload should be
// used.
po
.
setBufferId
(
OFPacketOut
.
BUFFER_ID_NONE
);
po
.
setPacketData
(
testPacketSerialized
);
poLength
+=
testPacketSerialized
.
length
;
po
.
setLength
(
poLength
);
reset
(
sw1
);
expect
(
sw1
.
getStringId
())
.
andReturn
(
"00:00:00:00:00:00:00:01"
).
anyTimes
();
expect
(
sw1
.
getId
()).
andReturn
(
1L
).
anyTimes
();
sw1
.
write
(
po
,
cntx
);
expectLastCall
().
once
();
replay
(
sw1
);
forwarding
.
pushPacket
(
sw1
,
packetIn
,
false
,
outPort
,
cntx
);
verify
(
sw1
);
// TEST3: we want to use the bufferId but the packet in
// doesn't have a buferId set,
packetIn
.
setBufferId
(
OFPacketOut
.
BUFFER_ID_NONE
);
reset
(
sw1
);
expect
(
sw1
.
getStringId
())
.
andReturn
(
"00:00:00:00:00:00:00:01"
).
anyTimes
();
expect
(
sw1
.
getId
()).
andReturn
(
1L
).
anyTimes
();
sw1
.
write
(
po
,
cntx
);
expectLastCall
().
once
();
replay
(
sw1
);
forwarding
.
pushPacket
(
sw1
,
packetIn
,
true
,
outPort
,
cntx
);
verify
(
sw1
);
}
}
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