noinst_LTLIBRARIES = libnetconf.la
-libnetconf_la_SOURCES = agent.cc agent.h
-libnetconf_la_SOURCES += translator.cc translator.h
-libnetconf_la_SOURCES += netconf_log.cc netconf_log.h
+libnetconf_la_SOURCES = netconf_log.cc netconf_log.h
nodist_libnetconf_la_SOURCES = netconf_messages.h netconf_messages.cc
kea_netconf_SOURCES = main.cc
kea_netconf_LDADD = libnetconf.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
kea_netconf_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
kea_netconf_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/util/threads/libkea-threads.la
-kea_netconf_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/util/threads/libkea-threads.la
+#kea_netconf_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
kea_netconf_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
kea_netconf_LDADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) $(BOOST_LIBS) $(SYSREPO_LIBS)
+++ /dev/null
-// Copyright (C) 2018 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
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#include <config.h>
-#include <netconf/agent.h>
-
-
-
-namespace isc {
-namespace netconf {
-
-bool NetconfAgent::run() {
-
- // We need to establish connection to the sysrepo first.
- if (!connectSysrepo()) {
- return (false);
- }
-
- // Second, we need to establish connection to Kea control socket.
- if (!connectControlSocket()) {
- return (false);
- }
-
- while (!shutdown_) {
- try {
- run_one();
- io_service_->poll();
- } catch (const std::exception& e) {
- // General catch-all exception that are not caught by more specific
- // catches. This one is for exceptions derived from std::exception.
- LOG_ERROR(netconf_logger, NETCONF_EXCEPTION)
- .arg(e.what());
- }
- }
-
- return (true);
-}
-
-bool NetconfAgent::connectSysrepo() {
- // Connect to sysrepo
-
- // Establish session
-
- // Register callbacks for event changes.
-
-
- // Once implemented, change this to true.
- return (false);
-}
-
-bool NetconfAgent::connectControlSocket() {
- // Establish connection to Kea control socket.
-
- // Once implemented, change this to true.
- return (false);
-}
-
-};
-};
+++ /dev/null
-// Copyright (C) 2018 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
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#ifndef NETCONF_AGENT_H
-#define NETCONF_AGENT_H
-
-#include <dhcpsrv/daemon.h>
-#include <asiolink/asio_wrapper.h>
-#include <asiolink/asiolink.h>
-
-namespace isc {
-namespace netconf {
-
- class NetconfAgent : public isc::dhcp::Daemon {
- public:
- NetconfAgent()
- :verbose_(false) {
-
- };
-
- bool run();
-
- void setVerbose(bool verbose) {
- verbose_ = verbose;
- }
-
-
-private:
-
- bool connectSysrepo();
-
- bool connectControlSocket();
-
- /// @brief IOService object, used for all ASIO operations.
- isc::asiolink::IOService io_service_;
-
-};
-
-};
-};
-
-
-#endif
-
#include <config.h>
-#include <netconf/agent.h>
#include <netconf/netconf_log.h>
-#include <dhcpsrv/cfgmgr.h>
#include <exceptions/exceptions.h>
+#include <dhcpsrv/daemon.h>
#include <iostream>
-int main(
+#include <sysrepo-cpp/Session.h>
- /// @brief Prints Kea Usage and exits
+using namespace std;
+using namespace isc;
+using namespace isc::netconf;
+
+/// @brief Prints Kea Usage and exits
///
/// Note: This function never returns. It terminates the process.
void
usage() {
- cerr << "Kea netconf daemon, version " << VERSION << endl;
- cerr << endl;
- cerr << "Usage: " <<
- << " -c: config-file" << endl;
- cerr << " -v: print version number and exit" << endl;
- cerr << " -V: print extended version and exit" << endl;
+ cerr << "Kea netconf daemon, version " << VERSION << endl
+ << endl
+ << "Usage: " << endl
+ << " -c: config-file" << endl
+ << " -d: debug mode (maximum verbosity)" << endl
+ << " -v: print version number and exit" << endl
+ << " -V: print extended version and exit" << endl;
exit(EXIT_FAILURE);
}
-} // end of anonymous namespace
int
main(int argc, char* argv[]) {
// The standard config file
std::string config_file("");
+ int ch;
while ((ch = getopt(argc, argv, "vVc:")) != -1) {
switch (ch) {
case 'v':
- cout << Dhcpv4Srv::getVersion(false) << endl;
+ cout << string(PACKAGE_VERSION) << endl;
return (EXIT_SUCCESS);
case 'V':
- cout << Dhcpv4Srv::getVersion(true) << endl;
+ cout << string(PACKAGE_VERSION) << endl;
+ cout << "git " << EXTENDED_VERSION << endl;
return (EXIT_SUCCESS);
case 'c': // config file
usage();
}
- //CfgMgr::instance().setFamily(AF_INET);
-
int ret = EXIT_SUCCESS;
try {
// It is important that we set a default logger name because this name
// will be used when the user doesn't provide the logging configuration
// in the Kea configuration file.
- CfgMgr::instance().setDefaultLoggerName(KEA_NETCONF_LOGGER_NAME);
+ //CfgMgr::instance().setDefaultLoggerName(KEA_NETCONF_LOGGER_NAME);
// Initialize logging. If verbose, we'll use maximum verbosity.
bool verbose_mode = true;
- Daemon::loggerInit(KEA_NETCONF_LOGGER_NAME, verbose_mode);
- LOG_INFO(netconf_logger, NETCONF_AGENT_STARTING).arg(VERSION).arg(getpid());
-
- // Create the server instance.
- NetconfAgent agent;
-
- // Remember verbose-mode
- agent.setVerbose(verbose_mode);
-
- // Create our PID file.
- //server.setProcName(DHCP4_NAME);
- //server.setConfigFile(config_file);
- //server.createPIDFile();
-
- try {
- // Initialize the server.
- server.init(config_file);
- } catch (const std::exception& ex) {
- cerr << "Failed to initialize server: " << ex.what() << endl;
- return (EXIT_FAILURE);
- }
+ isc::dhcp::Daemon::loggerInit(NETCONF_LOGGER_NAME, verbose_mode);
+ LOG_INFO(netconf_logger, NETCONF_STARTING).arg(VERSION).arg(getpid());
+ Connection conn("kea-netconf");
+
// Tell the admin we are ready to process packets
- LOG_INFO(netconf_logger, NETCONF_AGENT_STATED).arg(VERSION);
+ LOG_INFO(netconf_logger, NETCONF_STATED).arg(VERSION);
// And run the main loop of the server.
- agent.run();
+ while (true) {
+ cout << "Dummy kea-netconf running. Press ctrl-c to terminate."
+ << endl;
+ sleep(1);
+ }
LOG_INFO(netconf_logger, NETCONF_SHUTDOWN);
- } catch (const isc::exception& ex) {
+ } catch (const isc::Exception& ex) {
// First, we parint the error on stderr (that should always work)
- cerr "ERROR:" << ex.what() << endl;
-
+ cerr << "ERROR:" << ex.what() << endl;
+ ret = EXIT_FAILURE;
}
return (ret);
--- /dev/null
+// Copyright (C) 2018 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
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+/// @file netconf_log.cc
+/// Contains the loggers used by the netconf agent.
+
+#include <config.h>
+
+#include <netconf/netconf_log.h>
+
+namespace isc {
+namespace netconf {
+
+const char* NETCONF_LOGGER_NAME = "netconf";
+
+isc::log::Logger netconf_logger(NETCONF_LOGGER_NAME);
+
+} // namespace netconf
+} // namespace isc
+
--- /dev/null
+// Copyright (C) 2018 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
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+/// @file netconf_log.h
+/// Contains declarations for loggers used by the Kea netconf agent.
+
+#ifndef NETCONF_LOG_H
+#define NETCONF_LOG_H
+
+#include <log/logger_support.h>
+#include <log/macros.h>
+#include <netconf/netconf_messages.h>
+
+namespace isc {
+namespace netconf {
+
+/// @brief Defines the name of the root level (default) logger.
+extern const char* NETCONF_LOGGER_NAME;
+
+/// @brief Base logger for the netconf agent
+extern isc::log::Logger netconf_logger;
+
+} // namespace netconf
+} // namespace isc
+
+#endif // NETCONF_LOG_H
--- /dev/null
+# Copyright (C) 2012-2018 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
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+$NAMESPACE isc::netconf
+
+% NETCONF_STARTING Kea-netconf agent (version %1) is starting with process-id %2
+Describe it later.
+
+% NETCONF_STATED Kea-netconf agent (version %1) started
+Describe it later.
+
+% NETCONF_SHUTDOWN Kea-netconf agent shutting down.
+Describe it later.
+
+% NETCONF_EXCEPTION Exception encountered: %1
+Oops.