Skip to content

Conversation

@mfiedorowicz
Copy link
Member

@mfiedorowicz mfiedorowicz commented Feb 10, 2025

⚠️ Search backend/CachedValue is global and doesn't seem to be reliable with branching ⚠️

This pull request includes several updates to the netbox_diode_plugin to improve compatibility with the latest NetBox version, enhance serializers, and refactor API views for better performance and maintainability. The most important changes include upgrading the NetBox version, modifying serializers to handle site fields dynamically, and refactoring API views to improve query handling and validation.

Compatibility Updates:

Serializer Enhancements:

  • netbox_diode_plugin/api/serializers.py: Modified DiodePrefixSerializer and DiodeClusterSerializer to use SerializerMethodField for the site field and added methods to dynamically get the site from the instance scope. [1] [2]

API View Refactoring:

  • netbox_diode_plugin/api/views.py: Refactored the _search_queryset method to use search index classes and added validation for query fields. Introduced new helper methods for dynamic imports and field validation. [1] [2]
  • netbox_diode_plugin/api/views.py: Added _transform_object_data method to handle object data transformations based on object type, including handling IP address assigned objects and scope objects.

Test Adjustments:

Search backend/CachedValue is global and doesn't seem to be reliable with branching

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
@mfiedorowicz mfiedorowicz self-assigned this Feb 10, 2025
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
@github-actions
Copy link

github-actions bot commented Feb 13, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1396 1356 97% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
netbox_diode_plugin/init.py 100% 🟢
netbox_diode_plugin/api/serializers.py 91% 🟢
netbox_diode_plugin/api/views.py 93% 🟢
netbox_diode_plugin/tests/test_api_apply_change_set.py 100% 🟢
netbox_diode_plugin/tests/test_api_object_state.py 100% 🟢
TOTAL 97% 🟢

updated for commit: 81bdc1c by action🐍

@mfiedorowicz mfiedorowicz marked this pull request as ready for review February 13, 2025 14:00
ltucker and others added 3 commits February 13, 2025 11:04
* fix: add backwards compatible support for mac_address field
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
@mfiedorowicz mfiedorowicz merged commit 9d6dec4 into feat-diode-data-plugin Feb 14, 2025
2 checks passed
@mfiedorowicz mfiedorowicz deleted the fix-object-state-retrieval branch February 14, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants