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
3a86fd4a
Commit
3a86fd4a
authored
8 years ago
by
jkhutch3
Browse files
Options
Downloads
Patches
Plain Diff
Added a test for multiple cookies (found out the cookies are inserted in different orders)
Moving this to my own branch (I am forking it)
parent
e07ecae9
No related branches found
Branches containing commit
No related tags found
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
+48
-0
48 additions, 0 deletions
...a/net/floodlightcontroller/forwarding/ForwardingTest.java
with
48 additions
and
0 deletions
src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java
+
48
−
0
View file @
3a86fd4a
...
...
@@ -969,5 +969,53 @@ public class ForwardingTest extends FloodlightTestCase {
.
build
());
assertTrue
(
OFMessageUtils
.
equalsIgnoreXid
((
OFMessage
)
wc1
.
getValue
().
toArray
()[
0
],
(
OFMessage
)
msgs_test
.
toArray
()[
0
]));
assertTrue
(
OFMessageUtils
.
equalsIgnoreXid
((
OFMessage
)
wc2
.
getValue
().
toArray
()[
0
],
(
OFMessage
)
msgs_test
.
toArray
()[
0
]));
}
@Test
public
void
testForwardDeleteFlowsByDescriptorMultiple
()
throws
Exception
{
// Probably a tomorrow thing but there is a crash when it gets to "getActiveSwitch" in MockSwitchManager
Capture
<
Set
<
OFMessage
>>
wc1
=
EasyMock
.
newCapture
(
CaptureType
.
ALL
);
Capture
<
Set
<
OFMessage
>>
wc2
=
EasyMock
.
newCapture
(
CaptureType
.
ALL
);
List
<
Masked
<
U64
>>
descriptors
=
new
ArrayList
<
Masked
<
U64
>>();
descriptors
.
add
(
Masked
.
of
(
U64
.
of
(
0x00000000FFffFFff
L
),
U64
.
of
(
0x00200000FFffFFff
L
)));
// Mask = 0xffFFffFFL which is forwarding.DECISION_MASK/AppCookie.USER_MASK
descriptors
.
add
(
Masked
.
of
(
U64
.
of
(
0x00000000FFffFFff
L
),
U64
.
of
(
0x0020000000000000
L
)));
MockSwitchManager
switchService
=
getMockSwitchService
();
expect
(
sw1
.
getStatus
()).
andReturn
(
IOFSwitch
.
SwitchStatus
.
MASTER
).
anyTimes
();
expect
(
sw2
.
getStatus
()).
andReturn
(
IOFSwitch
.
SwitchStatus
.
MASTER
).
anyTimes
();
expect
(
sw1
.
write
(
capture
(
wc1
))).
andReturn
(
null
).
once
();
//.andReturn(true).once();
expect
(
sw2
.
write
(
capture
(
wc2
))).
andReturn
(
null
).
once
();
//.andReturn(true).once();
replay
(
sw1
,
sw2
,
routingEngine
);
forwarding
.
deleteFlowsByDescriptor
(
descriptors
);
verify
(
sw1
,
sw2
,
routingEngine
);
assertTrue
(
wc1
.
hasCaptured
());
assertTrue
(
wc2
.
hasCaptured
());
// Cookies
Masked
<
U64
>
masked_cookie
=
Masked
.
of
(
AppCookie
.
makeCookie
(
forwarding
.
FORWARDING_APP_ID
,
(
int
)
4294967295L
),
AppCookie
.
getAppFieldMask
().
or
(
U64
.
of
(
0xffffffff
L
)));
Masked
<
U64
>
masked_cookie2
=
Masked
.
of
(
AppCookie
.
makeCookie
(
forwarding
.
FORWARDING_APP_ID
,
0
),
AppCookie
.
getAppFieldMask
().
or
(
U64
.
of
(
0x0
L
)));
// Add cookies to a msg set
Set
<
OFMessage
>
msgs_test
=
new
HashSet
<
OFMessage
>();
msgs_test
.
add
(
factory
.
buildFlowDelete
()
.
setCookie
(
masked_cookie
.
getValue
())
.
setCookieMask
(
masked_cookie
.
getMask
())
.
build
());
msgs_test
.
add
(
factory
.
buildFlowDelete
()
.
setCookie
(
masked_cookie2
.
getValue
())
.
setCookieMask
(
masked_cookie2
.
getMask
())
.
build
());
// I would like to do a .containsIgnoreXid because the packets to delete should not need to be in a particular order
// as long as all packets are sent to the switch, but I do not (at this time) feel like making that function
assertTrue
(
OFMessageUtils
.
equalsIgnoreXid
((
OFMessage
)
wc1
.
getValue
().
toArray
()[
1
],
(
OFMessage
)
msgs_test
.
toArray
()[
0
]));
assertTrue
(
OFMessageUtils
.
equalsIgnoreXid
((
OFMessage
)
wc2
.
getValue
().
toArray
()[
0
],
(
OFMessage
)
msgs_test
.
toArray
()[
0
]));
assertTrue
(
OFMessageUtils
.
equalsIgnoreXid
((
OFMessage
)
wc1
.
getValue
().
toArray
()[
0
],
(
OFMessage
)
msgs_test
.
toArray
()[
1
]));
assertTrue
(
OFMessageUtils
.
equalsIgnoreXid
((
OFMessage
)
wc2
.
getValue
().
toArray
()[
1
],
(
OFMessage
)
msgs_test
.
toArray
()[
1
]));
}
}
\ No newline at end of file
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