Browse Source

[2594] Moved d2Srv to d2, removed "Srv" and "srv" from file names
and source. Corrected other review items.

Thomas Markwalder 12 years ago
parent
commit
3938742718

+ 3 - 3
configure.ac

@@ -1201,8 +1201,8 @@ AC_CONFIG_FILES([Makefile
                  src/bin/dhcp6/tests/Makefile
                  src/bin/dhcp4/Makefile
                  src/bin/dhcp4/tests/Makefile
-                 src/bin/d2srv/Makefile
-                 src/bin/d2srv/tests/Makefile
+                 src/bin/d2/Makefile
+                 src/bin/d2/tests/Makefile
                  src/bin/resolver/Makefile
                  src/bin/resolver/tests/Makefile
                  src/bin/resolver/bench/Makefile
@@ -1381,7 +1381,7 @@ AC_OUTPUT([doc/version.ent
            src/bin/auth/gen-statisticsitems.py.pre
            src/bin/dhcp4/spec_config.h.pre
            src/bin/dhcp6/spec_config.h.pre
-           src/bin/d2srv/spec_config.h.pre
+           src/bin/d2/spec_config.h.pre
            src/bin/tests/process_rename_test.py
            src/lib/config/tests/data_def_unittests_config.h
            src/lib/python/isc/config/tests/config_test

+ 1 - 1
src/bin/Makefile.am

@@ -1,5 +1,5 @@
 SUBDIRS = bind10 bindctl cfgmgr ddns loadzone msgq cmdctl auth xfrin \
-	xfrout usermgr zonemgr stats tests resolver sockcreator dhcp4 dhcp6 d2srv\
+	xfrout usermgr zonemgr stats tests resolver sockcreator dhcp4 dhcp6 d2\
 	dbutil sysinfo
 
 check-recursive: all-recursive

+ 15 - 22
src/bin/d2srv/Makefile.am

@@ -18,15 +18,15 @@ pkglibexecdir = $(libexecdir)/@PACKAGE@
 
 CLEANFILES  = *.gcno *.gcda spec_config.h d2_srv_messages.h d2_srv_messages.cc
 
-man_MANS = b10-d2srv.8
+man_MANS = b10-d2.8
 DISTCLEANFILES = $(man_MANS)
-EXTRA_DIST = $(man_MANS) b10-d2srv.xml d2srv.spec
+EXTRA_DIST = $(man_MANS) b10-d2.xml d2.spec
 
 if GENERATE_DOCS
-b10-d2srv.8: b10-d2srv.xml
+b10-d2.8: b10-d2.xml
 	@XSLTPROC@ --novalid --xinclude --nonet -o $@ \
         http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \
-	$(srcdir)/b10-d2srv.xml
+	$(srcdir)/b10-d2.xml
 
 else
 
@@ -39,27 +39,20 @@ endif
 spec_config.h: spec_config.h.pre
 	$(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" spec_config.h.pre >$@
 
-d2srv_messages.h d2srv_messages.cc: d2srv_messages.mes
-	$(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/bin/d2srv/d2srv_messages.mes
+d2_messages.h d2_messages.cc: d2_messages.mes
+	$(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/bin/d2/d2_messages.mes
 
-BUILT_SOURCES = spec_config.h d2srv_messages.h d2srv_messages.cc
+BUILT_SOURCES = spec_config.h d2_messages.h d2_messages.cc
 
-pkglibexec_PROGRAMS = b10-d2srv
+pkglibexec_PROGRAMS = b10-d2
 
-b10_d2srv_SOURCES  = main.cc
-b10_d2srv_SOURCES += d2srv_log.cc d2srv_log.h
+b10_d2_SOURCES  = main.cc
+b10_d2_SOURCES += d2_log.cc d2_log.h
 
-nodist_b10_d2srv_SOURCES = d2srv_messages.h d2srv_messages.cc
-EXTRA_DIST += d2srv_messages.mes
+nodist_b10_d2_SOURCES = d2_messages.h d2_messages.cc
+EXTRA_DIST += d2_messages.mes
 
-b10_d2srv_LDADD  = $(top_builddir)/src/lib/dhcp/libb10-dhcp++.la
-b10_d2srv_LDADD += $(top_builddir)/src/lib/util/libb10-util.la
-b10_d2srv_LDADD += $(top_builddir)/src/lib/dhcpsrv/libb10-dhcpsrv.la
-b10_d2srv_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
-b10_d2srv_LDADD += $(top_builddir)/src/lib/asiolink/libb10-asiolink.la
-b10_d2srv_LDADD += $(top_builddir)/src/lib/log/libb10-log.la
-b10_d2srv_LDADD += $(top_builddir)/src/lib/config/libb10-cfgclient.la
-b10_d2srv_LDADD += $(top_builddir)/src/lib/cc/libb10-cc.la
+b10_d2_LDADD = $(top_builddir)/src/lib/log/libb10-log.la
 
-b10_d2srvdir = $(pkgdatadir)
-b10_d2srv_DATA = d2srv.spec
+b10_d2dir = $(pkgdatadir)
+b10_d2_DATA = d2.spec

+ 12 - 12
src/bin/d2srv/b10-d2srv.xml

@@ -2,7 +2,7 @@
                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
 	       [<!ENTITY mdash "&#8212;">]>
 <!--
- - Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
+ - Copyright (C) 2013  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
@@ -20,30 +20,30 @@
 <refentry>
 
   <refentryinfo>
-    <date>October 27, 2011</date>
+    <date>May 15, 2013</date>
   </refentryinfo>
 
   <refmeta>
-    <refentrytitle>b10-d2srv</refentrytitle>
+    <refentrytitle>b10-d2</refentrytitle>
     <manvolnum>8</manvolnum>
     <refmiscinfo>BIND10</refmiscinfo>
   </refmeta>
 
   <refnamediv>
-    <refname>b10-d2srv</refname>
-    <refpurpose>DHCPv4 server in BIND 10 architecture</refpurpose>
+    <refname>b10-d2</refname>
+    <refpurpose>D2 process in BIND 10 architecture</refpurpose>
   </refnamediv>
 
   <docinfo>
     <copyright>
-      <year>2011</year>
+      <year>2013</year>
       <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
     </copyright>
   </docinfo>
 
   <refsynopsisdiv>
     <cmdsynopsis>
-      <command>b10-d2srv</command>
+      <command>b10-d2</command>
       <arg><option>-v</option></arg>
     </cmdsynopsis>
   </refsynopsisdiv>
@@ -51,8 +51,8 @@
   <refsect1>
     <title>DESCRIPTION</title>
     <para>
-      The <command>b10-d2srv</command> daemon will provide the
-       D2 server implementation when it becomes functional.
+      The <command>b10-d2</command> daemon processes requests to
+      to update DNS mapping based on DHCP lease change events.
     </para>
 
   </refsect1>
@@ -79,7 +79,7 @@
     <title>SEE ALSO</title>
     <para>
       <citerefentry>
-        <refentrytitle>b10-init</refentrytitle><manvolnum>8</manvolnum>
+        <refentrytitle>b10-d2</refentrytitle><manvolnum>8</manvolnum>
       </citerefentry>,
       <citerefentry>
         <refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum>
@@ -90,8 +90,8 @@
   <refsect1>
     <title>HISTORY</title>
     <para>
-      The <command>b10-d2srv</command> daemon was first coded in
-      November 2013 by Thomas Markwalder
+      The <command>b10-d2</command> process was first coded in
+      May 2013 by the ISC Kea/Dhcp team.
     </para>
   </refsect1>
 </refentry><!--

+ 3 - 3
src/bin/d2srv/d2srv.spec

@@ -1,13 +1,13 @@
 {
   "module_spec": {
-    "module_name": "D2Srv",
-    "module_description": "DHCP-DDNS server daemon",
+    "module_name": "D2",
+    "module_description": "DHCP-DDNS process",
     "config_data": [
     ],
     "commands": [
         {
             "command_name": "shutdown",
-            "command_description": "Shuts down D2Srv server.",
+            "command_description": "Shuts down the D2 process.",
             "command_args": [
                 {
                     "item_name": "pid",

+ 5 - 5
src/bin/d2srv/d2srv_log.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013  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
@@ -14,13 +14,13 @@
 
 /// Defines the logger used by the top-level component of b10-dhcp4.
 
-#include <d2srv/d2srv_log.h>
+#include <d2/d2_log.h>
 
 namespace isc {
-namespace d2srv {
+namespace d2 {
 
-isc::log::Logger d2srv_logger("d2srv");
+isc::log::Logger d2_logger("d2");
 
-} // namespace d2srv
+} // namespace d2
 } // namespace isc
 

+ 8 - 8
src/bin/d2srv/d2srv_log.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013  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
@@ -12,23 +12,23 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-#ifndef D2SRV_LOG_H
-#define D2SRV_LOG_H
+#ifndef D2_LOG_H
+#define D2_LOG_H
 
 #include <log/logger_support.h>
 #include <log/macros.h>
-#include <d2srv/d2srv_messages.h>
+#include <d2/d2_messages.h>
 
 namespace isc {
-namespace d2srv {
+namespace d2 {
 
 /// Define the logger for the "dhcp4" module part of b10-dhcp4.  We could define
 /// a logger in each file, but we would want to define a common name to avoid
 /// spelling mistakes, so it is just one small step from there to define a
 /// module-common logger.
-extern isc::log::Logger d2srv_logger;
+extern isc::log::Logger d2_logger;
 
-} // namespace d2srv
+} // namespace d2
 } // namespace isc
 
-#endif // D2SRV_LOG_H
+#endif // D2_LOG_H

+ 10 - 10
src/bin/d2srv/d2srv_messages.mes

@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2013  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2013  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
@@ -12,17 +12,17 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-$NAMESPACE isc::d2srv
+$NAMESPACE isc::d2
 
-% D2SRV_STARTING : server starting
-This is a debug message issued during a DController server startup.
+% D2_STARTING : process starting
+This is a debug message issued during a D2 process startup.
 
-% D2SRV_START_INFO pid: %1, verbose: %2, standalone: %3
-This is a debug message issued during the DController server startup.
-It lists some information about the parameters with which the server
-is running.
+% D2_START_INFO pid: %1, verbose: %2, standalone: %3
+This is a debug message issued during the D2 process startup.
+It lists some information about the parameters with which the 
+process is running.
 
-% D2SRV_SHUTDOWN : server is performing a normal shutting down
-This is a debug message issued when a D2Server shuts down 
+% D2_SHUTDOWN : process is performing a normal shutting down
+This is a debug message issued when a D2 process shuts down 
 normally in response to command to stop.
 

+ 21 - 13
src/bin/d2srv/main.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2012  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013  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
@@ -13,31 +13,31 @@
 // PERFORMANCE OF THIS SOFTWARE.
 
 #include <config.h>
-#include <d2srv/d2srv_log.h>
+#include <d2/d2_log.h>
 #include <log/logger_support.h>
 #include <log/logger_manager.h>
 
 #include <iostream>
 
-using namespace isc::d2srv;
+using namespace isc::d2;
 using namespace std;
 
 /// This file contains entry point (main() function) for standard DHCP-DDNS 
-///  server, b10-d2srv, component for BIND10 framework. It parses command-line 
+/// process, b10-d2, component for BIND10 framework. It parses command-line 
 /// arguments and instantiates D2Controller class that is responsible for 
 /// establishing connection with msgq (receiving commands and configuration) 
 /// and also creating D2Server object as well.
 ///
 /// For detailed explanation or relations between main(), D2Controller,
-/// D2Server and other classes, see \ref d2srvSession. 
+/// D2Server and other classes, see \ref d2Session. 
 
 namespace {
 
-const char* const D2SRV_NAME = "b10-d2srv";
+const char* const D2_NAME = "b10-d2";
 
 void
 usage() {
-    cerr << "Usage: " << D2SRV_NAME << " [-v] [-s] [-p number]" << endl;
+    cerr << "Usage: " << D2_NAME << " [-v] [-s]" << endl;
     cerr << "  -v: verbose output" << endl;
     cerr << "  -s: stand-alone mode (don't connect to BIND10)" << endl;
     exit(EXIT_FAILURE);
@@ -47,6 +47,12 @@ usage() {
 int
 main(int argc, char* argv[]) {
     int ch;
+
+    // NOTE these parameters are preliminary only. They are here to
+    // for symmetry with the DHCP servers.  They may or may not
+    // become part of the eventual implementation.
+
+
     bool stand_alone = false;  // Should be connect to BIND10 msgq?
     bool verbose_mode = false; // Should server be verbose?
 
@@ -72,18 +78,20 @@ main(int argc, char* argv[]) {
 
     // Initialize logging.  If verbose, we'll use maximum verbosity.
     // If standalone is enabled, do not buffer initial log messages
-    isc::log::initLogger(D2SRV_NAME,
+    isc::log::initLogger(D2_NAME,
                          (verbose_mode ? isc::log::DEBUG : isc::log::INFO),
                          isc::log::MAX_DEBUG_LEVEL, NULL, !stand_alone);
-    LOG_INFO(d2srv_logger, D2SRV_STARTING);
-    LOG_DEBUG(d2srv_logger, DBGLVL_START_SHUT, D2SRV_START_INFO)
+    LOG_INFO(d2_logger, D2_STARTING);
+    LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, D2_START_INFO)
               .arg(getpid()).arg(verbose_mode ? "yes" : "no")
               .arg(stand_alone ? "yes" : "no" );
 
 
-    int ret = EXIT_SUCCESS;
+    // For now we will sleep awhile to simulate doing something. 
+    // Without at least a sleep, the process will start, exit and be
+    // restarted by Bind10/Init endlessley in a rapid succession.
     sleep(1000);
-    LOG_INFO(d2srv_logger, D2SRV_SHUTDOWN);
-    return (ret);
+    LOG_INFO(d2_logger, D2_SHUTDOWN);
+    return (EXIT_SUCCESS);
 }
 

+ 2 - 2
src/bin/d2srv/spec_config.h.pre.in

@@ -1,4 +1,4 @@
-// Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013  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
@@ -12,4 +12,4 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-#define DHCP4_SPECFILE_LOCATION "@prefix@/share/@PACKAGE@/dhcp4.spec"
+#define D2_SPECFILE_LOCATION "@prefix@/share/@PACKAGE@/d2.spec"

+ 17 - 17
src/bin/d2srv/tests/Makefile.am

@@ -1,6 +1,6 @@
 PYCOVERAGE_RUN = @PYCOVERAGE_RUN@
 
-PYTESTS = d2srv_test.py
+PYTESTS = d2_test.py
 EXTRA_DIST = $(PYTESTS)
 
 # Explicitly specify paths to dynamic libraries required by loadable python
@@ -28,7 +28,7 @@ AM_CPPFLAGS += -I$(top_builddir)/src/lib/cc
 AM_CPPFLAGS += -I$(top_srcdir)/src/lib/asiolink
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(abs_top_srcdir)/src/lib/testutils/testdata\"
-AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/bin/d2srv/tests\"
+AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/bin/d2/tests\"
 AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
 
 CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile
@@ -49,23 +49,23 @@ TESTS_ENVIRONMENT = \
 TESTS =
 if HAVE_GTEST
 
-TESTS += d2srv_unittests
+TESTS += d2_unittests
 
-d2srv_unittests_SOURCES = ../d2srv_log.h ../d2srv_log.cc
-d2srv_unittests_SOURCES += d2srv_unittests.cc
-nodist_d2srv_unittests_SOURCES = ../d2srv_messages.h ../d2srv_messages.cc
+d2_unittests_SOURCES = ../d2_log.h ../d2_log.cc
+d2_unittests_SOURCES += d2_unittests.cc
+nodist_d2_unittests_SOURCES = ../d2_messages.h ../d2_messages.cc
 
-d2srv_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
-d2srv_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
-d2srv_unittests_LDADD = $(GTEST_LDADD)
-d2srv_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libb10-asiolink.la
-d2srv_unittests_LDADD += $(top_builddir)/src/lib/cc/libb10-cc.la
-d2srv_unittests_LDADD += $(top_builddir)/src/lib/config/libb10-cfgclient.la
-d2srv_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libb10-dhcp++.la
-d2srv_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libb10-dhcpsrv.la
-d2srv_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
-d2srv_unittests_LDADD += $(top_builddir)/src/lib/log/libb10-log.la
-d2srv_unittests_LDADD += $(top_builddir)/src/lib/util/libb10-util.la
+d2_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
+d2_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
+d2_unittests_LDADD = $(GTEST_LDADD)
+d2_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libb10-asiolink.la
+d2_unittests_LDADD += $(top_builddir)/src/lib/cc/libb10-cc.la
+d2_unittests_LDADD += $(top_builddir)/src/lib/config/libb10-cfgclient.la
+d2_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libb10-dhcp++.la
+d2_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libb10-dhcpsrv.la
+d2_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
+d2_unittests_LDADD += $(top_builddir)/src/lib/log/libb10-log.la
+d2_unittests_LDADD += $(top_builddir)/src/lib/util/libb10-util.la
 endif
 
 noinst_PROGRAMS = $(TESTS)

+ 8 - 9
src/bin/d2srv/tests/d2srv_test.py

@@ -1,4 +1,4 @@
-# Copyright (C) 2012 Internet Systems Consortium.
+# Copyright (C) 2013 Internet Systems Consortium.
 #
 # Permission to use, copy, modify, and distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -25,7 +25,7 @@ import time
 import isc
 import fcntl
 
-class TestD2srvDaemon(unittest.TestCase):
+class TestD2Daemon(unittest.TestCase):
     def setUp(self):
         # Don't redirect stdout/stderr here as we want to print out things
         # during the test
@@ -156,13 +156,12 @@ class TestD2srvDaemon(unittest.TestCase):
         return (rc, output, error)
 
     def test_alive(self):
-        print("Note: Purpose of some of the tests is to check if D2 server can be started,")
-        print("      not that is can bind sockets correctly. Please ignore binding errors.")
-        print("THIS TEST IS A PLACE HOLDER DURING INITIAL D2 SERVER WORK - IT ALWAYS PASSES")
-
-        #(returncode, output, error) = self.runCommand(["../b10-d2srv", "-v"])
-        #output_text = str(output) + str(error)
-        #self.assertEqual(output_text.count("D2SRV_STARTING"), 1)
+        print("Note: Simple test to verify that D2 server can be started.")
+        # note that "-s" for stand alone is necessary in order to flush the log output
+        # soon enough to catch it.
+        (returncode, output, error) = self.runCommand(["../b10-d2", "-s"])
+        output_text = str(output) + str(error)
+        self.assertEqual(output_text.count("D2_STARTING"), 1)
 
 if __name__ == '__main__':
     unittest.main()

+ 2 - 2
src/bin/d2srv/tests/d2srv_unittests.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013 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
@@ -13,7 +13,7 @@
 // PERFORMANCE OF THIS SOFTWARE.
 
 #include <log/logger_support.h>
-#include <d2srv/d2srv_log.h>
+#include <d2/d2_log.h>
 #include <gtest/gtest.h>
 
 int

File diff suppressed because it is too large
+ 210 - 0
src/bin/d2/tests/d2srv_unittests