Commit Graph

83 Commits

Author SHA1 Message Date
IluaAir
3c0e70b320 Update project configuration and dependencies
- Added `.vscode` to `.gitignore` to exclude Visual Studio Code settings.
- Updated `pyproject.toml` to include `ruff` for linting and configured its settings.
- Modified `uv.lock` to include `ruff` in both optional and development dependencies.
- Refactored type hints in several files to use `str | None` for optional parameters.
- Cleaned up unused imports and whitespace in various modules for improved code clarity.
2026-06-11 23:47:39 +03:00
IluaAir
c40cae1561 Update dependencies and clean up Huawei model code
- Updated `pytest` to version 9.0.3 and `responses` to version 0.26.1 in `pyproject.toml`.
- Removed the main execution block from the Huawei model for cleaner code structure.
2026-06-11 23:22:45 +03:00
7b09612313 Merge pull request 'test' (#2) from test into dev
Reviewed-on: #2
2026-06-11 16:22:05 +03:00
IluaAir
8edd1a296c Add H3C device support with configuration and expected output files
- Introduced support for H3C devices by adding a new configuration file `config.conf` containing interface and VLAN settings.
- Created an expected output JSON file `config.expected.json` to validate the parsing of H3C configurations.
- Updated the test model cases to include H3C for comprehensive testing of device parsing functionality.
2026-06-11 16:16:14 +03:00
IluaAir
686cd6d715 Remove main execution block from Quasar model and add configuration files for testing
- Eliminated the main execution block from the Quasar model for cleaner code.
- Introduced new configuration files `config_1.conf` and `config_2.conf` for Quasar devices, detailing interface settings and IP configurations.
- Added expected output JSON files `config_1.expected.json` and `config_2.expected.json` to validate the parsing of Quasar configurations against expected results.
2026-06-07 09:12:47 +03:00
IluaAir
acb3a6291c Add expected configuration output for Mikrotik devices
- Introduced a new JSON file `config.expected.json` containing expected system and interface configurations for Mikrotik devices, including model, serial number, IP addresses, and VLAN details.
- This addition facilitates testing and validation of the parsing functionality for Mikrotik configurations.
2026-06-07 09:07:17 +03:00
IluaAir
9c90279868 Add normalization method for TTP group results in BaseDevice class
- Introduced a static method `_as_list` to normalize TTP group results, ensuring consistent list output regardless of input type (dict or list).
- Updated the `_validate_contract` method to utilize `_as_list` for processing interfaces and VLANs, improving code clarity and reliability.
2026-06-07 09:06:52 +03:00
IluaAir
2ea056aa17 Refactor Mikrotik model and update TTP template for improved configuration handling
- Removed unused imports and main execution block from the Mikrotik model for cleaner code.
- Updated the Mikrotik TTP template to adjust the order of parameters in the 'add' command, enhancing clarity in the generated configurations.
- Added a new configuration file `config.conf` for Mikrotik devices to facilitate testing and validation of parsing functionality.
2026-06-07 09:06:24 +03:00
IluaAir
a617bd6ecd Add description fields to Eltex interface template
- Updated the Eltex TTP template to include 'name' and 'description' fields for interfaces, enhancing clarity and detail in the generated configurations.
2026-06-07 08:47:51 +03:00
IluaAir
0ef5e7798a Refactor Qtech model to utilize centralized VLAN range expansion utility
- Replaced the internal `_expand_vlan_range` function in the `Qtech` class with the new `expand_vlan_range` utility from `utils.py` for improved code maintainability.
- Added new configuration files `config_1.conf` and `config_2.conf` for Qtech devices to facilitate testing.
- Introduced expected output JSON files `config_1.expected.json` and `config_2.expected.json` to validate the parsing of Qtech configurations against expected results.
2026-06-07 08:47:08 +03:00
IluaAir
1bc01c9c1b Add Huawei configuration files for testing
- Introduced a new configuration file `config.conf` for Huawei devices, detailing interface settings and VLAN configurations.
- Added an expected output JSON file `config.expected.json` to validate the parsing of Huawei configurations against expected results, including system model, serial number, and interface details.
2026-06-07 08:44:35 +03:00
IluaAir
170a2ebf85 Refactor Eltex model to use centralized VLAN range expansion utility
- Replaced the internal `_expand_vlan_range` function in the `Eltex` class with the new `expand_vlan_range` utility from `utils.py` for improved code maintainability.
- Added a new configuration file `config.conf` for Eltex devices to facilitate testing.
- Introduced an expected output JSON file `config.expected.json` to validate the parsing of Eltex configurations against expected results.
2026-06-07 08:42:58 +03:00
IluaAir
168111e23c Refactor Keenetic model to utilize centralized UTF-8 decoding utility
- Removed the internal `_decode_utf` method from the `Keenetic` class and replaced its usage with the new `decode_utf` utility function for decoding interface descriptions.
- Added a new configuration file `config.conf` for Keenetic devices to facilitate testing.
- Introduced an expected output JSON file `config.expected.json` to validate the parsing of Keenetic configurations against expected results.
2026-06-07 08:41:59 +03:00
IluaAir
d329ddc4ad Add unit tests for device registry model parsing
- Introduced a new test file `test_models.py` to implement unit tests for various device models in the `device_registry`.
- Added parameterized tests to validate the parsing of device configurations against expected JSON outputs and to ensure required sections are present in the parsed models.
- Enhanced test coverage for multiple device types including Mikrotik, Keenetic, Qtech, Huawei, Eltex, and Quasar.
2026-06-06 13:55:51 +03:00
IluaAir
229bef99f6 Add UTF-8 decoding utility and corresponding unit tests
- Introduced a new utility function `decode_utf` in `utils.py` to decode escaped UTF-8 descriptions.
- Updated unit tests in `test_units.py` to include tests for the `decode_utf` function, covering plain text and escaped UTF-8 scenarios.
- Refactored existing tests to streamline the usage of the `expand_vlan_range` function.
2026-06-06 13:55:01 +03:00
IluaAir
f446ae52e7 Add VLAN range expansion utility and corresponding unit tests
- Introduced a new utility function `expand_vlan_range` in `utils.py` to expand VLAN range strings into individual VLAN IDs.
- Created a new test file `test_units.py` with unit tests for the `expand_vlan_range` function, covering various scenarios including simple ranges, reversed ranges, non-numeric inputs, and list inputs.
- Enhanced test coverage for other functionalities in the `device_registry` and template validation classes.
2026-06-06 13:49:55 +03:00
IluaAir
c4f20d3241 Update Huawei TTP template to include model information in version display
- Modified the Huawei TTP template to append the model identifier to the version string, enhancing the clarity of system information output for diagnostics.
2026-06-06 11:13:50 +03:00
IluaAir
bebbe78163 Add unit tests for OxiAPI node functionality
- Introduced a new test file `test_network.py` to implement unit tests for the `OxiAPI` class.
- Added tests for node retrieval, configuration fetching, error handling for missing nodes, and response status checks.
- Utilized the `responses` library to mock API responses for comprehensive testing of various scenarios, including successful retrieval and error cases.
2026-06-06 11:13:32 +03:00
IluaAir
a55fc938f0 Add optional dependencies for development and update .gitignore
- Added `.DS_Store` to `.gitignore` to prevent macOS system files from being tracked.
- Introduced optional development dependencies in `pyproject.toml`, including `pytest` and `responses`, to facilitate testing and development.
- Updated `uv.lock` with new package dependencies and versions for improved compatibility and functionality.
- Created new test files `conftest.py` and `test_view.py` to establish testing fixtures and implement unit tests for the `ModelView` class.
2026-06-06 11:06:03 +03:00
5bb69dfee3 Merge pull request 'documentation' (#1) from documentation into dev
Reviewed-on: #1
2026-05-29 15:55:32 +03:00
IluaAir
494cc9b08b Update project repository URL and simplify installation instructions in README.md
- Added a repository URL section in `pyproject.toml` to link to the GitHub repository.
- Updated installation instructions in `README.md` to reflect the change from Gitea to GitHub as the source for package installation, removing references to the private Gitea Package Registry.
2026-05-29 15:53:24 +03:00
IluaAir
2a03240414 Update setuptools version and modify license information in pyproject.toml
- Updated the required setuptools version from 61 to 77 to ensure compatibility with the latest features and improvements.
- Changed the license format in `pyproject.toml` to specify "Apache-2.0" directly and added a reference to the license file for clarity.
2026-05-28 15:55:20 +03:00
IluaAir
41c4cc48e9 Update project description and enhance documentation for clarity
- Revised the project description in `pyproject.toml` to better reflect the functionality of the `oxipy` client.
- Improved the README.md by adding detailed explanations of the project structure, installation instructions, and usage examples.
- Updated documentation files to enhance clarity and organization, including sections on extending models and writing TTP templates.
- Adjusted various TTP templates to ensure consistency and accuracy in the parsing of device configurations.
2026-05-25 16:01:38 +03:00
IluaAir
e8c33b0e64 Add VLAN range expansion utility and improve VLAN processing in Qtech model
- Introduced a new helper function `_expand_vlan_range` to convert VLAN range strings into a list of individual VLAN IDs.
- Enhanced the `vlans` method in the `Qtech` class to utilize the new function, improving the handling of VLAN IDs and ensuring proper processing of both individual and range-based VLAN inputs.
2026-05-25 15:41:50 +03:00
IluaAir
74647bea5b Update Huawei TTP template for improved system information display
- Modified the Huawei TTP template to enhance the system information output by including the line identifier and slot number alongside the version and serial number. This change aims to provide clearer context for system diagnostics.
2026-04-27 15:39:23 +03:00
IluaAir
5a4cfa18d4 Update Python version requirement and clean up imports
- Changed the required Python version in `pyproject.toml` from 3.11 to 3.10 to broaden compatibility.
- Removed an unused import from `oxi/conf.py` to streamline the code and improve readability.
2026-04-27 09:50:22 +03:00
IluaAir
5fa56d46af Enhance BaseDevice initialization and error handling
- Updated the `BaseDevice` class constructor to accept an optional `name` parameter for better context in error messages.
- Improved the `_validate_contract` method to raise an `OxiAPIError` with a descriptive message if the node is not found.
- Modified the `_run_ttp` method to include a check for node existence, returning `None` if not found.
- Changed the test file name in the `Eltex` model to reflect a more descriptive context for testing node not found scenarios.
2026-04-18 19:21:25 +03:00
IluaAir
9fd0ce1516 Implement enhanced error detection for NodeNotFound in OxiAPIError
- Added a new helper function `_looks_like_node_not_found_html` to identify NodeNotFound errors based on HTTP response content.
- Updated the `from_http_error` method in the `OxiAPIError` class to convert 500 status codes to 404 when a NodeNotFound error is detected, improving error handling and user feedback.
2026-04-17 20:45:16 +03:00
IluaAir
0b92e342e5 Enhance error handling in OxiAPI and Node classes
- Updated the `reload` method in the `OxiAPI` class to catch `HTTPError` exceptions and raise a custom `OxiAPIError` with context.
- Improved the `__call__` method in the `Node` class to handle `HTTPError` exceptions similarly, providing context-specific error messages.
- Introduced a new class method `from_http_error` in `OxiAPIError` for standardized error message generation based on HTTP status codes.
2026-03-26 20:10:05 +03:00
IluaAir
1cc225917e Add OxiApi create_session method for better view 2026-03-26 19:51:51 +03:00
IluaAir
61892d8f51 Add OxiAPIError exception class for improved error handling
- Introduced a new `OxiAPIError` class to standardize error reporting in the OxiAPI.
- The class includes an optional status code for enhanced context in error messages.
2026-03-26 00:39:43 +03:00
IluaAir
8cebbf743a Add OxiAdapter for enhanced HTTP request handling in OxiAPI
- Introduced a new `OxiAdapter` class that extends `HTTPAdapter` to manage timeouts and retries for HTTP requests.
- Integrated the `OxiAdapter` into the `OxiAPI` class, setting a default timeout and enabling retry logic for both HTTP and HTTPS requests.
2026-03-26 00:31:13 +03:00
IluaAir
a107662e99 Enhance OxiAPI and Node classes with type hints and property updates
- Updated the `OxiAPI` class to check for `None` explicitly when setting authentication credentials.
- Added type hints to the `Node` class and introduced a TODO for future enhancements.
- Refactored properties in the `NodeView` class to include type hints and improved handling of optional data retrieval.
2026-03-18 00:17:14 +03:00
IluaAir
1d0f5ed685 Refactor Quasar model by removing system method and updating TTP template
- Removed the `system` method from the `Quasar` model to streamline system information handling.
- Updated the TTP template to enhance the formatting of system details, including version and product information, for improved clarity and organization.
2026-03-18 00:01:22 +03:00
IluaAir
5b8380aeee Add system method to Quasar model and update TTP template
- Implemented a new `system` method in the `Quasar` model to extract and format system information, including version handling.
- Updated the TTP template to adjust the grouping and ignore patterns for better parsing of system details, ensuring compatibility with the new method.
2026-03-17 01:07:23 +03:00
IluaAir
65c82fbaf5 Refactor error handling in Node class
- Updated the `Node` class to use `response.raise_for_status()` for improved error handling, replacing the previous manual check for a 500 status code. This change simplifies the error management process when fetching node data.
2026-03-16 18:24:24 +03:00
IluaAir
974fff6038 Update TTP template to escape whitespace in ignore patterns
- Modified the TTP template to use double backslashes for escaping whitespace in the `ignore` function for both `interfaces` and `bulkinterfaces` groups, ensuring proper parsing of configuration lines.
2026-03-13 13:12:02 +03:00
IluaAir
586e52282b Refactor Quasar interface handling and update TTP template
- Enhanced the `interfaces` method in the `Quasar` model to process bulk interfaces, returning a structured list of interface details.
- Updated the TTP template to reflect the change from `interfaces` to `bulkinterfaces` for better organization of interface configurations.
2026-03-12 23:39:47 +03:00
IluaAir
e3392f6c76 Add reload method to OxiAPI class
- Implemented a new `reload` method to fetch the reload status from the API.
- The method raises an error for unsuccessful responses and returns the status code on success.
2026-03-12 20:16:33 +03:00
IluaAir
de0e09af9d Add node refresh functionality to NodeView
- Implemented a private `_updater` method to fetch the next node's status.
- Added `last_status` and `last_check` properties to retrieve the latest node status and check time.
- Introduced a `refresh` property to update the node status and handle errors appropriately.
2026-03-12 20:13:02 +03:00
IluaAir
ca96d2600a Add Quasar model and TTP template
- Introduced a new `Quasar` model for parsing Quasar devices.
- Created a corresponding TTP template defining required and optional groups for configuration parsing.
2026-03-11 23:29:08 +03:00
IluaAir
56eae15e27 Update README.md to include new device models
- Added Eltex, H3C, and Quasar to the list of supported device models with their corresponding identifiers.
2026-03-11 23:26:35 +03:00
IluaAir
db79199319 Add LICENSE file and update pyproject.toml
- Added Apache License 2.0 to the project.
- Updated project description in pyproject.toml to "Oxidized API client".
- Specified the LICENSE file in pyproject.toml.
- Added classifiers for Python version and license type.
2026-03-11 23:23:23 +03:00
2e109db121 Update Qtech:
- Add full support of diff types of switches
- Fix default system parser
2026-03-10 18:41:54 +03:00
b9dce8e417 Update config:
- add by_alias attr
Update contract:
- del aliase for Vlans vlan_id
Update qtech.ttp:
- fix vla_id _start_ method
2026-03-10 17:53:51 +03:00
d185dc6c7c Update config:
- add dump() for dict| list overview
- del qtech.ttp _start_ method
2026-03-10 16:56:13 +03:00
68566a24fb Update qtech.ttp:
- add interface name ORPHRASE
2026-03-10 16:00:57 +03:00
08733bd493 Merge remote-tracking branch 'origin/dev' into dev 2026-03-10 15:52:56 +03:00
a1c57733f6 Update pyproject.toml:
- Add package-data with resource .ttp
2026-03-10 15:52:38 +03:00
IluaAir
c9f6f3472f Add Eltex model and TTP template
- Introduced a new `Eltex` model for parsing Eltex devices.
- Created a corresponding TTP template for Eltex devices, defining required and optional groups for configuration parsing.
2026-03-04 15:50:47 +03:00