23 #include <database/testutils/schema.h>
32 #include <dhcpsrv/testutils/host_data_source_utils.h>
35 using isc::dhcp::test::HostDataSourceUtils;
62 size_t const& host_count) {
72 const uint16_t option_type,
73 const bool persist)
const {
83 const uint32_t vendor_id)
const {
107 true, formatted,
"my-boot-file"),
110 false, formatted, 64),
112 opts->add(createOption<OptionUint32>(
Option::V4, 1,
false, formatted, 312131),
113 "vendor-encapsulated-options");
114 opts->add(createAddressOption<Option4AddrLst>(254,
false, formatted,
"192.0.2.3"),
117 opts->add(createAddressOption<Option4AddrLst>(2,
false, formatted,
118 "10.0.0.5",
"10.0.0.3",
123 1,
"vendor-encapsulated-options",
"uint32")));
128 "isc",
"ipv4-address",
true)));
135 true, formatted,
"my-boot-file"),
138 false, formatted, 3600),
142 opts->add(createAddressOption<Option6AddrLst>(1024,
false, formatted,
"2001:db8:1::1"),
145 opts->add(createAddressOption<Option6AddrLst>(2,
false, formatted,
146 "3000::1",
"3000::2",
154 "isc2",
"ipv6-address",
true)));
165 if (host_count > 0xfffdu) {
166 cerr <<
"host_count <= 0xfffd or change address xgeneration in "
167 "GenericLeaseMgrBenchmark::prepareLeases6()"
171 for (
size_t i = 0x0001u; i < 0x0001u + host_count; ++i) {
172 std::stringstream ss;
177 const std::string prefix = std::string(
"2001:db8::") + n_host;
194 std::vector<uint8_t> hwaddr = host->getIdentifier();
195 hdsptr_->getAll(host->getIdentifierType(), &hwaddr[0], hwaddr.size());
202 hdsptr_->getAll4(host->getIPv4Reservation());
209 std::vector<uint8_t> hwaddr = host->getIdentifier();
210 hdsptr_->get4(host->getIPv4SubnetID(), host->getIdentifierType(),
211 &hwaddr[0], hwaddr.size());
218 hdsptr_->get4(host->getIPv4SubnetID(), host->getIPv4Reservation());
225 std::vector<uint8_t> hwaddr = host->getIdentifier();
226 hdsptr_->get6(host->getIPv6SubnetID(), host->getIdentifierType(),
227 &hwaddr[0], hwaddr.size());
235 hdsptr_->get6(host->getIPv6SubnetID(), range.first->second.getPrefix());
243 hdsptr_->get6(range.first->second.getPrefix(),
244 range.first->second.getPrefixLen());
static void clearRuntimeOptionDefs()
Removes runtime option definitions.
boost::shared_ptr< CfgOption > CfgOptionPtr
Non-const pointer.
Base class representing a DHCP option definition.
void addItem(const OptionDefinitionPtr &def)
Adds a new option definition to the container.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
boost::shared_ptr< Option > OptionPtr
void benchGetAll()
Essential steps required to benchmark the getAll(identifier-type, identifier) call.
Universe
defines option universe DHCPv4 or DHCPv6
static void setRuntimeOptionDefs(const OptionDefSpaceContainer &defs)
Copies option definitions created at runtime.
void benchGet4SubnetIdv4Resrv()
Essential steps requires to benchmark host reservation retrieval using getAll(v4-reservation) call...
AddedOptions
Defines what kind of options should be added for a host.
HostDataSourcePtr hdsptr_
Pointer to the host backend being benchmarked.
Class of option definition space container.
OptionDescriptor createVendorOption(const Option::Universe &universe, const bool persist, const bool formatted, const uint32_t vendor_id) const
creates a vendor-option
void setUpWithInserts(::benchmark::State &state, size_t const &host_count)
Sets up the benchmark with specified number of hosts.
std::pair< IPv6ResrvIterator, IPv6ResrvIterator > IPv6ResrvRange
void benchGet4IdentifierSubnetId()
Essential steps requires to benchmark host reservation retrieval using getAll(identifier-type, identifier, subnet-id) call.
OptionDescriptor createEmptyOption(const Option::Universe &universe, const uint16_t option_type, const bool persist) const
Creates a generic option with specific parameters.
void prepareHosts(size_t const &host_count)
Creates specified number of hosts and stores them in hosts_.
void insertHosts()
Inserts all hosts stored in hosts_ into the benchmarked host backend.
void benchGet6IdentifierSubnetId()
Essential steps requires to benchmark host reservation retrieval using get6(identifier-type, identifier, subnet-id) call.
void addTestOptions(const HostPtr &host, const bool formatted, const AddedOptions &added_options) const
Adds several v4 and/or v6 options to the host.
HostCollection hosts_
Store hosts being used during benchmark.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Both DHCPv4 and DHCPv6 options.
void benchGet6SubnetIdAddr()
Essential steps requires to benchmark host reservation retrieval using get6(ip-addr, subnet-id) call.
#define DHCP6_OPTION_SPACE
GenericHostDataSourceBenchmark()
Constructor.
#define DHCP4_OPTION_SPACE
global std option spaces
virtual ~GenericHostDataSourceBenchmark()
Destructor.
void getAllv4Resv()
Essential steps required to benchmark host reservation retrieval using getAll(ipv4-reservation) call...
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
The IOAddress class represents an IP addresses (version agnostic)
boost::shared_ptr< OptionVendor > OptionVendorPtr
Pointer to a vendor option.
void setUp(::benchmark::State &state, size_t const &host_count)
Sets up timers, creates and inserts hosts.
void benchGet6Prefix()
Essential steps requires to benchmark host reservation retrieval using get6(prefix, len) call.
This class represents vendor-specific information option.