-
Notifications
You must be signed in to change notification settings - Fork 8
feat: update nautobot with enriched data updated by inspect hooks #1495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1af7662 to
0cd0789
Compare
4ef1f91 to
2898164
Compare
|
Can you describe the changes in the body of the PR? |
python/understack-workflows/understack_workflows/oslo_event/ironic_node.py
Show resolved
Hide resolved
445cdf9 to
f4691e2
Compare
b769c2b to
834a825
Compare
stevekeay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
python/understack-workflows/understack_workflows/ironic/client.py
Outdated
Show resolved
Hide resolved
python/understack-workflows/understack_workflows/oslo_event/nautobot_device_sync.py
Show resolved
Hide resolved
python/understack-workflows/understack_workflows/oslo_event/nautobot_device_sync.py
Outdated
Show resolved
Hide resolved
python/understack-workflows/understack_workflows/oslo_event/nautobot_device_sync.py
Outdated
Show resolved
Hide resolved
python/understack-workflows/understack_workflows/oslo_event/nautobot_device_sync.py
Outdated
Show resolved
Hide resolved
python/understack-workflows/understack_workflows/oslo_event/nautobot_device_interface_sync.py
Outdated
Show resolved
Hide resolved
python/understack-workflows/understack_workflows/oslo_event/nautobot_device_interface_sync.py
Outdated
Show resolved
Hide resolved
python/understack-workflows/understack_workflows/oslo_event/nautobot_device_interface_sync.py
Outdated
Show resolved
Hide resolved
python/understack-workflows/understack_workflows/oslo_event/nautobot_device_interface_sync.py
Outdated
Show resolved
Hide resolved
python/understack-workflows/understack_workflows/oslo_event/nautobot_device_interface_sync.py
Outdated
Show resolved
Hide resolved
|
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
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