Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
57d3634c
Commit
57d3634c
authored
Sep 25, 2013
by
Marcin Siodelski
Browse files
[3173] Addressed review comments.
parent
b2686c2d
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/tools/perfdhcp/test_control.h
View file @
57d3634c
...
...
@@ -861,13 +861,6 @@ private:
/// specified, this function expects that IA_PD option is present in the
/// packet encapsulated by pkt_to object.
///
/// \todo In the future it is planned to add support for the perfdhcp to
/// request address and prefix in the same DHCP message (request both
/// IA_NA and IA_PD options). In this case, this function will have to
/// be extended to copy both IA_NA and IA_PD options.
///
/// \warning
///
/// \param [in] pkt_from A packet from which options should be copied.
/// \param [out] pkt_to A packet to which options should be copied.
///
...
...
tests/tools/perfdhcp/tests/stats_mgr_unittest.cc
View file @
57d3634c
...
...
@@ -81,6 +81,10 @@ public:
///
/// Method simulates sending or receiving multiple DHCPv6 packets.
///
/// \note The xchg_type parameter is passed as non-const value to avoid
/// false cppcheck errors which expect enum value being passed by reference.
/// This error is not reported when non-const enum is passed by value.
///
/// \param stats_mgr Statistics Manager instance to be used.
/// \param xchg_type packet exchange types.
/// \param packet_type DHCPv6 packet type.
...
...
@@ -88,7 +92,7 @@ public:
/// \param receive simulated packets are received (if true)
/// or sent (if false)
void
passMultiplePackets6
(
const
boost
::
shared_ptr
<
StatsMgr6
>
stats_mgr
,
const
StatsMgr6
::
ExchangeType
xchg_type
,
StatsMgr6
::
ExchangeType
xchg_type
,
const
uint8_t
packet_type
,
const
int
num_packets
,
const
bool
receive
=
false
)
{
...
...
tests/tools/perfdhcp/tests/test_control_unittest.cc
View file @
57d3634c
...
...
@@ -521,14 +521,8 @@ public:
boost
::
shared_ptr
<
Pkt6
>
advertise_pkt6
(
createAdvertisePkt6
(
transid
));
// Receive ADVERTISE and send REQUEST.
/* ASSERT_NO_THROW(tc.processReceivedPacket6(sock,
advertise_pkt6)); */
try
{
tc
.
processReceivedPacket6
(
sock
,
advertise_pkt6
);
}
catch
(
const
Exception
&
ex
)
{
std
::
cout
<<
ex
.
what
()
<<
std
::
endl
;
}
ASSERT_NO_THROW
(
tc
.
processReceivedPacket6
(
sock
,
advertise_pkt6
));
++
transid
;
}
if
(
tc
.
checkExitConditions
())
{
...
...
@@ -980,7 +974,7 @@ TEST_F(TestControlTest, Packet4Exchange) {
EXPECT_EQ
(
12
,
iterations_performed
);
}
TEST_F
(
TestControlTest
,
Packet6Exchange
)
{
TEST_F
(
TestControlTest
,
Packet6Exchange
FromTemplate
)
{
// Get the local loopback interface to open socket on
// it and test packets exchanges. We don't want to fail
// the test if interface is not available.
...
...
@@ -1015,11 +1009,56 @@ TEST_F(TestControlTest, Packet6Exchange) {
// then test should be interrupted and actual number of iterations will
// be 6.
const
int
received_num
=
3
;
// Simulate the number of Solicit-Advertise-Request-Reply (SARR) echanges.
// The test function generates server's responses and passes it to the
// TestControl class methods for processing. The number of exchanges
// actually performed is returned in 'iterations_performed' argument. If
// processing is successful, the number of performed iterations should be
// equal to the number of exchanges specified with the '-n' command line
// parameter (10 in this case). All exchanged packets carry the IA_NA option
// to simulate the IPv6 address acquisition and to verify that the
// IA_NA options returned by the server are processed correctly.
testPkt6Exchange
(
iterations_num
,
received_num
,
use_templates
,
iterations_performed
);
EXPECT_EQ
(
6
,
iterations_performed
);
}
TEST_F
(
TestControlTest
,
Packet6Exchange
)
{
// Get the local loopback interface to open socket on
// it and test packets exchanges. We don't want to fail
// the test if interface is not available.
std
::
string
loopback_iface
(
getLocalLoopback
());
if
(
loopback_iface
.
empty
())
{
std
::
cout
<<
"Unable to find the loopback interface. Skip test."
<<
std
::
endl
;
return
;
}
const
int
iterations_num
=
100
;
// Set number of iterations to 10.
processCmdLine
(
"perfdhcp -l "
+
loopback_iface
+
" -e address-only"
+
" -6 -r 100 -n 10 -R 20 -L 10547 ::1"
);
int
iterations_performed
=
0
;
// Set number of received packets equal to number of iterations.
// This simulates no packet drops.
bool
use_templates
=
false
;
// Simulate the number of Solicit-Advertise-Request-Reply (SARR) echanges.
// The test function generates server's responses and passes it to the
// TestControl class methods for processing. The number of exchanges
// actually performed is returned in 'iterations_performed' argument. If
// processing is successful, the number of performed iterations should be
// equal to the number of exchanges specified with the '-n' command line
// parameter (10 in this case). All exchanged packets carry the IA_NA option
// to simulate the IPv6 address acqusition and to verify that the IA_NA
// options returned by the server are processed correctly.
testPkt6Exchange
(
iterations_num
,
iterations_num
,
use_templates
,
iterations_performed
);
// Actual number of iterations should be 10.
EXPECT_EQ
(
10
,
iterations_performed
);
}
TEST_F
(
TestControlTest
,
Packet6ExchangePrefixDelegation
)
{
// Get the local loopback interface to open socket on
// it and test packets exchanges. We don't want to fail
...
...
@@ -1040,6 +1079,16 @@ TEST_F(TestControlTest, Packet6ExchangePrefixDelegation) {
// Set number of received packets equal to number of iterations.
// This simulates no packet drops.
bool
use_templates
=
false
;
// Simulate the number of Solicit-Advertise-Request-Reply (SARR) echanges.
// The test function generates server's responses and passes it to the
// TestControl class methods for processing. The number of exchanges
// actually performed is returned in 'iterations_performed' argument. If
// processing is successful, the number of performed iterations should be
// equal to the number of exchanges specified with the '-n' command line
// parameter (10 in this case). All exchanged packets carry the IA_PD option
// to simulate the Prefix Delegation and to verify that the IA_PD options
// returned by the server are processed correctly.
testPkt6Exchange
(
iterations_num
,
iterations_num
,
use_templates
,
iterations_performed
);
// Actual number of iterations should be 10.
...
...
@@ -1066,6 +1115,16 @@ TEST_F(TestControlTest, Packet6ExchangeAddressAndPrefix) {
// Set number of received packets equal to number of iterations.
// This simulates no packet drops.
bool
use_templates
=
false
;
// Simulate the number of Solicit-Advertise-Request-Reply (SARR) echanges.
// The test function generates server's responses and passes it to the
// TestControl class methods for processing. The number of exchanges
// actually performed is returned in 'iterations_performed' argument. If
// processing is successful, the number of performed iterations should be
// equal to the number of exchanges specified with the '-n' command line
// parameter (10 in this case). All exchanged packets carry either IA_NA
// or IA_PD options to simulate the address and prefix acquisition with
// the single message and to verify that the IA_NA and IA_PD options
// returned by the server are processed correctly.
testPkt6Exchange
(
iterations_num
,
iterations_num
,
use_templates
,
iterations_performed
);
// Actual number of iterations should be 10.
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment