Fix LS Topology map double-quoted protocol variable
The protocol variable has includeAll enabled, so Grafana auto-quotes
its value ('IS-IS_L2'); the SQL then wrapped it again, producing
''IS-IS_L2'' and a syntax error that blanked the node graph. Replace
the quoted equality filter with IN ($protocol) — Grafana already
emits a quoted CSV — and make the variable multi-select so "All"
expands cleanly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0200932ea0
commit
1acdc32dda
@ -25,13 +25,13 @@
|
|||||||
{
|
{
|
||||||
"datasource": {"type": "postgres","uid": "obmp_postgres"},
|
"datasource": {"type": "postgres","uid": "obmp_postgres"},
|
||||||
"format": "table",
|
"format": "table",
|
||||||
"rawSql": "SELECT n.hash_id::text AS id,\n CASE WHEN COALESCE(n.name,'') = '' THEN n.igp_router_id ELSE n.name END AS title,\n n.router_id AS mainstat,\n n.protocol::text AS secondarystat,\n n.igp_router_id AS detail__igp_id,\n 'AS ' || n.asn AS detail__asn,\n COALESCE(NULLIF(n.sr_capabilities,''),'none') AS detail__sr_caps,\n CASE WHEN COALESCE(n.sr_capabilities,'') <> '' THEN 1 ELSE 0 END AS arc__sr,\n CASE WHEN COALESCE(n.sr_capabilities,'') = '' THEN 1 ELSE 0 END AS arc__plain\nFROM ls_nodes n\nWHERE n.iswithdrawn = false\n AND n.peer_hash_id = '$peer_hash'\n AND ('$protocol' = '' OR n.protocol::text = '$protocol')\n AND ($asn = 0 OR n.asn = $asn)\nORDER BY title",
|
"rawSql": "SELECT n.hash_id::text AS id,\n CASE WHEN COALESCE(n.name,'') = '' THEN n.igp_router_id ELSE n.name END AS title,\n n.router_id AS mainstat,\n n.protocol::text AS secondarystat,\n n.igp_router_id AS detail__igp_id,\n 'AS ' || n.asn AS detail__asn,\n COALESCE(NULLIF(n.sr_capabilities,''),'none') AS detail__sr_caps,\n CASE WHEN COALESCE(n.sr_capabilities,'') <> '' THEN 1 ELSE 0 END AS arc__sr,\n CASE WHEN COALESCE(n.sr_capabilities,'') = '' THEN 1 ELSE 0 END AS arc__plain\nFROM ls_nodes n\nWHERE n.iswithdrawn = false\n AND n.peer_hash_id = '$peer_hash'\n AND n.protocol::text IN ($protocol)\n AND ($asn = 0 OR n.asn = $asn)\nORDER BY title",
|
||||||
"refId": "nodes"
|
"refId": "nodes"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"datasource": {"type": "postgres","uid": "obmp_postgres"},
|
"datasource": {"type": "postgres","uid": "obmp_postgres"},
|
||||||
"format": "table",
|
"format": "table",
|
||||||
"rawSql": "SELECT l.local_node_hash_id::text || '->' || l.remote_node_hash_id::text AS id,\n l.local_node_hash_id::text AS source,\n l.remote_node_hash_id::text AS target,\n MAX(l.igp_metric)::bigint AS mainstat,\n MAX(l.protocol::text) AS secondarystat,\n MAX(l.te_def_metric)::text AS detail__te_metric,\n MAX(l.max_link_bw)::text AS detail__max_bw\nFROM ls_links l\nJOIN ls_nodes ln ON ln.hash_id = l.local_node_hash_id AND ln.peer_hash_id = l.peer_hash_id\nWHERE l.iswithdrawn = false\n AND l.peer_hash_id = '$peer_hash'\n AND ('$protocol' = '' OR l.protocol::text = '$protocol')\n AND ($asn = 0 OR ln.asn = $asn)\nGROUP BY l.local_node_hash_id, l.remote_node_hash_id",
|
"rawSql": "SELECT l.local_node_hash_id::text || '->' || l.remote_node_hash_id::text AS id,\n l.local_node_hash_id::text AS source,\n l.remote_node_hash_id::text AS target,\n MAX(l.igp_metric)::bigint AS mainstat,\n MAX(l.protocol::text) AS secondarystat,\n MAX(l.te_def_metric)::text AS detail__te_metric,\n MAX(l.max_link_bw)::text AS detail__max_bw\nFROM ls_links l\nJOIN ls_nodes ln ON ln.hash_id = l.local_node_hash_id AND ln.peer_hash_id = l.peer_hash_id\nWHERE l.iswithdrawn = false\n AND l.peer_hash_id = '$peer_hash'\n AND l.protocol::text IN ($protocol)\n AND ($asn = 0 OR ln.asn = $asn)\nGROUP BY l.local_node_hash_id, l.remote_node_hash_id",
|
||||||
"refId": "edges"
|
"refId": "edges"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -67,7 +67,7 @@
|
|||||||
"hide": 0,
|
"hide": 0,
|
||||||
"includeAll": true,
|
"includeAll": true,
|
||||||
"label": "IGP Protocol",
|
"label": "IGP Protocol",
|
||||||
"multi": false,
|
"multi": true,
|
||||||
"name": "protocol",
|
"name": "protocol",
|
||||||
"options": [],
|
"options": [],
|
||||||
"query": "SELECT DISTINCT protocol::text FROM ls_nodes WHERE iswithdrawn=false AND protocol IS NOT NULL AND protocol::text <> '' ORDER BY 1",
|
"query": "SELECT DISTINCT protocol::text FROM ls_nodes WHERE iswithdrawn=false AND protocol IS NOT NULL AND protocol::text <> '' ORDER BY 1",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user