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
4e182b9c
Commit
4e182b9c
authored
12 years ago
by
Saurav Das
Browse files
Options
Downloads
Patches
Plain Diff
Controller: fixing unit test for unknown vendor message
parent
35ccb057
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/core/internal/ControllerTest.java
+31
-0
31 additions, 0 deletions
...et/floodlightcontroller/core/internal/ControllerTest.java
with
31 additions
and
0 deletions
src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+
31
−
0
View file @
4e182b9c
...
...
@@ -50,6 +50,7 @@ import net.floodlightcontroller.core.internal.RoleChanger.PendingRoleRequestEntr
import
net.floodlightcontroller.core.module.FloodlightModuleContext
;
import
net.floodlightcontroller.core.test.MockFloodlightProvider
;
import
net.floodlightcontroller.core.test.MockThreadPoolService
;
import
net.floodlightcontroller.core.util.ListenerDispatcher
;
import
net.floodlightcontroller.counter.CounterStore
;
import
net.floodlightcontroller.counter.ICounterStoreService
;
import
net.floodlightcontroller.packet.ARP
;
...
...
@@ -1073,11 +1074,41 @@ public class ControllerTest extends FloodlightTestCase
@Test
public
void
testVendorMessageUnknown
()
throws
Exception
{
// Check behavior with an unknown vendor id
// Ensure that vendor message listeners get called, even for Vendors
// unknown to floodlight. It is the responsibility of the listener to
// discard unknown vendors.
OFChannelState
state
=
new
OFChannelState
();
state
.
hsState
=
HandshakeState
.
READY
;
Controller
.
OFChannelHandler
chdlr
=
controller
.
new
OFChannelHandler
(
state
);
OFVendor
msg
=
new
OFVendor
();
msg
.
setVendor
(
0
);
IOFSwitch
sw
=
createMock
(
IOFSwitch
.
class
);
chdlr
.
sw
=
sw
;
controller
.
activeSwitches
.
put
(
1L
,
sw
);
// prepare the Vendor Message Listener expectations
ListenerDispatcher
<
OFType
,
IOFMessageListener
>
ld
=
new
ListenerDispatcher
<
OFType
,
IOFMessageListener
>();
IOFMessageListener
ml
=
createMock
(
IOFMessageListener
.
class
);
expect
(
ml
.
getName
()).
andReturn
(
"Dummy"
).
anyTimes
();
expect
(
ml
.
isCallbackOrderingPrereq
((
OFType
)
anyObject
(),
(
String
)
anyObject
())).
andReturn
(
false
).
anyTimes
();
expect
(
ml
.
isCallbackOrderingPostreq
((
OFType
)
anyObject
(),
(
String
)
anyObject
())).
andReturn
(
false
).
anyTimes
();
expect
(
ml
.
receive
(
eq
(
sw
),
eq
(
msg
),
isA
(
FloodlightContext
.
class
))).
andReturn
(
Command
.
CONTINUE
).
once
();
controller
.
messageListeners
.
put
(
OFType
.
VENDOR
,
ld
);
// prepare the switch and lock expectations
Lock
lock
=
createNiceMock
(
Lock
.
class
);
expect
(
sw
.
getListenerReadLock
()).
andReturn
(
lock
).
anyTimes
();
expect
(
sw
.
isConnected
()).
andReturn
(
true
).
anyTimes
();
expect
(
sw
.
getHARole
()).
andReturn
(
Role
.
MASTER
).
anyTimes
();
expect
(
sw
.
getId
()).
andReturn
(
1L
).
anyTimes
();
// test
replay
(
chdlr
.
sw
,
lock
,
ml
);
ld
.
addListener
(
OFType
.
VENDOR
,
ml
);
chdlr
.
processOFMessage
(
msg
);
}
...
...
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