Skip to content

Commit ae85dcc

Browse files
add segmentation_id to ucvni create request
1 parent a37d8bc commit ae85dcc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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)