This change affects DHCP servers and D2.
return (getD2CfgContext()->getD2Params());
}
+std::string
+D2CfgMgr::getConfigSummary(const uint16_t) {
+ return (getD2Params()->getConfigSummary());
+}
+
void
D2CfgMgr::buildParams(isc::data::ConstElementPtr params_config) {
// Base class build creates parses and invokes build on each parser.
/// @return reference to const D2ParamsPtr
const D2ParamsPtr& getD2Params();
+ /// @brief Returns configuration summary in the textual format.
+ ///
+ /// @param selection Bitfield which describes the parts of the configuration
+ /// to be returned. This parameter is ignored for the D2.
+ ///
+ /// @return Summary of the configuration in the textual format.
+ virtual std::string getConfigSummary(const uint16_t selection);
+
protected:
/// @brief Performs the parsing of the given "params" element.
///
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/predicate.hpp>
+#include <sstream>
#include <string>
namespace isc {
}
}
+std::string
+D2Params::getConfigSummary() const {
+ std::ostringstream s;
+ s << "listening on " << getIpAddress() << ", port " << getPort();
+ return (s.str());
+}
+
bool
D2Params::operator == (const D2Params& other) const {
return ((ip_address_ == other.ip_address_) &&
return(ncr_format_);
}
+ /// @brief Return summary of the configuration used by D2.
+ ///
+ /// The returned summary of the configuration is meant to be appended to
+ /// the log message informing about the successful completion of the
+ /// D2 configuration.
+ ///
+ /// @return Configuration summary in the textual format.
+ std::string getConfigSummary() const;
+
/// @brief Compares two D2Paramss for equality
bool operator == (const D2Params& other) const;
-// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2014 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
}
// Everything was fine. Configuration set processed successfully.
- LOG_INFO(dctl_logger, DCTL_CONFIG_COMPLETE).arg("");
+ LOG_INFO(dctl_logger, DCTL_CONFIG_COMPLETE).arg(getConfigSummary(0));
answer = isc::config::createAnswer(0, "Configuration committed.");
} catch (const std::exception& ex) {
return (context_);
}
+ /// @brief Returns configuration summary in the textual format.
+ ///
+ /// This method returns the brief text describing the current configuration.
+ /// It may be used for logging purposes, e.g. whn the new configuration is
+ /// committed to notify a user about the changes in configuration.
+ ///
+ /// @param selection Bitfield which describes the parts of the configuration
+ /// to be returned.
+ ///
+ /// @return Summary of the configuration in the textual format.
+ virtual std::string getConfigSummary(const uint16_t selection) = 0;
+
protected:
/// @brief Parses a set of scalar configuration elements into global
/// parameters
// Verify that the global scalars have the proper values.
EXPECT_EQ(isc::asiolink::IOAddress("3001::5"),
d2_params_->getIpAddress());
+
+ // Verify the configuration summary.
+ EXPECT_EQ("listening on 3001::5, port 777",
+ d2_params_->getConfigSummary());
}
/// @brief Tests default values for D2Params.
const isc::data::Element::Position& /* pos */) {
return (isc::dhcp::ParserPtr());
}
+
+ /// @brief Returns summary of configuration in the textual format.
+ virtual std::string getConfigSummary(const uint16_t) {
+ return ("");
+ }
};
/// @brief Test fixture class for testing DCfgMgrBase class.
virtual isc::data::ConstElementPtr command(const std::string& command,
isc::data::ConstElementPtr args);
+ /// @brief Returns configuration summary in the textual format.
+ ///
+ /// @return Always an empty string.
+ virtual std::string getConfigSummary(const uint16_t) {
+ return ("");
+ }
+
// @brief Destructor
virtual ~DStubProcess();
};
const isc::data::Element::Position& pos
= isc::data::Element::Position());
+ /// @brief Returns a summary of the configuration in the textual format.
+ ///
+ /// @return Always an empty string.
+ virtual std::string getConfigSummary(const uint16_t) {
+ return ("");
+ }
+
/// @brief A list for remembering the element ids in the order they were
/// parsed.
ElementIdList parsed_order_;
return (answer);
}
- /// @todo: Append most essential info here (like "2 new subnets configured")
- string config_details;
-
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_COMMAND,
DHCP4_CONFIG_START).arg(config_set->str());
return (answer);
}
- LOG_INFO(dhcp4_logger, DHCP4_CONFIG_COMPLETE).arg(config_details);
+ LOG_INFO(dhcp4_logger, DHCP4_CONFIG_COMPLETE)
+ .arg(CfgMgr::instance().getConfiguration()->
+ getConfigSummary(Configuration::CFGSEL_ALL4));
// Everything was fine. Configuration is successful.
answer = isc::config::createAnswer(0, "Configuration committed.");
return (answer);
}
- /// @todo: Append most essential info here (like "2 new subnets configured")
- string config_details;
-
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_COMMAND,
DHCP6_CONFIG_START).arg(config_set->str());
return (answer);
}
- LOG_INFO(dhcp6_logger, DHCP6_CONFIG_COMPLETE).arg(config_details);
+ LOG_INFO(dhcp6_logger, DHCP6_CONFIG_COMPLETE)
+ .arg(CfgMgr::instance().getConfiguration()->
+ getConfigSummary(Configuration::CFGSEL_ALL6));
// Everything was fine. Configuration is successful.
answer = isc::config::createAnswer(0, "Configuration committed.");
/// @brief Returns summary of the configuration in the textual format.
///
/// This method returns the brief text describing the current configuration.
- /// It may be use for logging purposes, e.g. when the new configuration is
+ /// It may be used for logging purposes, e.g. when the new configuration is
/// committed to notify a user about the changes in configuration.
///
/// @todo Currently this method uses @c CfgMgr accessors to get the