mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 21:45:37 +00:00
[4202] Replaced underscore with hypen in src/bin/d2 for kea-ddns parameters
Updated D2 server code, spec file, and tests with hypenated configuration elements names
This commit is contained in:
@@ -33,8 +33,8 @@ typedef std::vector<uint8_t> ByteAddress;
|
||||
|
||||
D2CfgContext::D2CfgContext()
|
||||
: d2_params_(new D2Params()),
|
||||
forward_mgr_(new DdnsDomainListMgr("forward_mgr")),
|
||||
reverse_mgr_(new DdnsDomainListMgr("reverse_mgr")),
|
||||
forward_mgr_(new DdnsDomainListMgr("forward-ddns")),
|
||||
reverse_mgr_(new DdnsDomainListMgr("reverse-ddns")),
|
||||
keys_(new TSIGKeyInfoMap()) {
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ const char* D2CfgMgr::IPV6_REV_ZONE_SUFFIX = "ip6.arpa.";
|
||||
D2CfgMgr::D2CfgMgr() : DCfgMgrBase(DCfgContextBasePtr(new D2CfgContext())) {
|
||||
// TSIG keys need to parse before the Domains, so we can catch Domains
|
||||
// that specify undefined keys. Create the necessary parsing order now.
|
||||
addToParseOrder("tsig_keys");
|
||||
addToParseOrder("forward_ddns");
|
||||
addToParseOrder("reverse_ddns");
|
||||
addToParseOrder("tsig-keys");
|
||||
addToParseOrder("forward-ddns");
|
||||
addToParseOrder("reverse-ddns");
|
||||
}
|
||||
|
||||
D2CfgMgr::~D2CfgMgr() {
|
||||
@@ -218,7 +218,7 @@ D2CfgMgr::buildParams(isc::data::ConstElementPtr params_config) {
|
||||
isc::dhcp::StringStoragePtr strings = context->getStringStorage();
|
||||
asiolink::IOAddress ip_address(D2Params::DFT_IP_ADDRESS);
|
||||
|
||||
std::string ip_address_str = strings->getOptionalParam("ip_address",
|
||||
std::string ip_address_str = strings->getOptionalParam("ip-address",
|
||||
D2Params::
|
||||
DFT_IP_ADDRESS);
|
||||
try {
|
||||
@@ -226,12 +226,12 @@ D2CfgMgr::buildParams(isc::data::ConstElementPtr params_config) {
|
||||
} catch (const std::exception& ex) {
|
||||
isc_throw(D2CfgError, "IP address invalid : \""
|
||||
<< ip_address_str << "\" ("
|
||||
<< strings->getPosition("ip_address") << ")");
|
||||
<< strings->getPosition("ip-address") << ")");
|
||||
}
|
||||
|
||||
if ((ip_address.toText() == "0.0.0.0") || (ip_address.toText() == "::")) {
|
||||
isc_throw(D2CfgError, "IP address cannot be \"" << ip_address << "\" ("
|
||||
<< strings->getPosition("ip_address") << ")");
|
||||
<< strings->getPosition("ip-address") << ")");
|
||||
}
|
||||
|
||||
// Fetch and validate port.
|
||||
@@ -245,12 +245,12 @@ D2CfgMgr::buildParams(isc::data::ConstElementPtr params_config) {
|
||||
|
||||
// Fetch and validate dns_server_timeout.
|
||||
uint32_t dns_server_timeout
|
||||
= ints->getOptionalParam("dns_server_timeout",
|
||||
= ints->getOptionalParam("dns-server-timeout",
|
||||
D2Params::DFT_DNS_SERVER_TIMEOUT);
|
||||
|
||||
if (dns_server_timeout < 1) {
|
||||
isc_throw(D2CfgError, "DNS server timeout must be larger than 0 ("
|
||||
<< ints->getPosition("dns_server_timeout") << ")");
|
||||
<< ints->getPosition("dns-server-timeout") << ")");
|
||||
}
|
||||
|
||||
// Fetch and validate ncr_protocol.
|
||||
@@ -258,20 +258,20 @@ D2CfgMgr::buildParams(isc::data::ConstElementPtr params_config) {
|
||||
try {
|
||||
ncr_protocol = dhcp_ddns::
|
||||
stringToNcrProtocol(strings->
|
||||
getOptionalParam("ncr_protocol",
|
||||
getOptionalParam("ncr-protocol",
|
||||
D2Params::
|
||||
DFT_NCR_PROTOCOL));
|
||||
} catch (const std::exception& ex) {
|
||||
isc_throw(D2CfgError, "ncr_protocol : "
|
||||
isc_throw(D2CfgError, "ncr-protocol : "
|
||||
<< ex.what() << " ("
|
||||
<< strings->getPosition("ncr_protocol") << ")");
|
||||
<< strings->getPosition("ncr-protocol") << ")");
|
||||
}
|
||||
|
||||
if (ncr_protocol != dhcp_ddns::NCR_UDP) {
|
||||
isc_throw(D2CfgError, "ncr_protocol : "
|
||||
isc_throw(D2CfgError, "ncr-protocol : "
|
||||
<< dhcp_ddns::ncrProtocolToString(ncr_protocol)
|
||||
<< " is not yet supported ("
|
||||
<< strings->getPosition("ncr_protocol") << ")");
|
||||
<< strings->getPosition("ncr-protocol") << ")");
|
||||
}
|
||||
|
||||
// Fetch and validate ncr_format.
|
||||
@@ -279,20 +279,20 @@ D2CfgMgr::buildParams(isc::data::ConstElementPtr params_config) {
|
||||
try {
|
||||
ncr_format = dhcp_ddns::
|
||||
stringToNcrFormat(strings->
|
||||
getOptionalParam("ncr_format",
|
||||
getOptionalParam("ncr-format",
|
||||
D2Params::
|
||||
DFT_NCR_FORMAT));
|
||||
} catch (const std::exception& ex) {
|
||||
isc_throw(D2CfgError, "ncr_format : "
|
||||
isc_throw(D2CfgError, "ncr-format : "
|
||||
<< ex.what() << " ("
|
||||
<< strings->getPosition("ncr_format") << ")");
|
||||
<< strings->getPosition("ncr-format") << ")");
|
||||
}
|
||||
|
||||
if (ncr_format != dhcp_ddns::FMT_JSON) {
|
||||
isc_throw(D2CfgError, "NCR Format:"
|
||||
<< dhcp_ddns::ncrFormatToString(ncr_format)
|
||||
<< " is not yet supported ("
|
||||
<< strings->getPosition("ncr_format") << ")");
|
||||
<< strings->getPosition("ncr-format") << ")");
|
||||
}
|
||||
|
||||
// Attempt to create the new client config. This ought to fly as
|
||||
@@ -312,24 +312,24 @@ D2CfgMgr::createConfigParser(const std::string& config_id,
|
||||
// Create parser instance based on element_id.
|
||||
isc::dhcp::ParserPtr parser;
|
||||
if ((config_id.compare("port") == 0) ||
|
||||
(config_id.compare("dns_server_timeout") == 0)) {
|
||||
(config_id.compare("dns-server-timeout") == 0)) {
|
||||
parser.reset(new isc::dhcp::Uint32Parser(config_id,
|
||||
context->getUint32Storage()));
|
||||
} else if ((config_id.compare("ip_address") == 0) ||
|
||||
(config_id.compare("ncr_protocol") == 0) ||
|
||||
(config_id.compare("ncr_format") == 0)) {
|
||||
} else if ((config_id.compare("ip-address") == 0) ||
|
||||
(config_id.compare("ncr-protocol") == 0) ||
|
||||
(config_id.compare("ncr-format") == 0)) {
|
||||
parser.reset(new isc::dhcp::StringParser(config_id,
|
||||
context->getStringStorage()));
|
||||
} else if (config_id == "forward_ddns") {
|
||||
parser.reset(new DdnsDomainListMgrParser("forward_mgr",
|
||||
} else if (config_id == "forward-ddns") {
|
||||
parser.reset(new DdnsDomainListMgrParser("forward-ddns",
|
||||
context->getForwardMgr(),
|
||||
context->getKeys()));
|
||||
} else if (config_id == "reverse_ddns") {
|
||||
parser.reset(new DdnsDomainListMgrParser("reverse_mgr",
|
||||
} else if (config_id == "reverse-ddns") {
|
||||
parser.reset(new DdnsDomainListMgrParser("reverse-ddns",
|
||||
context->getReverseMgr(),
|
||||
context->getKeys()));
|
||||
} else if (config_id == "tsig_keys") {
|
||||
parser.reset(new TSIGKeyInfoListParser("tsig_key_list",
|
||||
} else if (config_id == "tsig-keys") {
|
||||
parser.reset(new TSIGKeyInfoListParser("tsig-key-list",
|
||||
context->getKeys()));
|
||||
} else {
|
||||
isc_throw(NotImplemented,
|
||||
|
@@ -118,12 +118,12 @@ std::string
|
||||
D2Params::toText() const {
|
||||
std::ostringstream stream;
|
||||
|
||||
stream << ", ip_address: " << ip_address_.toText()
|
||||
stream << ", ip-address: " << ip_address_.toText()
|
||||
<< ", port: " << port_
|
||||
<< ", dns_server_timeout_: " << dns_server_timeout_
|
||||
<< ", ncr_protocol: "
|
||||
<< ", dns-server-timeout_: " << dns_server_timeout_
|
||||
<< ", ncr-protocol: "
|
||||
<< dhcp_ddns::ncrProtocolToString(ncr_protocol_)
|
||||
<< ", ncr_format: " << ncr_format_
|
||||
<< ", ncr-format: " << ncr_format_
|
||||
<< dhcp_ddns::ncrFormatToString(ncr_format_);
|
||||
|
||||
return (stream.str());
|
||||
@@ -382,7 +382,7 @@ TSIGKeyInfoParser::build(isc::data::ConstElementPtr key_config) {
|
||||
try {
|
||||
pos["name"] = local_scalars_.getParam("name", name);
|
||||
pos["algorithm"] = local_scalars_.getParam("algorithm", algorithm);
|
||||
pos["digest_bits"] = local_scalars_.getParam("digest_bits", digestbits,
|
||||
pos["digest-bits"] = local_scalars_.getParam("digest-bits", digestbits,
|
||||
DCfgContextBase::OPTIONAL);
|
||||
pos["secret"] = local_scalars_.getParam("secret", secret);
|
||||
} catch (const std::exception& ex) {
|
||||
@@ -415,34 +415,34 @@ TSIGKeyInfoParser::build(isc::data::ConstElementPtr key_config) {
|
||||
if (digestbits > 0) {
|
||||
if ((digestbits % 8) != 0) {
|
||||
isc_throw(D2CfgError, "Invalid TSIG key digest_bits specified : " <<
|
||||
digestbits << " (" << pos["digest_bits"] << ")");
|
||||
digestbits << " (" << pos["digest-bits"] << ")");
|
||||
}
|
||||
if (digestbits < 80) {
|
||||
isc_throw(D2CfgError, "TSIG key digest_bits too small : " <<
|
||||
digestbits << " (" << pos["digest_bits"] << ")");
|
||||
digestbits << " (" << pos["digest-bits"] << ")");
|
||||
}
|
||||
if (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA224_STR)) {
|
||||
if (digestbits < 112) {
|
||||
isc_throw(D2CfgError, "TSIG key digest_bits too small : " <<
|
||||
digestbits << " (" << pos["digest_bits"]
|
||||
digestbits << " (" << pos["digest-bits"]
|
||||
<< ")");
|
||||
}
|
||||
} else if (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA256_STR)) {
|
||||
if (digestbits < 128) {
|
||||
isc_throw(D2CfgError, "TSIG key digest_bits too small : " <<
|
||||
digestbits << " (" << pos["digest_bits"]
|
||||
digestbits << " (" << pos["digest-bits"]
|
||||
<< ")");
|
||||
}
|
||||
} else if (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA384_STR)) {
|
||||
if (digestbits < 192) {
|
||||
isc_throw(D2CfgError, "TSIG key digest_bits too small : " <<
|
||||
digestbits << " (" << pos["digest_bits"]
|
||||
digestbits << " (" << pos["digest-bits"]
|
||||
<< ")");
|
||||
}
|
||||
} else if (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA512_STR)) {
|
||||
if (digestbits < 256) {
|
||||
isc_throw(D2CfgError, "TSIG key digest_bits too small : " <<
|
||||
digestbits << " (" << pos["digest_bits"]
|
||||
digestbits << " (" << pos["digest-bits"]
|
||||
<< ")");
|
||||
}
|
||||
}
|
||||
@@ -483,7 +483,7 @@ TSIGKeyInfoParser::createConfigParser(const std::string& config_id,
|
||||
(config_id == "secret")) {
|
||||
parser = new isc::dhcp::StringParser(config_id,
|
||||
local_scalars_.getStringStorage());
|
||||
} else if (config_id == "digest_bits") {
|
||||
} else if (config_id == "digest-bits") {
|
||||
parser = new isc::dhcp::Uint32Parser(config_id,
|
||||
local_scalars_.getUint32Storage());
|
||||
} else {
|
||||
@@ -588,7 +588,7 @@ DnsServerInfoParser::build(isc::data::ConstElementPtr server_config) {
|
||||
// local storage. They're all optional, so no try-catch here.
|
||||
pos["hostname"] = local_scalars_.getParam("hostname", hostname,
|
||||
DCfgContextBase::OPTIONAL);
|
||||
pos["ip_address"] = local_scalars_.getParam("ip_address", ip_address,
|
||||
pos["ip-address"] = local_scalars_.getParam("ip-address", ip_address,
|
||||
DCfgContextBase::OPTIONAL);
|
||||
pos["port"] = local_scalars_.getParam("port", port,
|
||||
DCfgContextBase::OPTIONAL);
|
||||
@@ -632,7 +632,7 @@ DnsServerInfoParser::build(isc::data::ConstElementPtr server_config) {
|
||||
serverInfo.reset(new DnsServerInfo(hostname, io_addr, port));
|
||||
} catch (const isc::asiolink::IOError& ex) {
|
||||
isc_throw(D2CfgError, "Dns Server : invalid IP address : "
|
||||
<< ip_address << " (" << pos["ip_address"] << ")");
|
||||
<< ip_address << " (" << pos["ip-address"] << ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -648,7 +648,7 @@ DnsServerInfoParser::createConfigParser(const std::string& config_id,
|
||||
// Based on the configuration id of the element, create the appropriate
|
||||
// parser. Scalars are set to use the parser's local scalar storage.
|
||||
if ((config_id == "hostname") ||
|
||||
(config_id == "ip_address")) {
|
||||
(config_id == "ip-address")) {
|
||||
parser = new isc::dhcp::StringParser(config_id,
|
||||
local_scalars_.getStringStorage());
|
||||
} else if (config_id == "port") {
|
||||
@@ -760,7 +760,7 @@ DdnsDomainParser::build(isc::data::ConstElementPtr domain_config) {
|
||||
// Any required that are missing will throw.
|
||||
try {
|
||||
pos["name"] = local_scalars_.getParam("name", name);
|
||||
pos["key_name"] = local_scalars_.getParam("key_name", key_name,
|
||||
pos["key-name"] = local_scalars_.getParam("key-name", key_name,
|
||||
DCfgContextBase::OPTIONAL);
|
||||
} catch (const std::exception& ex) {
|
||||
isc_throw(D2CfgError, "DdnsDomain incomplete : " << ex.what()
|
||||
@@ -796,7 +796,7 @@ DdnsDomainParser::build(isc::data::ConstElementPtr domain_config) {
|
||||
if (!tsig_key_info) {
|
||||
isc_throw(D2CfgError, "DdnsDomain : " << name
|
||||
<< " specifies an undefined key: " << key_name
|
||||
<< " (" << pos["key_name"] << ")");
|
||||
<< " (" << pos["key-name"] << ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -814,10 +814,10 @@ DdnsDomainParser::createConfigParser(const std::string& config_id,
|
||||
// Based on the configuration id of the element, create the appropriate
|
||||
// parser. Scalars are set to use the parser's local scalar storage.
|
||||
if ((config_id == "name") ||
|
||||
(config_id == "key_name")) {
|
||||
(config_id == "key-name")) {
|
||||
parser = new isc::dhcp::StringParser(config_id,
|
||||
local_scalars_.getStringStorage());
|
||||
} else if (config_id == "dns_servers") {
|
||||
} else if (config_id == "dns-servers") {
|
||||
// Server list parser is given in our local server storage. It will pass
|
||||
// this down to its server parsers and is where they will write their
|
||||
// server instances upon commit.
|
||||
@@ -918,7 +918,7 @@ DdnsDomainListMgrParser::createConfigParser(const std::string& config_id,
|
||||
const isc::data::Element::
|
||||
Position& pos) {
|
||||
DhcpConfigParser* parser = NULL;
|
||||
if (config_id == "ddns_domains") {
|
||||
if (config_id == "ddns-domains") {
|
||||
// Domain list parser is given our local domain storage. It will pass
|
||||
// this down to its domain parsers and is where they will write their
|
||||
// domain instances upon commit.
|
||||
|
@@ -87,9 +87,9 @@ namespace d2 {
|
||||
/// @code
|
||||
/// {
|
||||
/// "interface" : "eth1" ,
|
||||
/// "ip_address" : "192.168.1.33" ,
|
||||
/// "ip-address" : "192.168.1.33" ,
|
||||
/// "port" : 88 ,
|
||||
/// "tsig_keys":
|
||||
/// "tsig-keys":
|
||||
//// [
|
||||
/// {
|
||||
/// "name": "d2_key.tmark.org" ,
|
||||
@@ -97,14 +97,14 @@ namespace d2 {
|
||||
/// "secret": "0123456989"
|
||||
/// }
|
||||
/// ],
|
||||
/// "forward_ddns" :
|
||||
/// "forward-ddns" :
|
||||
/// {
|
||||
/// "ddns_domains":
|
||||
/// "ddns-domains":
|
||||
/// [
|
||||
/// {
|
||||
/// "name": "tmark.org." ,
|
||||
/// "key_name": "d2_key.tmark.org" ,
|
||||
/// "dns_servers" :
|
||||
/// "key-name": "d2_key.tmark.org" ,
|
||||
/// "dns-servers" :
|
||||
/// [
|
||||
/// { "hostname": "fserver.tmark.org" },
|
||||
/// { "hostname": "f2server.tmark.org" }
|
||||
@@ -112,24 +112,24 @@ namespace d2 {
|
||||
/// },
|
||||
/// {
|
||||
/// "name": "pub.tmark.org." ,
|
||||
/// "key_name": "d2_key.tmark.org" ,
|
||||
/// "dns_servers" :
|
||||
/// "key-name": "d2_key.tmark.org" ,
|
||||
/// "dns-servers" :
|
||||
/// [
|
||||
/// { "hostname": "f3server.tmark.org" }
|
||||
/// ]
|
||||
/// }
|
||||
/// ]
|
||||
/// },
|
||||
/// "reverse_ddns" :
|
||||
/// "reverse-ddns" :
|
||||
/// {
|
||||
/// "ddns_domains":
|
||||
/// "ddns-domains":
|
||||
/// [
|
||||
/// {
|
||||
/// "name": " 0.168.192.in.addr.arpa." ,
|
||||
/// "key_name": "d2_key.tmark.org" ,
|
||||
/// "dns_servers" :
|
||||
/// "key-name": "d2_key.tmark.org" ,
|
||||
/// "dns-servers" :
|
||||
/// [
|
||||
/// { "ip_address": "127.0.0.101" , "port": 100 }
|
||||
/// { "ip-address": "127.0.0.101" , "port": 100 }
|
||||
/// ]
|
||||
/// }
|
||||
/// ]
|
||||
@@ -742,7 +742,7 @@ typedef boost::shared_ptr<DScalarContext> DScalarContextPtr;
|
||||
|
||||
/// @brief Parser for TSIGKeyInfo
|
||||
///
|
||||
/// This class parses the configuration element "tsig_key" defined in
|
||||
/// This class parses the configuration element "tsig-key" defined in
|
||||
/// src/bin/d2/dhcp-ddns.spec and creates an instance of a TSIGKeyInfo.
|
||||
class TSIGKeyInfoParser : public isc::dhcp::DhcpConfigParser {
|
||||
public:
|
||||
@@ -758,16 +758,16 @@ public:
|
||||
/// @brief Destructor
|
||||
virtual ~TSIGKeyInfoParser();
|
||||
|
||||
/// @brief Performs the actual parsing of the given "tsig_key" element.
|
||||
/// @brief Performs the actual parsing of the given "tsig-key" element.
|
||||
///
|
||||
/// Parses a configuration for the elements needed to instantiate a
|
||||
/// TSIGKeyInfo, validates those entries, creates a TSIGKeyInfo instance
|
||||
/// then attempts to add to a list of keys
|
||||
///
|
||||
/// @param key_config is the "tsig_key" configuration to parse
|
||||
/// @param key_config is the "tsig-key" configuration to parse
|
||||
virtual void build(isc::data::ConstElementPtr key_config);
|
||||
|
||||
/// @brief Creates a parser for the given "tsig_key" member element id.
|
||||
/// @brief Creates a parser for the given "tsig-key" member element id.
|
||||
///
|
||||
/// The key elements currently supported are(see dhcp-ddns.spec):
|
||||
/// 1. name
|
||||
@@ -776,7 +776,7 @@ public:
|
||||
/// 4. secret
|
||||
///
|
||||
/// @param config_id is the "item_name" for a specific member element of
|
||||
/// the "tsig_key" specification.
|
||||
/// the "tsig-key" specification.
|
||||
/// @param pos position within the configuration text (or file) of element
|
||||
/// to be parsed. This is passed for error messaging.
|
||||
///
|
||||
@@ -811,7 +811,7 @@ private:
|
||||
|
||||
/// @brief Parser for a list of TSIGKeyInfos
|
||||
///
|
||||
/// This class parses a list of "tsig_key" configuration elements.
|
||||
/// This class parses a list of "tsig-key" configuration elements.
|
||||
/// (see src/bin/d2/dhcp-ddns.spec). The TSIGKeyInfo instances are added
|
||||
/// to the given storage upon commit.
|
||||
class TSIGKeyInfoListParser : public isc::dhcp::DhcpConfigParser {
|
||||
@@ -827,7 +827,7 @@ public:
|
||||
/// @brief Destructor
|
||||
virtual ~TSIGKeyInfoListParser();
|
||||
|
||||
/// @brief Performs the parsing of the given list "tsig_key" elements.
|
||||
/// @brief Performs the parsing of the given list "tsig-key" elements.
|
||||
///
|
||||
/// It iterates over each key entry in the list:
|
||||
/// 1. Instantiate a TSIGKeyInfoParser for the entry
|
||||
@@ -865,7 +865,7 @@ private:
|
||||
|
||||
/// @brief Parser for DnsServerInfo
|
||||
///
|
||||
/// This class parses the configuration element "dns_server" defined in
|
||||
/// This class parses the configuration element "dns-server" defined in
|
||||
/// src/bin/d2/dhcp-ddns.spec and creates an instance of a DnsServerInfo.
|
||||
class DnsServerInfoParser : public isc::dhcp::DhcpConfigParser {
|
||||
public:
|
||||
@@ -882,13 +882,13 @@ public:
|
||||
/// @brief Destructor
|
||||
virtual ~DnsServerInfoParser();
|
||||
|
||||
/// @brief Performs the actual parsing of the given "dns_server" element.
|
||||
/// @brief Performs the actual parsing of the given "dns-server" element.
|
||||
///
|
||||
/// Parses a configuration for the elements needed to instantiate a
|
||||
/// DnsServerInfo, validates those entries, creates a DnsServerInfo instance
|
||||
/// then attempts to add to a list of servers.
|
||||
///
|
||||
/// @param server_config is the "dns_server" configuration to parse
|
||||
/// @param server_config is the "dns-server" configuration to parse
|
||||
///
|
||||
/// @throw D2CfgError if:
|
||||
/// -# hostname is not blank, hostname is not yet supported
|
||||
@@ -896,7 +896,7 @@ public:
|
||||
/// -# port is 0
|
||||
virtual void build(isc::data::ConstElementPtr server_config);
|
||||
|
||||
/// @brief Creates a parser for the given "dns_server" member element id.
|
||||
/// @brief Creates a parser for the given "dns-server" member element id.
|
||||
///
|
||||
/// The server elements currently supported are(see dhcp-ddns.spec):
|
||||
/// 1. hostname
|
||||
@@ -904,7 +904,7 @@ public:
|
||||
/// 3. port
|
||||
///
|
||||
/// @param config_id is the "item_name" for a specific member element of
|
||||
/// the "dns_server" specification.
|
||||
/// the "dns-server" specification.
|
||||
/// @param pos position within the configuration text (or file) of element
|
||||
/// to be parsed. This is passed for error messaging.
|
||||
///
|
||||
@@ -939,7 +939,7 @@ private:
|
||||
|
||||
/// @brief Parser for a list of DnsServerInfos
|
||||
///
|
||||
/// This class parses a list of "dns_server" configuration elements.
|
||||
/// This class parses a list of "dns-server" configuration elements.
|
||||
/// (see src/bin/d2/dhcp-ddns.spec). The DnsServerInfo instances are added
|
||||
/// to the given storage upon commit.
|
||||
class DnsServerInfoListParser : public isc::dhcp::DhcpConfigParser {
|
||||
@@ -956,7 +956,7 @@ public:
|
||||
/// @brief Destructor
|
||||
virtual ~DnsServerInfoListParser();
|
||||
|
||||
/// @brief Performs the actual parsing of the given list "dns_server"
|
||||
/// @brief Performs the actual parsing of the given list "dns-server"
|
||||
/// elements.
|
||||
/// It iterates over each server entry in the list:
|
||||
/// 1. Instantiate a DnsServerInfoParser for the entry
|
||||
@@ -966,7 +966,7 @@ public:
|
||||
/// The net effect is to parse all of the server entries in the list
|
||||
/// prepping them for commit.
|
||||
///
|
||||
/// @param server_list_config is the list of "dns_server" elements to parse.
|
||||
/// @param server_list_config is the list of "dns-server" elements to parse.
|
||||
virtual void build(isc::data::ConstElementPtr server_list_config);
|
||||
|
||||
/// @brief Commits the list of DnsServerInfos
|
||||
@@ -990,7 +990,7 @@ private:
|
||||
|
||||
/// @brief Parser for DdnsDomain
|
||||
///
|
||||
/// This class parses the configuration element "ddns_domain" defined in
|
||||
/// This class parses the configuration element "ddns-domain" defined in
|
||||
/// src/bin/d2/dhcp-ddns.spec and creates an instance of a DdnsDomain.
|
||||
class DdnsDomainParser : public isc::dhcp::DhcpConfigParser {
|
||||
public:
|
||||
@@ -998,7 +998,7 @@ public:
|
||||
///
|
||||
/// @param entry_name is an arbitrary label assigned to this configuration
|
||||
/// definition. Since domains are specified in a list this value is likely
|
||||
/// be something akin to "forward_ddns:0", set during parsing.
|
||||
/// be something akin to "forward-ddns:0", set during parsing.
|
||||
/// @param domains is a pointer to the storage area to which the parser
|
||||
/// @param keys is a pointer to a map of the defined TSIG keys.
|
||||
/// should commit the newly created DdnsDomain instance.
|
||||
@@ -1008,16 +1008,16 @@ public:
|
||||
/// @brief Destructor
|
||||
virtual ~DdnsDomainParser();
|
||||
|
||||
/// @brief Performs the actual parsing of the given "ddns_domain" element.
|
||||
/// @brief Performs the actual parsing of the given "ddns-domain" element.
|
||||
///
|
||||
/// Parses a configuration for the elements needed to instantiate a
|
||||
/// DdnsDomain, validates those entries, creates a DdnsDomain instance
|
||||
/// then attempts to add it to a list of domains.
|
||||
///
|
||||
/// @param domain_config is the "ddns_domain" configuration to parse
|
||||
/// @param domain_config is the "ddns-domain" configuration to parse
|
||||
virtual void build(isc::data::ConstElementPtr domain_config);
|
||||
|
||||
/// @brief Creates a parser for the given "ddns_domain" member element id.
|
||||
/// @brief Creates a parser for the given "ddns-domain" member element id.
|
||||
///
|
||||
/// The domain elements currently supported are(see dhcp-ddns.spec):
|
||||
/// 1. name
|
||||
@@ -1025,7 +1025,7 @@ public:
|
||||
/// 3. dns_servers
|
||||
///
|
||||
/// @param config_id is the "item_name" for a specific member element of
|
||||
/// the "ddns_domain" specification.
|
||||
/// the "ddns-domain" specification.
|
||||
/// @param pos position within the configuration text (or file) of element
|
||||
/// to be parsed. This is passed for error messaging.
|
||||
///
|
||||
@@ -1071,7 +1071,7 @@ private:
|
||||
|
||||
/// @brief Parser for a list of DdnsDomains
|
||||
///
|
||||
/// This class parses a list of "ddns_domain" configuration elements.
|
||||
/// This class parses a list of "ddns-domain" configuration elements.
|
||||
/// (see src/bin/d2/dhcp-ddns.spec). The DdnsDomain instances are added
|
||||
/// to the given storage upon commit.
|
||||
class DdnsDomainListParser : public isc::dhcp::DhcpConfigParser {
|
||||
@@ -1089,7 +1089,7 @@ public:
|
||||
/// @brief Destructor
|
||||
virtual ~DdnsDomainListParser();
|
||||
|
||||
/// @brief Performs the actual parsing of the given list "ddns_domain"
|
||||
/// @brief Performs the actual parsing of the given list "ddns-domain"
|
||||
/// elements.
|
||||
/// It iterates over each domain entry in the list:
|
||||
/// 1. Instantiate a DdnsDomainParser for the entry
|
||||
@@ -1099,7 +1099,7 @@ public:
|
||||
/// The net effect is to parse all of the domain entries in the list
|
||||
/// prepping them for commit.
|
||||
///
|
||||
/// @param domain_list_config is the list of "ddns_domain" elements to
|
||||
/// @param domain_list_config is the list of "ddns-domain" elements to
|
||||
/// parse.
|
||||
virtual void build(isc::data::ConstElementPtr domain_list_config);
|
||||
|
||||
@@ -1130,8 +1130,8 @@ private:
|
||||
|
||||
/// @brief Parser for DdnsDomainListMgr
|
||||
///
|
||||
/// This class parses the configuration elements "forward_ddns" and
|
||||
/// "reverse_ddns" as defined in src/bin/d2/dhcp-ddns.spec. It populates the
|
||||
/// This class parses the configuration elements "forward-ddns" and
|
||||
/// "reverse-ddns" as defined in src/bin/d2/dhcp-ddns.spec. It populates the
|
||||
/// given DdnsDomainListMgr with parsed information upon commit. Note that
|
||||
/// unlike other parsers, this parser does NOT instantiate the final object
|
||||
/// during the commit phase, it populates it. It must pre-exist.
|
||||
|
@@ -5,7 +5,7 @@
|
||||
"module_description": "DHPC-DDNS Service",
|
||||
"config_data": [
|
||||
{
|
||||
"item_name": "ip_address",
|
||||
"item_name": "ip-address",
|
||||
"item_type": "string",
|
||||
"item_optional": false,
|
||||
"item_default": "127.0.0.1"
|
||||
@@ -17,31 +17,31 @@
|
||||
"item_default": 53001
|
||||
},
|
||||
{
|
||||
"item_name": "dns_server_timeout",
|
||||
"item_name": "dns-server-timeout",
|
||||
"item_type": "integer",
|
||||
"item_optional": true,
|
||||
"item_default": 100
|
||||
},
|
||||
{
|
||||
"item_name": "ncr_protocol",
|
||||
"item_name": "ncr-protocol",
|
||||
"item_type": "string",
|
||||
"item_optional": true,
|
||||
"item_default": "UDP"
|
||||
},
|
||||
{
|
||||
"item_name": "ncr_format",
|
||||
"item_name": "ncr-format",
|
||||
"item_type": "string",
|
||||
"item_optional": true,
|
||||
"item_default": "JSON"
|
||||
},
|
||||
{
|
||||
"item_name": "tsig_keys",
|
||||
"item_name": "tsig-keys",
|
||||
"item_type": "list",
|
||||
"item_optional": true,
|
||||
"item_default": [],
|
||||
"list_item_spec":
|
||||
{
|
||||
"item_name": "tsig_key",
|
||||
"item_name": "tsig-key",
|
||||
"item_type": "map",
|
||||
"item_optional": false,
|
||||
"item_default": {"algorithm" : "HMAC-MD5"},
|
||||
@@ -59,7 +59,7 @@
|
||||
"item_default": ""
|
||||
},
|
||||
{
|
||||
"item_name": "digest_bits",
|
||||
"item_name": "digest-bits",
|
||||
"item_type": "integer",
|
||||
"item_optional": true,
|
||||
"item_default": 0
|
||||
@@ -73,19 +73,19 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"item_name": "forward_ddns",
|
||||
"item_name": "forward-ddns",
|
||||
"item_type": "map",
|
||||
"item_optional": true,
|
||||
"item_default": {},
|
||||
"map_item_spec": [
|
||||
{
|
||||
"item_name": "ddns_domains",
|
||||
"item_name": "ddns-domains",
|
||||
"item_type": "list",
|
||||
"item_optional": false,
|
||||
"item_default": [],
|
||||
"list_item_spec":
|
||||
{
|
||||
"item_name": "ddns_domain",
|
||||
"item_name": "ddns-domain",
|
||||
"item_type": "map",
|
||||
"item_optional": false,
|
||||
"item_default": {},
|
||||
@@ -98,20 +98,20 @@
|
||||
},
|
||||
|
||||
{
|
||||
"item_name": "key_name",
|
||||
"item_name": "key-name",
|
||||
"item_type": "string",
|
||||
"item_optional": true,
|
||||
"item_default": ""
|
||||
},
|
||||
|
||||
{
|
||||
"item_name": "dns_servers",
|
||||
"item_name": "dns-servers",
|
||||
"item_type": "list",
|
||||
"item_optional": false,
|
||||
"item_default": [],
|
||||
"list_item_spec":
|
||||
{
|
||||
"item_name": "dns_server",
|
||||
"item_name": "dns-server",
|
||||
"item_type": "map",
|
||||
"item_optional": false,
|
||||
"item_default": {},
|
||||
@@ -123,7 +123,7 @@
|
||||
"item_default": ""
|
||||
},
|
||||
{
|
||||
"item_name": "ip_address",
|
||||
"item_name": "ip-address",
|
||||
"item_type": "string",
|
||||
"item_optional": true,
|
||||
"item_default": ""
|
||||
@@ -141,19 +141,19 @@
|
||||
},
|
||||
|
||||
{
|
||||
"item_name": "reverse_ddns",
|
||||
"item_name": "reverse-ddns",
|
||||
"item_type": "map",
|
||||
"item_optional": true,
|
||||
"item_default": {},
|
||||
"map_item_spec": [
|
||||
{
|
||||
"item_name": "ddns_domains",
|
||||
"item_name": "ddns-domains",
|
||||
"item_type": "list",
|
||||
"item_optional": false,
|
||||
"item_default": [],
|
||||
"list_item_spec":
|
||||
{
|
||||
"item_name": "ddns_domain",
|
||||
"item_name": "ddns-domain",
|
||||
"item_type": "map",
|
||||
"item_optional": false,
|
||||
"item_default": {},
|
||||
@@ -166,20 +166,20 @@
|
||||
},
|
||||
|
||||
{
|
||||
"item_name": "key_name",
|
||||
"item_name": "key-name",
|
||||
"item_type": "string",
|
||||
"item_optional": true,
|
||||
"item_default": ""
|
||||
},
|
||||
|
||||
{
|
||||
"item_name": "dns_servers",
|
||||
"item_name": "dns-servers",
|
||||
"item_type": "list",
|
||||
"item_optional": false,
|
||||
"item_default": [],
|
||||
"list_item_spec":
|
||||
{
|
||||
"item_name": "dns_server",
|
||||
"item_name": "dns-server",
|
||||
"item_type": "map",
|
||||
"item_optional": false,
|
||||
"item_default": {},
|
||||
@@ -191,7 +191,7 @@
|
||||
"item_default": ""
|
||||
},
|
||||
{
|
||||
"item_name": "ip_address",
|
||||
"item_name": "ip-address",
|
||||
"item_type": "string",
|
||||
"item_optional": true,
|
||||
"item_default": ""
|
||||
|
@@ -89,14 +89,14 @@ public:
|
||||
std::ostringstream config;
|
||||
config <<
|
||||
"{"
|
||||
" \"ip_address\": \"" << ip_address << "\" , "
|
||||
" \"ip-address\": \"" << ip_address << "\" , "
|
||||
" \"port\": " << port << " , "
|
||||
" \"dns_server_timeout\": " << dns_server_timeout << " , "
|
||||
" \"ncr_protocol\": \"" << ncr_protocol << "\" , "
|
||||
" \"ncr_format\": \"" << ncr_format << "\", "
|
||||
"\"tsig_keys\": [], "
|
||||
"\"forward_ddns\" : {}, "
|
||||
"\"reverse_ddns\" : {} "
|
||||
" \"dns-server-timeout\": " << dns_server_timeout << " , "
|
||||
" \"ncr-protocol\": \"" << ncr_protocol << "\" , "
|
||||
" \"ncr-format\": \"" << ncr_format << "\", "
|
||||
"\"tsig-keys\": [], "
|
||||
"\"forward-ddns\" : {}, "
|
||||
"\"reverse-ddns\" : {} "
|
||||
"}";
|
||||
|
||||
return (config.str());
|
||||
@@ -396,12 +396,12 @@ TEST_F(D2CfgMgrTest, defaultValues) {
|
||||
std::string config =
|
||||
"{"
|
||||
" \"port\": 777 , "
|
||||
" \"dns_server_timeout\": 333 , "
|
||||
" \"ncr_protocol\": \"UDP\" , "
|
||||
" \"ncr_format\": \"JSON\", "
|
||||
"\"tsig_keys\": [], "
|
||||
"\"forward_ddns\" : {}, "
|
||||
"\"reverse_ddns\" : {} "
|
||||
" \"dns-server-timeout\": 333 , "
|
||||
" \"ncr-protocol\": \"UDP\" , "
|
||||
" \"ncr-format\": \"JSON\", "
|
||||
"\"tsig-keys\": [], "
|
||||
"\"forward-ddns\" : {}, "
|
||||
"\"reverse-ddns\" : {} "
|
||||
"}";
|
||||
|
||||
runConfig(config);
|
||||
@@ -411,13 +411,13 @@ TEST_F(D2CfgMgrTest, defaultValues) {
|
||||
// Check that omitting port gets you its default
|
||||
config =
|
||||
"{"
|
||||
" \"ip_address\": \"192.0.0.1\" , "
|
||||
" \"dns_server_timeout\": 333 , "
|
||||
" \"ncr_protocol\": \"UDP\" , "
|
||||
" \"ncr_format\": \"JSON\", "
|
||||
"\"tsig_keys\": [], "
|
||||
"\"forward_ddns\" : {}, "
|
||||
"\"reverse_ddns\" : {} "
|
||||
" \"ip-address\": \"192.0.0.1\" , "
|
||||
" \"dns-server-timeout\": 333 , "
|
||||
" \"ncr-protocol\": \"UDP\" , "
|
||||
" \"ncr-format\": \"JSON\", "
|
||||
"\"tsig-keys\": [], "
|
||||
"\"forward-ddns\" : {}, "
|
||||
"\"reverse-ddns\" : {} "
|
||||
"}";
|
||||
|
||||
runConfig(config);
|
||||
@@ -426,13 +426,13 @@ TEST_F(D2CfgMgrTest, defaultValues) {
|
||||
// Check that omitting timeout gets you its default
|
||||
config =
|
||||
"{"
|
||||
" \"ip_address\": \"192.0.0.1\" , "
|
||||
" \"ip-address\": \"192.0.0.1\" , "
|
||||
" \"port\": 777 , "
|
||||
" \"ncr_protocol\": \"UDP\" , "
|
||||
" \"ncr_format\": \"JSON\", "
|
||||
"\"tsig_keys\": [], "
|
||||
"\"forward_ddns\" : {}, "
|
||||
"\"reverse_ddns\" : {} "
|
||||
" \"ncr-protocol\": \"UDP\" , "
|
||||
" \"ncr-format\": \"JSON\", "
|
||||
"\"tsig-keys\": [], "
|
||||
"\"forward-ddns\" : {}, "
|
||||
"\"reverse-ddns\" : {} "
|
||||
"}";
|
||||
|
||||
runConfig(config);
|
||||
@@ -442,13 +442,13 @@ TEST_F(D2CfgMgrTest, defaultValues) {
|
||||
// Check that protocol timeout gets you its default
|
||||
config =
|
||||
"{"
|
||||
" \"ip_address\": \"192.0.0.1\" , "
|
||||
" \"ip-address\": \"192.0.0.1\" , "
|
||||
" \"port\": 777 , "
|
||||
" \"dns_server_timeout\": 333 , "
|
||||
" \"ncr_format\": \"JSON\", "
|
||||
"\"tsig_keys\": [], "
|
||||
"\"forward_ddns\" : {}, "
|
||||
"\"reverse_ddns\" : {} "
|
||||
" \"dns-server-timeout\": 333 , "
|
||||
" \"ncr-format\": \"JSON\", "
|
||||
"\"tsig-keys\": [], "
|
||||
"\"forward-ddns\" : {}, "
|
||||
"\"reverse-ddns\" : {} "
|
||||
"}";
|
||||
|
||||
runConfig(config);
|
||||
@@ -458,13 +458,13 @@ TEST_F(D2CfgMgrTest, defaultValues) {
|
||||
// Check that format timeout gets you its default
|
||||
config =
|
||||
"{"
|
||||
" \"ip_address\": \"192.0.0.1\" , "
|
||||
" \"ip-address\": \"192.0.0.1\" , "
|
||||
" \"port\": 777 , "
|
||||
" \"dns_server_timeout\": 333 , "
|
||||
" \"ncr_protocol\": \"UDP\", "
|
||||
"\"tsig_keys\": [], "
|
||||
"\"forward_ddns\" : {}, "
|
||||
"\"reverse_ddns\" : {} "
|
||||
" \"dns-server-timeout\": 333 , "
|
||||
" \"ncr-protocol\": \"UDP\", "
|
||||
"\"tsig-keys\": [], "
|
||||
"\"forward-ddns\" : {}, "
|
||||
"\"reverse-ddns\" : {} "
|
||||
"}";
|
||||
|
||||
runConfig(config);
|
||||
@@ -477,15 +477,15 @@ TEST_F(D2CfgMgrTest, unsupportedTopLevelItems) {
|
||||
// Check that an unsupported top level parameter fails.
|
||||
std::string config =
|
||||
"{"
|
||||
" \"ip_address\": \"127.0.0.1\", "
|
||||
" \"ip-address\": \"127.0.0.1\", "
|
||||
" \"port\": 777 , "
|
||||
" \"dns_server_timeout\": 333 , "
|
||||
" \"ncr_protocol\": \"UDP\" , "
|
||||
" \"ncr_format\": \"JSON\", "
|
||||
"\"tsig_keys\": [], "
|
||||
"\"forward_ddns\" : {}, "
|
||||
"\"reverse_ddns\" : {}, "
|
||||
"\"bogus_param\" : true "
|
||||
" \"dns-server-timeout\": 333 , "
|
||||
" \"ncr-protocol\": \"UDP\" , "
|
||||
" \"ncr-format\": \"JSON\", "
|
||||
"\"tsig-keys\": [], "
|
||||
"\"forward-ddns\" : {}, "
|
||||
"\"reverse-ddns\" : {}, "
|
||||
"\"bogus-param\" : true "
|
||||
"}";
|
||||
|
||||
runConfig(config, SHOULD_FAIL);
|
||||
@@ -494,16 +494,16 @@ TEST_F(D2CfgMgrTest, unsupportedTopLevelItems) {
|
||||
// D2 these fail as they are not in the parse order.
|
||||
config =
|
||||
"{"
|
||||
" \"ip_address\": \"127.0.0.1\", "
|
||||
" \"ip-address\": \"127.0.0.1\", "
|
||||
" \"port\": 777 , "
|
||||
" \"dns_server_timeout\": 333 , "
|
||||
" \"ncr_protocol\": \"UDP\" , "
|
||||
" \"ncr_format\": \"JSON\", "
|
||||
"\"tsig_keys\": [], "
|
||||
"\"bogus_object_one\" : {}, "
|
||||
"\"forward_ddns\" : {}, "
|
||||
"\"reverse_ddns\" : {}, "
|
||||
"\"bogus_object_two\" : {} "
|
||||
" \"dns-server-timeout\": 333 , "
|
||||
" \"ncr-protocol\": \"UDP\" , "
|
||||
" \"ncr-format\": \"JSON\", "
|
||||
"\"tsig-keys\": [], "
|
||||
"\"bogus-object-one\" : {}, "
|
||||
"\"forward-ddns\" : {}, "
|
||||
"\"reverse-ddns\" : {}, "
|
||||
"\"bogus-object-two\" : {} "
|
||||
"}";
|
||||
|
||||
runConfig(config, SHOULD_FAIL);
|
||||
@@ -622,7 +622,7 @@ TEST_F(TSIGKeyInfoTest, validEntry) {
|
||||
std::string config = "{"
|
||||
" \"name\": \"d2_key_one\" , "
|
||||
" \"algorithm\": \"HMAC-MD5\" , "
|
||||
" \"digest_bits\": 120 , "
|
||||
" \"digest-bits\": 120 , "
|
||||
" \"secret\": \"dGhpcyBrZXkgd2lsbCBtYXRjaA==\" "
|
||||
"}";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
@@ -654,13 +654,13 @@ TEST_F(TSIGKeyInfoTest, invalidTSIGKeyList) {
|
||||
|
||||
" { \"name\": \"key1\" , "
|
||||
" \"algorithm\": \"HMAC-MD5\" ,"
|
||||
" \"digest_bits\": 120 , "
|
||||
" \"digest-bits\": 120 , "
|
||||
" \"secret\": \"GWG/Xfbju4O2iXGqkSu4PQ==\" "
|
||||
" },"
|
||||
// this entry has an invalid algorithm
|
||||
" { \"name\": \"key2\" , "
|
||||
" \"algorithm\": \"\" ,"
|
||||
" \"digest_bits\": 120 , "
|
||||
" \"digest-bits\": 120 , "
|
||||
" \"secret\": \"GWG/Xfbju4O2iXGqkSu4PQ==\" "
|
||||
" },"
|
||||
" { \"name\": \"key3\" , "
|
||||
@@ -687,12 +687,12 @@ TEST_F(TSIGKeyInfoTest, duplicateTSIGKey) {
|
||||
|
||||
" { \"name\": \"key1\" , "
|
||||
" \"algorithm\": \"HMAC-MD5\" ,"
|
||||
" \"digest_bits\": 120 , "
|
||||
" \"digest-bits\": 120 , "
|
||||
" \"secret\": \"GWG/Xfbju4O2iXGqkSu4PQ==\" "
|
||||
" },"
|
||||
" { \"name\": \"key2\" , "
|
||||
" \"algorithm\": \"HMAC-MD5\" ,"
|
||||
" \"digest_bits\": 120 , "
|
||||
" \"digest-bits\": 120 , "
|
||||
" \"secret\": \"GWG/Xfbju4O2iXGqkSu4PQ==\" "
|
||||
" },"
|
||||
" { \"name\": \"key1\" , "
|
||||
@@ -719,32 +719,32 @@ TEST_F(TSIGKeyInfoTest, validTSIGKeyList) {
|
||||
|
||||
" { \"name\": \"key1\" , "
|
||||
" \"algorithm\": \"HMAC-MD5\" ,"
|
||||
" \"digest_bits\": 80 , "
|
||||
" \"digest-bits\": 80 , "
|
||||
" \"secret\": \"dGhpcyBrZXkgd2lsbCBtYXRjaA==\" "
|
||||
" },"
|
||||
" { \"name\": \"key2\" , "
|
||||
" \"algorithm\": \"HMAC-SHA1\" ,"
|
||||
" \"digest_bits\": 80 , "
|
||||
" \"digest-bits\": 80 , "
|
||||
" \"secret\": \"dGhpcyBrZXkgd2lsbCBtYXRjaA==\" "
|
||||
" },"
|
||||
" { \"name\": \"key3\" , "
|
||||
" \"algorithm\": \"HMAC-SHA256\" ,"
|
||||
" \"digest_bits\": 128 , "
|
||||
" \"digest-bits\": 128 , "
|
||||
" \"secret\": \"dGhpcyBrZXkgd2lsbCBtYXRjaA==\" "
|
||||
" },"
|
||||
" { \"name\": \"key4\" , "
|
||||
" \"algorithm\": \"HMAC-SHA224\" ,"
|
||||
" \"digest_bits\": 112 , "
|
||||
" \"digest-bits\": 112 , "
|
||||
" \"secret\": \"dGhpcyBrZXkgd2lsbCBtYXRjaA==\" "
|
||||
" },"
|
||||
" { \"name\": \"key5\" , "
|
||||
" \"algorithm\": \"HMAC-SHA384\" ,"
|
||||
" \"digest_bits\": 192 , "
|
||||
" \"digest-bits\": 192 , "
|
||||
" \"secret\": \"dGhpcyBrZXkgd2lsbCBtYXRjaA==\" "
|
||||
" },"
|
||||
" { \"name\": \"key6\" , "
|
||||
" \"algorithm\": \"HMAC-SHA512\" ,"
|
||||
" \"digest_bits\": 256 , "
|
||||
" \"digest-bits\": 256 , "
|
||||
" \"secret\": \"dGhpcyBrZXkgd2lsbCBtYXRjaA==\" "
|
||||
" }"
|
||||
" ]";
|
||||
@@ -827,20 +827,20 @@ TEST_F(DnsServerInfoTest, invalidEntry) {
|
||||
// Create a config in which both host and ip address are supplied.
|
||||
// Verify that build fails.
|
||||
std::string config = "{ \"hostname\": \"pegasus.tmark\", "
|
||||
" \"ip_address\": \"127.0.0.1\" } ";
|
||||
" \"ip-address\": \"127.0.0.1\" } ";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
EXPECT_THROW(parser_->build(config_set_), D2CfgError);
|
||||
|
||||
// Neither host nor ip address supplied
|
||||
// Verify that builds fails.
|
||||
config = "{ \"hostname\": \"\", "
|
||||
" \"ip_address\": \"\" } ";
|
||||
" \"ip-address\": \"\" } ";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
EXPECT_THROW(parser_->build(config_set_), D2CfgError);
|
||||
|
||||
// Create a config with a negative port number.
|
||||
// Verify that build fails.
|
||||
config = "{ \"ip_address\": \"192.168.5.6\" ,"
|
||||
config = "{ \"ip-address\": \"192.168.5.6\" ,"
|
||||
" \"port\": -100 }";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
EXPECT_THROW (parser_->build(config_set_), isc::BadValue);
|
||||
@@ -877,7 +877,7 @@ TEST_F(DnsServerInfoTest, validEntry) {
|
||||
/// reset();
|
||||
|
||||
// Valid entries for static ip
|
||||
std::string config = " { \"ip_address\": \"127.0.0.1\" , "
|
||||
std::string config = " { \"ip-address\": \"127.0.0.1\" , "
|
||||
" \"port\": 100 }";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
|
||||
@@ -897,7 +897,7 @@ TEST_F(DnsServerInfoTest, validEntry) {
|
||||
reset();
|
||||
|
||||
// Valid entries for static ip, no port
|
||||
config = " { \"ip_address\": \"192.168.2.5\" }";
|
||||
config = " { \"ip-address\": \"192.168.2.5\" }";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
|
||||
// Verify that it builds and commits without throwing.
|
||||
@@ -918,9 +918,9 @@ TEST_F(DnsServerInfoTest, validEntry) {
|
||||
/// entries is detected.
|
||||
TEST_F(ConfigParseTest, invalidServerList) {
|
||||
// Construct a list of servers with an invalid server entry.
|
||||
std::string config = "[ { \"ip_address\": \"127.0.0.1\" }, "
|
||||
"{ \"ip_address\": \"\" }, "
|
||||
"{ \"ip_address\": \"127.0.0.2\" } ]";
|
||||
std::string config = "[ { \"ip-address\": \"127.0.0.1\" }, "
|
||||
"{ \"ip-address\": \"\" }, "
|
||||
"{ \"ip-address\": \"127.0.0.2\" } ]";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
|
||||
// Create the server storage and list parser.
|
||||
@@ -936,9 +936,9 @@ TEST_F(ConfigParseTest, invalidServerList) {
|
||||
/// a valid configuration.
|
||||
TEST_F(ConfigParseTest, validServerList) {
|
||||
// Create a valid list of servers.
|
||||
std::string config = "[ { \"ip_address\": \"127.0.0.1\" }, "
|
||||
"{ \"ip_address\": \"127.0.0.2\" }, "
|
||||
"{ \"ip_address\": \"127.0.0.3\" } ]";
|
||||
std::string config = "[ { \"ip-address\": \"127.0.0.1\" }, "
|
||||
"{ \"ip-address\": \"127.0.0.2\" }, "
|
||||
"{ \"ip-address\": \"127.0.0.3\" } ]";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
|
||||
// Create the server storage and list parser.
|
||||
@@ -984,13 +984,13 @@ TEST_F(DdnsDomainTest, invalidDdnsDomainEntry) {
|
||||
new DdnsDomainParser("test", domains, keys_)), D2CfgError);
|
||||
|
||||
// Create a domain configuration without a name
|
||||
std::string config = "{ \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" , "
|
||||
std::string config = "{ \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" , "
|
||||
" \"port\": 100 },"
|
||||
" { \"ip_address\": \"127.0.0.2\" , "
|
||||
" { \"ip-address\": \"127.0.0.2\" , "
|
||||
" \"port\": 200 },"
|
||||
" { \"ip_address\": \"127.0.0.3\" , "
|
||||
" { \"ip-address\": \"127.0.0.3\" , "
|
||||
" \"port\": 300 } ] } ";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
|
||||
@@ -999,8 +999,8 @@ TEST_F(DdnsDomainTest, invalidDdnsDomainEntry) {
|
||||
|
||||
// Create a domain configuration with an empty server list.
|
||||
config = "{ \"name\": \"tmark.org\" , "
|
||||
" \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" ] } ";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
|
||||
@@ -1009,9 +1009,9 @@ TEST_F(DdnsDomainTest, invalidDdnsDomainEntry) {
|
||||
|
||||
// Create a domain configuration with a mal-formed server entry.
|
||||
config = "{ \"name\": \"tmark.org\" , "
|
||||
" \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.3\" , "
|
||||
" \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.3\" , "
|
||||
" \"port\": -1 } ] } ";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
|
||||
@@ -1020,9 +1020,9 @@ TEST_F(DdnsDomainTest, invalidDdnsDomainEntry) {
|
||||
|
||||
// Create a domain configuration without an defined key name
|
||||
config = "{ \"name\": \"tmark.org\" , "
|
||||
" \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.3\" , "
|
||||
" \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.3\" , "
|
||||
" \"port\": 300 } ] } ";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
|
||||
@@ -1041,13 +1041,13 @@ TEST_F(DdnsDomainTest, ddnsDomainParsing) {
|
||||
// servers.
|
||||
std::string config =
|
||||
"{ \"name\": \"tmark.org\" , "
|
||||
" \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" , "
|
||||
" \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" , "
|
||||
" \"port\": 100 },"
|
||||
" { \"ip_address\": \"127.0.0.2\" , "
|
||||
" { \"ip-address\": \"127.0.0.2\" , "
|
||||
" \"port\": 200 },"
|
||||
" { \"ip_address\": \"127.0.0.3\" , "
|
||||
" { \"ip-address\": \"127.0.0.3\" , "
|
||||
" \"port\": 300 } ] } ";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
|
||||
@@ -1107,23 +1107,23 @@ TEST_F(DdnsDomainTest, DdnsDomainListParsing) {
|
||||
std::string config =
|
||||
"[ "
|
||||
"{ \"name\": \"tmark.org\" , "
|
||||
" \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" , "
|
||||
" \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" , "
|
||||
" \"port\": 100 },"
|
||||
" { \"ip_address\": \"127.0.0.2\" , "
|
||||
" { \"ip-address\": \"127.0.0.2\" , "
|
||||
" \"port\": 200 },"
|
||||
" { \"ip_address\": \"127.0.0.3\" , "
|
||||
" { \"ip-address\": \"127.0.0.3\" , "
|
||||
" \"port\": 300 } ] } "
|
||||
", "
|
||||
"{ \"name\": \"billcat.net\" , "
|
||||
" \"key_name\": \"d2_key.billcat.net\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.4\" , "
|
||||
" \"key-name\": \"d2_key.billcat.net\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.4\" , "
|
||||
" \"port\": 400 },"
|
||||
" { \"ip_address\": \"127.0.0.5\" , "
|
||||
" { \"ip-address\": \"127.0.0.5\" , "
|
||||
" \"port\": 500 },"
|
||||
" { \"ip_address\": \"127.0.0.6\" , "
|
||||
" { \"ip-address\": \"127.0.0.6\" , "
|
||||
" \"port\": 600 } ] } "
|
||||
"] ";
|
||||
|
||||
@@ -1212,13 +1212,13 @@ TEST_F(DdnsDomainTest, duplicateDomain) {
|
||||
std::string config =
|
||||
"[ "
|
||||
"{ \"name\": \"tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.3\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.3\" , "
|
||||
" \"port\": 300 } ] } "
|
||||
", "
|
||||
"{ \"name\": \"tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.3\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.3\" , "
|
||||
" \"port\": 300 } ] } "
|
||||
"] ";
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
@@ -1264,12 +1264,12 @@ TEST_F(D2CfgMgrTest, fullConfig) {
|
||||
// both the forward and reverse ddns managers. Both managers have two
|
||||
// domains with three servers per domain.
|
||||
std::string config = "{ "
|
||||
"\"ip_address\" : \"192.168.1.33\" , "
|
||||
"\"ip-address\" : \"192.168.1.33\" , "
|
||||
"\"port\" : 88 , "
|
||||
" \"dns_server_timeout\": 333 , "
|
||||
" \"ncr_protocol\": \"UDP\" , "
|
||||
" \"ncr_format\": \"JSON\", "
|
||||
"\"tsig_keys\": ["
|
||||
" \"dns-server-timeout\": 333 , "
|
||||
" \"ncr-protocol\": \"UDP\" , "
|
||||
" \"ncr-format\": \"JSON\", "
|
||||
"\"tsig-keys\": ["
|
||||
"{"
|
||||
" \"name\": \"d2_key.tmark.org\" , "
|
||||
" \"algorithm\": \"hmac-md5\" , "
|
||||
@@ -1278,44 +1278,44 @@ TEST_F(D2CfgMgrTest, fullConfig) {
|
||||
"{"
|
||||
" \"name\": \"d2_key.billcat.net\" , "
|
||||
" \"algorithm\": \"hmac-md5\" , "
|
||||
" \"digest_bits\": 120 , "
|
||||
" \"digest-bits\": 120 , "
|
||||
" \"secret\": \"LSWXnfkKZjdPJI5QxlpnfQ==\" "
|
||||
"}"
|
||||
"],"
|
||||
"\"forward_ddns\" : {"
|
||||
"\"ddns_domains\": [ "
|
||||
"\"forward-ddns\" : {"
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \"tmark.org\" , "
|
||||
" \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" } , "
|
||||
" { \"ip_address\": \"127.0.0.2\" } , "
|
||||
" { \"ip_address\": \"127.0.0.3\"} "
|
||||
" \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" } , "
|
||||
" { \"ip-address\": \"127.0.0.2\" } , "
|
||||
" { \"ip-address\": \"127.0.0.3\"} "
|
||||
" ] } "
|
||||
", "
|
||||
"{ \"name\": \"billcat.net\" , "
|
||||
" \"key_name\": \"d2_key.billcat.net\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.4\" } , "
|
||||
" { \"ip_address\": \"127.0.0.5\" } , "
|
||||
" { \"ip_address\": \"127.0.0.6\" } "
|
||||
" \"key-name\": \"d2_key.billcat.net\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.4\" } , "
|
||||
" { \"ip-address\": \"127.0.0.5\" } , "
|
||||
" { \"ip-address\": \"127.0.0.6\" } "
|
||||
" ] } "
|
||||
"] },"
|
||||
"\"reverse_ddns\" : {"
|
||||
"\"ddns_domains\": [ "
|
||||
"\"reverse-ddns\" : {"
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \" 0.168.192.in.addr.arpa.\" , "
|
||||
" \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.1.1\" } , "
|
||||
" { \"ip_address\": \"127.0.2.1\" } , "
|
||||
" { \"ip_address\": \"127.0.3.1\" } "
|
||||
" \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.1.1\" } , "
|
||||
" { \"ip-address\": \"127.0.2.1\" } , "
|
||||
" { \"ip-address\": \"127.0.3.1\" } "
|
||||
" ] } "
|
||||
", "
|
||||
"{ \"name\": \" 0.247.106.in.addr.arpa.\" , "
|
||||
" \"key_name\": \"d2_key.billcat.net\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.4.1\" }, "
|
||||
" { \"ip_address\": \"127.0.5.1\" } , "
|
||||
" { \"ip_address\": \"127.0.6.1\" } "
|
||||
" \"key-name\": \"d2_key.billcat.net\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.4.1\" }, "
|
||||
" { \"ip-address\": \"127.0.5.1\" } , "
|
||||
" { \"ip-address\": \"127.0.6.1\" } "
|
||||
" ] } "
|
||||
"] } }";
|
||||
|
||||
@@ -1407,27 +1407,27 @@ TEST_F(D2CfgMgrTest, forwardMatch) {
|
||||
// Create configuration with one domain, one sub domain, and the wild
|
||||
// card.
|
||||
std::string config = "{ "
|
||||
"\"ip_address\" : \"192.168.1.33\" , "
|
||||
"\"ip-address\" : \"192.168.1.33\" , "
|
||||
"\"port\" : 88 , "
|
||||
"\"tsig_keys\": [] ,"
|
||||
"\"forward_ddns\" : {"
|
||||
"\"ddns_domains\": [ "
|
||||
"\"tsig-keys\": [] ,"
|
||||
"\"forward-ddns\" : {"
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \"tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" } "
|
||||
" ] } "
|
||||
", "
|
||||
"{ \"name\": \"one.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.2\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.2\" } "
|
||||
" ] } "
|
||||
", "
|
||||
"{ \"name\": \"*\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.3\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.3\" } "
|
||||
" ] } "
|
||||
"] }, "
|
||||
"\"reverse_ddns\" : {} "
|
||||
"\"reverse-ddns\" : {} "
|
||||
"}";
|
||||
|
||||
|
||||
@@ -1480,22 +1480,22 @@ TEST_F(D2CfgMgrTest, forwardMatch) {
|
||||
TEST_F(D2CfgMgrTest, matchNoWildcard) {
|
||||
// Create a configuration with one domain, one sub-domain, and NO wild card.
|
||||
std::string config = "{ "
|
||||
"\"ip_address\" : \"192.168.1.33\" , "
|
||||
"\"ip-address\" : \"192.168.1.33\" , "
|
||||
"\"port\" : 88 , "
|
||||
"\"tsig_keys\": [] ,"
|
||||
"\"forward_ddns\" : {"
|
||||
"\"ddns_domains\": [ "
|
||||
"\"tsig-keys\": [] ,"
|
||||
"\"forward-ddns\" : {"
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \"tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" } "
|
||||
" ] } "
|
||||
", "
|
||||
"{ \"name\": \"one.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.2\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.2\" } "
|
||||
" ] } "
|
||||
"] }, "
|
||||
"\"reverse_ddns\" : {} "
|
||||
"\"reverse-ddns\" : {} "
|
||||
" }";
|
||||
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
@@ -1527,17 +1527,17 @@ TEST_F(D2CfgMgrTest, matchNoWildcard) {
|
||||
/// This test verifies that any FQDN matches the wild card.
|
||||
TEST_F(D2CfgMgrTest, matchAll) {
|
||||
std::string config = "{ "
|
||||
"\"ip_address\" : \"192.168.1.33\" , "
|
||||
"\"ip-address\" : \"192.168.1.33\" , "
|
||||
"\"port\" : 88 , "
|
||||
"\"tsig_keys\": [] ,"
|
||||
"\"forward_ddns\" : {"
|
||||
"\"ddns_domains\": [ "
|
||||
"\"tsig-keys\": [] ,"
|
||||
"\"forward-ddns\" : {"
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \"*\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" } "
|
||||
" ] } "
|
||||
"] }, "
|
||||
"\"reverse_ddns\" : {} "
|
||||
"\"reverse-ddns\" : {} "
|
||||
"}";
|
||||
|
||||
ASSERT_TRUE(fromJSON(config));
|
||||
@@ -1573,32 +1573,32 @@ TEST_F(D2CfgMgrTest, matchAll) {
|
||||
/// as a match.
|
||||
TEST_F(D2CfgMgrTest, matchReverse) {
|
||||
std::string config = "{ "
|
||||
"\"ip_address\" : \"192.168.1.33\" , "
|
||||
"\"ip-address\" : \"192.168.1.33\" , "
|
||||
"\"port\" : 88 , "
|
||||
"\"tsig_keys\": [] ,"
|
||||
"\"forward_ddns\" : {}, "
|
||||
"\"reverse_ddns\" : {"
|
||||
"\"ddns_domains\": [ "
|
||||
"\"tsig-keys\": [] ,"
|
||||
"\"forward-ddns\" : {}, "
|
||||
"\"reverse-ddns\" : {"
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \"5.100.168.192.in-addr.arpa.\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" } "
|
||||
" ] }, "
|
||||
"{ \"name\": \"100.200.192.in-addr.arpa.\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" } "
|
||||
" ] }, "
|
||||
"{ \"name\": \"170.192.in-addr.arpa.\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" } "
|
||||
" ] }, "
|
||||
// Note mixed case to test case insensitivity.
|
||||
"{ \"name\": \"2.0.3.0.8.b.d.0.1.0.0.2.IP6.ARPA.\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" } "
|
||||
" ] },"
|
||||
"{ \"name\": \"*\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" } "
|
||||
" ] } "
|
||||
"] } }";
|
||||
|
||||
@@ -1662,7 +1662,7 @@ TEST_F(D2CfgMgrTest, matchReverse) {
|
||||
///
|
||||
/// # Each test has:
|
||||
/// # 1. description - optional text description
|
||||
/// # 2. should_fail - bool indicator if parsing is expected to file
|
||||
/// # 2. should-fail - bool indicator if parsing is expected to file
|
||||
/// # (defaults to false)
|
||||
/// # 3. data - configuration text to parse
|
||||
/// #
|
||||
@@ -1702,15 +1702,16 @@ TEST_F(D2CfgMgrTest, configPermutations) {
|
||||
|
||||
// Read in each test For each test, read:
|
||||
// 1. description - optional text description
|
||||
// 2. should_fail - bool indicator if parsing is expected to file (defaults
|
||||
// 2. should-fail - bool indicator if parsing is expected to file (defaults
|
||||
// to false
|
||||
// 3. data - configuration text to parse
|
||||
//
|
||||
// Next attempt to parse the configuration by passing it into
|
||||
// D2CfgMgr::parseConfig(). Then check the parsing outcome against the
|
||||
// expected outcome as given by should_fail.
|
||||
// expected outcome as given by should-fail.
|
||||
isc::data::ConstElementPtr test;
|
||||
BOOST_FOREACH(test, tests->get("test_list")->listValue()) {
|
||||
ASSERT_TRUE(tests->get("test-list"));
|
||||
BOOST_FOREACH(test, tests->get("test-list")->listValue()) {
|
||||
|
||||
// Grab the description.
|
||||
std::string description = "<no desc>";
|
||||
@@ -1719,10 +1720,10 @@ TEST_F(D2CfgMgrTest, configPermutations) {
|
||||
elem->getValue(description);
|
||||
}
|
||||
|
||||
// Grab the outcome flag, should_fail, defaults to false if it's
|
||||
// Grab the outcome flag, should-fail, defaults to false if it's
|
||||
// not specified.
|
||||
bool should_fail = false;
|
||||
elem = test->get("should_fail");
|
||||
elem = test->get("should-fail");
|
||||
if (elem) {
|
||||
elem->getValue(should_fail);
|
||||
}
|
||||
|
@@ -259,11 +259,11 @@ TEST_F(D2ControllerTest, validConfigReload) {
|
||||
// Define a replacement config.
|
||||
const char* second_cfg =
|
||||
"{"
|
||||
" \"ip_address\": \"192.168.77.1\" , "
|
||||
" \"ip-address\": \"192.168.77.1\" , "
|
||||
" \"port\": 777 , "
|
||||
"\"tsig_keys\": [], "
|
||||
"\"forward_ddns\" : {}, "
|
||||
"\"reverse_ddns\" : {} "
|
||||
"\"tsig-keys\": [], "
|
||||
"\"forward-ddns\" : {}, "
|
||||
"\"reverse-ddns\" : {} "
|
||||
"}";
|
||||
|
||||
// Schedule to replace the configuration file after launch. This way the
|
||||
|
@@ -36,26 +36,26 @@ namespace {
|
||||
|
||||
/// @brief Valid configuration containing an unavailable IP address.
|
||||
const char* bad_ip_d2_config = "{ "
|
||||
"\"ip_address\" : \"1.1.1.1\" , "
|
||||
"\"ip-address\" : \"1.1.1.1\" , "
|
||||
"\"port\" : 5031, "
|
||||
"\"tsig_keys\": ["
|
||||
"\"tsig-keys\": ["
|
||||
"{ \"name\": \"d2_key.tmark.org\" , "
|
||||
" \"algorithm\": \"HMAC-MD5\" ,"
|
||||
" \"secret\": \"LSWXnfkKZjdPJI5QxlpnfQ==\" "
|
||||
"} ],"
|
||||
"\"forward_ddns\" : {"
|
||||
"\"ddns_domains\": [ "
|
||||
"\"forward-ddns\" : {"
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \"tmark.org\" , "
|
||||
" \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.101\" } "
|
||||
" \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.101\" } "
|
||||
"] } ] }, "
|
||||
"\"reverse_ddns\" : {"
|
||||
"\"ddns_domains\": [ "
|
||||
"\"reverse-ddns\" : {"
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \" 0.168.192.in.addr.arpa.\" , "
|
||||
" \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.101\" , "
|
||||
" \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.101\" , "
|
||||
" \"port\": 100 } ] } "
|
||||
"] } }";
|
||||
|
||||
@@ -608,11 +608,11 @@ TEST_F(D2ProcessTest, fatalErrorShutdown) {
|
||||
/// loopback.
|
||||
TEST_F(D2ProcessTest, notLoopbackTest) {
|
||||
const char* config = "{ "
|
||||
"\"ip_address\" : \"0.0.0.0\" , "
|
||||
"\"ip-address\" : \"0.0.0.0\" , "
|
||||
"\"port\" : 53001, "
|
||||
"\"tsig_keys\": [],"
|
||||
"\"forward_ddns\" : {},"
|
||||
"\"reverse_ddns\" : {}"
|
||||
"\"tsig-keys\": [],"
|
||||
"\"forward-ddns\" : {},"
|
||||
"\"reverse-ddns\" : {}"
|
||||
"}";
|
||||
|
||||
// Note we don't care nor can we predict if this
|
||||
@@ -626,11 +626,11 @@ TEST_F(D2ProcessTest, notLoopbackTest) {
|
||||
/// DHCP_DDNS_NOT_ON_LOOPBACK is not issued.
|
||||
TEST_F(D2ProcessTest, v4LoopbackTest) {
|
||||
const char* config = "{ "
|
||||
"\"ip_address\" : \"127.0.0.1\" , "
|
||||
"\"ip-address\" : \"127.0.0.1\" , "
|
||||
"\"port\" : 53001, "
|
||||
"\"tsig_keys\": [],"
|
||||
"\"forward_ddns\" : {},"
|
||||
"\"reverse_ddns\" : {}"
|
||||
"\"tsig-keys\": [],"
|
||||
"\"forward-ddns\" : {},"
|
||||
"\"reverse-ddns\" : {}"
|
||||
"}";
|
||||
ASSERT_TRUE(runWithConfig(config));
|
||||
}
|
||||
@@ -639,11 +639,11 @@ TEST_F(D2ProcessTest, v4LoopbackTest) {
|
||||
/// DHCP_DDNS_NOT_ON_LOOPBACK is not issued.
|
||||
TEST_F(D2ProcessTest, v6LoopbackTest) {
|
||||
const char* config = "{ "
|
||||
"\"ip_address\" : \"::1\" , "
|
||||
"\"ip-address\" : \"::1\" , "
|
||||
"\"port\" : 53001, "
|
||||
"\"tsig_keys\": [],"
|
||||
"\"forward_ddns\" : {},"
|
||||
"\"reverse_ddns\" : {}"
|
||||
"\"tsig-keys\": [],"
|
||||
"\"forward-ddns\" : {},"
|
||||
"\"reverse-ddns\" : {}"
|
||||
"}";
|
||||
ASSERT_TRUE(runWithConfig(config));
|
||||
}
|
||||
|
@@ -122,29 +122,29 @@ public:
|
||||
void makeCannedConfig() {
|
||||
std::string canned_config_ =
|
||||
"{ "
|
||||
"\"ip_address\" : \"192.168.1.33\" , "
|
||||
"\"ip-address\" : \"192.168.1.33\" , "
|
||||
"\"port\" : 88 , "
|
||||
"\"tsig_keys\": [] ,"
|
||||
"\"forward_ddns\" : {"
|
||||
"\"ddns_domains\": [ "
|
||||
"\"tsig-keys\": [] ,"
|
||||
"\"forward-ddns\" : {"
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \"example.com.\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\", \"port\" : 5301 } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\", \"port\" : 5301 } "
|
||||
" ] },"
|
||||
"{ \"name\": \"org.\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" } "
|
||||
" ] }, "
|
||||
"] }, "
|
||||
"\"reverse_ddns\" : { "
|
||||
"\"ddns_domains\": [ "
|
||||
"\"reverse-ddns\" : { "
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \"1.168.192.in-addr.arpa.\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\", \"port\" : 5301 } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\", \"port\" : 5301 } "
|
||||
" ] }, "
|
||||
"{ \"name\": \"2.0.3.0.8.B.D.0.1.0.0.2.ip6.arpa.\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.1\" } "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.1\" } "
|
||||
" ] } "
|
||||
"] } }";
|
||||
|
||||
|
@@ -24,26 +24,26 @@ namespace isc {
|
||||
namespace d2 {
|
||||
|
||||
const char* valid_d2_config = "{ "
|
||||
"\"ip_address\" : \"127.0.0.1\" , "
|
||||
"\"ip-address\" : \"127.0.0.1\" , "
|
||||
"\"port\" : 5031, "
|
||||
"\"tsig_keys\": ["
|
||||
"\"tsig-keys\": ["
|
||||
"{ \"name\": \"d2_key.tmark.org\" , "
|
||||
" \"algorithm\": \"HMAC-MD5\" ,"
|
||||
" \"secret\": \"LSWXnfkKZjdPJI5QxlpnfQ==\" "
|
||||
"} ],"
|
||||
"\"forward_ddns\" : {"
|
||||
"\"ddns_domains\": [ "
|
||||
"\"forward-ddns\" : {"
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \"tmark.org.\" , "
|
||||
" \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.101\" } "
|
||||
" \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.101\" } "
|
||||
"] } ] }, "
|
||||
"\"reverse_ddns\" : {"
|
||||
"\"ddns_domains\": [ "
|
||||
"\"reverse-ddns\" : {"
|
||||
"\"ddns-domains\": [ "
|
||||
"{ \"name\": \" 0.168.192.in.addr.arpa.\" , "
|
||||
" \"key_name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns_servers\" : [ "
|
||||
" { \"ip_address\": \"127.0.0.101\" , "
|
||||
" \"key-name\": \"d2_key.tmark.org\" , "
|
||||
" \"dns-servers\" : [ "
|
||||
" { \"ip-address\": \"127.0.0.101\" , "
|
||||
" \"port\": 100 } ] } "
|
||||
"] } }";
|
||||
|
||||
|
916
src/bin/d2/tests/testdata/d2_cfg_tests.json
vendored
916
src/bin/d2/tests/testdata/d2_cfg_tests.json
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user