Commit 61f14487 authored by Marcin Siodelski's avatar Marcin Siodelski

[1959] Implemented most of the command line options.

parent 3e6ed8d5
......@@ -78,15 +78,27 @@ TestControl::instance() {
return (test_control);
}
TestControl::TestControl() :
send_due_(microsec_clock::universal_time()),
last_sent_(send_due_),
transid_gen_(new TransidGenerator()) {
TestControl::TestControl() {
reset();
}
bool
TestControl::checkExitConditions() const {
CommandOptions& options = CommandOptions::instance();
// Check if test period passed..
if (options.getPeriod() != 0) {
if (options.getIpVersion() == 4) {
time_period period(stats_mgr4_->getTestPeriod());
if (period.length().total_seconds() >= options.getPeriod()) {
return true;
}
} else if (options.getIpVersion() == 6) {
time_period period = stats_mgr6_->getTestPeriod();
if (period.length().total_seconds() >= options.getPeriod()) {
return true;
}
}
}
// Check if we reached maximum number of DISCOVER/SOLICIT sent.
if (options.getNumRequests().size() > 0) {
if (options.getIpVersion() == 4) {
......@@ -167,14 +179,14 @@ TestControl::checkExitConditions() const {
if ((stats_mgr4_->getSentPacketsNum(StatsMgr4::XCHG_RA) > 10) &&
((100. * stats_mgr4_->getDroppedPacketsNum(StatsMgr4::XCHG_RA) /
stats_mgr4_->getSentPacketsNum(StatsMgr4::XCHG_RA)) >=
options.getMaxDropPercentage()[0])) {
options.getMaxDropPercentage()[1])) {
return(true);
}
} else if (options.getIpVersion() == 6) {
if ((stats_mgr6_->getSentPacketsNum(StatsMgr6::XCHG_RR) > 10) &&
((100. * stats_mgr6_->getDroppedPacketsNum(StatsMgr6::XCHG_RR) /
stats_mgr6_->getSentPacketsNum(StatsMgr6::XCHG_RR)) >=
options.getMaxDropPercentage()[0])) {
options.getMaxDropPercentage()[1])) {
return(true);
}
}
......@@ -372,6 +384,18 @@ TestControl::getSentPacketsNum(const ExchangeType xchg_type) const {
getSentPacketsNum(static_cast<StatsMgr6::ExchangeType>(xchg_type)));
}
void
TestControl::initPacketTemplates() {
CommandOptions& options = CommandOptions::instance();
std::vector<std::string> template_files = options.getTemplateFiles();
for (std::vector<std::string>::const_iterator it = template_files.begin();
it != template_files.end();
++it) {
std::cout << "Open file " << *it << std::endl;
}
}
void
TestControl::initializeStatsMgr() {
CommandOptions& options = CommandOptions::instance();
......@@ -394,10 +418,11 @@ TestControl::initializeStatsMgr() {
}
int
TestControl::openSocket(uint16_t port) const {
TestControl::openSocket() const {
CommandOptions& options = CommandOptions::instance();
std::string localname = options.getLocalName();
std::string servername = options.getServerName();
uint16_t port = options.getLocalPort();
uint8_t family = AF_INET;
int sock = 0;
IOAddress remoteaddr(servername);
......@@ -522,18 +547,18 @@ TestControl::printStats() const {
}
void
TestControl::receivePacket4(const TestControlSocket&,
TestControl::receivePacket4(const TestControlSocket& socket,
const Pkt4Ptr& pkt4) {
switch(pkt4->getType()) {
case DHCPOFFER :
stats_mgr4_->passRcvdPacket(StatsMgr4::XCHG_DO, pkt4);
break;
case DHCPACK :
if (pkt4->getType() == DHCPOFFER) {
Pkt4Ptr discover_pkt4(stats_mgr4_->passRcvdPacket(StatsMgr4::XCHG_DO,
pkt4));
CommandOptions::ExchangeMode xchg_mode =
CommandOptions::instance().getExchangeMode();
if ((xchg_mode == CommandOptions::DORA_SARR) && discover_pkt4) {
sendRequest4(socket, pkt4);
}
} else if (pkt4->getType() == DHCPACK) {
stats_mgr4_->passRcvdPacket(StatsMgr4::XCHG_RA, pkt4);
break;
default:
isc_throw(BadValue, "unknown type " << pkt4->getType()
<< " of received DHCPv4 packet");
}
}
......@@ -544,14 +569,13 @@ TestControl::receivePacket6(const TestControlSocket& socket,
if (packet_type == DHCPV6_ADVERTISE) {
Pkt6Ptr solicit_pkt6(stats_mgr6_->passRcvdPacket(StatsMgr6::XCHG_SA,
pkt6));
if (solicit_pkt6) {
CommandOptions::ExchangeMode xchg_mode =
CommandOptions::instance().getExchangeMode();
if ((xchg_mode == CommandOptions::DORA_SARR) && solicit_pkt6) {
sendRequest6(socket, solicit_pkt6, pkt6);
}
} else if (packet_type == DHCPV6_REPLY) {
stats_mgr6_->passRcvdPacket(StatsMgr6::XCHG_RR, pkt6);
} else {
isc_throw(BadValue, "unknown type " << pkt6->getType()
<< " of received DHCPv6 packet");
}
}
......@@ -589,6 +613,9 @@ TestControl::registerOptionFactories4() const {
LibDHCP::OptionFactoryRegister(Option::V4,
DHO_DHCP_MESSAGE_TYPE,
&TestControl::factoryGeneric);
LibDHCP::OptionFactoryRegister(Option::V4,
DHO_DHCP_SERVER_IDENTIFIER,
&TestControl::factoryGeneric);
// DHCP_PARAMETER_REQUEST_LIST option factory.
LibDHCP::OptionFactoryRegister(Option::V4,
DHO_DHCP_PARAMETER_REQUEST_LIST,
......@@ -613,7 +640,9 @@ TestControl::registerOptionFactories6() const {
LibDHCP::OptionFactoryRegister(Option::V6,
D6O_CLIENTID,
&TestControl::factoryGeneric);
LibDHCP::OptionFactoryRegister(Option::V6,
D6O_SERVERID,
&TestControl::factoryGeneric);
LibDHCP::OptionFactoryRegister(Option::V6,
D6O_IA_NA,
&TestControl::factoryIana6);
......@@ -639,10 +668,23 @@ TestControl::registerOptionFactories() const {
}
}
void
TestControl::reset() {
send_due_ = microsec_clock::universal_time();
last_sent_ = send_due_;
transid_gen_.reset();
transid_gen_ = TransidGeneratorPtr(new TransidGenerator());
first_packet_serverid_.clear();
}
void
TestControl::run() {
sent_packets_0_ = 0;
sent_packets_1_ = 0;
// Reset singleton state before test starts.
reset();
CommandOptions& options = CommandOptions::instance();
// Ip version is not set ONLY in case the command options
// were not parsed. This surely means that parse() function
......@@ -655,7 +697,26 @@ TestControl::run() {
registerOptionFactories();
TestControlSocket socket(openSocket());
// Initialize packet templates.
initPacketTemplates();
// Initialize randomization seed.
if (options.isSeeded()) {
srandom(options.getSeed());
}
// Preload server with number of packets.
const bool do_preload = true;
for (int i = 0; i < options.getPreload(); ++i) {
if (options.getIpVersion() == 4) {
sendDiscover4(socket, do_preload);
} else if (options.getIpVersion() == 6) {
sendSolicit6(socket, do_preload);
}
}
initializeStatsMgr();
uint64_t packets_sent = 0;
for (;;) {
updateSendDue();
......@@ -679,7 +740,8 @@ TestControl::run() {
}
void
TestControl::sendDiscover4(const TestControlSocket& socket) {
TestControl::sendDiscover4(const TestControlSocket& socket,
const bool preload /*= false*/) {
++sent_packets_0_;
last_sent_ = microsec_clock::universal_time();
// Generate the MAC address to be passed in the packet.
......@@ -698,6 +760,61 @@ TestControl::sendDiscover4(const TestControlSocket& socket) {
pkt4->addOption(Option::factory(Option::V4,
DHO_DHCP_PARAMETER_REQUEST_LIST));
// Set client's and server's ports as well as server's address,
// and local (relay) address.
setDefaults4(socket, pkt4);
pkt4->pack();
IfaceMgr::instance().send(pkt4);
if (!preload) {
if (!stats_mgr4_) {
isc_throw(InvalidOperation, "Statistics Manager for DHCPv4 "
"hasn't been initialized");
}
stats_mgr4_->passSentPacket(StatsMgr4::XCHG_DO, pkt4);
}
}
void
TestControl::sendRequest4(const TestControlSocket& socket,
const dhcp::Pkt4Ptr& offer_pkt4) {
const uint32_t transid = generateTransid();
Pkt4Ptr pkt4(new Pkt4(DHCPREQUEST, transid));
OptionBuffer buf_msg_type;
buf_msg_type.push_back(DHCPREQUEST);
OptionPtr opt_msg_type = Option::factory(Option::V4, DHO_DHCP_MESSAGE_TYPE,
buf_msg_type);
pkt4->addOption(opt_msg_type);
if (first_packet_serverid_.size() > 0) {
pkt4->addOption(Option::factory(Option::V4, DHO_DHCP_SERVER_IDENTIFIER,
first_packet_serverid_));
} else {
OptionPtr opt_serverid =
offer_pkt4->getOption(DHO_DHCP_SERVER_IDENTIFIER);
if (!opt_serverid) {
isc_throw(BadValue, "there is no SERVER_IDENTIFIER option "
<< "in OFFER message");
}
if (CommandOptions::instance().isUseFirst() &&
stats_mgr4_->getRcvdPacketsNum(StatsMgr4::XCHG_DO) == 1) {
first_packet_serverid_ = opt_serverid->getData();
}
pkt4->addOption(opt_serverid);
}
/// Set client address.
asiolink::IOAddress yiaddr = offer_pkt4->getYiaddr();
if (!yiaddr.getAddress().is_v4()) {
isc_throw(BadValue, "the YIADDR returned in OFFER packet is not "
" IPv4 address");
}
OptionPtr opt_requested_address =
OptionPtr(new Option(Option::V4, DHO_DHCP_REQUESTED_ADDRESS,
OptionBuffer()));
opt_requested_address->setUint32(yiaddr);
pkt4->addOption(opt_requested_address);
OptionPtr opt_parameter_list =
Option::factory(Option::V4, DHO_DHCP_PARAMETER_REQUEST_LIST);
pkt4->addOption(opt_parameter_list);
// Set client's and server's ports as well as server's address,
// and local (relay) address.
setDefaults4(socket, pkt4);
......@@ -707,14 +824,15 @@ TestControl::sendDiscover4(const TestControlSocket& socket) {
isc_throw(InvalidOperation, "Statistics Manager for DHCPv4 "
"hasn't been initialized");
}
stats_mgr4_->passSentPacket(StatsMgr4::XCHG_DO, pkt4);
stats_mgr4_->passSentPacket(StatsMgr4::XCHG_RA, pkt4);
}
void
TestControl::sendRequest6(const TestControlSocket& socket,
const Pkt6Ptr& solicit_pkt6,
const Pkt6Ptr& advertise_pkt6) {
const uint32_t transid = static_cast<uint32_t>(random() % 0x00FFFFFF);
const uint32_t transid = generateTransid();
Pkt6Ptr pkt6(new Pkt6(DHCPV6_REQUEST, transid));
// Calculate elapsed time
ptime solicit_time = solicit_pkt6->getTimestamp();
......@@ -741,11 +859,20 @@ TestControl::sendRequest6(const TestControlSocket& socket,
isc_throw(Unexpected, "client id not found in received packet");
}
pkt6->addOption(opt_clientid);
OptionPtr opt_serverid = advertise_pkt6->getOption(D6O_SERVERID);
if (!opt_serverid) {
isc_throw(Unexpected, "server id not found in received packet");
if (first_packet_serverid_.size() > 0) {
pkt6->addOption(Option::factory(Option::V6, D6O_SERVERID,
first_packet_serverid_));
} else {
OptionPtr opt_serverid = advertise_pkt6->getOption(D6O_SERVERID);
if (!opt_serverid) {
isc_throw(Unexpected, "server id not found in received packet");
}
if (CommandOptions::instance().isUseFirst() &&
stats_mgr6_->getRcvdPacketsNum(StatsMgr6::XCHG_SA) == 1) {
first_packet_serverid_ = opt_serverid->getData();
}
pkt6->addOption(opt_serverid);
}
pkt6->addOption(opt_serverid);
OptionPtr opt_ia_na = advertise_pkt6->getOption(D6O_IA_NA);
if (!opt_ia_na) {
isc_throw(Unexpected, "DHCPv6 IA_NA option not found in received "
......@@ -764,7 +891,8 @@ TestControl::sendRequest6(const TestControlSocket& socket,
}
void
TestControl::sendSolicit6(const TestControlSocket& socket) {
TestControl::sendSolicit6(const TestControlSocket& socket,
const bool preload /*= false*/) {
++sent_packets_0_;
last_sent_ = microsec_clock::universal_time();
// Generate the MAC address to be passed in the packet.
......@@ -778,7 +906,9 @@ TestControl::sendSolicit6(const TestControlSocket& socket) {
isc_throw(Unexpected, "failed to create SOLICIT packet");
}
pkt6->addOption(Option::factory(Option::V6, D6O_ELAPSED_TIME));
// pkt6->addOption(Option::factory(Option::V6, D6O_RAPID_COMMIT));
if (CommandOptions::instance().isRapidCommit()) {
pkt6->addOption(Option::factory(Option::V6, D6O_RAPID_COMMIT));
}
pkt6->addOption(Option::factory(Option::V6, D6O_CLIENTID, duid));
pkt6->addOption(Option::factory(Option::V6, D6O_ORO));
pkt6->addOption(Option::factory(Option::V6, D6O_IA_NA));
......@@ -786,11 +916,13 @@ TestControl::sendSolicit6(const TestControlSocket& socket) {
setDefaults6(socket, pkt6);
pkt6->pack();
IfaceMgr::instance().send(pkt6);
if (!stats_mgr6_) {
isc_throw(InvalidOperation, "Statistics Manager for DHCPv6 "
"hasn't been initialized");
if (!preload) {
if (!stats_mgr6_) {
isc_throw(InvalidOperation, "Statistics Manager for DHCPv6 "
"hasn't been initialized");
}
stats_mgr6_->passSentPacket(StatsMgr6::XCHG_SA, pkt6);
}
stats_mgr6_->passSentPacket(StatsMgr6::XCHG_SA, pkt6);
}
void
......@@ -811,6 +943,9 @@ TestControl::setDefaults4(const TestControlSocket& socket,
pkt->setLocalAddr(IOAddress(socket.getAddress()));
// Set relay (GIADDR) address to local address.
pkt->setGiaddr(IOAddress(socket.getAddress()));
std::vector<uint8_t> mac = generateMacAddress();
// Set hardware address
pkt->setHWAddr(HTYPE_ETHER, mac.size(), mac);
// Pretend that we have one relay (which is us).
pkt->setHops(1);
}
......
......@@ -58,6 +58,10 @@ public:
typedef boost::shared_ptr<StatsMgr6> StatsMgr6Ptr;
// Packet exchange type.
typedef StatsMgr<>::ExchangeType ExchangeType;
// Packet template buffer.
typedef std::vector<uint8_t> TemplateBuffer;
//Packet template buffers list.
typedef std::list<TemplateBuffer> TemplateBufferList;
/// \brief Socket wrapper class.
///
......@@ -333,6 +337,8 @@ protected:
/// \return number of exchanges to be started immediatelly.
uint64_t getNextExchangesNum() const;
void initPacketTemplates();
/// \brief Initializes Statistics Manager.
///
/// This function initializes Statistics Manager. If there is
......@@ -350,7 +356,6 @@ protected:
/// (for DHCPv6) than broadcast or multicast option is set on
/// the socket.
///
/// \param port port to bound socket to.
/// \throw isc::BadValue if socket can't be created for given
/// interface, local address or remote address.
/// \throw isc::InvalidOperation if broadcast option can't be
......@@ -358,7 +363,7 @@ protected:
/// for the v6 socket.
/// \throw isc::Unexpected if interal unexpected error occured.
/// \return socket descriptor.
int openSocket(uint16_t port = 0) const;
int openSocket() const;
/// \brief Print rate statistics.
///
......@@ -436,6 +441,13 @@ protected:
/// depending in whch mode test is currently running.
void registerOptionFactories() const;
/// \brief Resets internal state of the object.
///
/// Method resets internal state of the object. It has to be
/// called before new test is started.
void reset();
/// \brief Send DHCPv4 DISCOVER message.
///
/// Method creates and sends DHCPv4 DISCOVER message to the server
......@@ -448,11 +460,25 @@ protected:
/// on the number of clients specified from the command line.
///
/// \param socket socket to be used to send the message.
/// \param preload preload mode, packets not included in statistics.
/// \throw isc::Unexpected if failed to create new packet instance.
/// \throw isc::BadValue if MAC address has invalid length.
void sendDiscover4(const TestControlSocket& socket);
void sendDiscover4(const TestControlSocket& socket,
const bool preload = false);
/// \brief Sent DHCPv6 REQUEST message.
/// \brief Send DHCPv4 REQUEST message.
///
/// Method creates and sends DHCPv4 REQUEST message to the server.
///
/// \param socket socket to be used to send message.
/// \param offer_pkt4 OFFER packet object.
/// \throw isc::Unexpected if unexpected error occured.
/// \throw isc::InvalidOperation if Statistics Manager has not been
/// initialized.
void sendRequest4(const TestControlSocket& socket,
const dhcp::Pkt4Ptr& offer_pkt4);
/// \brief Send DHCPv6 REQUEST message.
///
/// Method creates and sends DHCPv6 REQUEST message to the server
/// with the following options:
......@@ -485,8 +511,10 @@ protected:
/// - D6O_IA_NA.
///
/// \param socket socket to be used to send the message.
/// \param preload mode, packets not included in statistics.
/// \throw isc::Unexpected if failed to create new packet instance.
void sendSolicit6(const TestControlSocket& socket);
void sendSolicit6(const TestControlSocket& socket,
const bool preload = false);
/// \brief Set default DHCPv4 packet parameters.
///
......@@ -557,9 +585,14 @@ private:
StatsMgr4Ptr stats_mgr4_; ///< Statistics Manager 4.
StatsMgr6Ptr stats_mgr6_; ///< Statistics Manager 6.
// Pointers to functions.
TransidGeneratorPtr transid_gen_; ///< Transaction id generator.
/// Buffer holiding server id received in first packet
dhcp::OptionBuffer first_packet_serverid_;
/// Packet template buffers.
TemplateBufferList template_buffers_;
uint64_t sent_packets_0_;
uint64_t sent_packets_1_;
};
......
......@@ -310,7 +310,6 @@ public:
void testPkt4Exchange(int iterations_num,
int receive_num,
int& iterations_performed) const {
uint16_t port = 10547;
int sock_handle = 0;
NakedTestControl tc;
tc.initializeStatsMgr();
......@@ -323,25 +322,26 @@ public:
generator(new NakedTestControl::IncrementalGenerator());
tc.setTransidGenerator(generator);
// Socket is needed to send packets through the interface.
ASSERT_NO_THROW(sock_handle = tc.openSocket(port));
ASSERT_NO_THROW(sock_handle = tc.openSocket());
TestControl::TestControlSocket sock(sock_handle);
int i = 0;
for (; i < iterations_num; ++i) {
if (tc.checkExitConditions()) {
break;
}
uint32_t transid = 0;
for (int i = 0; i < iterations_num; ++i) {
ASSERT_NO_THROW(tc.sendDiscover4(sock));
++transid;
// Do not simulate responses for packets later
// that specified as receive_num. This simulates
// packet drops.
if (i - 1 < receive_num) {
boost::shared_ptr<Pkt4> offer_pkt4(createOfferPkt4(i));
// Receive OFFER and send REQUEST.
if (i < receive_num) {
boost::shared_ptr<Pkt4> offer_pkt4(createOfferPkt4(transid));
ASSERT_NO_THROW(tc.receivePacket4(sock, offer_pkt4));
++transid;
}
if (tc.checkExitConditions()) {
iterations_performed = i + 1;
break;
}
iterations_performed = i + 1;
}
// Return the number of iterations performed.
iterations_performed = i;
}
/// \brief Test DHCPv6 exchanges.
......@@ -360,7 +360,6 @@ public:
void testPkt6Exchange(int iterations_num,
int receive_num,
int& iterations_performed) const {
uint16_t port = 10547;
int sock_handle = 0;
NakedTestControl tc;
tc.initializeStatsMgr();
......@@ -373,26 +372,28 @@ public:
generator(new NakedTestControl::IncrementalGenerator());
tc.setTransidGenerator(generator);
// Socket is needed to send packets through the interface.
ASSERT_NO_THROW(sock_handle = tc.openSocket(port));
ASSERT_NO_THROW(sock_handle = tc.openSocket());
TestControl::TestControlSocket sock(sock_handle);
int i = 0;
for (; i < iterations_num; ++i) {
if (tc.checkExitConditions()) {
break;
}
uint32_t transid = 0;
for (int i = 0; i < iterations_num; ++i) {
// Do not simulate responses for packets later
// that specified as receive_num. This simulates
// packet drops.
ASSERT_NO_THROW(tc.sendSolicit6(sock));
if (i - 1 < receive_num) {
boost::shared_ptr<Pkt6> advertise_pkt6(createAdvertisePkt6(i));
++transid;
if (i < receive_num) {
boost::shared_ptr<Pkt6>
advertise_pkt6(createAdvertisePkt6(transid));
// Receive ADVERTISE and send REQUEST.
ASSERT_NO_THROW(tc.receivePacket6(sock, advertise_pkt6));
++transid;
}
if (tc.checkExitConditions()) {
iterations_performed = i + 1;
break;
}
iterations_performed = i + 1;
}
// Return the number of iterations performed.
iterations_performed = i;
}
/// \brief Test generation of multiple MAC addresses.
......@@ -463,8 +464,12 @@ private:
boost::shared_ptr<Pkt4> offer(new Pkt4(DHCPOFFER, transid));
OptionPtr opt_msg_type = Option::factory(Option::V4, DHO_DHCP_MESSAGE_TYPE,
OptionBuffer(DHCPOFFER));
OptionPtr opt_serverid = Option::factory(Option::V4,
DHO_DHCP_SERVER_IDENTIFIER,
OptionBuffer(4, 1));
offer->setYiaddr(asiolink::IOAddress("127.0.0.1"));
offer->addOption(opt_msg_type);
offer->addOption(opt_serverid);
offer->updateTimestamp();
return(offer);
}
......@@ -671,13 +676,12 @@ TEST_F(TestControlTest, Packet4) {
std::string loopback_iface(getLocalLoopback());
if (!loopback_iface.empty()) {
ASSERT_NO_THROW(processCmdLine("perfdhcp -l " + loopback_iface +
" all"));
uint16_t port = 10547;
" -L 10547 all"));
NakedTestControl tc;
int sock_handle = 0;
// We have to create the socket to setup some parameters of
// outgoing packet.
ASSERT_NO_THROW(sock_handle = tc.openSocket(port));
ASSERT_NO_THROW(sock_handle = tc.openSocket());
TestControl::TestControlSocket sock(sock_handle);
uint32_t transid = 123;
boost::shared_ptr<Pkt4> pkt4(new Pkt4(DHCPDISCOVER, transid));
......@@ -705,13 +709,12 @@ TEST_F(TestControlTest, Packet6) {
std::string loopback_iface(getLocalLoopback());
if (!loopback_iface.empty()) {
ASSERT_NO_THROW(processCmdLine("perfdhcp -6 -l " + loopback_iface +
" servers"));
uint16_t port = 10547;
" -L 10547 servers"));
NakedTestControl tc;
int sock_handle = 0;
// Create the socket. It will be needed to set packet's
// parameters.
ASSERT_NO_THROW(sock_handle = tc.openSocket(port));
ASSERT_NO_THROW(sock_handle = tc.openSocket());
TestControl::TestControlSocket sock(sock_handle);
uint32_t transid = 123;
boost::shared_ptr<Pkt6> pkt6(new Pkt6(DHCPV6_SOLICIT, transid));
......@@ -744,7 +747,7 @@ TEST_F(TestControlTest, Packet4Exchange) {
// Set number of iterations to some high value.
const int iterations_num = 100;
processCmdLine("perfdhcp -l " + loopback_iface
+ " -r 100 -n 10 -R 20 127.0.0.1");
+ " -r 100 -n 10 -R 20 -L 10547 127.0.0.1");
// The actual number of iterations will be stored in the
// following variable.
int iterations_performed = 0;
......@@ -756,7 +759,7 @@ TEST_F(TestControlTest, Packet4Exchange) {
// With the following command line we restrict the maximum
// number of dropped packets to 20% of all.
processCmdLine("perfdhcp -l " + loopback_iface
+ " -r 100 -R 20 -n 20 -D 10% 127.0.0.1");
+ " -r 100 -R 20 -n 20 -D 10% -L 10547 127.0.0.1");
// The number iterations is restricted by the percentage of
// dropped packets (-D 10%). We also have to bump up the number
// of iterations because the percentage limitation checks starts
......@@ -781,7 +784,7 @@ TEST_F(TestControlTest, Packet6Exchange) {
const int iterations_num = 100;
// Set number of iterations to 10.
processCmdLine("perfdhcp -l " + loopback_iface
+ " -6 -r 100 -n 10 -R 20 ::1");
+ " -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.
......@@ -791,7 +794,7 @@ TEST_F(TestControlTest, Packet6Exchange) {
// The maximum number of dropped packets is 3 (because of -D 3).
processCmdLine("perfdhcp -l " + loopback_iface
+ " -6 -r 100 -n 10 -R 20 -D 3 ::1");
+ " -6 -r 100 -n 10 -R 20 -D 3 -L 10547 ::1");
// For the first 3 packets we are simulating responses from server.
// For other packets we don't so packet as 4,5,6 will be dropped and
// then test should be interrupted and actual number of iterations will
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment