Skip to content

Conversation

@mfiedorowicz
Copy link
Member

This pull request improves the handling of auto-created component objects (such as interfaces and module bays) to prevent duplicate creation when applying changes through the API. It introduces logic to detect and update existing components that were instantiated from templates, ensuring that incoming changes reuse and update these objects rather than creating new duplicates. The changes are validated with new tests that verify correct reuse and updating of components.

Component Deduplication Logic:

  • Updated _apply_change in netbox_diode_plugin/api/applier.py to check for existing auto-created components (like dcim.interface, dcim.modulebay, etc.) before creating new ones, and to update them if found instead of creating duplicates.

Testing Improvements:

  • Added test_module_bay_from_template_no_duplicate and test_interface_from_template_no_duplicate to netbox_diode_plugin/tests/test_api_apply_change_set.py to verify that module bays and interfaces created from templates are reused and updated, not duplicated, when ingested via API changes.

Operational Tuning:

  • Increased the healthcheck start_period for the NetBox service in docker/docker-compose.yaml from 60s to 180s to allow more time for startup before healthchecks begin.

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

@jajeffries jajeffries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good - couple of minor suggestions but happy for it to go in as is

…rove readability

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

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

@jajeffries jajeffries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
4186 3792 91% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
netbox_diode_plugin/api/applier.py 94% 🟢
netbox_diode_plugin/tests/test_api_apply_change_set.py 100% 🟢
TOTAL 97% 🟢

updated for commit: 522d4d0 by action🐍

@mfiedorowicz mfiedorowicz merged commit 82ecf9d into develop Dec 2, 2025
7 checks passed
@mfiedorowicz mfiedorowicz deleted the feat-components-support branch December 2, 2025 09:12
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.

4 participants