|
| 1 | +# OpenStack to Nautobot Synchronization |
| 2 | + |
| 3 | +This guide explains how OpenStack data (Keystone, Neutron, Ironic) is |
| 4 | +synchronized to Nautobot and how to handle situations when they get out of sync. |
| 5 | + |
| 6 | +## Event-Driven Sync |
| 7 | + |
| 8 | +Under normal operation, OpenStack data is automatically synchronized to Nautobot |
| 9 | +via Oslo notifications. When changes occur, events are published to RabbitMQ |
| 10 | +and processed by Argo Events workflows. |
| 11 | + |
| 12 | +### How It Works |
| 13 | + |
| 14 | +1. OpenStack services publish Oslo notifications to RabbitMQ when resources change |
| 15 | +2. Argo Events EventSources consume messages from the queues |
| 16 | +3. Sensors filter for relevant events and trigger workflows |
| 17 | +4. The `openstack-oslo-event` workflow processes the event and updates Nautobot |
| 18 | + |
| 19 | +### Supported Events |
| 20 | + |
| 21 | +The following events trigger Nautobot updates: |
| 22 | + |
| 23 | +| Service | Event Type | Action | |
| 24 | +|---------|------------|--------| |
| 25 | +| Keystone | `identity.project.created` | Creates tenant in Nautobot | |
| 26 | +| Keystone | `identity.project.updated` | Updates tenant in Nautobot | |
| 27 | +| Keystone | `identity.project.deleted` | Deletes tenant from Nautobot | |
| 28 | +| Neutron | `network.create.end` | Creates UCVNI in Nautobot | |
| 29 | +| Neutron | `network.update.end` | Updates UCVNI in Nautobot | |
| 30 | +| Neutron | `network.delete.end` | Deletes UCVNI from Nautobot | |
| 31 | +| Neutron | `subnet.create.end` | Creates IPAM namespace/prefix in Nautobot | |
| 32 | +| Neutron | `subnet.update.end` | Updates IPAM namespace/prefix in Nautobot | |
| 33 | +| Neutron | `subnet.delete.end` | Deletes IPAM namespace/prefix from Nautobot | |
| 34 | +| Ironic | `baremetal.node.update.end` | Updates device in Nautobot | |
| 35 | +| Ironic | `baremetal.node.delete.end` | Deletes device from Nautobot | |
| 36 | +| Ironic | `baremetal.node.provision_set.end` | Updates device status and syncs inspection data | |
| 37 | +| Ironic | `baremetal.port.create.end` | Creates interface in Nautobot | |
| 38 | +| Ironic | `baremetal.port.update.end` | Updates interface in Nautobot | |
| 39 | +| Ironic | `baremetal.port.delete.end` | Deletes interface from Nautobot | |
| 40 | +| Ironic | `baremetal.portgroup.create.end` | Creates interface in Nautobot | |
| 41 | +| Ironic | `baremetal.portgroup.update.end` | Updates interface in Nautobot | |
| 42 | +| Ironic | `baremetal.portgroup.delete.end` | Deletes interface from Nautobot | |
| 43 | + |
| 44 | +### Data Synchronized |
| 45 | + |
| 46 | +**Keystone Projects → Nautobot Tenants:** |
| 47 | + |
| 48 | +- Tenant name and description |
| 49 | + |
| 50 | +**Neutron Networks → Nautobot UCVNIs:** |
| 51 | + |
| 52 | +- UCVNI identifier and VLAN segmentation ID |
| 53 | +- Associated tenant |
| 54 | + |
| 55 | +**Neutron Subnets → Nautobot IPAM:** |
| 56 | + |
| 57 | +- IPAM namespace per network |
| 58 | +- Prefix with CIDR |
| 59 | + |
| 60 | +**Ironic Nodes → Nautobot Devices:** |
| 61 | + |
| 62 | +- Device name (generated from manufacturer and service tag) |
| 63 | +- Serial number |
| 64 | +- Manufacturer and model |
| 65 | +- Hardware specs (memory, CPUs, local storage) |
| 66 | +- Provision state (mapped to Nautobot status) |
| 67 | +- Location and rack (derived from connected switches) |
| 68 | +- Tenant (from Ironic lessee field) |
| 69 | +- Network interfaces and their connections |
| 70 | + |
| 71 | +## Bulk Resync |
| 72 | + |
| 73 | +When Nautobot gets out of sync with OpenStack (e.g., after database restore, |
| 74 | +missed events, or manual changes), you can perform a bulk resync. |
| 75 | + |
| 76 | +### Resync Order |
| 77 | + |
| 78 | +The resync workflow runs three steps sequentially in dependency order: |
| 79 | + |
| 80 | +1. **Keystone** - Syncs projects as tenants (must exist before devices reference them) |
| 81 | +2. **Neutron** - Syncs networks as UCVNIs and subnets as IPAM namespaces/prefixes |
| 82 | +3. **Ironic** - Syncs nodes as devices with interfaces |
| 83 | + |
| 84 | +Each step continues even if the previous step fails. |
| 85 | + |
| 86 | +### Scheduled Resync (CronWorkflow) |
| 87 | + |
| 88 | +A CronWorkflow runs daily at 2:00 AM UTC to catch any drift between OpenStack |
| 89 | +and Nautobot. This provides a safety net for missed events. |
| 90 | + |
| 91 | +Check the schedule: |
| 92 | + |
| 93 | +```bash |
| 94 | +argo -n argo-events cron list |
| 95 | +``` |
| 96 | + |
| 97 | +Manually trigger the scheduled workflow: |
| 98 | + |
| 99 | +```bash |
| 100 | +argo -n argo-events submit --from cronworkflow/resync-nautobot |
| 101 | +``` |
| 102 | + |
| 103 | +Suspend/resume the schedule: |
| 104 | + |
| 105 | +```bash |
| 106 | +argo -n argo-events cron suspend resync-nautobot |
| 107 | +argo -n argo-events cron resume resync-nautobot |
| 108 | +``` |
| 109 | + |
| 110 | +### On-Demand Resync (WorkflowTemplate) |
| 111 | + |
| 112 | +Resync all OpenStack resources: |
| 113 | + |
| 114 | +```bash |
| 115 | +argo -n argo-events submit --from workflowtemplate/resync-nautobot |
| 116 | +``` |
| 117 | + |
| 118 | +### Using CLI Directly |
| 119 | + |
| 120 | +For debugging or running outside the cluster: |
| 121 | + |
| 122 | +```bash |
| 123 | +# Resync all Keystone projects |
| 124 | +resync-keystone-nautobot \ |
| 125 | + --nautobot_url https://nautobot.example.com \ |
| 126 | + --nautobot_token <token> |
| 127 | + |
| 128 | +# Resync all Neutron networks and subnets |
| 129 | +resync-neutron-nautobot \ |
| 130 | + --nautobot_url https://nautobot.example.com \ |
| 131 | + --nautobot_token <token> |
| 132 | + |
| 133 | +# Resync all Ironic nodes |
| 134 | +resync-ironic-nautobot \ |
| 135 | + --nautobot_url https://nautobot.example.com \ |
| 136 | + --nautobot_token <token> |
| 137 | +``` |
0 commit comments