Skip to content

Commit 537900f

Browse files
committed
Add workflow to update Nautobot based on openstack CRUD events
This does part of what the ml2 driver was doing to update networks and subnets in Nautobot.
1 parent 09f5b61 commit 537900f

19 files changed

+598
-8
lines changed

python/neutron-understack/neutron_understack/neutron_understack_mech.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def _bind_port_segment(self, context: PortContext, segment):
258258
current_vlan_segment = utils.vlan_segment_for_physnet(context, vlan_group_name)
259259
if current_vlan_segment:
260260
LOG.info(
261-
"vlan segment: %(segment)s already preset for physnet: " "%(physnet)s",
261+
"vlan segment: %(segment)s already preset for physnet: %(physnet)s",
262262
{"segment": current_vlan_segment, "physnet": vlan_group_name},
263263
)
264264
dynamic_segment = current_vlan_segment

python/neutron-understack/neutron_understack/tests/test_trunk.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,7 @@ def test_when_segment_is_unused_by_other_ports(
249249
)
250250
mocker.patch("neutron_understack.utils.release_dynamic_segment")
251251

252-
understack_trunk_driver._handle_segment_deallocation(
253-
[subport], str(host_id)
254-
)
252+
understack_trunk_driver._handle_segment_deallocation([subport], str(host_id))
255253

256254
utils.release_dynamic_segment.assert_called_once_with(str(network_segment_id))
257255
port_binding_level.delete.assert_called_once()
@@ -280,9 +278,7 @@ def test_when_segment_is_used_by_other_ports(
280278
)
281279
mocker.patch("neutron_understack.utils.release_dynamic_segment")
282280

283-
understack_trunk_driver._handle_segment_deallocation(
284-
[subport], str(host_id)
285-
)
281+
understack_trunk_driver._handle_segment_deallocation([subport], str(host_id))
286282

287283
utils.release_dynamic_segment.assert_not_called()
288284
port_binding_level.delete.assert_called_once()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
The openstack event payloads published via Rabbitmq can be snooped on with commands like:
2+
3+
```sh
4+
kubectl -n openstack exec -it rabbitmq-server-0 -c rabbitmq -- \
5+
rabbitmqadmin --vhost=neutron get \
6+
queue=notifications.info \
7+
ackmode=ack_requeue_true \
8+
count=1000 \
9+
| awk -F\| '{print $5}' \
10+
| fgrep network.create.end
11+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"oslo.version": "2.0", "oslo.message": "{\"message_id\": \"8994f9f2-851b-4279-ba38-1e55d0307926\", \"publisher_id\": \"network.neutron-server-7d76968979-6np4r\", \"event_type\": \"network.create.end\", \"priority\": \"INFO\", \"payload\": {\"network\": {\"id\": \"5dddb3dc-b6d6-4247-a02e-8089c4374290\", \"name\": \"marek-storage-test-network\", \"tenant_id\": \"962f6e0dfb314d43bdee2a9d5c7bd7f6\", \"admin_state_up\": true, \"mtu\": 9000, \"status\": \"ACTIVE\", \"subnets\": [], \"shared\": false, \"project_id\": \"46c1e917980e4485915b1444e8c50cc2\", \"port_security_enabled\": true, \"router:external\": false, \"provider:network_type\": \"vxlan\", \"provider:physical_network\": null, \"provider:segmentation_id\": 1862, \"is_default\": false, \"availability_zone_hints\": [], \"availability_zones\": [], \"ipv4_address_scope\": null, \"ipv6_address_scope\": null, \"description\": \"\", \"l2_adjacency\": true, \"tags\": [], \"created_at\": \"2025-09-11T16:25:54Z\", \"updated_at\": \"2025-09-11T16:25:55Z\", \"revision_number\": 1}}, \"timestamp\": \"2025-09-11 16:26:01.168699\", \"_unique_id\": \"23fdf96e8a7d4452ab57b05042244d9b\", \"_context_user\": \"5f9179b7e200cd85c55e8a26400e266c6b4f7209f6d3fb2adc3cf8e1113c378c\", \"_context_project_id\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_system_scope\": null, \"_context_project\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_domain\": null, \"_context_user_domain\": \"1f75c3b20fcb41ec924a71be83a5ee94\", \"_context_project_domain\": \"7f46f53fcb3c4625a343eaa35b5e0d04\", \"_context_is_admin\": true, \"_context_read_only\": false, \"_context_show_deleted\": false, \"_context_auth_token\": null, \"_context_request_id\": \"req-3297674b-4d51-44ad-b787-e2667f43ff53\", \"_context_global_request_id\": null, \"_context_resource_uuid\": null, \"_context_roles\": [\"manager\", \"reader\", \"member\", \"admin\"], \"_context_user_identity\": \"5f9179b7e200cd85c55e8a26400e266c6b4f7209f6d3fb2adc3cf8e1113c378c 32e02632f4f04415bab5895d1e7247b7 - 1f75c3b20fcb41ec924a71be83a5ee94 7f46f53fcb3c4625a343eaa35b5e0d04\", \"_context_is_admin_project\": true, \"_context_user_id\": \"5f9179b7e200cd85c55e8a26400e266c6b4f7209f6d3fb2adc3cf8e1113c378c\", \"_context_tenant_id\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_timestamp\": \"2025-09-11 16:26:01.168178\", \"_context_tenant_name\": \"baremetal\", \"_context_project_name\": \"baremetal\", \"_context_user_name\": \"[email protected]\"}"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"oslo.version": "2.0", "oslo.message": "{\"message_id\": \"f1d4303d-3870-4513-8696-f1732b22e227\", \"publisher_id\": \"network.neutron-server-7d76968979-9f6wd\", \"event_type\": \"network.delete.end\", \"priority\": \"INFO\", \"payload\": {\"network\": {\"id\": \"5dddb3dc-b6d6-4247-a02e-8089c4374290\", \"name\": \"marek-storage-test-network\", \"tenant_id\": \"46c1e917980e4485915b1444e8c50cc2\", \"admin_state_up\": true, \"mtu\": 9000, \"status\": \"ACTIVE\", \"subnets\": [], \"standard_attr_id\": 13740, \"shared\": false, \"availability_zone_hints\": [], \"availability_zones\": [], \"ipv4_address_scope\": null, \"ipv6_address_scope\": null, \"router:external\": false, \"vlan_transparent\": null, \"description\": \"\", \"port_security_enabled\": true, \"l2_adjacency\": true, \"tags\": [], \"created_at\": \"2025-09-11T16:25:54Z\", \"updated_at\": \"2025-09-11T16:31:21Z\", \"revision_number\": 3, \"project_id\": \"4cde1e465a5d41e482755f7d1ce12b28\", \"provider:network_type\": \"vxlan\", \"provider:physical_network\": null, \"provider:segmentation_id\": 1862}, \"network_id\": \"5dddb3dc-b6d6-4247-a02e-8089c4374290\"}, \"timestamp\": \"2025-09-11 16:31:58.734463\", \"_unique_id\": \"5e4090d2069440209794e0c6d29dee5b\", \"_context_user\": \"5f9179b7e200cd85c55e8a26400e266c6b4f7209f6d3fb2adc3cf8e1113c378c\", \"_context_project_id\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_system_scope\": null, \"_context_project\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_domain\": null, \"_context_user_domain\": \"1f75c3b20fcb41ec924a71be83a5ee94\", \"_context_project_domain\": \"7f46f53fcb3c4625a343eaa35b5e0d04\", \"_context_is_admin\": true, \"_context_read_only\": false, \"_context_show_deleted\": false, \"_context_auth_token\": null, \"_context_request_id\": \"req-7164140a-3ff6-4eeb-b4b0-191e4312344c\", \"_context_global_request_id\": null, \"_context_resource_uuid\": null, \"_context_roles\": [\"manager\", \"reader\", \"member\", \"admin\"], \"_context_user_identity\": \"5f9179b7e200cd85c55e8a26400e266c6b4f7209f6d3fb2adc3cf8e1113c378c 32e02632f4f04415bab5895d1e7247b7 - 1f75c3b20fcb41ec924a71be83a5ee94 7f46f53fcb3c4625a343eaa35b5e0d04\", \"_context_is_admin_project\": true, \"_context_user_id\": \"5f9179b7e200cd85c55e8a26400e266c6b4f7209f6d3fb2adc3cf8e1113c378c\", \"_context_tenant_id\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_timestamp\": \"2025-09-11 16:31:58.733890\", \"_context_tenant_name\": \"baremetal\", \"_context_project_name\": \"baremetal\", \"_context_user_name\": \"[email protected]\"}"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"oslo.version": "2.0", "oslo.message": "{\"message_id\": \"65fc1389-1981-4a8d-9799-0fd41f051023\", \"publisher_id\": \"network.neutron-server-5bb5c5b5d9-cl6lv\", \"event_type\": \"network.update.end\", \"priority\": \"INFO\", \"payload\": {\"network\": {\"id\": \"f4aa4b99-2c2f-4698-a2f0-ac9920b1ee81\", \"name\": \"service-net\", \"tenant_id\": \"a4a74dbf982a471e8150db2babcac8c2\", \"admin_state_up\": true, \"mtu\": 9000, \"status\": \"ACTIVE\", \"subnets\": [\"1600eeef-6b3c-47fe-981a-e9ae83e23ce7\"], \"shared\": false, \"availability_zone_hints\": [], \"availability_zones\": [], \"ipv4_address_scope\": \"73bb6292-e015-4607-aac9-9a7095efa1a9\", \"ipv6_address_scope\": null, \"router:external\": false, \"description\": \"test-servicenet-network\", \"port_security_enabled\": true, \"l2_adjacency\": true, \"tags\": [], \"created_at\": \"2025-08-20T13:15:46Z\", \"updated_at\": \"2025-09-16T16:15:04Z\", \"revision_number\": 5, \"project_id\": \"a4a74dbf982a471e8150db2babcac8c2\", \"provider:network_type\": \"vxlan\", \"provider:physical_network\": null, \"provider:segmentation_id\": 1860}}, \"timestamp\": \"2025-09-16 16:15:05.161384\", \"_unique_id\": \"d5da8774d7d8447cb0d6476729f21c70\", \"_context_user\": \"e63aa434bf761337c4588ed49af49f6a7a2a86501a66a11d7da13ec0ead25ed4\", \"_context_project_id\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_system_scope\": null, \"_context_project\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_domain\": null, \"_context_user_domain\": \"1f75c3b20fcb41ec924a71be83a5ee94\", \"_context_project_domain\": \"7f46f53fcb3c4625a343eaa35b5e0d04\", \"_context_is_admin\": true, \"_context_read_only\": false, \"_context_show_deleted\": false, \"_context_auth_token\": null, \"_context_request_id\": \"req-23005bcf-c8e2-4b30-8b89-b911358b734e\", \"_context_global_request_id\": null, \"_context_resource_uuid\": null, \"_context_roles\": [\"manager\", \"reader\", \"member\", \"admin\"], \"_context_user_identity\": \"e63aa434bf761337c4588ed49af49f6a7a2a86501a66a11d7da13ec0ead25ed4 32e02632f4f04415bab5895d1e7247b7 - 1f75c3b20fcb41ec924a71be83a5ee94 7f46f53fcb3c4625a343eaa35b5e0d04\", \"_context_is_admin_project\": true, \"_context_user_id\": \"e63aa434bf761337c4588ed49af49f6a7a2a86501a66a11d7da13ec0ead25ed4\", \"_context_tenant_id\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_timestamp\": \"2025-09-16 16:15:05.160974\", \"_context_tenant_name\": \"baremetal\", \"_context_project_name\": \"baremetal\", \"_context_user_name\": \"[email protected]\"}"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"oslo.version": "2.0", "oslo.message": "{\"message_id\": \"60b24028-342c-4337-93f3-d0853ee753a4\", \"publisher_id\": \"network.neutron-server-7bb5fc5987-w8srl\", \"event_type\": \"subnet.create.end\", \"priority\": \"INFO\", \"payload\": {\"subnet\": {\"id\": \"eb9edeef-cc57-45ca-9caf-42be046822ff\", \"name\": \"c_rally_49fb715e_XGTdOFQF\", \"tenant_id\": \"3a69b98463964e19b295f87cffa5db52\", \"network_id\": \"b69b1a1d-5620-48fa-8fc2-fb0d1e90cf1c\", \"ip_version\": 4, \"subnetpool_id\": null, \"enable_dhcp\": true, \"ipv6_ra_mode\": null, \"ipv6_address_mode\": null, \"gateway_ip\": \"192.168.91.1\", \"cidr\": \"192.168.91.0/24\", \"allocation_pools\": [{\"start\": \"192.168.91.2\", \"end\": \"192.168.91.254\"}], \"host_routes\": [], \"dns_nameservers\": [\"8.8.8.8\"], \"description\": \"\", \"router:external\": false, \"service_types\": [], \"tags\": [], \"created_at\": \"2025-09-15T00:19:56Z\", \"updated_at\": \"2025-09-15T00:19:56Z\", \"revision_number\": 0, \"project_id\": \"3a69b98463964e19b295f87cffa5db52\"}}, \"timestamp\": \"2025-09-15 00:19:56.545912\", \"_unique_id\": \"46a2d701444f4f07aadc3c6c77dd4d08\", \"_context_user\": \"592e424b165948288c86687057c88fe8\", \"_context_project_id\": \"3a69b98463964e19b295f87cffa5db52\", \"_context_system_scope\": null, \"_context_project\": \"3a69b98463964e19b295f87cffa5db52\", \"_context_domain\": null, \"_context_user_domain\": \"default\", \"_context_project_domain\": \"default\", \"_context_is_admin\": false, \"_context_read_only\": false, \"_context_show_deleted\": false, \"_context_auth_token\": null, \"_context_request_id\": \"req-b1617d34-e375-45fd-ae90-5c14c8bef0d0\", \"_context_global_request_id\": null, \"_context_resource_uuid\": null, \"_context_roles\": [\"member\", \"reader\"], \"_context_user_identity\": \"592e424b165948288c86687057c88fe8 3a69b98463964e19b295f87cffa5db52 - default default\", \"_context_is_admin_project\": true, \"_context_user_id\": \"592e424b165948288c86687057c88fe8\", \"_context_tenant_id\": \"3a69b98463964e19b295f87cffa5db52\", \"_context_timestamp\": \"2025-09-15 00:19:56.544749\", \"_context_tenant_name\": \"c_rally_49fb715e_K771F0gL\", \"_context_project_name\": \"c_rally_49fb715e_K771F0gL\", \"_context_user_name\": \"c_rally_49fb715e_DAKXu9bI\"}"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"oslo.version": "2.0", "oslo.message": "{\"message_id\": \"7dac063f-e339-42e2-aa02-a02796aa9ee0\", \"publisher_id\": \"network.neutron-server-7bb5fc5987-w8srl\", \"event_type\": \"subnet.delete.end\", \"priority\": \"INFO\", \"payload\": {\"subnet\": {\"id\": \"eb9edeef-cc57-45ca-9caf-42be046822ff\", \"name\": \"c_rally_49fb715e_XGTdOFQF\", \"tenant_id\": \"3a69b98463964e19b295f87cffa5db52\", \"network_id\": \"b69b1a1d-5620-48fa-8fc2-fb0d1e90cf1c\", \"ip_version\": 4, \"subnetpool_id\": null, \"enable_dhcp\": true, \"ipv6_ra_mode\": null, \"ipv6_address_mode\": null, \"standard_attr_id\": 14245, \"gateway_ip\": \"192.168.91.1\", \"cidr\": \"192.168.91.0/24\", \"allocation_pools\": [{\"start\": \"192.168.91.2\", \"end\": \"192.168.91.254\"}], \"host_routes\": [], \"dns_nameservers\": [\"8.8.8.8\"], \"shared\": false, \"description\": \"\", \"router:external\": false, \"service_types\": [], \"segment_id\": null, \"tags\": [], \"created_at\": \"2025-09-15T00:19:56Z\", \"updated_at\": \"2025-09-15T00:19:56Z\", \"revision_number\": 0, \"project_id\": \"3a69b98463964e19b295f87cffa5db52\"}, \"subnet_id\": \"eb9edeef-cc57-45ca-9caf-42be046822ff\"}, \"timestamp\": \"2025-09-15 00:28:41.377712\", \"_unique_id\": \"df61372c5814497d99892c9b5d485475\", \"_context_user\": \"592e424b165948288c86687057c88fe8\", \"_context_project_id\": \"3a69b98463964e19b295f87cffa5db52\", \"_context_system_scope\": null, \"_context_project\": \"3a69b98463964e19b295f87cffa5db52\", \"_context_domain\": null, \"_context_user_domain\": \"default\", \"_context_project_domain\": \"default\", \"_context_is_admin\": false, \"_context_read_only\": false, \"_context_show_deleted\": false, \"_context_auth_token\": null, \"_context_request_id\": \"req-9bb860ee-02be-4b0f-a45a-6c1042440555\", \"_context_global_request_id\": null, \"_context_resource_uuid\": null, \"_context_roles\": [\"member\", \"reader\"], \"_context_user_identity\": \"592e424b165948288c86687057c88fe8 3a69b98463964e19b295f87cffa5db52 - default default\", \"_context_is_admin_project\": true, \"_context_user_id\": \"592e424b165948288c86687057c88fe8\", \"_context_tenant_id\": \"3a69b98463964e19b295f87cffa5db52\", \"_context_timestamp\": \"2025-09-15 00:28:41.376637\", \"_context_tenant_name\": \"c_rally_49fb715e_K771F0gL\", \"_context_project_name\": \"c_rally_49fb715e_K771F0gL\", \"_context_user_name\": \"c_rally_49fb715e_DAKXu9bI\"}"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"oslo.version": "2.0", "oslo.message": "{\"message_id\": \"3c72f869-d29b-4eaf-91d5-2d0606477367\", \"publisher_id\": \"network.neutron-server-5bb5c5b5d9-c82x2\", \"event_type\": \"subnet.update.end\", \"priority\": \"INFO\", \"payload\": {\"subnet\": {\"id\": \"1600eeef-6b3c-47fe-981a-e9ae83e23ce7\", \"name\": \"my-servicenet\", \"tenant_id\": \"a4a74dbf982a471e8150db2babcac8c2\", \"network_id\": \"f4aa4b99-2c2f-4698-a2f0-ac9920b1ee81\", \"ip_version\": 4, \"subnetpool_id\": \"eed7e843-645f-43b6-85e4-6272dd395a9d\", \"enable_dhcp\": false, \"ipv6_ra_mode\": null, \"ipv6_address_mode\": null, \"gateway_ip\": \"10.148.4.33\", \"cidr\": \"10.148.4.32/27\", \"allocation_pools\": [{\"start\": \"10.148.4.34\", \"end\": \"10.148.4.62\"}], \"host_routes\": [], \"dns_nameservers\": [], \"description\": \"\", \"router:external\": false, \"service_types\": [], \"segment_id\": null, \"tags\": [], \"created_at\": \"2025-08-20T13:16:18Z\", \"updated_at\": \"2025-09-16T16:12:01Z\", \"revision_number\": 2, \"project_id\": \"a4a74dbf982a471e8150db2babcac8c2\"}}, \"timestamp\": \"2025-09-16 16:12:01.737116\", \"_unique_id\": \"844c0977a501475cbb9dea8207ccaf02\", \"_context_user\": \"e63aa434bf761337c4588ed49af49f6a7a2a86501a66a11d7da13ec0ead25ed4\", \"_context_project_id\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_system_scope\": null, \"_context_project\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_domain\": null, \"_context_user_domain\": \"1f75c3b20fcb41ec924a71be83a5ee94\", \"_context_project_domain\": \"7f46f53fcb3c4625a343eaa35b5e0d04\", \"_context_is_admin\": true, \"_context_read_only\": false, \"_context_show_deleted\": false, \"_context_auth_token\": null, \"_context_request_id\": \"req-4483343f-a44e-4716-b835-cd605c4e0898\", \"_context_global_request_id\": null, \"_context_resource_uuid\": null, \"_context_roles\": [\"manager\", \"reader\", \"member\", \"admin\"], \"_context_user_identity\": \"e63aa434bf761337c4588ed49af49f6a7a2a86501a66a11d7da13ec0ead25ed4 32e02632f4f04415bab5895d1e7247b7 - 1f75c3b20fcb41ec924a71be83a5ee94 7f46f53fcb3c4625a343eaa35b5e0d04\", \"_context_is_admin_project\": true, \"_context_user_id\": \"e63aa434bf761337c4588ed49af49f6a7a2a86501a66a11d7da13ec0ead25ed4\", \"_context_tenant_id\": \"32e02632f4f04415bab5895d1e7247b7\", \"_context_timestamp\": \"2025-09-16 16:12:01.736781\", \"_context_tenant_name\": \"baremetal\", \"_context_project_name\": \"baremetal\", \"_context_user_name\": \"[email protected]\"}"}

0 commit comments

Comments
 (0)