Make L3VPN RD/VRF filter dynamic (roadmap E4)

Both L3VPN dashboards had a static custom 'rd' variable holding only
the '-' (all) sentinel — you could not actually filter by a VRF.
Convert 'rd' to a query variable that discovers route distinguishers
from l3vpn_rib. Degrades cleanly on the (currently empty) lab table:
the query always returns '-', so behaviour is unchanged until real
L3VPN data exists, then RDs auto-populate. Existing panel SQL
('$rd' = '-' OR rd = '$rd') is untouched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
sam 2026-05-19 08:00:50 -07:00
parent 0451b2aa87
commit 6496b60311
2 changed files with 34 additions and 33 deletions

View File

@ -645,27 +645,28 @@
"type": "query" "type": "query"
}, },
{ {
"name": "rd",
"type": "query",
"label": "RD",
"description": "Route Distinguisher (VRF). Auto-discovered from l3vpn_rib; '-' = all VRFs.",
"datasource": {
"type": "postgres",
"uid": "obmp_postgres"
},
"query": "SELECT '-' AS rd UNION SELECT DISTINCT rd FROM l3vpn_rib WHERE iswithdrawn = false ORDER BY rd",
"definition": "SELECT '-' AS rd UNION SELECT DISTINCT rd FROM l3vpn_rib WHERE iswithdrawn = false ORDER BY rd",
"refresh": 1,
"includeAll": false,
"multi": false,
"current": { "current": {
"selected": false, "selected": true,
"text": "-", "text": "-",
"value": "-" "value": "-"
}, },
"description": "RD in the format of N:N. Set to - for all.", "options": [],
"sort": 1,
"hide": 0, "hide": 0,
"includeAll": false, "skipUrlSync": false
"label": "RD",
"multi": false,
"name": "rd",
"options": [
{
"selected": true,
"text": "-",
"value": "-"
}
],
"query": "-",
"skipUrlSync": false,
"type": "custom"
} }
] ]
}, },

View File

@ -1067,28 +1067,28 @@
"useTags": false "useTags": false
}, },
{ {
"name": "rd",
"type": "query",
"label": "RD",
"description": "Route Distinguisher (VRF). Auto-discovered from l3vpn_rib; '-' = all VRFs.",
"datasource": {
"type": "postgres",
"uid": "obmp_postgres"
},
"query": "SELECT '-' AS rd UNION SELECT DISTINCT rd FROM l3vpn_rib WHERE iswithdrawn = false ORDER BY rd",
"definition": "SELECT '-' AS rd UNION SELECT DISTINCT rd FROM l3vpn_rib WHERE iswithdrawn = false ORDER BY rd",
"refresh": 1,
"includeAll": false,
"multi": false,
"current": { "current": {
"selected": true, "selected": true,
"text": "-", "text": "-",
"value": "-" "value": "-"
}, },
"description": "RD in the format of N:N. Set to - for all.", "options": [],
"sort": 1,
"hide": 0, "hide": 0,
"includeAll": false, "skipUrlSync": false
"label": "RD",
"multi": false,
"name": "rd",
"options": [
{
"selected": true,
"text": "-",
"value": "-"
}
],
"query": "-",
"queryValue": "203:20",
"skipUrlSync": false,
"type": "custom"
}, },
{ {
"current": { "current": {