]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3729] Add netconf
authorAndrei Pavel <andrei@isc.org>
Mon, 17 Feb 2025 09:03:38 +0000 (11:03 +0200)
committerAndrei Pavel <andrei@isc.org>
Mon, 17 Feb 2025 13:35:21 +0000 (15:35 +0200)
21 files changed:
configure.ac
meson.build
src/bin/agent/tests/ca_process_tests.sh.in
src/bin/agent/tests/meson-test_basic_auth_libraries.h.in
src/bin/agent/tests/meson-test_callout_libraries.h.in
src/bin/d2/tests/d2_process_tests.sh.in
src/bin/d2/tests/meson-test_callout_libraries.h.in
src/bin/d2/tests/meson-test_configured_libraries.h.in
src/bin/dhcp6/tests/dhcp6_process_tests.sh.in
src/bin/dhcp6/tests/meson-dhcp6_process_tests.sh.in
src/bin/dhcp6/tests/meson-test_libraries.h.in
src/bin/meson.build
src/bin/netconf/control_socket.h
src/bin/netconf/meson.build
src/bin/netconf/tests/.gitignore
src/bin/netconf/tests/Makefile.am
src/bin/netconf/tests/get_config_unittest.cc
src/bin/netconf/tests/meson.build
src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc
src/bin/netconf/tests/test_data_files_config.h.in [deleted file]
src/bin/netconf/tests/test_libraries.h.in [deleted file]

index 7fde06458d915e411119e0813bb43cf83c074121..85ccc1e099377d9b25b9a491fbe5cf4f628eb877 100644 (file)
@@ -1577,8 +1577,6 @@ AC_CONFIG_FILES([src/bin/netconf/tests/Makefile])
 AC_CONFIG_FILES([src/bin/netconf/tests/shtests/Makefile])
 AC_CONFIG_FILES([src/bin/netconf/tests/shtests/netconf_tests.sh],
                 [chmod +x src/bin/netconf/tests/shtests/netconf_tests.sh])
-AC_CONFIG_FILES([src/bin/netconf/tests/test_data_files_config.h])
-AC_CONFIG_FILES([src/bin/netconf/tests/test_libraries.h])
 AC_CONFIG_FILES([src/bin/perfdhcp/Makefile])
 AC_CONFIG_FILES([src/bin/perfdhcp/tests/Makefile])
 AC_CONFIG_FILES([src/bin/perfdhcp/tests/testdata/Makefile])
index c41d4fc5dbe683046c1ff3fa1e86022481d59820..9420ba5af57825ce84bc198acb10f6a5914fb716 100644 (file)
@@ -665,3 +665,5 @@ subdir('fuzz')
 if have_premium
     subdir('premium')
 endif
+
+install_emptydir('var/run/kea')
index 23751ed86004e454e2d293134b8f36dfc5341cb2..06c84e7b69c86006ca11beef9b7bcfb905764bdd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2016-2024 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2016-2025 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
index c6f3a6720edc16638351fba00350013ece15effb..50358485080bcb429b622cf87e0ccf7945c27aa5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2020-2025 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
index f73532ed2b02c4371a4a010323ae7366a7730ae3..271a5fd540cf66383231c7bf0d04b3592fd0af2f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2025 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
index 65e321f487680d5c459b67651c79efc760cb4a94..3bd7773752d56093fb60cef63ee6c3f46cbfa285 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2014-2024 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2014-2025 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
index 5f04b3ee7dc193b7cf50139f8a0a281a08d4daf7..b6373a5a5ae57a50175f68b36cd05dfa04d5f892 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2021-2025 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
index cd2fa47fd2e56d481f6f5a8280943cbb65ec594f..d936e46d1fd5f7c8c3fec43a9780104e01e65a73 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2021-2025 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
index 28968041171e5f83fd84ef99a95cbcbb6557b2ff..820e0d11caa6fc67416d6d0b3872d521cbd10f6d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2014-2024 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2014-2025 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
index 7647850b137c656548d08f59b296fb775d24044a..87ebd1d652b517691d43e060c993f588d0014ad5 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2014-2024 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2014-2025 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
index 15206e01df85e760d3b8c4e1c99a2f847f87f8d7..e17ab8a2d2dd2cc1920e7c934f396a40e3bae944 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2025 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
index 989056a45c1d5277689041937b222348c4ae6bec..094c3c6f97b1cd3036d9f3a4da42f4cc1deae674 100644 (file)
@@ -7,4 +7,4 @@ subdir('admin')
 subdir('keactrl')
 subdir('perfdhcp')
 subdir('shell')
