Skip to content

Commit bf3d5aa

Browse files
committed
[#3729] Add netconf
1 parent 694a04f commit bf3d5aa

21 files changed

+53
-62
lines changed

configure.ac

-2
Original file line numberDiff line numberDiff line change
@@ -1577,8 +1577,6 @@ AC_CONFIG_FILES([src/bin/netconf/tests/Makefile])
15771577
AC_CONFIG_FILES([src/bin/netconf/tests/shtests/Makefile])
15781578
AC_CONFIG_FILES([src/bin/netconf/tests/shtests/netconf_tests.sh],
15791579
[chmod +x src/bin/netconf/tests/shtests/netconf_tests.sh])
1580-
AC_CONFIG_FILES([src/bin/netconf/tests/test_data_files_config.h])
1581-
AC_CONFIG_FILES([src/bin/netconf/tests/test_libraries.h])
15821580
AC_CONFIG_FILES([src/bin/perfdhcp/Makefile])
15831581
AC_CONFIG_FILES([src/bin/perfdhcp/tests/Makefile])
15841582
AC_CONFIG_FILES([src/bin/perfdhcp/tests/testdata/Makefile])

meson.build

+2
Original file line numberDiff line numberDiff line change
@@ -665,3 +665,5 @@ subdir('fuzz')
665665
if have_premium
666666
subdir('premium')
667667
endif
668+
669+
install_emptydir('var/run/kea')

src/bin/agent/tests/ca_process_tests.sh.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
# Copyright (C) 2016-2024 Internet Systems Consortium, Inc. ("ISC")
3+
# Copyright (C) 2016-2025 Internet Systems Consortium, Inc. ("ISC")
44
#
55
# This Source Code Form is subject to the terms of the Mozilla Public
66
# License, v. 2.0. If a copy of the MPL was not distributed with this

src/bin/agent/tests/meson-test_basic_auth_libraries.h.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2020 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2020-2025 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this

src/bin/agent/tests/meson-test_callout_libraries.h.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2017-2025 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this

src/bin/d2/tests/d2_process_tests.sh.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
# Copyright (C) 2014-2024 Internet Systems Consortium, Inc. ("ISC")
3+
# Copyright (C) 2014-2025 Internet Systems Consortium, Inc. ("ISC")
44
#
55
# This Source Code Form is subject to the terms of the Mozilla Public
66
# License, v. 2.0. If a copy of the MPL was not distributed with this

src/bin/d2/tests/meson-test_callout_libraries.h.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2021-2025 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this

src/bin/d2/tests/meson-test_configured_libraries.h.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2021-2025 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this

src/bin/dhcp6/tests/dhcp6_process_tests.sh.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
# Copyright (C) 2014-2024 Internet Systems Consortium, Inc. ("ISC")
3+
# Copyright (C) 2014-2025 Internet Systems Consortium, Inc. ("ISC")
44
#
55
# This Source Code Form is subject to the terms of the Mozilla Public
66
# License, v. 2.0. If a copy of the MPL was not distributed with this

src/bin/dhcp6/tests/meson-dhcp6_process_tests.sh.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
# Copyright (C) 2014-2024 Internet Systems Consortium, Inc. ("ISC")
3+
# Copyright (C) 2014-2025 Internet Systems Consortium, Inc. ("ISC")
44
#
55
# This Source Code Form is subject to the terms of the Mozilla Public
66
# License, v. 2.0. If a copy of the MPL was not distributed with this

src/bin/dhcp6/tests/meson-test_libraries.h.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2013-2024 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2013-2025 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this

src/bin/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ subdir('admin')
77
subdir('keactrl')
88
subdir('perfdhcp')
99
subdir('shell')
10-
# subdir('netconf')
10+
subdir('netconf')

src/bin/netconf/control_socket.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2018-2025 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// 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>;
111111
/// @param ctrl_sock The control socket configuration.
112112
/// @return A pointer to a control socket communication object.
113113
/// @throw NotImplemented if no specialization was called.
114-
template <CfgControlSocket::Type TYPE> ControlSocketBasePtr
114+
template <CfgControlSocket::Type TYPE>
115+
ControlSocketBasePtr
115116
createControlSocket(CfgControlSocketPtr ctrl_sock) {
116117
isc_throw(NotImplemented, "not specialized createControlSocket");
117118
}

src/bin/netconf/meson.build

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ if not NETCONF_DEPS_FOUND
33
endif
44

55
netconf_lib = static_library(
6+
'netconf',
67
'control_socket.cc',
78
'http_control_socket.cc',
89
'netconf.cc',
@@ -18,16 +19,21 @@ netconf_lib = static_library(
1819
'simple_parser.cc',
1920
'stdout_control_socket.cc',
2021
'unix_control_socket.cc',
22+
dependencies: NETCONF_DEPS_ARRAY + [crypto],
2123
include_directories: [include_directories('.')] + INCLUDES,
24+
link_with: [kea_yang_testutils_lib, kea_process_testutils_lib] + LIBS_BUILT_SO_FAR,
2225
override_options: ['cpp_std=c++20'],
2326
)
2427

2528
executable(
2629
'kea-netconf',
2730
'main.cc',
31+
dependencies: NETCONF_DEPS_ARRAY + [crypto],
2832
include_directories: [include_directories('.')] + INCLUDES,
2933
install: true,
3034
install_dir: 'sbin',
3135
link_with: [netconf_lib] + LIBS_BUILT_SO_FAR,
3236
override_options: ['cpp_std=c++20'],
3337
)
38+
39+
subdir('tests')

src/bin/netconf/tests/.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
/netconf_tests.sh
22
netconf_unittests
3-
test_data_files_config.h
4-
test_libraries.h

src/bin/netconf/tests/Makefile.am

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
99
AM_CPPFLAGS += -DCFG_EXAMPLES=\"$(abs_top_srcdir)/doc/examples/netconf\"
1010
AM_CPPFLAGS += -DKEATEST_MODULE
1111
AM_CPPFLAGS += -DSYNTAX_FILE=\"$(abs_srcdir)/../netconf_parser.yy\"
12+
AM_CPPFLAGS += -DTEST_DATA_SOURCEDIR=\"$(abs_top_srcdir)/src/bin/netconf/tests\"
1213
AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/bin/netconf/tests\"
14+
AM_CPPFLAGS += -DBASIC_CALLOUT_LIBRARY=\"$(abs_top_builddir)/src/bin/netconf/tests/.libs/libbasic.so\"
1315
AM_CPPFLAGS += $(BOOST_INCLUDES) $(CRYPTO_CFLAGS) $(CRYPTO_INCLUDES)
1416
AM_CPPFLAGS += $(LIBYANG_CPPFLAGS)
1517
AM_CPPFLAGS += $(LIBYANG_INCLUDEDIR)
@@ -22,8 +24,6 @@ AM_CPPFLAGS += $(SYSREPOCPP_INCLUDEDIR)
2224

2325
CLEANFILES = *.json *.log
2426

25-
DISTCLEANFILES = test_data_files_config.h test_libraries.h
26-
2727
AM_CXXFLAGS = $(KEA_CXXFLAGS)
2828

2929
if USE_STATIC_LINK
@@ -86,7 +86,6 @@ libbasic_la_LIBADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
8686
libbasic_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
8787
libbasic_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
8888

89-
nodist_netconf_unittests_SOURCES = test_data_files_config.h test_libraries.h
9089
endif
9190

9291
noinst_EXTRA_DIST = configs-list.txt

src/bin/netconf/tests/get_config_unittest.cc

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2018-2025 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -20,9 +20,6 @@
2020

2121
#include <gtest/gtest.h>
2222

23-
#include "test_data_files_config.h"
24-
#include "test_libraries.h"
25-
2623
using namespace isc::netconf;
2724
using namespace isc::config;
2825
using namespace isc::data;
@@ -235,8 +232,7 @@ TEST_F(NetconfGetCfgTest, simple) {
235232
ASSERT_NO_THROW_LOG(config = readFile(simple_file));
236233

237234
// get the expected configuration
238-
string expected_file =
239-
string(NETCONF_TEST_DATA_DIR) + "/" + "get_config.json";
235+
string const expected_file(string(TEST_DATA_SOURCEDIR) + "/testdata/get_config.json");
240236
string expected;
241237
ASSERT_NO_THROW_LOG(expected = readFile(expected_file));
242238

src/bin/netconf/tests/meson.build

+27-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ if not gtest.found() or not NETCONF_DEPS_FOUND
22
subdir_done()
33
endif
44

5+
current_build_dir = meson.current_build_dir()
6+
current_source_dir = meson.current_source_dir()
7+
58
kea_netconf_tests = executable(
69
'kea-netconf-tests',
710
'basic_library.cc',
@@ -13,9 +16,31 @@ kea_netconf_tests = executable(
1316
'netconf_unittests.cc',
1417
'parser_unittests.cc',
1518
'run_unittests.cc',
16-
dependencies: NETCONF_DEPS_ARRAY + [gtest],
19+
cpp_args: [
20+
f'-DBASIC_CALLOUT_LIBRARY="@current_build_dir@/libbasic.so"',
21+
f'-DCFG_EXAMPLES="@TOP_SOURCE_DIR@/doc/examples/netconf"',
22+
'-DKEATEST_MODULE',
23+
f'-DSYNTAX_FILE="@current_source_dir@/../netconf_parser.yy"',
24+
f'-DTEST_DATA_SOURCEDIR="@current_source_dir@"',
25+
f'-DTEST_DATA_BUILDDIR="@current_build_dir@"',
26+
],
27+
dependencies: NETCONF_DEPS_ARRAY + [gtest, crypto],
1728
include_directories: [include_directories('.')] + INCLUDES,
18-
link_with: [kea_yang_tests_lib] + LIBS_BUILT_SO_FAR,
29+
link_with: [
30+
netconf_lib,
31+
kea_yang_testutils_lib,
32+
kea_process_testutils_lib,
33+
kea_testutils_lib,
34+
] + LIBS_BUILT_SO_FAR,
1935
override_options: ['cpp_std=c++20'],
2036
)
2137
test('kea-netconf-tests', kea_netconf_tests, protocol: 'gtest')
38+
39+
shared_library(
40+
'basic',
41+
'basic_library.cc',
42+
include_directories: [include_directories('.')] + INCLUDES,
43+
link_with: LIBS_BUILT_SO_FAR,
44+
build_rpath: '/nowhere',
45+
name_suffix: 'so',
46+
)

src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2018-2025 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -10,7 +10,6 @@
1010
#include <exceptions/exceptions.h>
1111
#include <netconf/netconf_cfg_mgr.h>
1212
#include <netconf/parser_context.h>
13-
#include <netconf/tests/test_libraries.h>
1413
#include <process/d_cfg_mgr.h>
1514
#include <process/testutils/d_test_stubs.h>
1615
#include <testutils/gtest_utils.h>

src/bin/netconf/tests/test_data_files_config.h.in

-9
This file was deleted.

src/bin/netconf/tests/test_libraries.h.in

-24
This file was deleted.

0 commit comments

Comments
 (0)