Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e844b62
Refactor Makefile.am to include additional setup.py targets
jgmel Jun 30, 2024
f5d2498
Refactor Dockerfile structure for container-specific directories
jgmel Jun 30, 2024
1f18d7b
Issue #4 Refactored tests to use pytest for assertions instead of uni…
jgmel Jun 30, 2024
5c9b997
Issue #4 update test assertions for compatibility with different Pyth…
jgmel Jun 30, 2024
b7b00de
Issue #4 refactor test cases in TestPkt4_toText class for improved re…
jgmel Jun 30, 2024
4423260
Issue #4 refactor and enhance HostMgr methods for improved IPv4 subne…
jgmel Jul 15, 2024
f677f07
Fix #4 incorrect function references in previous commit
jgmel Jul 15, 2024
797ab39
Issue #4 refactored HostMgr to improve memory management.
jgmel Jul 15, 2024
fc82115
Issue #4 refactor `host_mgr.cc` for improved code formatting and cons…
jgmel Jul 16, 2024
c3196db
Add .clang-format and .pre-commit-config.yaml for code style enforcement
jgmel Jul 16, 2024
6da3720
Refactored keamodule: Improved code readability and consistency
jgmel Jul 16, 2024
6ca395f
Issue #4 restored `HostMgr_instance` to be a static method.
jgmel Jul 21, 2024
53c538e
Issue #4 refactor and extend CfgMgr Python bindings
jgmel Jul 21, 2024
8f9ba3a
Added KEA version constant and refactored Pkt4 toToxt tests
jgmel Jul 22, 2024
ced546c
Issue #4 refactored `cfg_mgr.cc` and `test_cfg_mgr.py` for improved r…
jgmel Jul 22, 2024
9fb5d44
Issue #5 :Refactor and centralize Dockerfiles into specific directories
jgmel Jul 23, 2024
d7f68d6
Merge pull request #7 from phicus/update/5-container-specific-directo…
jgmel Jul 23, 2024
c182a98
Refactor Dockerfile structure for container-specific directories
jgmel Jun 30, 2024
ac97ddd
Issue #5 :Refactor and centralize Dockerfiles into specific directories
jgmel Jul 23, 2024
9cdb0c6
Refactored #4 HostMgr and test cases to improve readability and adher…
jgmel Jul 23, 2024
1a47d8c
Issue #4 refactored Host class and added comprehensive unit tests
jgmel Jul 23, 2024
f965cc0
Merge pull request #8 from phicus/update/4-upgrade-kea-260
jgmel Sep 14, 2024
5554315
bump version 1.2
jgmel Oct 1, 2024
5e260ea
chore(release): Update package version to v1.2.0
jgmel Apr 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# PEP 7
BasedOnStyle: Google
AlwaysBreakAfterReturnType: All
ColumnLimit: 0
IndentWidth: 4
Language: Cpp
PointerAlignment: Right
SpaceAfterCStyleCast: false
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Python KEA Development",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
"dockerfile": "../containers/kea-python-dev/Dockerfile",
"context": "..",
"args": {
"BASE_OS_VERSION": "ubuntu-20.04",
"ARG PYTHON_VERSION": "3.8",
"ARG KEA_VERSION": "2.6.0"
}
},

"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack"
]
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root"
}
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v18.1.8' # Use the sha / tag you want to point at
hooks:
- id: clang-format
types_or: [c++, c]
30 changes: 0 additions & 30 deletions Dockerfile

This file was deleted.

37 changes: 0 additions & 37 deletions DockerfileDev

This file was deleted.

19 changes: 11 additions & 8 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ AUTOMAKE_OPTIONS = foreign

SUBDIRS = keahook keamodule

KEA_VESION ?= 2.4.1
KEA_VERSION ?= 2.6.0
CONTAINER_RUNTIME ?= $(if $(shell command -v podman ;),podman,docker)

.PHONY: build-kea-dev
build-kea-dev:
$(CONTAINER_RUNTIME) build --build-arg KEA_VESION=$(KEA_VESION) -f DockerfileDev --tag kea-dev:$(KEA_VESION) .
$(CONTAINER_RUNTIME) build -f containers/kea-python-dev/Dockerfile --build-arg KEA_VERSION=$(KEA_VERSION) --tag kea-dev:$(KEA_VERSION) .

.PHONY: build-kea
build-kea:
$(CONTAINER_RUNTIME) build --build-arg KEA_VESION=$(KEA_VESION) --tag kea:$(KEA_VESION) .
$(CONTAINER_RUNTIME) build -f containers/kea-python/Dockerfile --build-arg KEA_VERSION=$(KEA_VERSION) --tag kea:$(KEA_VERSION) .

.PHONY: build-dhtest
build-dhtest:
cd dhtest && $(CONTAINER_RUNTIME) build --tag dhtest .
$(CONTAINER_RUNTIME) build -f containers/dhtest/Dockerfile --tag dhtest .

