Skip to content

Commit f37859a

Browse files
author
Steve Keay
committed
Handle the VLAN-type network bind ports
Our provisioning network uses this.
1 parent c5235e1 commit f37859a

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

Diff for: python/neutron-understack/neutron_understack/neutron_understack_mech.py

+30-5
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ def update_port_postcommit(self, context):
308308
# conditional based on what appears to have changed in the provided
309309
# context versus the "original".
310310
vlan_group_name = self._vlan_group_name(context)
311+
LOG.debug(
312+
"update_port_postcommit vlan_group=%s vif_type=%s",
313+
vlan_group_name, context.vif_type
314+
)
311315
if vlan_group_name and context.vif_type == portbindings.VIF_TYPE_OTHER:
312316
self.invoke_undersync(vlan_group_name)
313317

@@ -361,6 +365,9 @@ def bind_port(self, context: PortContext) -> None:
361365
362366
We obtain the dynamic segment for this network and vlan_group.
363367
368+
If there are no VXLAN segments, then bind a VLAN segment instead (this
369+
is required for VALN_type networks like the provisioning network).
370+
364371
We configure the nautobot switch interface with the new VLAN(s).
365372
366373
Then make the required call in to the black box: context.set_binding.
@@ -373,6 +380,29 @@ def bind_port(self, context: PortContext) -> None:
373380
self._bind_port_segment(context, segment)
374381
return
375382

383+
for segment in context.network.network_segments:
384+
if segment[api.NETWORK_TYPE] == p_const.TYPE_VLAN:
385+
self._bind_port_vlan_segment(context, segment)
386+
return
387+
388+
def _bind_port_vlan_segment(self, context: PortContext, segment: dict):
389+
LOG.debug("bind_port_vlan_segment %s", segment)
390+
391+
if is_provisioning_network(network_id):
392+
self._set_nautobot_port_status(context, "Provisioning-Interface")
393+
else:
394+
LOG.info(
395+
"bind_port_vlan_segment won't configure segment in nautobot %s",
396+
segment
397+
)
398+
399+
context.set_binding(
400+
segment[api.ID],
401+
portbindings.VIF_TYPE_OTHER,
402+
{},
403+
status=p_const.PORT_STATUS_ACTIVE,
404+
)
405+
376406
def _bind_port_segment(self, context: PortContext, segment):
377407
trunk_details = context.current.get("trunk_details", {})
378408
network_id = context.current["network_id"]
@@ -382,11 +412,6 @@ def _bind_port_segment(self, context: PortContext, segment):
382412
)
383413
vlan_group_name = self._vlan_group_name(context)
384414

385-
if is_provisioning_network(network_id):
386-
LOG.debug("bind_port_segment side-stepping provisioning interface")
387-
self._set_nautobot_port_status(context, "Provisioning-Interface")
388-
return
389-
390415
LOG.debug(
391416
"bind_port_segment interface %s network %s type %s",
392417
connected_interface_uuid,

0 commit comments

Comments
 (0)