Commit Graph

42 Commits

Author SHA1 Message Date
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
i.shramko
2e109db121 Update Qtech:
- Add full support of diff types of switches
- Fix default system parser
2026-03-10 18:41:54 +03:00
i.shramko
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
i.shramko
d185dc6c7c Update config:
- add dump() for dict| list overview
- del qtech.ttp _start_ method
2026-03-10 16:56:13 +03:00
i.shramko
68566a24fb Update qtech.ttp:
- add interface name ORPHRASE
2026-03-10 16:00:57 +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
i.shramko
1e84452eb5 Add H3C parse:
- Add h3c.py with basemodel parser
- Add ttp template for h3c
2026-03-04 15:23:55 +03:00
i.shramko
4ed34227d9 Update __init__.py:
- Add BaseDevice to __all__
- Add type str for register_parser
2026-03-03 09:52:28 +03:00
IluaAir
bf6dd0c189 Refactor Qtech model and update TTP template
- Removed the `interfaces` method from the `Qtech` model, simplifying the interface processing.
- Updated the TTP template to use `mask` instead of `netmask` for IP address configuration, enhancing clarity in CIDR notation.
2026-02-28 10:44:20 +03:00
IluaAir
197550558d Add Huawei model and TTP template
- Introduced a new `Huawei` model
- Created a corresponding TTP template for Huawei devices.
- Updated the base template to correct HTML entity encoding for vendor placeholders.
2026-02-28 10:39:03 +03:00
IluaAir
9e4574e869 Merge branch 'docs' into dev 2026-02-25 22:42:51 +03:00
IluaAir
2c3f5ce354 Add interfaces and vlans methods to Qtech model; update TTP template
- Implemented the `interfaces` method to process IP addresses and netmasks, adding a calculated mask to the output.
- Added the `vlans` method to handle VLAN data, supporting both individual and grouped VLAN IDs.
- Updated the QTECH TTP template to include a new version field and improved formatting for VLAN definitions.
2026-02-25 19:11:12 +03:00
IluaAir
77f539254c Add Qtech model and template; clean up Mikrotik model
- Introduced a new `Qtech` model with a corresponding TTP template for parsing QTECH devices.
- Removed commented-out methods in the `Mikrotik` model to improve code clarity and maintainability.
2026-02-25 17:00:36 +03:00
IluaAir
c9d171e2fa Update Keenetic TTP template
- Modified the `description` field in the Keenetic TTP template to strip surrounding quotes.
2026-02-25 13:47:06 +03:00
IluaAir
fe6d0c4ccf Add README and documentation for Oxi API client
- Introduced a comprehensive README file detailing the installation, quick start guide, and API reference for the oxipy Python client.
- Added documentation on extending and overriding device models, including architecture, registration of new devices, and method overriding examples.
- Created a template guide for writing TTP templates, outlining structure, mandatory groups, and practical examples for new device support.
- Included a base template for device configuration parsing, enhancing usability for developers integrating with the Oxi API.
2026-02-24 23:27:14 +03:00
IluaAir
ac835d6b56 Enhance ModelView class with iterable and indexing support
- Added iterator, length, and item access methods to the `ModelView` class, allowing it to handle single models and lists more effectively.
- Refactored the `vlans` method in the `Keenetic` model to restore functionality for decoding VLAN descriptions, improving data processing consistency.
2026-02-24 23:19:57 +03:00
IluaAir
3159570e27 Add ModelView class for enhanced JSON serialization in NodeConfig
- Introduced a new `ModelView` class to facilitate JSON serialization of model data, supporting both single models and lists.
- Updated `NodeConfig` methods to utilize `ModelView` for `vlans`, `interfaces`, and `system` properties, improving data handling consistency.
- Refactored the `json` method to ensure proper serialization of parsed data.
2026-02-24 22:50:55 +03:00
IluaAir
16e97692fc Refactor NodeConfig methods for consistency in data access
- Renamed `l3interfaces` to `interfaces` and `vlaninterfaces` to `system` in the `NodeConfig` class to align with updated data structure.
- This change enhances clarity and consistency in method naming, reflecting the underlying data model more accurately.
2026-02-24 22:31:18 +03:00
IluaAir
3fdff33e2e Implement validation for optional VLANs in BaseDevice
- Added a check in the BaseDevice class to raise a ValueError if the 'vlans' section is declared in the template but not present in the raw data returned by TTP.
- This enhancement improves data integrity by ensuring that optional groups are properly validated before processing.
2026-02-24 22:28:36 +03:00
IluaAir
753268a381 Refactor BaseDevice and Interfaces models for improved validation and structure
- Introduced `_declared_sections` in `BaseDevice` to track declared template groups.
- Enhanced `_validate_contract` method to conditionally validate VLANs based on declared sections.
- Updated docstrings in `BaseDevice` and `Interfaces` models for clarity on expected structures.
- Refactored `Interfaces` and `Vlans` models to improve field definitions and aliases.
- Commented out unused `vlans` method in `Keenetic` model for future reference.
2026-02-22 15:52:45 +03:00
IluaAir
3635a07b27 Refactor BaseDevice methods for improved data handling and validation
- Updated the `BaseDevice` class to replace `_raw` with `raw` for consistency in data access.
- Enhanced the `vlans`, `interfaces`, and `system` methods to utilize the new `raw` attribute.
- Introduced a `_validate_contract` method to streamline the validation of parsed data into structured models.
- Adjusted the `Keenetic` and `Mikrotik` models to align with the updated data handling approach, ensuring proper parsing and decoding of interface and VLAN data.
2026-02-22 09:52:17 +03:00
IluaAir
2394296f5b Enhance Keenetic model and update templates for improved data handling
- Implemented the `interfaces` and `vlans` methods in the `Keenetic` model to process and decode interface and VLAN data.
- Added a `_decode_utf` method to handle UTF-8 encoded descriptions.
- Updated the Keenetic TTP template to define structured groups for system, interfaces, and VLANs.
- Refactored file paths in the `Mikrotik` model for consistency and clarity.
2026-02-22 00:21:55 +03:00
IluaAir
a41cb1f7ec """
Implement Keenetic model and enhance BaseDevice documentation

- Added a new `Keenetic` model that registers a parser for KeeneticOS, extending the `BaseDevice` class.
- Updated docstrings in the `BaseDevice` class methods to provide clearer descriptions of their functionality and expected data structures.
- Introduced `model_config` in the `Vlans` model to enable name-based population.
- Removed unnecessary print statements from the `Mikrotik` model methods to streamline output.
"""
2026-02-19 00:49:10 +03:00
IluaAir
a938fe2d47 Update Interfaces model and Mikrotik template for improved data handling
- Made the `description` field in the `Interfaces` model optional to enhance flexibility.
- Renamed `id` to `vlan_id` in the `Vlans` model for clarity.
- Refactored the `Mikrotik` class methods to streamline raw data access and removed unnecessary print statements.
- Updated the Mikrotik TTP template to reflect changes in variable names and improve overall structure for interface and VLAN configurations.
2026-02-19 00:31:54 +03:00
IluaAir
685ff19d2f Enhance BaseDevice validation and update Mikrotik model
- Introduced a new method `_validate_template_groups` in `BaseDevice` to ensure TTP templates declare all required and optional sections.
- Updated `_REQUIRED_SECTIONS` and added `_OPTIONAL_SECTIONS` to improve template validation.
- Modified the `vlans` method in `Mikrotik` to streamline raw data handling and added debug print statements for clarity.
- Revised the Mikrotik TTP template to include structured variable definitions and improved group handling for interfaces and VLANs.
2026-02-19 00:16:37 +03:00
IluaAir
c434712309 Refactor Mikrotik model and update template structure
- Changed the parsing method in `NodeConfig` to use `parse()` instead of `parse_config()`.
- Updated the template loading path in `BaseDevice` to reflect the new directory structure.
- Enhanced the `Mikrotik` class with new methods for `system`, `interfaces`, and `vlans`, including debug print statements.
- Expanded the TTP template for Mikrotik to include structured variable definitions and groups for system, interfaces, and VLANs.
2026-02-18 15:45:17 +03:00
IluaAir
91b6606e3f Enhance BaseDevice methods with detailed parsing documentation
- Updated the `vlans`, `interfaces`, and `system` methods in the `BaseDevice` class to include comprehensive docstrings outlining expected raw data structures and error handling.
- Modified the `Interfaces` model in `contract.py` to allow optional fields for `ip_address` and `mask`, improving flexibility in interface definitions.
2026-02-18 00:55:43 +03:00
IluaAir
72cd796803 Refactor parse method in BaseDevice for improved readability
- Simplified the `parse` method in the `BaseDevice` class by directly returning a `Device` instance with keyword arguments, enhancing code clarity and maintainability.
2026-02-18 00:11:14 +03:00
IluaAir
e82bc25346 Refactor BaseDevice and update Device model structure
- Enhanced the `BaseDevice` class with methods for loading templates and parsing configuration data using TTP.
- Updated the `Device` model to use lists for `interfaces` and `vlans`, allowing for multiple entries.
- Introduced new TTP template files for structured data parsing.
2026-02-18 00:06:48 +03:00
IluaAir
2cfcc41e58 Enhance device interface structure and update dependencies
- Added `.idea` to `.gitignore` to exclude IDE configuration files.
- Introduced `pydantic` version `2.12.5` as a dependency in `pyproject.toml` and `uv.lock`.
- Added `annotated-types` as a new dependency in `uv.lock`.
- Refactored `BaseDevice` class to include abstract methods for device properties and loading templates.
- Created `Interfaces`, `System`, `Vlans`, and `Device` models in a new `contract.py` file for structured data handling.
- Updated `Mikrotik` class to implement the new `BaseDevice` structure and added a template loading method.
2026-02-16 00:57:09 +03:00
IluaAir
544688dae1 Update .gitignore and refactor Mikrotik model to inherit from BaseDevice
- Added *.txt files to .gitignore to exclude etc files.
- Refactored Mikrotik class to inherit from BaseDevice for improved structure and functionality.
2026-02-15 02:44:29 +03:00
IluaAir
b60182ef3c Add ttp dependency and refactor OxiAPI and NodeConfig classes
- Added `ttp` as a dependency in `pyproject.toml` and `uv.lock`.
- Updated `NodeConfig` to store model names in lowercase.
- Refactored `OxiAPI` to always create a new session and added a `close` method.
- Removed unnecessary logging in `Node` class.
- Introduced interfaces for device registration with a new `BaseDevice` class and a `register_parser` function.
- Created initial structure for device models, including a `Mikrotik` parser.
2026-02-14 21:31:02 +03:00
IluaAir
8e85086d98 base structure 2026-02-14 01:07:26 +03:00