Skip to content

Conversation

@mfiedorowicz
Copy link
Member

This pull request includes several changes to the netbox_diode_plugin to improve the handling of object types and scopes, as well as updates to the test suite to cover new functionality. The most important changes include updating methods to handle both string and NetBoxType object types, refining scope handling logic, and adding new test cases.

Updates to object type handling:

Refinement of scope handling:

Test suite improvements:

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
@github-actions
Copy link

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1472 1424 97% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
netbox_diode_plugin/api/views.py 92% 🟢
netbox_diode_plugin/tests/test_api_apply_change_set.py 100% 🟢
TOTAL 96% 🟢

updated for commit: 65d245c by action🐍

@mfiedorowicz mfiedorowicz merged commit 93e4c9b into feat-diode-data-plugin Feb 20, 2025
2 checks passed
@mfiedorowicz mfiedorowicz deleted the fix-apply-change-set-scope-support branch February 20, 2025 13:57
ltucker pushed a commit that referenced this pull request Mar 27, 2025
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
ltucker pushed a commit that referenced this pull request Apr 7, 2025
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
ltucker added a commit that referenced this pull request Apr 7, 2025
* fix: scope support on apply change set (#64)

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* wip diff api

* set default values and missing slugs

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* tidy up setting defaults

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* remove unused imports

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* fix constructor of object type

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* set slugs (if not present) after resolving existing instances

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* emit ref_id instead of variable object_id field for new objects

* improve entity field mapping coverage

* fill in primary value mapping, use primary value for slug

* use canonical field ordering in change dicts

* first pass at certain common circular refs

* remove ref id to itself

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* tidy up

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* add applier

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* fix resolve ref before lookup, use field name directly, not field attr

* don't query with unresolved references

* fix _build_expressions_queryset

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* resolve lint issues

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* exclude fields with GenericRelation type

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* fix sorting dict

we may get ints strings etc

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* rework applier logic

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* applier with content type fields

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* fix content type related existing value

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* exclude foreign key fields with many to one rel

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* fix: support for post create updates eg (primary mac address) (#68)

* fix: support for post create updates eg (primary mac address)

* use serializers, fix relevent tests

* linting

* filter fields in the prior state

* add some basic smoke tests for diff / diff+apply

* Change set validation (#69)

* add change set validation

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* remove redundant serializers

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* remove redundant serializers tests

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* tidy up

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* adjust tests, lighter validation of refs on diff, handle generic

---------

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Co-authored-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>

* fix: expand support for cycle breaking, add additional logical matchers (#70)

* fix: fix error fingerprinting tags (#71)

* fix: all noops -> no changes, show noops as only prior state (#72)

---------

Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Co-authored-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
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