.PHONY: run-kea-dev
run-kea-dev: kea-network
$(CONTAINER_RUNTIME) run --rm -it --network kea -e LANG=C.UTF-8 --privileged -v`pwd`:/workdir --name kea-dev kea-dev:$(KEA_VESION) bash
$(CONTAINER_RUNTIME) run --rm -it --network kea -e LANG=C.UTF-8 --privileged -v`pwd`:/workdir --name kea-dev kea-dev:$(KEA_VERSION) bash

.PHONY: run-kea
run-kea: kea-network
$(CONTAINER_RUNTIME) run --rm -it --network kea -e LANG=C.UTF-8 --privileged -v`pwd`:/workdir --name kea kea:$(KEA_VESION) bash
$(CONTAINER_RUNTIME) run --rm -it --network kea -e LANG=C.UTF-8 --privileged -v`pwd`:/workdir --name kea kea:$(KEA_VERSION) bash

.PHONY: run-mysql
run-mysql: kea-network dhcpdb_create.mysql.sql
Expand All @@ -48,5 +48,8 @@ kea-network:

.PHONY: dhcpdb_create.mysql.sql
dhcpdb_create.mysql.sql:
tar xz --strip-components 6 -f kea-$(KEA_VESION).tar.gz kea-$(KEA_VESION)/src/share/database/scripts/mysql/dhcpdb_create.mysql
mv dhcpdb_create.mysql dhcpdb_create.mysql.sql
tar xz --strip-components 6 -f kea-$(KEA_VERSION).tar.gz kea-$(KEA_VERSION)/src/share/database/scripts/mysql/dhcpdb_create.mysql
mv dhcpdb_create.mysql dhcpdb_create.mysql.sql

install-exec-hook:
cd $(srcdir)/keamodule && $(MAKE) install
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT(kea_python, 1.1)
AC_INIT([kea-python], [1.2.0], [jgomez@phicus.es], [kea-python])

AM_INIT_AUTOMAKE(foreign)

Expand Down
File renamed without changes.
49 changes: 49 additions & 0 deletions containers/kea-python-dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# SPDX-License-Identifier: MPL-2.0

ARG BASE_OS_VERSION=ubuntu-20.04
FROM mcr.microsoft.com/vscode/devcontainers/cpp:${BASE_OS_VERSION}

ARG PYTHON_VERSION=3.8
ARG KEA_VERSION=2.6.0

LABEL org.opencontainers.image.authors="Juan Gomez <jgomez@phicus.es>"

ENV DEBIAN_FRONTEND=noninteractive \
BASE_OS_VERSION=${BASE_OS_VERSION} \
PYTHON_VERSION=${PYTHON_VERSION} \
KEA_VERSION=${KEA_VERSION}


RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install --no-install-recommends -y \
software-properties-common \
apt-transport-https \
apt-utils \
bash \
ca-certificates \
curl \
gnupg \
&& add-apt-repository -y ppa:deadsnakes/ppa \
&& curl -1sLf "https://dl.cloudsmith.io/public/isc/kea-$(echo "${KEA_VERSION}" | cut -c1;)-$(echo "${KEA_VERSION}" | cut -c3;)/setup.deb.sh" | bash \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
autoconf \
automake \
autoconf-archive \
libtool \
libffi-dev \
libboost-dev \
libboost-system-dev \
make \
g++ \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
python3-pip \
isc-kea-dev \
isc-kea-hooks \
isc-kea-dhcp4 \
# Clean up to reduce image size
&& apt-get clean \
&& rm -rf /etc/apt/sources.list.d/isc-kea-* /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1
38 changes: 38 additions & 0 deletions containers/kea-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
ARG KEA_VERSION=2.6.0

FROM kea-dev:$KEA_VERSION AS build

WORKDIR /source
COPY . .

# RUN make clean install \
# && mkdir /dist \
# && cd /usr/local \
# && find lib -name \*.so\* | tar cf - -T - | (cd /dist; tar xf -) \
# && tar cf - etc share/man bin sbin var | (cd /dist; tar xf -)

RUN autoreconf -i && \
./configure --prefix=/usr --libdir=${prefix}/lib/x86_64-linux-gnu --libexecdir=${prefix}/lib/x86_64-linux-gnu && \
make install

# FROM ubuntu:21.04
# ENV DEBIAN_FRONTEND noninteractive

# RUN apt-get update -y \
# && apt-get -y install \
# procps \
# socat \
# python3 \
# libpython3.9 \
# liblog4cplus-2.0.5 \
# libboost-system1.74.0 \
# libffi8ubuntu1 \
# libpq5 \
# libmariadb3

# COPY --from=build /dist /usr/local

# RUN ldconfig


# podman build -f ./containers/kea-python/Dockerfile --build-arg KEA_VERSION=2.6.0 -t kea-python:2.6.0 -t kea-python . && podman run -it kea-python bash
15 changes: 13 additions & 2 deletions keamodule/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@

install:
$(PYTHON) setup.py install

EXTRA_DIST = setup.py

install: setup.py
$(PYTHON) setup.py install

all-local: setup.py
$(PYTHON) setup.py build

clean-local: setup.py
-$(PYTHON) setup.py clean --all
-find $(srcdir) \( -name "build" -o -name "dist" -o -name "*.pyc" \
-o -name "*.egg-info" \) -exec rm -rf '{}' \+
Loading