Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
789611d2
Commit
789611d2
authored
Dec 14, 2017
by
Tomek Mrugalski
🛰
Browse files
[5389] Dead code for .spec files removed.
parent
f7841a91
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
789611d2
...
...
@@ -1209,14 +1209,12 @@ AC_CONFIG_FILES([Makefile
src/bin/d2/tests/d2_process_tests.sh
src/bin/d2/tests/test_data_files_config.h
src/bin/dhcp4/Makefile
src/bin/dhcp4/spec_config.h.pre
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/dhcp6/Makefile
src/bin/dhcp6/spec_config.h.pre
src/bin/dhcp6/tests/Makefile
src/bin/dhcp6/tests/dhcp6_process_tests.sh
src/bin/dhcp6/tests/marker_file.h
...
...
@@ -1296,7 +1294,6 @@ AC_CONFIG_FILES([Makefile
src/lib/log/tests/severity_test.sh
src/lib/log/tests/tempdir.h
src/lib/process/Makefile
src/lib/process/spec_config.h.pre
src/lib/process/tests/Makefile
src/lib/process/testutils/Makefile
src/lib/stats/Makefile
...
...
src/bin/d2/Makefile.am
View file @
789611d2
...
...
@@ -23,7 +23,7 @@ CLEANFILES = *.gcno *.gcda d2_messages.h d2_messages.cc s-messages
man_MANS
=
kea-dhcp-ddns.8
DISTCLEANFILES
=
$(man_MANS)
EXTRA_DIST
=
$(man_MANS)
kea-dhcp-ddns.xml
dhcp-ddns.spec
d2.dox
EXTRA_DIST
=
$(man_MANS)
kea-dhcp-ddns.xml d2.dox
EXTRA_DIST
+=
d2_parser.yy
EXTRA_DIST
+=
images/abstract_app_classes.svg images/add_state_model.svg
...
...
@@ -119,7 +119,6 @@ kea_dhcp_ddns_LDFLAGS += $(CQL_LIBS)
endif
kea_dhcp_ddnsdir
=
$(pkgdatadir)
kea_dhcp_ddns_DATA
=
dhcp-ddns.spec
if
GENERATE_PARSER
...
...
src/bin/d2/dhcp-ddns.spec
deleted
100644 → 0
View file @
f7841a91
{
"module_spec":
{
"module_name": "DhcpDdns",
"module_description": "DHPC-DDNS Service",
"config_data": [
{
"item_name": "ip-address",
"item_type": "string",
"item_optional": false,
"item_default": "127.0.0.1"
},
{
"item_name": "port",
"item_type": "integer",
"item_optional": true,
"item_default": 53001
},
{
"item_name": "dns-server-timeout",
"item_type": "integer",
"item_optional": true,
"item_default": 100
},
{
"item_name": "ncr-protocol",
"item_type": "string",
"item_optional": true,
"item_default": "UDP"
},
{
"item_name": "ncr-format",
"item_type": "string",
"item_optional": true,
"item_default": "JSON"
},
{
"item_name": "tsig-keys",
"item_type": "list",
"item_optional": true,
"item_default": [],
"list_item_spec":
{
"item_name": "tsig-key",
"item_type": "map",
"item_optional": false,
"item_default": {"algorithm" : "HMAC-MD5"},
"map_item_spec": [
{
"item_name": "name",
"item_type": "string",
"item_optional": false,
"item_default": ""
},
{
"item_name": "algorithm",
"item_type": "string",
"item_optional": false,
"item_default": ""
},
{
"item_name": "digest-bits",
"item_type": "integer",
"item_optional": true,
"item_default": 0
},
{
"item_name": "secret",
"item_type": "string",
"item_optional": false,
"item_default": ""
}]
}
},
{
"item_name": "forward-ddns",
"item_type": "map",
"item_optional": true,
"item_default": {},
"map_item_spec": [
{
"item_name": "ddns-domains",
"item_type": "list",
"item_optional": false,
"item_default": [],
"list_item_spec":
{
"item_name": "ddns-domain",
"item_type": "map",
"item_optional": false,
"item_default": {},
"map_item_spec": [
{
"item_name": "name",
"item_type": "string",
"item_optional": false,
"item_default": ""
},
{
"item_name": "key-name",
"item_type": "string",
"item_optional": true,
"item_default": ""
},
{
"item_name": "dns-servers",
"item_type": "list",
"item_optional": false,
"item_default": [],
"list_item_spec":
{
"item_name": "dns-server",
"item_type": "map",
"item_optional": false,
"item_default": {},
"map_item_spec": [
{
"item_name": "hostname",
"item_type": "string",
"item_optional": true,
"item_default": ""
},
{
"item_name": "ip-address",
"item_type": "string",
"item_optional": true,
"item_default": ""
},
{
"item_name": "port",
"item_type": "integer",
"item_optional": true,
"item_default": 53
}]
}
}]
}
}]
},
{
"item_name": "reverse-ddns",
"item_type": "map",
"item_optional": true,
"item_default": {},
"map_item_spec": [
{
"item_name": "ddns-domains",
"item_type": "list",
"item_optional": false,
"item_default": [],
"list_item_spec":
{
"item_name": "ddns-domain",
"item_type": "map",
"item_optional": false,
"item_default": {},
"map_item_spec": [
{
"item_name": "name",
"item_type": "string",
"item_optional": false,
"item_default": ""
},
{
"item_name": "key-name",
"item_type": "string",
"item_optional": true,
"item_default": ""
},
{
"item_name": "dns-servers",
"item_type": "list",
"item_optional": false,
"item_default": [],
"list_item_spec":
{
"item_name": "dns-server",
"item_type": "map",
"item_optional": false,
"item_default": {},
"map_item_spec": [
{
"item_name": "hostname",
"item_type": "string",
"item_optional": true,
"item_default": ""
},
{
"item_name": "ip-address",
"item_type": "string",
"item_optional": true,
"item_default": ""
},
{
"item_name": "port",
"item_type": "integer",
"item_optional": true,
"item_default": 53
}]
}
}]
}
}]
}],
"commands": [
{
"command_name": "shutdown",
"command_description": "Shuts down kea-dhcp-ddns module server.",
"command_args": [
{
"item_name": "type",
"item_type": "string",
"item_optional": true,
"item_default": "normal",
"item_description": "values: normal (default), now, or drain_first"
}
]
}
]
}
}
src/bin/d2/tests/d2_cfg_mgr_unittests.cc
View file @
789611d2
...
...
@@ -6,7 +6,6 @@
#include <config.h>
#include <config/module_spec.h>
#include <d2/d2_config.h>
#include <d2/d2_cfg_mgr.h>
#include <d2/d2_simple_parser.h>
...
...
@@ -28,16 +27,6 @@ using namespace isc::process;
namespace
{
/// @brief Function to create full path to the spec file
///
/// The full path is dependent upon the value of D2_SRC_DIR which
/// whose value is generated from test_data_files_config.h.in
///
/// @param name file name to which the path should be prepended
std
::
string
specfile
(
const
std
::
string
&
name
)
{
return
(
std
::
string
(
D2_SRC_DIR
)
+
"/"
+
name
);
}
/// @brief Function to create full path to test data file
///
/// The full path is dependent upon the value of D2_TEST_DATA_DIR which
...
...
@@ -229,14 +218,6 @@ public:
#define SYNTAX_ERROR(a,b) ASSERT_TRUE(runConfigOrFail(a,SYNTAX_ERROR,b))
#define LOGIC_ERROR(a,b) ASSERT_TRUE(runConfigOrFail(a,LOGIC_ERROR,b))
/// @brief Tests that the spec file is valid.
/// Verifies that the DHCP-DDNS configuration specification file
/// is valid.
TEST
(
D2SpecTest
,
basicSpec
)
{
ASSERT_NO_THROW
(
isc
::
config
::
moduleSpecFromFile
(
specfile
(
"dhcp-ddns.spec"
)));
}
/// @brief Tests a basic valid configuration for D2Param.
TEST_F
(
D2CfgMgrTest
,
validParamsEntry
)
{
// Verify that ip_address can be valid v4 address.
...
...
src/bin/dhcp4/Makefile.am
View file @
789611d2
...
...
@@ -20,11 +20,11 @@ if USE_STATIC_LINK
AM_LDFLAGS
=
-static
endif
CLEANFILES
=
*
.gcno
*
.gcda
spec_config.h
dhcp4_messages.h dhcp4_messages.cc s-messages
CLEANFILES
=
*
.gcno
*
.gcda dhcp4_messages.h dhcp4_messages.cc s-messages
man_MANS
=
kea-dhcp4.8
DISTCLEANFILES
=
$(man_MANS)
EXTRA_DIST
=
$(man_MANS)
kea-dhcp4.xml
dhcp4.spec
EXTRA_DIST
=
$(man_MANS)
kea-dhcp4.xml
EXTRA_DIST
+=
dhcp4.dox dhcp4_hooks.dox dhcp4o6.dox
EXTRA_DIST
+=
dhcp4_parser.yy
...
...
@@ -42,16 +42,13 @@ $(man_MANS):
endif
spec_config.h
:
spec_config.h.pre
$(SED)
-e
"s|@@LOCALSTATEDIR@@|
$(localstatedir)
|"
spec_config.h.pre
>
$@
dhcp4_messages.h dhcp4_messages.cc
:
s-messages
s-messages
:
dhcp4_messages.mes
$(top_builddir)
/src/lib/log/compiler/kea-msg-compiler
$(top_srcdir)
/src/bin/dhcp4/dhcp4_messages.mes
touch
$@
BUILT_SOURCES
=
spec_config.h
dhcp4_messages.h dhcp4_messages.cc
BUILT_SOURCES
=
dhcp4_messages.h dhcp4_messages.cc
# convenience archive
...
...
@@ -105,7 +102,6 @@ kea_dhcp4_LDFLAGS += $(CQL_LIBS)
endif
kea_dhcp4dir
=
$(pkgdatadir)
kea_dhcp4_DATA
=
dhcp4.spec
if
GENERATE_PARSER
...
...
src/bin/dhcp4/dhcp4.spec
deleted
100644 → 0
View file @
f7841a91
This diff is collapsed.
Click to expand it.
src/bin/dhcp4/spec_config.h.pre.in
deleted
100644 → 0
View file @
f7841a91
// Copyright (C) 2011-2015 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/.
#define DHCP4_SPECFILE_LOCATION "@prefix@/share/@PACKAGE@/dhcp4.spec"
src/bin/dhcp4/tests/config_parser_unittest.cc
View file @
789611d2
...
...
@@ -10,7 +10,6 @@
#include <gtest/gtest.h>
#include <cc/command_interpreter.h>
#include <config/module_spec.h>
#include <dhcp4/dhcp4_srv.h>
#include <dhcp4/json_config_parser.h>
#include <dhcp/option4_addrlst.h>
...
...
@@ -132,22 +131,6 @@ const char* PARSER_CONFIGS[] = {
"}"
};
/// @brief Prepends the given name with the DHCP4 source directory
///
/// @param name file name of the desired file
/// @return string containing the absolute path of the file in the DHCP source
/// directory.
std
::
string
specfile
(
const
std
::
string
&
name
)
{
return
(
std
::
string
(
DHCP4_SRC_DIR
)
+
"/"
+
name
);
}
/// @brief Tests that the spec file is valid.
/// Verifies that the Kea DHCPv4 configuration specification file is valid.
TEST
(
Dhcp4SpecTest
,
basicSpec
)
{
(
isc
::
config
::
moduleSpecFromFile
(
specfile
(
"dhcp4.spec"
)));
ASSERT_NO_THROW
(
isc
::
config
::
moduleSpecFromFile
(
specfile
(
"dhcp4.spec"
)));
}
class
Dhcp4ParserTest
:
public
::
testing
::
Test
{
protected:
// Check that no hooks libraries are loaded. This is a pre-condition for
...
...
src/bin/dhcp6/Makefile.am
View file @
789611d2
...
...
@@ -20,11 +20,11 @@ if USE_STATIC_LINK
AM_LDFLAGS
=
-static
endif
CLEANFILES
=
spec_config.h
dhcp6_messages.h dhcp6_messages.cc s-messages
CLEANFILES
=
dhcp6_messages.h dhcp6_messages.cc s-messages
man_MANS
=
kea-dhcp6.8
DISTCLEANFILES
=
$(man_MANS)
EXTRA_DIST
=
$(man_MANS)
kea-dhcp6.xml
dhcp6.spec
EXTRA_DIST
=
$(man_MANS)
kea-dhcp6.xml
EXTRA_DIST
+=
dhcp6.dox dhcp6_hooks.dox dhcp4o6.dox
EXTRA_DIST
+=
dhcp6_parser.yy
...
...
@@ -43,16 +43,13 @@ $(man_MANS):
endif
spec_config.h
:
spec_config.h.pre
$(SED)
-e
"s|@@LOCALSTATEDIR@@|
$(localstatedir)
|"
spec_config.h.pre
>
$@
dhcp6_messages.h dhcp6_messages.cc
:
s-messages
s-messages
:
dhcp6_messages.mes
$(top_builddir)
/src/lib/log/compiler/kea-msg-compiler
$(top_srcdir)
/src/bin/dhcp6/dhcp6_messages.mes
touch
$@
BUILT_SOURCES
=
spec_config.h
dhcp6_messages.h dhcp6_messages.cc
BUILT_SOURCES
=
dhcp6_messages.h dhcp6_messages.cc
# convenience archive
...
...
@@ -105,7 +102,6 @@ kea_dhcp6_LDFLAGS += $(CQL_LIBS)
endif
kea_dhcp6dir
=
$(pkgdatadir)
kea_dhcp6_DATA
=
dhcp6.spec
if
GENERATE_PARSER
...
...
src/bin/dhcp6/tests/config_parser_unittest.cc
View file @
789611d2
...
...
@@ -7,7 +7,6 @@
#include <config.h>
#include <cc/command_interpreter.h>
#include <config/module_spec.h>
#include <dhcp/libdhcp++.h>
#include <dhcp/option6_ia.h>
#include <dhcp/iface_mgr.h>
...
...
@@ -209,17 +208,6 @@ const char* PARSER_CONFIGS[] = {
"}"
};
std
::
string
specfile
(
const
std
::
string
&
name
)
{
return
(
std
::
string
(
DHCP6_SRC_DIR
)
+
"/"
+
name
);
}
/// @brief Tests that the spec file is valid.
/// Verifies that the DHCP6 configuration specification file is valid.
TEST
(
Dhcp6SpecTest
,
basicSpec
)
{
ASSERT_NO_THROW
(
isc
::
config
::
moduleSpecFromFile
(
specfile
(
"dhcp6.spec"
)));
}
class
Dhcp6ParserTest
:
public
::
testing
::
Test
{
protected:
// Check that no hooks libraries are loaded. This is a pre-condition for
...
...
src/lib/config/Makefile.am
View file @
789611d2
...
...
@@ -13,9 +13,7 @@ s-messages: config_messages.mes
BUILT_SOURCES
=
config_messages.h config_messages.cc
lib_LTLIBRARIES
=
libkea-cfgclient.la
libkea_cfgclient_la_SOURCES
=
config_data.h config_data.cc
libkea_cfgclient_la_SOURCES
+=
cmds_impl.h
libkea_cfgclient_la_SOURCES
+=
module_spec.h module_spec.cc
libkea_cfgclient_la_SOURCES
=
cmds_impl.h
libkea_cfgclient_la_SOURCES
+=
base_command_mgr.cc base_command_mgr.h
libkea_cfgclient_la_SOURCES
+=
client_connection.cc client_connection.h
libkea_cfgclient_la_SOURCES
+=
command_mgr.cc command_mgr.h
...
...
@@ -53,7 +51,6 @@ libkea_cfgclient_include_HEADERS = \
command_mgr.h
\
config_data.h
\
config_log.h
\
hooked_command_mgr.h
\
module_spec.h
hooked_command_mgr.h
src/lib/config/module_spec.cc
deleted
100644 → 0
View file @
f7841a91
// Copyright (C) 2010-2017 Internet Systems Consortium.
//
// 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/module_spec.h>
#include <sstream>
#include <iostream>
#include <fstream>
#include <cerrno>
#include <boost/foreach.hpp>
// todo: add more context to thrown ModuleSpecErrors?
using
namespace
isc
::
data
;
using
namespace
isc
::
config
;
namespace
{
//
// Private functions
//
void
check_leaf_item
(
ConstElementPtr
spec
,
const
std
::
string
&
name
,
Element
::
types
type
,
bool
mandatory
)
{
if
(
spec
->
contains
(
name
))
{
if
(
type
==
Element
::
any
||
spec
->
get
(
name
)
->
getType
()
==
type
)
{
return
;
}
else
{
isc_throw
(
ModuleSpecError
,
name
+
" not of type "
+
Element
::
typeToName
(
type
));
}
}
else
if
(
mandatory
)
{
// todo: want parent item name, and perhaps some info about location
// in list? or just catch and throw new...
// or make this part non-throwing and check return value...
isc_throw
(
ModuleSpecError
,
name
+
" missing in "
+
spec
->
str
());
}
}
void
check_config_item_list
(
ConstElementPtr
spec
);
void
check_config_item
(
ConstElementPtr
spec
)
{
check_leaf_item
(
spec
,
"item_name"
,
Element
::
string
,
true
);
check_leaf_item
(
spec
,
"item_type"
,
Element
::
string
,
true
);
check_leaf_item
(
spec
,
"item_optional"
,
Element
::
boolean
,
true
);
check_leaf_item
(
spec
,
"item_default"
,
Element
::
nameToType
(
spec
->
get
(
"item_type"
)
->
stringValue
()),
!
spec
->
get
(
"item_optional"
)
->
boolValue
()
);
// if list, check the list specification
if
(
Element
::
nameToType
(
spec
->
get
(
"item_type"
)
->
stringValue
())
==
Element
::
list
)
{
check_leaf_item
(
spec
,
"list_item_spec"
,
Element
::
map
,
true
);
check_config_item
(
spec
->
get
(
"list_item_spec"
));
}
if
(
spec
->
get
(
"item_type"
)
->
stringValue
()
==
"map"
)
{
check_leaf_item
(
spec
,
"map_item_spec"
,
Element
::
list
,
true
);
check_config_item_list
(
spec
->
get
(
"map_item_spec"
));
}
else
if
(
spec
->
get
(
"item_type"
)
->
stringValue
()
==
"named_set"
)
{
check_leaf_item
(
spec
,
"named_set_item_spec"
,
Element
::
map
,
true
);
check_config_item
(
spec
->
get
(
"named_set_item_spec"
));
}
}
void
check_config_item_list
(
ConstElementPtr
spec
)
{
if
(
spec
->
getType
()
!=
Element
::
list
)
{
isc_throw
(
ModuleSpecError
,
"config_data is not a list of elements"
);
}
BOOST_FOREACH
(
ConstElementPtr
item
,
spec
->
listValue
())
{
check_config_item
(
item
);
}
}
// checks whether the given element is a valid statistics specification
// returns false if the specification is bad
bool
check_format
(
ConstElementPtr
value
,
ConstElementPtr
format_name
)
{
typedef
std
::
map
<
std
::
string
,
std
::
string
>
format_types
;
format_types
time_formats
;
// TODO: should be added other format types if necessary
time_formats
.
insert
(
format_types
::
value_type
(
"date-time"
,
"%Y-%m-%dT%H:%M:%SZ"
)
);
time_formats
.
insert
(
format_types
::
value_type
(
"date"
,
"%Y-%m-%d"
)
);
time_formats
.
insert
(
format_types
::
value_type
(
"time"
,
"%H:%M:%S"
)
);
BOOST_FOREACH
(
const
format_types
::
value_type
&
f
,
time_formats
)
{
if
(
format_name
->
stringValue
()
==
f
.
first
)
{
struct
tm
tm
;
std
::
vector
<
char
>
buf
(
32
);
memset
(
&
tm
,
0
,
sizeof
(
tm
));
// reverse check
return
(
strptime
(
value
->
stringValue
().
c_str
(),
f
.
second
.
c_str
(),
&
tm
)
!=
NULL
&&
strftime
(
&
buf
[
0
],
buf
.
size
(),
f
.
second
.
c_str
(),
&
tm
)
!=
0
&&
strncmp
(
value
->
stringValue
().
c_str
(),
&
buf
[
0
],
buf
.
size
())
==
0
);
}
}
return
(
false
);
}
void
check_statistics_item_list
(
ConstElementPtr
spec
);
void
check_statistics_item_list
(
ConstElementPtr
spec
)
{
if
(
spec
->
getType
()
!=
Element
::
list
)
{
isc_throw
(
ModuleSpecError
,
"statistics is not a list of elements"
);
}
BOOST_FOREACH
(
ConstElementPtr
item
,
spec
->
listValue
())
{
check_config_item
(
item
);
// additional checks for statistics
check_leaf_item
(
item
,
"item_title"
,
Element
::
string
,
true
);
check_leaf_item
(
item
,
"item_description"
,
Element
::
string
,
true
);
check_leaf_item
(
item
,
"item_format"
,
Element
::
string
,
false
);
// checks name of item_format and validation of item_default
if
(
item
->
contains
(
"item_format"
)
&&
item
->
contains
(
"item_default"
))
{
if
(
!
check_format
(
item
->
get
(
"item_default"
),
item
->
get
(
"item_format"
)))
{
isc_throw
(
ModuleSpecError
,
"item_default not valid type of item_format"
);
}
}
}
}
void
check_command
(
ConstElementPtr
spec
)
{
check_leaf_item
(
spec
,
"command_name"
,
Element
::
string
,
true
);
check_leaf_item
(
spec
,
"command_args"
,
Element
::
list
,
true
);
check_config_item_list
(
spec
->
get
(
"command_args"
));
}
void
check_command_list
(
ConstElementPtr
spec
)
{
if
(
spec
->
getType
()
!=
Element
::
list
)
{
isc_throw
(
ModuleSpecError
,
"commands is not a list of elements"
);
}
BOOST_FOREACH
(
ConstElementPtr
item
,
spec
->
listValue
())
{
check_command
(
item
);
}
}
void
check_data_specification
(
ConstElementPtr
spec
)
{
check_leaf_item
(
spec
,
"module_name"
,
Element
::
string
,
true
);
check_leaf_item
(
spec
,
"module_description"
,
Element
::
string
,
false
);