Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ class PaloAltoHaSecondaryMissing(n_exc.Conflict):
)


# Conflict -> HTTP 409: the HA pair's units ended up on different VLANs.
class PaloAltoHaVlanMismatch(n_exc.Conflict):
message = (
"Palo Alto router %(router_id)s port %(port_id)s is on VLAN %(primary)s "
"on the HA primary but %(secondary)s on the secondary; retry."
)


# Conflict -> HTTP 409: more than one of our wiring objects has this name.
class PaloAltoWiringAmbiguous(n_exc.Conflict):
message = (
Expand Down Expand Up @@ -852,9 +860,17 @@ def attach_port(
)
for secondary_stack in secondary_stacks:
mirror = self._ensure_mirror_port(router_id, port)
self._add_router_port_subport(
mirror_vlan = self._add_router_port_subport(
router_id, secondary_stack.trunk, mirror, label, lambda: vlan
)
# A fabric_vlan set mid-wiring overrides the primary's VLAN here.
if mirror_vlan != vlan:
raise PaloAltoHaVlanMismatch(
router_id=router_id,
port_id=port["id"],
primary=vlan,
secondary=mirror_vlan,
)
LOG.info(
"Attached Palo Alto router %s %s port %s via parent %s trunk %s%s",
router_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,16 @@ def test_a_retry_puts_the_mirror_on_the_primarys_vlan(self, wiring, pair):
"palo-alto-router-mirror-r1-intf-1": 250
}

def test_the_units_must_share_one_vlan(self, mocker, wiring, pair):
# A fabric_vlan set while only the primary is wired reaches the secondary.
wiring.attach_port("r1", dict(_HA_INTERFACE), "interface")
secondary = pair.neutron.trunks["palo-alto-router-trunk-r1-inside-secondary"]
secondary["sub_ports"] = []
mocker.patch("neutron_understack.utils.network_fabric_vlan", return_value=3005)

with pytest.raises(palo_alto_wiring.PaloAltoHaVlanMismatch):
wiring.attach_port("r1", dict(_HA_INTERFACE), "interface")

def test_an_ha_primary_without_its_secondary_is_refused(self, wiring, ironic, pair):
ironic.secondaries_for_router.return_value = []

Expand Down
Loading