Skip to content

Conversation

@leoparente
Copy link
Contributor

This pull request refactors how parent interfaces are represented and resolved in the translation logic for device discovery, focusing on simplifying parent-child relationships by storing and passing parent interface names instead of full interface objects. It also introduces a new test to ensure subinterfaces derived only from IP data correctly link to their parent interfaces.

Refactoring parent interface representation

  • Changed the parent parameter in translate_interface and related docstrings to use str | None (interface name) instead of Interface | None (full object), streamlining how parent relationships are handled. [1] [2]
  • Updated the assignment of assigned_object_interface in IP entity creation to use the interface name rather than the interface object.
  • Refactored the resolve_parent function to return the parent interface name (str | None) instead of the full interface object, and adjusted the logic to check both defined and entity names for parent existence.

Testing parent-child relationships

  • Added a new test, test_translate_data_creates_ip_only_subinterface_parent_relationship, which verifies that subinterfaces created solely from IP data correctly reference their parent interface by name.

@github-actions
Copy link

github-actions bot commented Oct 30, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
device_discovery
   discovery.py63297%142–145
   main.py49296%183, 189
   metrics.py53198%114
   server.py821088%35–37, 63–78, 168, 171
   translate.py164199%321
   version.py7186%14
device_discovery/policy
   manager.py41295%36–37
   runner.py117298%186–187
TOTAL6742197% 

Tests Skipped Failures Errors Time
77 0 💤 0 ❌ 0 🔥 7.213s ⏱️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants