Skip to content

Commit f971dc0

Browse files
authored
Merge pull request #1372 from rackerlabs/fix-wrong-ucvni
fix: add segmentation_id to ucvni create request
2 parents 0892ea9 + d404835 commit f971dc0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

python/understack-workflows/tests/test_oslo_event_neutron_network.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def test_handle_network_create(network_create_event_data):
5151
"ucvni_group": {
5252
"name": "FOO",
5353
},
54+
"ucvni_id": 1862,
5455
},
5556
)
5657
assert result == 0
@@ -78,6 +79,7 @@ def test_handle_network_update(network_update_event_data):
7879
"ucvni_group": {
7980
"name": "FOO",
8081
},
82+
"ucvni_id": 1860,
8183
},
8284
)
8385
assert result == 0

python/understack-workflows/understack_workflows/oslo_event/neutron_network.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class NetworkEvent:
2121
network_name: str
2222
tenant_id: UUID
2323
external: bool
24+
provider_segmentation_id: int
2425

2526
@classmethod
2627
def from_event_dict(cls, data: dict) -> Self:
@@ -31,6 +32,7 @@ def from_event_dict(cls, data: dict) -> Self:
3132
network["name"],
3233
UUID(network["project_id"]),
3334
bool(network["router:external"]),
35+
int(network["provider:segmentation_id"]),
3436
)
3537

3638

@@ -66,13 +68,16 @@ def _create_nautobot_ucvni(
6668
ucvni_group_name = os.getenv("UCVNI_GROUP_NAME")
6769
if ucvni_group_name is None:
6870
raise RuntimeError("Please set environment variable UCVNI_GROUP_NAME")
71+
if event.provider_segmentation_id is None:
72+
raise RuntimeError("Network %s missing provider:segmentation_id", id)
6973

7074
payload = {
7175
"id": id,
7276
"name": event.network_name,
7377
"status": {"name": "Active"},
7478
"tenant": str(event.tenant_id),
7579
"ucvni_group": {"name": ucvni_group_name},
80+
"ucvni_id": event.provider_segmentation_id,
7681
}
7782
try:
7883
response = nautobot.plugins.undercloud_vni.ucvnis.create(payload)

0 commit comments

Comments
 (0)