mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 13:37:55 +00:00
[trac983] added minimal set of files. right now this is mostly just a
placeholder for subsequent development.
This commit is contained in:
@@ -809,6 +809,8 @@ AC_CONFIG_FILES([Makefile
|
||||
src/lib/cc/tests/Makefile
|
||||
src/lib/python/Makefile
|
||||
src/lib/python/isc/Makefile
|
||||
src/lib/python/isc/acl/Makefile
|
||||
src/lib/python/isc/acl/tests/Makefile
|
||||
src/lib/python/isc/util/Makefile
|
||||
src/lib/python/isc/util/tests/Makefile
|
||||
src/lib/python/isc/datasrc/Makefile
|
||||
|
@@ -1,4 +1,4 @@
|
||||
SUBDIRS = datasrc cc config log net notify util testutils
|
||||
SUBDIRS = datasrc cc config log net notify util testutils acl
|
||||
|
||||
python_PYTHON = __init__.py
|
||||
|
||||
|
20
src/lib/python/isc/acl/Makefile.am
Normal file
20
src/lib/python/isc/acl/Makefile.am
Normal file
@@ -0,0 +1,20 @@
|
||||
SUBDIRS = . tests
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
|
||||
#Do we need boost?
|
||||
#AM_CPPFLAGS += $(BOOST_INCLUDES)
|
||||
AM_CXXFLAGS = $(B10_CXXFLAGS)
|
||||
|
||||
pyexec_LTLIBRARIES = dns.la
|
||||
dns_la_SOURCES = dns.cc
|
||||
dns_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_INCLUDES)
|
||||
dns_la_LDFLAGS = $(PYTHON_LDFLAGS)
|
||||
# Note: PYTHON_CXXFLAGS may have some -Wno... workaround, which must be
|
||||
# placed after -Wextra defined in AM_CXXFLAGS
|
||||
acl_la_CXXFLAGS = $(AM_CXXFLAGS) $(PYTHON_CXXFLAGS)
|
||||
|
||||
# Python prefers .so, while some OSes (specifically MacOS) use a different
|
||||
# suffix for dynamic objects. -module is necessary to work this around.
|
||||
dns_la_LDFLAGS += -module
|
||||
dns_la_LIBADD = $(top_builddir)/src/lib/acl/libacl.la
|
||||
dns_la_LIBADD += $(PYTHON_LIB)
|
3
src/lib/python/isc/acl/__init__.py
Normal file
3
src/lib/python/isc/acl/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
"""
|
||||
Here are function and classes for manipulating access control lists.
|
||||
"""
|
38
src/lib/python/isc/acl/dns.cc
Normal file
38
src/lib/python/isc/acl/dns.cc
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2011 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
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
namespace {
|
||||
PyModuleDef dnsacl = {
|
||||
{ PyObject_HEAD_INIT(NULL) NULL, 0, NULL},
|
||||
"acl",
|
||||
"This module provides Python bindings for the C++ classes in the "
|
||||
"isc::acl::dns namespace. Specifically, it defines Python interfaces of "
|
||||
"handling access control lists (ACLs) with DNS related contexts.\n\n"
|
||||
"These bindings are close match to the C++ API, but they are not complete "
|
||||
"(some parts are not needed) and some are done in more python-like ways.",
|
||||
-1,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
} // end of unnamed namespace
|
||||
|
||||
PyMODINIT_FUNC
|
||||
PyInit_dns(void) {
|
||||
return (PyModule_Create(&dnsacl));
|
||||
}
|
33
src/lib/python/isc/acl/dns.py
Normal file
33
src/lib/python/isc/acl/dns.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# Copyright (C) 2011 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
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM
|
||||
# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
|
||||
# INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
|
||||
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# This file is not installed. The log.so is installed into the right place.
|
||||
# It is only to find it in the .libs directory when we run as a test or
|
||||
# from the build directory.
|
||||
# But as nobody gives us the builddir explicitly (and we can't use generation
|
||||
# from .in file, as it would put us into the builddir and we wouldn't be found)
|
||||
# we guess from current directory. Any idea for something better? This should
|
||||
# be enough for the tests, but would it work for B10_FROM_SOURCE as well?
|
||||
# Should we look there? Or define something in bind10_config?
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
for base in sys.path[:]:
|
||||
bindingdir = os.path.join(base, 'isc/acl/.libs')
|
||||
if os.path.exists(bindingdir):
|
||||
sys.path.insert(0, bindingdir)
|
||||
|
||||
from dns import *
|
30
src/lib/python/isc/acl/tests/Makefile.am
Normal file
30
src/lib/python/isc/acl/tests/Makefile.am
Normal file
@@ -0,0 +1,30 @@
|
||||
PYCOVERAGE_RUN = @PYCOVERAGE_RUN@
|
||||
PYTESTS = dns_test.py
|
||||
|
||||
EXTRA_DIST = $(PYTESTS)
|
||||
|
||||
# If necessary (rare cases), explicitly specify paths to dynamic libraries
|
||||
# required by loadable python modules.
|
||||
LIBRARY_PATH_PLACEHOLDER =
|
||||
if SET_ENV_LIBRARY_PATH
|
||||
LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/acl/.libs:$(abs_top_builddir)/src/lib/cc/.libs:$(abs_top_builddir)/src/lib/config/.libs:$(abs_top_builddir)/src/lib/log/.libs:$(abs_top_builddir)/src/lib/util/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$$$(ENV_LIBRARY_PATH)
|
||||
endif
|
||||
|
||||
# test using command-line arguments, so use check-local target instead of TESTS
|
||||
check-local:
|
||||
if ENABLE_PYTHON_COVERAGE
|
||||
touch $(abs_top_srcdir)/.coverage
|
||||
rm -f .coverage
|
||||
${LN_S} $(abs_top_srcdir)/.coverage .coverage
|
||||
endif
|
||||
for pytest in $(PYTESTS) ; do \
|
||||
echo Running test: $$pytest ; \
|
||||
env PYTHONPATH=$(abs_top_builddir)/src/lib/isc/python/acl/.libs:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \
|
||||
$(LIBRARY_PATH_PLACEHOLDER) \
|
||||
$(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \
|
||||
done
|
||||
|
||||
CLEANDIRS = __pycache__
|
||||
|
||||
clean-local:
|
||||
rm -rf $(CLEANDIRS)
|
25
src/lib/python/isc/acl/tests/dns_test.py
Normal file
25
src/lib/python/isc/acl/tests/dns_test.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Copyright (C) 2011 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
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM
|
||||
# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
|
||||
# INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
|
||||
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import unittest
|
||||
from isc.acl.dns import *
|
||||
|
||||
class DNSACLTest(unittest.TestCase):
|
||||
|
||||
def test_placeholder(self):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Reference in New Issue
Block a user