feat: update nautobot with enriched data updated by inspect hooks#1495
Merged
Conversation
1af7662 to
0cd0789
Compare
4ef1f91 to
2898164
Compare
Contributor
|
Can you describe the changes in the body of the PR? |
445cdf9 to
f4691e2
Compare
b769c2b to
834a825
Compare
stevekeay
approved these changes
Jan 2, 2026
Contributor
stevekeay
left a comment
There was a problem hiding this comment.
I like this, but I have some concerns that if we get a "partial" update, we would overwrite some nautobot data but potentially leave behind stale records or attributes. Like for instance, we don't seem to delete any old interfaces or cables.
I think we should get this merged. I have left a boatload of style suggestions.
Contributor
|
Just to be clear, I approved this because I think it will work, but we should still make the changes! |
834a825 to
7016c7e
Compare
7016c7e to
54ad2da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By leveraging Ironic's native notification system (documented at Ironic Notifications),
we can react to state changes to keep Nautobot in sync.
Subscribe to specific Ironic notification events:
Nodes:
baremetal.node.update.end / baremetal.node.create.end → create or update the node in Nautobot
baremetal.node.delete.end → remove the node from Nautobot
Ports:
baremetal.port.update.end / baremetal.port.create.end → create or update the port in Nautobot
baremetal.port.delete.end → remove the port from Nautobot
Portgroups:
baremetal.portgroup.update.end / baremetal.portgroup.create.end → create or update the portgroup in Nautobot
baremetal.portgroup.delete.end → remove the portgroup from Nautobot
We focus on .end events since those represent completed operations with consistent state, and handle create/update together since a newly created node may not have complete information initially.
Sync these Nautobot resources:
dcim.devices) - server identity, location, rack, tenant, statusdcim.interfaces) - network ports with MAC, type, descriptiondcim.interfaces) - management interface with BMC MACdcim.cables) - connections between server interfaces and switch portsipam.ip_addresses) - BMC IP addressipam.ip_address_to_interface) - links BMC IP to iDRAC interfaceNautobot Device Sync Implementation Comparison
Overview
Comparison between old (
nautobot_device.py) and new (nautobot_device_sync.py+nautobot_device_interface_sync.py) implementations.Data Source
ChassisInfo)Device Identification
serial_numberto find/create deviceuuidas device ID{manufacturer}-{service_tag}Switch Lookup
cf_chassis_mac_addresscustom field via GraphQLname(switch_info) or interface MAC address via RESTInterface Identification
device+nameuuidas interface IDIP Address Handling
ipv4_addressparentprefix specifiedtype: dhcp→type: host)API Approach
Additional Features in New Implementation
provision_stateto Nautobot status viaProvisionStateMappertenantfrom Ironiclesseefieldcustom_fieldson device