<< element_id << element->getPosition());
}
} catch (const D2CfgError& ex) {
- // Should already have a specific error and postion info
+ // Should already have a specific error and position info
throw ex;
} catch (const std::exception& ex) {
isc_throw(D2CfgError, "element: " << element_id << " : " << ex.what()
-// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
return (keys_);
}
- /// @brief Sets the mapy of TSIG keys
+ /// @brief Sets the map of TSIG keys
///
/// @param pointer to the new TSIG key map
void setKeys(const TSIGKeyInfoMapPtr& keys) {
/// @brief Defines a pointer for DScalarContext instances.
typedef boost::shared_ptr<DScalarContext> DScalarContextPtr;
-/// @brief Parser for TSIGKeyInfo
+/// @brief Parser for TSIGKeyInfo
///
/// 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 data::SimpleParser {
public:
- /// @brief Constructor
- TSIGKeyInfoParser(){};
-
- /// @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
/// @return pointer to the new TSIGKeyInfo instance
TSIGKeyInfoPtr parse(data::ConstElementPtr key_config);
-private:
};
/// @brief Parser for a list of TSIGKeyInfos
/// to the given storage upon commit.
class TSIGKeyInfoListParser : public data::SimpleParser {
public:
- /// @brief Constructor
- TSIGKeyInfoListParser(){};
-
- /// @brief Destructor
- virtual ~TSIGKeyInfoListParser(){};
-
/// @brief Performs the parsing of the given list "tsig-key" elements.
///
- /// Creates an emtpy TSIGKeyInfoMap
+ /// Creates an empty TSIGKeyInfoMap
///
/// It iterates over each key entry in the list:
/// 1. Instantiate a TSIGKeyInfoParser for the entry
/// src/bin/d2/dhcp-ddns.spec and creates an instance of a DnsServerInfo.
class DnsServerInfoParser : public data::SimpleParser {
public:
- /// @brief Constructor
- DnsServerInfoParser(){};
-
- /// @brief Destructor
- virtual ~DnsServerInfoParser(){};
-
/// @brief Performs the actual parsing of the given "dns-server" element.
///
/// Parses a configuration for the elements needed to instantiate a
/// to the given storage upon commit.
class DnsServerInfoListParser : public data::SimpleParser{
public:
- /// @brief Constructor
- DnsServerInfoListParser(){};
-
- /// @brief Destructor
- virtual ~DnsServerInfoListParser(){};
-
/// @brief Performs the actual parsing of the given list "dns-server"
/// elements.
///
/// src/bin/d2/dhcp-ddns.spec and creates an instance of a DdnsDomain.
class DdnsDomainParser : public data::SimpleParser {
public:
- /// @brief Constructor
- DdnsDomainParser(){};
-
- /// @brief Destructor
- virtual ~DdnsDomainParser(){};
-
/// @brief Performs the actual parsing of the given "ddns-domain" element.
///
/// Parses a configuration for the elements needed to instantiate a
/// (see src/bin/d2/dhcp-ddns.spec) into a map of DdnsDomains.
class DdnsDomainListParser : public data::SimpleParser {
public:
-
- /// @brief Constructor
- DdnsDomainListParser(){};
-
- /// @brief Destructor
- virtual ~DdnsDomainListParser(){};
-
/// @brief Performs the actual parsing of the given list "ddns-domain"
/// elements.
/// Creates a new DdnsDomain map
/// given DdnsDomainListMgr with parsed information.
class DdnsDomainListMgrParser : public data::SimpleParser {
public:
- /// @brief Constructor
- DdnsDomainListMgrParser(){};
-
- /// @brief Destructor
- virtual ~DdnsDomainListMgrParser(){};
-
/// @brief Performs the actual parsing of the given manager element.
///
/// Parses a configuration for the elements needed to instantiate a
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
///@brief Parse a given file into Elements
///
- /// Uses bison parsing to parse a JSON configruation file into an
+ /// Uses bison parsing to parse a JSON configuration file into an
/// a element map.
///
/// @param file_name pathname of the file to parse
///
/// @return pointer to the map of elements created
+ /// @throw BadValue if the file is empty
virtual isc::data::ConstElementPtr parseFile(const std::string& file_name);
/// @brief Constructor is declared private to maintain the integrity of
};
dhcpddns_params: dhcpddns_param
- | dhcpddns_params COMMA dhcpddns_param
- ;
-// These are teh top-level parameters allowed for DhcpDdns
-dhcpddns_param: ip_address
- | port
- | dns_server_timeout
- | ncr_protocol
- | ncr_format
- | forward_ddns
- | reverse_ddns
- | tsig_keys
- | unknown_map_entry
+ | dhcpddns_params COMMA dhcpddns_param
;
+// These are the top-level parameters allowed for DhcpDdns
+dhcpddns_param: ip_address
+ | port
+ | dns_server_timeout
+ | ncr_protocol
+ | ncr_format
+ | forward_ddns
+ | reverse_ddns
+ | tsig_keys
+ | unknown_map_entry
+ ;
+
ip_address: IP_ADDRESS {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
#include <d2/d2_simple_parser.h>
#include <cc/data.h>
#include <boost/foreach.hpp>
-#include <boost/lexical_cast.hpp>
using namespace isc::data;
<< "\njson: [" << json << " ]";
}
- // JSON parsed ok, so the defaults to the element tree it produced.
+ // JSON parsed ok, so add the defaults to the element tree it produced.
D2SimpleParser::setAllDefaults(elem);
config_set_ = elem;
} catch (const std::exception& ex) {
if (exp_error.empty()) {
// We did not expect an error, so fail.
return ::testing::AssertionFailure()
- << "Unexpected sytnax error:" << ex.what()
+ << "Unexpected syntax error:" << ex.what()
<< "\njson: [" << json << " ]";
}
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
/// DnsServerInfo against the given set of values.
///
/// It is structured in such a way that each value is checked, and output
-/// is generate for all that do not match.
+/// is generated for all that do not match.
///
/// @param server is a pointer to the server to check against.
/// @param hostname is the value to compare against server's hostname_.
/// 2. Algorithm cannot be blank.
/// 3. Secret cannot be blank.
TEST_F(TSIGKeyInfoParserTest, invalidEntry) {
+
// Name cannot be blank.
std::string config = "{"
" \"name\": \"\" , "
#include <gtest/gtest.h>
#include <cc/data.h>
#include <d2/parser_context.h>
-#include <testutils/io_utils.h>
using namespace isc::data;
using namespace std;
-# Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2014-2015,2017 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this