fix(switch-compat): parse embedded port speed for chassis switches

Chassis switches use ports_config keys like 'max_per_slot_100G_QSFP28' (speed in
the middle), not just '100G_QSFP28'. The '^[0-9.]+G' anchor failed -> port_speed
NULL -> 0 suggestions (e.g. Cisco 8818 router). Now extracts the speed token
wherever it sits before the cage. Cisco 8818: 0 -> 55, all Cisco-codeable, max 400G.
This commit is contained in:
Rene Fichtmueller 2026-06-11 06:57:42 +00:00
parent 3bec30bad3
commit 2dc21ee0aa

View File

@ -352,10 +352,13 @@ export async function getFlexoptixSuggestions(switchId: string) {
-- bounded by the port speed so corrupt/oversized records cannot leak in. -- bounded by the port speed so corrupt/oversized records cannot leak in.
SELECT DISTINCT SELECT DISTINCT
-- numeric speed prefix: 100G->100, 25G->25, 2.5G->2.5, 100M->0.1, 800G->800 -- numeric speed prefix: 100G->100, 25G->25, 2.5G->2.5, 100M->0.1, 800G->800
-- speed token may be at the start ('100G_QSFP28') or embedded
-- ('max_per_slot_100G_QSFP28' on chassis switches). Match before the cage.
CASE CASE
WHEN k ~ '^[0-9.]+M' THEN (substring(k from '^([0-9.]+)M')::numeric / 1000) WHEN k ~ '[0-9.]+M[_A-Za-z]' THEN (substring(k from '([0-9.]+)M[_A-Za-z]')::numeric / 1000)
WHEN k ~ '^[0-9.]+G' THEN substring(k from '^([0-9.]+)G')::numeric WHEN k ~ '[0-9.]+T[_A-Za-z]' THEN (substring(k from '([0-9.]+)T[_A-Za-z]')::numeric * 1000)
WHEN k ~ '^[0-9.]+T' THEN (substring(k from '^([0-9.]+)T')::numeric * 1000) WHEN k ~ '[0-9.]+G[_A-Za-z]' THEN substring(k from '([0-9.]+)G[_A-Za-z]')::numeric
WHEN k ~ '[0-9.]+G$' THEN substring(k from '([0-9.]+)G$')::numeric
ELSE NULL ELSE NULL
END AS port_speed, END AS port_speed,
-- the port's specific cage type (determines which modules mechanically seat) -- the port's specific cage type (determines which modules mechanically seat)