src/bin/agent/tests/ca_process_tests.sh
src/bin/agent/tests/test_data_files_config.h
src/bin/agent/tests/test_libraries.h
+ src/bin/agent/tools/Makefile
src/bin/d2/Makefile
src/bin/d2/tests/Makefile
src/bin/d2/tests/d2_process_tests.sh
src/bin/d2/tests/test_data_files_config.h
+ src/bin/d2/tools/Makefile
src/bin/dhcp4/Makefile
src/bin/dhcp4/tests/Makefile
src/bin/dhcp4/tests/dhcp4_process_tests.sh
src/bin/dhcp4/tests/marker_file.h
src/bin/dhcp4/tests/test_data_files_config.h
src/bin/dhcp4/tests/test_libraries.h
+ src/bin/dhcp4/tools/Makefile
src/bin/dhcp6/Makefile
src/bin/dhcp6/tests/Makefile
src/bin/dhcp6/tests/dhcp6_process_tests.sh
src/bin/dhcp6/tests/marker_file.h
src/bin/dhcp6/tests/test_data_files_config.h
src/bin/dhcp6/tests/test_libraries.h
+ src/bin/dhcp6/tools/Makefile
src/bin/keactrl/Makefile
src/bin/keactrl/keactrl
src/bin/keactrl/keactrl.conf
src/bin/netconf/tests/shtests/netconf_tests.sh
src/bin/netconf/tests/test_data_files_config.h
src/bin/netconf/tests/test_libraries.h
+ src/bin/netconf/tools/Makefile
src/bin/perfdhcp/Makefile
src/bin/perfdhcp/tests/Makefile
src/bin/perfdhcp/tests/testdata/Makefile
-SUBDIRS = . tests
+SUBDIRS = . tests tools
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
BUILT_SOURCES = ca_messages.h ca_messages.cc
-# convenience archive
+# convenience archives
-noinst_LTLIBRARIES = libagent.la
+noinst_LTLIBRARIES = libagent.la libparser-ca.la
-libagent_la_SOURCES = agent_parser.cc agent_parser.h
-libagent_la_SOURCES += agent_lexer.cc
-libagent_la_SOURCES += ca_cfg_mgr.cc ca_cfg_mgr.h
+libagent_la_SOURCES = ca_cfg_mgr.cc ca_cfg_mgr.h
libagent_la_SOURCES += ca_controller.cc ca_controller.h
libagent_la_SOURCES += ca_command_mgr.cc ca_command_mgr.h
libagent_la_SOURCES += ca_log.cc ca_log.h
libagent_la_SOURCES += ca_response_creator.cc ca_response_creator.h
libagent_la_SOURCES += ca_response_creator_factory.h
libagent_la_SOURCES += simple_parser.cc simple_parser.h
-libagent_la_SOURCES += parser_context.cc parser_context.h parser_context_decl.h
-libagent_la_SOURCES += agent_lexer.ll location.hh position.hh stack.hh
-
nodist_libagent_la_SOURCES = ca_messages.h ca_messages.cc
EXTRA_DIST += ca_messages.mes
EXTRA_DIST += agent_lexer.ll
EXTRA_DIST += agent_parser.yy
+libparser_ca_la_SOURCES = agent_lexer.ll agent_lexer.cc
+libparser_ca_la_SOURCES += location.hh position.hh stack.hh
+libparser_ca_la_SOURCES += agent_parser.cc agent_parser.h
+libparser_ca_la_SOURCES += parser_context.cc parser_context.h
+libparser_ca_la_SOURCES += parser_context_decl.h
+
sbin_PROGRAMS = kea-ctrl-agent
kea_ctrl_agent_SOURCES = main.cc
-kea_ctrl_agent_LDADD = libagent.la
+kea_ctrl_agent_LDADD = libagent.la libparser-ca.la
kea_ctrl_agent_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
kea_ctrl_agent_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
kea_ctrl_agent_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
ca_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
ca_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS)
-ca_unittests_LDADD = $(top_builddir)/src/bin/agent/libagent.la
+ca_unittests_LDADD = $(top_builddir)/src/bin/agent/libagent.la
+ca_unittests_LDADD += $(top_builddir)/src/bin/agent/libparser-ca.la
ca_unittests_LDADD += $(top_builddir)/src/lib/process/testutils/libprocesstest.la
ca_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
ca_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
--- /dev/null
+/parser-ca
+/tools-ca.8
--- /dev/null
+AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
+AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_builddir)/src
+AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+#AM_CPPFLAGS += $(SYSREPO_CPPFLAGS)
+
+CLEANFILES = *.gcno *.gcda
+
+sbin_PROGRAMS = parser-ca
+#sbin_PROGRAMS += to-yang from-yang
+
+parser_ca_SOURCES = parser-ca.cc
+parser_ca_LDADD = $(top_builddir)/src/bin/agent/libparser-ca.la
+parser_ca_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
+parser_ca_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+parser_ca_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
+parser_ca_LDADD += $(BOOST_LIBS)
+#parser_ca_LDADD += $(SYSREPO_LIBS)
+parser_ca_LDFLAGS = $(AM_LDFLAGS)
--- /dev/null
+// Copyright (C) 2019 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 <kea_version.h>
+
+#include <agent/parser_context.h>
+
+#include <fstream>
+#include <iostream>
+
+using namespace isc;
+using namespace isc::data;
+using namespace std;
+
+/// @file Just apply the Control agent parser from the input file and
+/// pretty print the result to the output file.
+
+/// @brief Print parser-ca usage.
+void
+usage() {
+ cerr << "Usage: parser-ca [-v] [-V] -i <input> -o <output>" << endl;
+}
+
+int
+main(int argc, char* argv[]) {
+ string input_file("");
+ string output_file("");
+
+ int ch;
+ while ((ch = getopt(argc, argv, "i:o:vV")) != -1) {
+ switch (ch) {
+ case 'i':
+ input_file = optarg;
+ break;
+
+ case 'o':
+ output_file = optarg;
+ break;
+
+ case 'v':
+ cout << VERSION << endl;
+ return (EXIT_SUCCESS);
+
+ case 'V':
+ cout << VERSION << endl << EXTENDED_VERSION << endl;
+ return (EXIT_SUCCESS);
+
+ default:
+ usage();
+ return (EXIT_FAILURE);
+ }
+ }
+
+ // Check for extraneous parameters.
+ if (argc > optind) {
+ usage();
+ return (EXIT_FAILURE);
+ }
+
+ // Input file is required.
+ if (input_file.empty()) {
+ cerr << "Input file was not specified." << endl;
+ usage();
+ return (EXIT_FAILURE);
+ }
+
+ try {
+ ParserContext parser;
+ ConstElementPtr json;
+ json = parser.parseFile(input_file, ParserContext::PARSER_AGENT);
+ if (!json) {
+ cerr << "No input found" << endl;
+ return (EXIT_FAILURE);
+ }
+
+ if (output_file.empty()) {
+ cout << prettyPrint(json) << endl;
+ } else {
+ ofstream out(output_file, ios::trunc);
+ if (!out.good()) {
+ isc_throw(Unexpected, "Unable to open file " + output_file +
+ " for writing");
+ out << prettyPrint(json) << endl;
+ }
+ out.close();
+ }
+ } catch (const std::exception& ex) {
+ cerr << "parser-ca failed with " << ex.what() << endl;
+ return (EXIT_FAILURE);
+ }
+ return (EXIT_SUCCESS);
+}
-SUBDIRS = . tests
+SUBDIRS = . tests tools
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
BUILT_SOURCES = d2_messages.h d2_messages.cc
-# convenience archive
+# convenience archives
-noinst_LTLIBRARIES = libd2.la
+noinst_LTLIBRARIES = libd2.la libparser2.la
libd2_la_SOURCES =
libd2_la_SOURCES += d2_log.cc d2_log.h
libd2_la_SOURCES += d2_process.cc d2_process.h
libd2_la_SOURCES += d2_config.cc d2_config.h
libd2_la_SOURCES += d2_cfg_mgr.cc d2_cfg_mgr.h
-libd2_la_SOURCES += d2_lexer.ll location.hh position.hh stack.hh
-libd2_la_SOURCES += d2_parser.cc d2_parser.h
libd2_la_SOURCES += d2_queue_mgr.cc d2_queue_mgr.h
libd2_la_SOURCES += d2_simple_parser.cc d2_simple_parser.h
libd2_la_SOURCES += d2_update_message.cc d2_update_message.h
libd2_la_SOURCES += nc_remove.cc nc_remove.h
libd2_la_SOURCES += nc_trans.cc nc_trans.h
libd2_la_SOURCES += d2_controller.cc d2_controller.h
-libd2_la_SOURCES += parser_context.cc parser_context.h parser_context_decl.h
+
nodist_libd2_la_SOURCES = d2_messages.h d2_messages.cc
EXTRA_DIST += d2_messages.mes
+libparser2_la_SOURCES =
+libparser2_la_SOURCES += d2_lexer.ll location.hh position.hh stack.hh
+libparser2_la_SOURCES += d2_parser.cc d2_parser.h
+libparser2_la_SOURCES += parser_context.cc parser_context.h
+libparser2_la_SOURCES += parser_context_decl.h
+
sbin_PROGRAMS = kea-dhcp-ddns
kea_dhcp_ddns_SOURCES = main.cc
-kea_dhcp_ddns_LDADD = libd2.la
+kea_dhcp_ddns_LDADD = libd2.la libparser2.la
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
d2_unittests_LDFLAGS += $(GTEST_LDFLAGS)
d2_unittests_LDADD = $(top_builddir)/src/bin/d2/libd2.la
+d2_unittests_LDADD += $(top_builddir)/src/bin/d2/libparser2.la
d2_unittests_LDADD += $(top_builddir)/src/lib/process/testutils/libprocesstest.la
d2_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
d2_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
--- /dev/null
+/parser2
+/tools4.8
--- /dev/null
+AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
+AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_builddir)/src
+AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+#AM_CPPFLAGS += $(SYSREPO_CPPFLAGS)
+
+CLEANFILES = *.gcno *.gcda
+
+sbin_PROGRAMS = parser2
+#sbin_PROGRAMS += to-yang from-yang
+
+parser2_SOURCES = parser2.cc
+parser2_LDADD = $(top_builddir)/src/bin/d2/libparser2.la
+parser2_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
+parser2_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+parser2_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
+parser2_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
+parser2_LDADD += $(BOOST_LIBS)
+#parser2_LDADD += $(SYSREPO_LIBS)
+parser2_LDFLAGS = $(AM_LDFLAGS)
--- /dev/null
+// Copyright (C) 2019 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 <kea_version.h>
+
+#include <d2/parser_context.h>
+
+#include <fstream>
+#include <iostream>
+
+using namespace isc;
+using namespace isc::data;
+using namespace std;
+
+/// @file Just apply the D2 parser from the input file and pretty print
+/// the result to the output file.
+
+/// @brief Print parser2 usage.
+void
+usage() {
+ cerr << "Usage: parser2 [-v] [-V] -i <input> -o <output>" << endl;
+}
+
+int
+main(int argc, char* argv[]) {
+ string input_file("");
+ string output_file("");
+
+ int ch;
+ while ((ch = getopt(argc, argv, "i:o:vV")) != -1) {
+ switch (ch) {
+ case 'i':
+ input_file = optarg;
+ break;
+
+ case 'o':
+ output_file = optarg;
+ break;
+
+ case 'v':
+ cout << VERSION << endl;
+ return (EXIT_SUCCESS);
+
+ case 'V':
+ cout << VERSION << endl << EXTENDED_VERSION << endl;
+ return (EXIT_SUCCESS);
+
+ default:
+ usage();
+ return (EXIT_FAILURE);
+ }
+ }
+
+ // Check for extraneous parameters.
+ if (argc > optind) {
+ usage();
+ return (EXIT_FAILURE);
+ }
+
+ // Input file is required.
+ if (input_file.empty()) {
+ cerr << "Input file was not specified." << endl;
+ usage();
+ return (EXIT_FAILURE);
+ }
+
+ try {
+ D2ParserContext parser;
+ ConstElementPtr json;
+ json = parser.parseFile(input_file, D2ParserContext::PARSER_DHCPDDNS);
+ if (!json) {
+ cerr << "No input found" << endl;
+ return (EXIT_FAILURE);
+ }
+
+ if (output_file.empty()) {
+ cout << prettyPrint(json) << endl;
+ } else {
+ ofstream out(output_file, ios::trunc);
+ if (!out.good()) {
+ isc_throw(Unexpected, "Unable to open file " + output_file +
+ " for writing");
+ out << prettyPrint(json) << endl;
+ }
+ out.close();
+ }
+ } catch (const std::exception& ex) {
+ cerr << "parser2 failed with " << ex.what() << endl;
+ return (EXIT_FAILURE);
+ }
+ return (EXIT_SUCCESS);
+}
-SUBDIRS = . tests
+SUBDIRS = . tests tools
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
BUILT_SOURCES = dhcp4_messages.h dhcp4_messages.cc
-# convenience archive
+# convenience archives
-noinst_LTLIBRARIES = libdhcp4.la
+noinst_LTLIBRARIES = libdhcp4.la libparser4.la
libdhcp4_la_SOURCES =
libdhcp4_la_SOURCES += ctrl_dhcp4_srv.cc ctrl_dhcp4_srv.h
libdhcp4_la_SOURCES += dhcp4_log.cc dhcp4_log.h
libdhcp4_la_SOURCES += dhcp4_srv.cc dhcp4_srv.h
libdhcp4_la_SOURCES += dhcp4to6_ipc.cc dhcp4to6_ipc.h
-libdhcp4_la_SOURCES += dhcp4_lexer.ll location.hh position.hh stack.hh
-libdhcp4_la_SOURCES += dhcp4_parser.cc dhcp4_parser.h
-libdhcp4_la_SOURCES += parser_context.cc parser_context.h parser_context_decl.h
nodist_libdhcp4_la_SOURCES = dhcp4_messages.h dhcp4_messages.cc
EXTRA_DIST += dhcp4_messages.mes
+libparser4_la_SOURCES =
+libparser4_la_SOURCES += dhcp4_lexer.ll location.hh position.hh stack.hh
+libparser4_la_SOURCES += dhcp4_parser.cc dhcp4_parser.h
+libparser4_la_SOURCES += parser_context.cc parser_context.h
+libparser4_la_SOURCES += parser_context_decl.h
+
sbin_PROGRAMS = kea-dhcp4
kea_dhcp4_SOURCES = main.cc
-kea_dhcp4_LDADD = libdhcp4.la
+kea_dhcp4_LDADD = libdhcp4.la libparser4.la
kea_dhcp4_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
kea_dhcp4_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
kea_dhcp4_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
dhcp4_unittests_LDFLAGS += $(GTEST_LDFLAGS)
dhcp4_unittests_LDADD = $(top_builddir)/src/bin/dhcp4/libdhcp4.la
+dhcp4_unittests_LDADD += $(top_builddir)/src/bin/dhcp4/libparser4.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
--- /dev/null
+/parser4
+/tools4.8
--- /dev/null
+AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
+AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_builddir)/src
+AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+#AM_CPPFLAGS += $(SYSREPO_CPPFLAGS)
+
+CLEANFILES = *.gcno *.gcda
+
+sbin_PROGRAMS = parser4
+#sbin_PROGRAMS += to-yang from-yang
+
+parser4_SOURCES = parser4.cc
+parser4_LDADD = $(top_builddir)/src/bin/dhcp4/libparser4.la
+parser4_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
+parser4_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+parser4_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
+parser4_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
+parser4_LDADD += $(BOOST_LIBS)
+#parser4_LDADD += $(SYSREPO_LIBS)
+parser4_LDFLAGS = $(AM_LDFLAGS)
--- /dev/null
+// Copyright (C) 2019 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 <kea_version.h>
+
+#include <dhcp4/parser_context.h>
+
+#include <fstream>
+#include <iostream>
+
+using namespace isc;
+using namespace isc::data;
+using namespace std;
+
+/// @file Just apply the DHCPv4 parser from the input file and pretty print
+/// the result to the output file.
+
+/// @brief Print parser4 usage.
+void
+usage() {
+ cerr << "Usage: parser4 [-v] [-V] -i <input> -o <output>" << endl;
+}
+
+int
+main(int argc, char* argv[]) {
+ string input_file("");
+ string output_file("");
+
+ int ch;
+ while ((ch = getopt(argc, argv, "i:o:vV")) != -1) {
+ switch (ch) {
+ case 'i':
+ input_file = optarg;
+ break;
+
+ case 'o':
+ output_file = optarg;
+ break;
+
+ case 'v':
+ cout << VERSION << endl;
+ return (EXIT_SUCCESS);
+
+ case 'V':
+ cout << VERSION << endl << EXTENDED_VERSION << endl;
+ return (EXIT_SUCCESS);
+
+ default:
+ usage();
+ return (EXIT_FAILURE);
+ }
+ }
+
+ // Check for extraneous parameters.
+ if (argc > optind) {
+ usage();
+ return (EXIT_FAILURE);
+ }
+
+ // Input file is required.
+ if (input_file.empty()) {
+ cerr << "Input file was not specified." << endl;
+ usage();
+ return (EXIT_FAILURE);
+ }
+
+ try {
+ Parser4Context parser;
+ ConstElementPtr json;
+ json = parser.parseFile(input_file, Parser4Context::PARSER_DHCP4);
+ if (!json) {
+ cerr << "No input found" << endl;
+ return (EXIT_FAILURE);
+ }
+
+ if (output_file.empty()) {
+ cout << prettyPrint(json) << endl;
+ } else {
+ ofstream out(output_file, ios::trunc);
+ if (!out.good()) {
+ isc_throw(Unexpected, "Unable to open file " + output_file +
+ " for writing");
+ out << prettyPrint(json) << endl;
+ }
+ out.close();
+ }
+ } catch (const std::exception& ex) {
+ cerr << "parser4 failed with " << ex.what() << endl;
+ return (EXIT_FAILURE);
+ }
+ return (EXIT_SUCCESS);
+}
-SUBDIRS = . tests
+SUBDIRS = . tests tools
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
BUILT_SOURCES = dhcp6_messages.h dhcp6_messages.cc
-# convenience archive
+# convenience archives
-noinst_LTLIBRARIES = libdhcp6.la
+noinst_LTLIBRARIES = libdhcp6.la libparser6.la
libdhcp6_la_SOURCES =
libdhcp6_la_SOURCES += dhcp6_log.cc dhcp6_log.h
libdhcp6_la_SOURCES += ctrl_dhcp6_srv.cc ctrl_dhcp6_srv.h
libdhcp6_la_SOURCES += json_config_parser.cc json_config_parser.h
libdhcp6_la_SOURCES += dhcp6to4_ipc.cc dhcp6to4_ipc.h
-libdhcp6_la_SOURCES += dhcp6_lexer.ll location.hh position.hh stack.hh
-libdhcp6_la_SOURCES += dhcp6_parser.cc dhcp6_parser.h
-libdhcp6_la_SOURCES += parser_context.cc parser_context.h parser_context_decl.h
nodist_libdhcp6_la_SOURCES = dhcp6_messages.h dhcp6_messages.cc
EXTRA_DIST += dhcp6_messages.mes
+libparser6_la_SOURCES =
+libparser6_la_SOURCES += dhcp6_lexer.ll location.hh position.hh stack.hh
+libparser6_la_SOURCES += dhcp6_parser.cc dhcp6_parser.h
+libparser6_la_SOURCES += parser_context.cc parser_context.h
+libparser6_la_SOURCES += parser_context_decl.h
+
sbin_PROGRAMS = kea-dhcp6
kea_dhcp6_SOURCES = main.cc
-kea_dhcp6_LDADD = libdhcp6.la
+kea_dhcp6_LDADD = libdhcp6.la libparser6.la
kea_dhcp6_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
kea_dhcp6_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
kea_dhcp6_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
dhcp6_unittests_LDFLAGS += $(GTEST_LDFLAGS)
dhcp6_unittests_LDADD = $(top_builddir)/src/bin/dhcp6/libdhcp6.la
+dhcp6_unittests_LDADD += $(top_builddir)/src/bin/dhcp6/libparser6.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
--- /dev/null
+/parser6
+/tools6.8
--- /dev/null
+AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
+AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_builddir)/src
+AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+#AM_CPPFLAGS += $(SYSREPO_CPPFLAGS)
+
+CLEANFILES = *.gcno *.gcda
+
+sbin_PROGRAMS = parser6
+#sbin_PROGRAMS += to-yang from-yang
+
+parser6_SOURCES = parser6.cc
+parser6_LDADD = $(top_builddir)/src/bin/dhcp6/libparser6.la
+parser6_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
+parser6_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+parser6_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
+parser6_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
+parser6_LDADD += $(BOOST_LIBS)
+#parser6_LDADD += $(SYSREPO_LIBS)
+parser6_LDFLAGS = $(AM_LDFLAGS)
--- /dev/null
+// Copyright (C) 2019 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 <kea_version.h>
+
+#include <dhcp6/parser_context.h>
+
+#include <fstream>
+#include <iostream>
+
+using namespace isc;
+using namespace isc::data;
+using namespace std;
+
+/// @file Just apply the DHCPv6 parser from the input file and pretty print
+/// the result to the output file.
+
+/// @brief Print parser6 usage.
+void
+usage() {
+ cerr << "Usage: parser6 [-v] [-V] -i <input> -o <output>" << endl;
+}
+
+int
+main(int argc, char* argv[]) {
+ string input_file("");
+ string output_file("");
+
+ int ch;
+ while ((ch = getopt(argc, argv, "i:o:vV")) != -1) {
+ switch (ch) {
+ case 'i':
+ input_file = optarg;
+ break;
+
+ case 'o':
+ output_file = optarg;
+ break;
+
+ case 'v':
+ cout << VERSION << endl;
+ return (EXIT_SUCCESS);
+
+ case 'V':
+ cout << VERSION << endl << EXTENDED_VERSION << endl;
+ return (EXIT_SUCCESS);
+
+ default:
+ usage();
+ return (EXIT_FAILURE);
+ }
+ }
+
+ // Check for extraneous parameters.
+ if (argc > optind) {
+ usage();
+ return (EXIT_FAILURE);
+ }
+
+ // Input file is required.
+ if (input_file.empty()) {
+ cerr << "Input file was not specified." << endl;
+ usage();
+ return (EXIT_FAILURE);
+ }
+
+ try {
+ Parser6Context parser;
+ ConstElementPtr json;
+ json = parser.parseFile(input_file, Parser6Context::PARSER_DHCP6);
+ if (!json) {
+ cerr << "No input found" << endl;
+ return (EXIT_FAILURE);
+ }
+
+ if (output_file.empty()) {
+ cout << prettyPrint(json) << endl;
+ } else {
+ ofstream out(output_file, ios::trunc);
+ if (!out.good()) {
+ isc_throw(Unexpected, "Unable to open file " + output_file +
+ " for writing");
+ out << prettyPrint(json) << endl;
+ }
+ out.close();
+ }
+ } catch (const std::exception& ex) {
+ cerr << "parser6 failed with " << ex.what() << endl;
+ return (EXIT_FAILURE);
+ }
+ return (EXIT_SUCCESS);
+}
-SUBDIRS = . tests
+SUBDIRS = . tests tools
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
BUILT_SOURCES = netconf_messages.h netconf_messages.cc
-# convenience archive
+# convenience archives
-noinst_LTLIBRARIES = libnetconf.la
+noinst_LTLIBRARIES = libnetconf.la libparser-nc.la
libnetconf_la_SOURCES = control_socket.cc control_socket.h
libnetconf_la_SOURCES += http_control_socket.cc http_control_socket.h
libnetconf_la_SOURCES += netconf_config.cc netconf_config.h
libnetconf_la_SOURCES += netconf_controller.cc netconf_controller.h
libnetconf_la_SOURCES += netconf_log.cc netconf_log.h
-libnetconf_la_SOURCES += netconf_parser.cc netconf_parser.h
libnetconf_la_SOURCES += netconf_process.cc netconf_process.h
-libnetconf_la_SOURCES += parser_context.cc parser_context.h
-libnetconf_la_SOURCES += parser_context_decl.h
libnetconf_la_SOURCES += simple_parser.cc simple_parser.h
-libnetconf_la_SOURCES += location.hh position.hh stack.hh
-libnetconf_la_SOURCES += netconf_lexer.ll netconf_parser.yy
nodist_libnetconf_la_SOURCES = netconf_messages.h netconf_messages.cc
EXTRA_DIST += netconf_lexer.ll
EXTRA_DIST += netconf_parser.yy
+libparser_nc_la_SOURCES = netconf_parser.cc netconf_parser.h
+libparser_nc_la_SOURCES += parser_context.cc parser_context.h
+libparser_nc_la_SOURCES += parser_context_decl.h
+libparser_nc_la_SOURCES += location.hh position.hh stack.hh
+libparser_nc_la_SOURCES += netconf_lexer.ll netconf_parser.yy
+
+
sbin_PROGRAMS = kea-netconf
kea_netconf_SOURCES = main.cc
-kea_netconf_LDADD = libnetconf.la
+kea_netconf_LDADD = libnetconf.la libparser-nc.la
kea_netconf_LDADD += $(top_builddir)/src/lib/http/libkea-http.la
kea_netconf_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
kea_netconf_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
netconf_unittests_LDADD = $(top_builddir)/src/bin/netconf/libnetconf.la
+netconf_unittests_LDADD += $(top_builddir)/src/bin/netconf/libparser-nc.la
netconf_unittests_LDADD += $(top_builddir)/src/lib/http/libkea-http.la
netconf_unittests_LDADD += $(top_builddir)/src/lib/process/testutils/libprocesstest.la
netconf_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
netconf_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
-#netconf_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
-#netconf_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
-#netconf_unittests_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
-#netconf_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
netconf_unittests_LDADD += $(top_builddir)/src/lib/yang/testutils/libyangtest.la
netconf_unittests_LDADD += $(top_builddir)/src/lib/yang/libkea-yang.la
-#netconf_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
netconf_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
-#netconf_unittests_LDADD += $(top_builddir)/src/lib/dhcp/tests/libdhcptest.la
netconf_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
netconf_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
netconf_unittests_LDADD += $(top_builddir)/src/lib/testutils/libkea-testutils.la
--- /dev/null
+/parser-nc
+/tools-nc.8
--- /dev/null
+AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
+AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_builddir)/src
+AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+#AM_CPPFLAGS += $(SYSREPO_CPPFLAGS)
+
+CLEANFILES = *.gcno *.gcda
+
+sbin_PROGRAMS = parser-nc
+#sbin_PROGRAMS += to-yang from-yang
+
+parser_nc_SOURCES = parser-nc.cc
+parser_nc_LDADD = $(top_builddir)/src/bin/netconf/libparser-nc.la
+parser_nc_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
+parser_nc_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+parser_nc_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
+parser_nc_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
+parser_nc_LDADD += $(BOOST_LIBS)
+#parser_nc_LDADD += $(SYSREPO_LIBS)
+parser_nc_LDFLAGS = $(AM_LDFLAGS)
--- /dev/null
+// Copyright (C) 2019 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 <kea_version.h>
+
+#include <netconf/parser_context.h>
+
+#include <fstream>
+#include <iostream>
+
+using namespace isc;
+using namespace isc::data;
+using namespace std;
+
+/// @file Just apply the Netconf parser from the input file and pretty print
+/// the result to the output file.
+
+/// @brief Print parser-nc usage.
+void
+usage() {
+ cerr << "Usage: parser-nc [-v] [-V] -i <input> -o <output>" << endl;
+}
+
+int
+main(int argc, char* argv[]) {
+ string input_file("");
+ string output_file("");
+
+ int ch;
+ while ((ch = getopt(argc, argv, "i:o:vV")) != -1) {
+ switch (ch) {
+ case 'i':
+ input_file = optarg;
+ break;
+
+ case 'o':
+ output_file = optarg;
+ break;
+
+ case 'v':
+ cout << VERSION << endl;
+ return (EXIT_SUCCESS);
+
+ case 'V':
+ cout << VERSION << endl << EXTENDED_VERSION << endl;
+ return (EXIT_SUCCESS);
+
+ default:
+ usage();
+ return (EXIT_FAILURE);
+ }
+ }
+
+ // Check for extraneous parameters.
+ if (argc > optind) {
+ usage();
+ return (EXIT_FAILURE);
+ }
+
+ // Input file is required.
+ if (input_file.empty()) {
+ cerr << "Input file was not specified." << endl;
+ usage();
+ return (EXIT_FAILURE);
+ }
+
+ try {
+ ParserContext parser;
+ ConstElementPtr json;
+ json = parser.parseFile(input_file, ParserContext::PARSER_NETCONF);
+ if (!json) {
+ cerr << "No input found" << endl;
+ return (EXIT_FAILURE);
+ }
+
+ if (output_file.empty()) {
+ cout << prettyPrint(json) << endl;
+ } else {
+ ofstream out(output_file, ios::trunc);
+ if (!out.good()) {
+ isc_throw(Unexpected, "Unable to open file " + output_file +
+ " for writing");
+ out << prettyPrint(json) << endl;
+ }
+ out.close();
+ }
+ } catch (const std::exception& ex) {
+ cerr << "parser-nc failed with " << ex.what() << endl;
+ return (EXIT_FAILURE);
+ }
+ return (EXIT_SUCCESS);
+}