forked from invite-networks/kea_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Release/v1.2.0 #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Added new Dockerfiles: - containers/dhtest/Dockerfile - containers/kea-python-dev/Dockerfile - containers/kea-python/Dockerfile - Removed outdated Dockerfiles: - Dockerfile - DockerfileDev - dhtest/Dockerfile
…ttest - Replaced all `self.assertRaises` and `self.assertEqual` with `pytest.raises` and `assert` respectively - Ensured all assertion messages are correctly matched with `match` in `pytest.raises` - Updated test methods to use `pytest` syntax - Added `import pytest` where necessary - Updated test scripts to be compatible with Python 3.11
…on versions The commit updates several pytest assertions in the test cases to match both possible error messages for `TypeError` that can occur in different Python versions. - Updated `test_badarg_type` in `test_callout_handle.py` to match both "an integer is required" and "object cannot be interpreted as an integer". - Applied similar updates to `test_option.py` for various methods. - Made equivalent changes in `test_pkt4.py` to ensure compatibility. - Modified `utils.py` to align with the updated test patterns for method argument validation.
…adability - Removed @unittest.skip decorators from test_empty and test_filled methods
…t management - Split `HostMgr_get` into `HostMgr_get4` and `HostMgr_get4Any` for clearer differentiation. - Updated method signatures to include `HostMgrOperationTarget` for enhanced targeting flexibility. - Added new method `HostMgr_get4` to retrieve hosts by address. - Added new method `HostMgr_get4Any` to retrieve hosts by (identifier_type, identifier). - Improved `HostMgr_get4Any` to handle (subnet4-id, identifier) retrievals. - Fix `HostMgr_getAll4` to accept an optional `HostMgrOperationTarget` parameter.
The previous commit contained errors in the function references for the HostMgr methods. Specifically: - The method reference for "get4Any" was incorrectly set to HostMgr_get instead of HostMgr_get4Any. - The method reference for "getAll4" was incorrectly set to HostMgr_get4Any instead of HostMgr_getAll4. These issues have been corrected to ensure the proper functioning of the methods: - Updated "get4Any" to use the correct reference: HostMgr_get4Any. - Updated "getAll4" to use the correct reference: HostMgr_getAll4. This fix ensures that the methods return the expected hosts in a DHCPv4 subnet.
- Removed unnecessary try-catch block in `HostMgr_instance` method for better performance and simpler code. - Changed `HostMgr_instance` to increment reference count and return self, ensuring singleton pattern adherence. - Introduced `HostMgr_new` method to handle custom singleton instantiation, replacing the previous constructor method. - Added `kea__loggerInit` method in kea module to initialize the logger, aiding in debugging and testing. - Updated `test_host_mgr.py` with new tests for the singleton pattern, argument validation, and method functionality.
…istency
- Merged single-line catch blocks for better readability.
- Adjusted spacing around references to improve code style.
- Consolidated clang-format off/on directives around method definitions and struct initializations.
- Replaced old sentinel `{0}` with `{NULL, NULL, 0, NULL}` for method arrays.
- Added `HostMgr_dealloc` method and included it in `HostMgrType` struct.
- Updated `HostMgrType` struct initialization to the modern PyTypeObject format.
- Removed commented out `HostMgr_init` function.
- Introduced `.clang-format` file with settings based on Google style adapted to PEP 7 recommendations. - Set `AlwaysBreakAfterReturnType` to `All`. - Disabled `ColumnLimit`. - Configured `IndentWidth` to 4 spaces. - Specified `Language` as C++. - Aligned pointers to the right. - Disabled space after C-style casts. - Added `.pre-commit-config.yaml` file to support pre-commit hooks for automatic code style checks.
- Modified `PyInit_kea` function to improve error handling and readability. - Updated functions to follow a consistent naming convention (`*_registerType`).
- Modified `HostMgr_instance` to ensure it returns a sole instance of `HostMgr`. - Added static allocation for `HostMgr` instance. - Updated method definition in `HostMgr_methods` to include `METH_STATIC`. - Refactored `HostMgr_new` to call `HostMgr_instance`. - Updated tests to validate singleton behavior and correct instance type. Changes ensure proper singleton pattern and method consistency.
- Introduced singleton pattern for CfgMgr instance management. - Added methods to get and set the data directory: - `CfgMgr_getDataDir` retrieves the current data directory. - `CfgMgr_setDataDir` sets a new data directory. - Enhanced existing methods to utilize the singleton instance: - Updated `CfgMgr_getCurrentCfg` to use `self->cfg_mgr->getCurrentCfg()`. - Updated `CfgMgr_getStagingCfg` to use `self->cfg_mgr->getStagingCfg()`. - Added detailed docstrings for all methods: - Documented the purpose and usage of each method for better clarity. - Refactored `CfgMgr_new` and `CfgMgr_dealloc` functions for cleaner memory management. - Applied clang-format for consistent code styling.
- Introduced `KEA_VERSION` string constant in keamodule initialization. - Refactored `test_pkt4.py`: - Split `test_empty` and `test_filled` into `test_Pkt4_toText_empty` and `test_Pkt4_toText_filled`. - Utilized `check_kea_version` for version-dependent assertions. - Adjusted formatting and comments for better readability. - Enhanced `utils.py` with `check_kea_version` function to compare KEA versions.
…obustness and readability - **cfg_mgr.cc**: - Replaced `const_cast` with direct conversion for `datadir`. - Enhanced UTF-8 string handling with error checking in `CfgMgr_getDataDir`. - Corrected minor formatting issues. - **test_cfg_mgr.py**: - Migrated from custom `utils.BaseTestCase` to `pytest` framework for better test management. - Added `cfg_mgr` fixture for consistent `CfgMgr` instance across tests. - Implemented `test_CfgMgr_singleton` and `test_CfgMgr_instance` to verify singleton behavior. - Parametrized tests for method argument validation in `test_CfgMgr_method_bad_args`. - Included tests for `getDataDir`, `setDataDir`, `getCurrentCfg`, and `getStagingCfg` to ensure proper functionality and type safety. These changes aim to enhance code clarity, error handling, and test coverage.
This commit modernizes and restructures the Dockerfile setup for better organization and maintainability. Following the guidelines from issue #5, Dockerfiles have been moved from the project root into container-specific directories. Key changes include: - Moved `Dockerfile` and `DockerfileDev` to `containers/kea-python-dev/` and `containers/kea-python/` respectively. - `dhtest/Dockerfile` has been relocated to `containers/dhtest/`. - Updated paths in Makefile.am and devcontainer configurations to reflect the new directory structure.
…ries Update container specific directories
- Added new Dockerfiles: - containers/dhtest/Dockerfile - containers/kea-python-dev/Dockerfile - containers/kea-python/Dockerfile - Removed outdated Dockerfiles: - Dockerfile - DockerfileDev - dhtest/Dockerfile
This commit modernizes and restructures the Dockerfile setup for better organization and maintainability. Following the guidelines from issue #5, Dockerfiles have been moved from the project root into container-specific directories. Key changes include: - Moved `Dockerfile` and `DockerfileDev` to `containers/kea-python-dev/` and `containers/kea-python/` respectively. - `dhtest/Dockerfile` has been relocated to `containers/dhtest/`. - Updated paths in Makefile.am and devcontainer configurations to reflect the new directory structure.
…e to best practices - Updated HostMgr_instance function to properly use Py_UNUSED macro for unused parameters. - Removed commented out code and unused variable declarations for cleaner code. - Corrected clang-format comments to align with the new style. - Updated test function names in test_cfg_mgr.py and test_host_mgr.py for clarity and consistency. - Enhanced test assertions with descriptive error messages for better debugging. - Added new parameterized test cases for invalid arguments in CfgMgr and HostMgr methods.
- Updated Host_toElement function to return NULL instead of 0 on error. - Added Host_getIdentifier function to retrieve host identifier as a string. - Introduced Host_str function for better string representation of Host object. - Enhanced Host_init function for clearer error handling. - Updated HostType definition to align with the latest standards and added string representation method. - Added new test_host.py file with comprehensive unit tests for Host class. - Included tests for getHostId, toElement, getIdentifier, use_count, and __str__ methods.
Update kea-python to support kea 2.6.0
- Renamed package to `kea-python` for consistency with distribution naming - Set full semantic version to 1.2.0 - Added maintainer email and package identifier to AC_INIT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 37 out of 45 changed files in this pull request and generated no comments.
Files not reviewed (8)
- .devcontainer/devcontainer.json: Language not supported
- Dockerfile: Language not supported
- DockerfileDev: Language not supported
- Makefile.am: Language not supported
- configure.ac: Language not supported
- containers/kea-python-dev/Dockerfile: Language not supported
- containers/kea-python/Dockerfile: Language not supported
- keamodule/Makefile.am: Language not supported
Comments suppressed due to low confidence (1)
keamodule/host_mgr.cc:200
- The previous usage mistakenly separated the 'target' parameter using the comma operator. Please confirm that passing 'target' as an argument within the function call (as now implemented) correctly fixes the intended behavior.
if (self->mgr->del4(subnet_id, Host::getIdentifierType(identifier_type), &binary.front(), binary.size(), target)) {
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.