-subdir('netconf')
+subdir('netconf')
index 10bcafcc40acd3dfd961b7cb4d6c663f8f331ddb..d201bf200bb107ffaaf7b57c4b4361e310ee82f7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2025 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
@@ -111,7 +111,8 @@ using ControlSocketBasePtr = std::shared_ptr<ControlSocketBase>;
 /// @param ctrl_sock The control socket configuration.
 /// @return A pointer to a control socket communication object.
 /// @throw NotImplemented if no specialization was called.
-template <CfgControlSocket::Type TYPE> ControlSocketBasePtr
+template <CfgControlSocket::Type TYPE>
+ControlSocketBasePtr
 createControlSocket(CfgControlSocketPtr ctrl_sock) {
     isc_throw(NotImplemented, "not specialized createControlSocket");
 }
index 8aae12c5576661084f960c2cbda3ee2aee0aeacf..8df690567c7db4d1fa5c77e93918251635f7334a 100644 (file)
@@ -3,6 +3,7 @@ if not NETCONF_DEPS_FOUND
 endif
 
 netconf_lib = static_library(
+    'netconf',
     'control_socket.cc',
     'http_control_socket.cc',
     'netconf.cc',
@@ -18,16 +19,21 @@ netconf_lib = static_library(
     'simple_parser.cc',
     'stdout_control_socket.cc',
     'unix_control_socket.cc',
+    dependencies: NETCONF_DEPS_ARRAY + [crypto],
     include_directories: [include_directories('.')] + INCLUDES,
+    link_with: [kea_yang_testutils_lib, kea_process_testutils_lib] + LIBS_BUILT_SO_FAR,
     override_options: ['cpp_std=c++20'],
 )
 
 executable(
     'kea-netconf',
     'main.cc',
+    dependencies: NETCONF_DEPS_ARRAY + [crypto],
     include_directories: [include_directories('.')] + INCLUDES,
     install: true,
     install_dir: 'sbin',
     link_with: [netconf_lib] + LIBS_BUILT_SO_FAR,
     override_options: ['cpp_std=c++20'],
 )
+
+subdir('tests')
index c1442d24aaee1cbcf57896c6a5e8b39b45588d29..64baea4bd3a42412c33818dc6ece39efaeccbc28 100644 (file)
@@ -1,4 +1,2 @@
 /netconf_tests.sh
 netconf_unittests
-test_data_files_config.h
-test_libraries.h
index 41e394c08f17a8ca38e05f2d6255cfc36dd298c1..f6b97b53e5479ea4ba3ebe681610a94395668cda 100644 (file)
@@ -9,7 +9,9 @@ AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
 AM_CPPFLAGS += -DCFG_EXAMPLES=\"$(abs_top_srcdir)/doc/examples/netconf\"
 AM_CPPFLAGS += -DKEATEST_MODULE
 AM_CPPFLAGS += -DSYNTAX_FILE=\"$(abs_srcdir)/../netconf_parser.yy\"
+AM_CPPFLAGS += -DTEST_DATA_SOURCEDIR=\"$(abs_top_srcdir)/src/bin/netconf/tests\"
 AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/bin/netconf/tests\"
+AM_CPPFLAGS += -DBASIC_CALLOUT_LIBRARY=\"$(abs_top_builddir)/src/bin/netconf/tests/.libs/libbasic.so\"
 AM_CPPFLAGS += $(BOOST_INCLUDES) $(CRYPTO_CFLAGS) $(CRYPTO_INCLUDES)
 AM_CPPFLAGS += $(LIBYANG_CPPFLAGS)
 AM_CPPFLAGS += $(LIBYANG_INCLUDEDIR)
@@ -22,8 +24,6 @@ AM_CPPFLAGS += $(SYSREPOCPP_INCLUDEDIR)
 
 CLEANFILES = *.json *.log
 
-DISTCLEANFILES = test_data_files_config.h test_libraries.h
-
 AM_CXXFLAGS = $(KEA_CXXFLAGS)
 
 if USE_STATIC_LINK
@@ -86,7 +86,6 @@ libbasic_la_LIBADD  += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 libbasic_la_LIBADD  += $(top_builddir)/src/lib/log/libkea-log.la
 libbasic_la_LDFLAGS  = -avoid-version -export-dynamic -module -rpath /nowhere
 
-nodist_netconf_unittests_SOURCES = test_data_files_config.h test_libraries.h
 endif
 
 noinst_EXTRA_DIST = configs-list.txt
index 98dc57a524324b259ecdc0007f527296efd47835..06462e416729c126ae2f0f03bc67aa82e7dfb855 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2025 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
@@ -20,9 +20,6 @@
 
 #include <gtest/gtest.h>
 
-#include "test_data_files_config.h"
-#include "test_libraries.h"
-
 using namespace isc::netconf;
 using namespace isc::config;
 using namespace isc::data;
@@ -235,8 +232,7 @@ TEST_F(NetconfGetCfgTest, simple) {
     ASSERT_NO_THROW_LOG(config = readFile(simple_file));
 
     // get the expected configuration
-    string expected_file =
-        string(NETCONF_TEST_DATA_DIR) + "/" + "get_config.json";
+    string const expected_file(string(TEST_DATA_SOURCEDIR) + "/testdata/get_config.json");
     string expected;
     ASSERT_NO_THROW_LOG(expected = readFile(expected_file));
 
index f02ea77f1307a3a8a738852628fc8363ecc30659..30dbbde55c855f999d374770d787c82907a9eebd 100644 (file)
@@ -2,6 +2,9 @@ if not gtest.found() or not NETCONF_DEPS_FOUND
     subdir_done()
 endif
 
+current_build_dir = meson.current_build_dir()
+current_source_dir = meson.current_source_dir()
+
 kea_netconf_tests = executable(
     'kea-netconf-tests',
     'basic_library.cc',
@@ -13,9 +16,31 @@ kea_netconf_tests = executable(
     'netconf_unittests.cc',
     'parser_unittests.cc',
     'run_unittests.cc',
-    dependencies: NETCONF_DEPS_ARRAY + [gtest],
+    cpp_args: [
+        f'-DBASIC_CALLOUT_LIBRARY="@current_build_dir@/libbasic.so"',
+        f'-DCFG_EXAMPLES="@TOP_SOURCE_DIR@/doc/examples/netconf"',
+        '-DKEATEST_MODULE',
+        f'-DSYNTAX_FILE="@current_source_dir@/../netconf_parser.yy"',
+        f'-DTEST_DATA_SOURCEDIR="@current_source_dir@"',
+        f'-DTEST_DATA_BUILDDIR="@current_build_dir@"',
+    ],
+    dependencies: NETCONF_DEPS_ARRAY + [gtest, crypto],
     include_directories: [include_directories('.')] + INCLUDES,
-    link_with: [kea_yang_tests_lib] + LIBS_BUILT_SO_FAR,
+    link_with: [
+        netconf_lib,
+        kea_yang_testutils_lib,
+        kea_process_testutils_lib,
+        kea_testutils_lib,
+    ] + LIBS_BUILT_SO_FAR,
     override_options: ['cpp_std=c++20'],
 )
 test('kea-netconf-tests', kea_netconf_tests, protocol: 'gtest')
+
+shared_library(
+    'basic',
+    'basic_library.cc',
+    include_directories: [include_directories('.')] + INCLUDES,
+    link_with: LIBS_BUILT_SO_FAR,
+    build_rpath: '/nowhere',
+    name_suffix: 'so',
+)
index 20fdd9fb2a6e94f5cf8857d0084a4db3a43eabe1..17b390f5d73a51579961ec0fb250ad13c59badcd 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2025 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
@@ -10,7 +10,6 @@
 #include <exceptions/exceptions.h>
 #include <netconf/netconf_cfg_mgr.h>
 #include <netconf/parser_context.h>
-#include <netconf/tests/test_libraries.h>
 #include <process/d_cfg_mgr.h>
 #include <process/testutils/d_test_stubs.h>
 #include <testutils/gtest_utils.h>
diff --git a/src/bin/netconf/tests/test_data_files_config.h.in b/src/bin/netconf/tests/test_data_files_config.h.in
deleted file mode 100644 (file)
index 78f5c60..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// 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/.
-
-/// @brief Path to netconf source dir
-#define NETCONF_SRC_DIR "@abs_top_srcdir@/src/bin/netconf"
-#define NETCONF_TEST_DATA_DIR "@abs_top_srcdir@/src/bin/netconf/tests/testdata"
diff --git a/src/bin/netconf/tests/test_libraries.h.in b/src/bin/netconf/tests/test_libraries.h.in
deleted file mode 100644 (file)
index 2bf269a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2018-2022 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 AGENT_TEST_LIBRARIES_H
-#define AGENT_TEST_LIBRARIES_H
-
-#include <config.h>
-
-namespace {
-
-// Names of the libraries used in these tests.  These libraries are built using
-// libtool, so we need to look in the hidden ".libs" directory to locate the
-// .so file.  Note that we access the .so file - libtool creates this as a
-// like to the real shared library.
-
-// Basic library with context_create and three "standard" callouts.
-static const char* BASIC_CALLOUT_LIBRARY = "@abs_builddir@/.libs/libbasic.so";
-
-}  // anonymous namespace
-
-#endif  // TEST_LIBRARIES_H