import json

dashboard = json.dumps(
    {
        "annotations": {
            "list": [
                {
                    "builtIn": 1,
                    "datasource": "-- Grafana --",
                    "enable": True,
                    "hide": True,
                    "iconColor": "rgba(0, 211, 255, 1)",
                    "name": "Annotations & Alerts",
                    "target": {
                        "limit": 100,
                        "matchAny": False,
                        "tags": [],
                        "type": "dashboard",
                    },
                    "type": "dashboard",
                }
            ]
        },
        "description": "VIPI proxy traffic by AS",
        "editable": True,
        "fiscalYearStartMonth": 0,
        "gnetId": 11206,
        "graphTooltip": 0,
        "id": 1,
        "iteration": 1668446221155,
        "links": [],
        "liveNow": False,
        "panels": [
            {
                "aliasColors": {},
                "bars": False,
                "dashLength": 10,
                "dashes": False,
                "datasource": "Prometheus",
                "fieldConfig": {"defaults": {"links": []}, "overrides": []},
                "fill": 1,
                "fillGradient": 0,
                "gridPos": {"h": 6, "w": 24, "x": 0, "y": 0},
                "hiddenSeries": False,
                "id": 2,
                "legend": {
                    "alignAsTable": True,
                    "avg": True,
                    "current": False,
                    "hideEmpty": False,
                    "hideZero": True,
                    "max": False,
                    "min": False,
                    "rightSide": True,
                    "show": False,
                    "sideWidth": 250,
                    "sort": "avg",
                    "sortDesc": True,
                    "total": False,
                    "values": True,
                },
                "lines": True,
                "linewidth": 1,
                "NonePointMode": "None as zero",
                "options": {"alertThreshold": True},
                "percentage": False,
                "pluginVersion": "8.2.6",
                "pointradius": 2,
                "points": False,
                "renderer": "flot",
                "seriesOverrides": [],
                "spaceLength": 10,
                "stack": False,
                "steppedLine": False,
                "targets": [
                    {
                        "expr": 'topk(5, sum(rate(proxy_downstream_total{job="vipen-server",src_as=~"$as",instance=~"$server"}[1m]) * 8) by (src_as, src_as_name))',
                        "intervalFactor": 1,
                        "legendFormat": "{{src_as_name}} (AS{{src_as}})",
                        "refId": "B",
                    }
                ],
                "thresholds": [],
                "timeFrom": None,
                "timeRegions": [],
                "timeShift": None,
                "title": "Downstream Traffic by AS",
                "tooltip": {"shared": False, "sort": 1, "value_type": "individual"},
                "type": "graph",
                "xaxis": {
                    "buckets": None,
                    "mode": "time",
                    "name": None,
                    "show": True,
                    "values": [],
                },
                "yaxes": [
                    {
                        "format": "bps",
                        "label": "",
                        "logBase": 1,
                        "max": None,
                        "min": None,
                        "show": True,
                    },
                    {
                        "format": "short",
                        "label": None,
                        "logBase": 1,
                        "max": None,
                        "min": None,
                        "show": False,
                    },
                ],
                "yaxis": {"align": False, "alignLevel": None},
            },
            {
                "aliasColors": {},
                "bars": False,
                "dashLength": 10,
                "dashes": False,
                "datasource": "Prometheus",
                "fieldConfig": {"defaults": {"links": []}, "overrides": []},
                "fill": 1,
                "fillGradient": 0,
                "gridPos": {"h": 6, "w": 24, "x": 0, "y": 6},
                "hiddenSeries": False,
                "id": 7,
                "legend": {
                    "alignAsTable": True,
                    "avg": True,
                    "current": False,
                    "hideEmpty": False,
                    "hideZero": True,
                    "max": False,
                    "min": False,
                    "rightSide": True,
                    "show": False,
                    "sideWidth": 250,
                    "sort": "avg",
                    "sortDesc": True,
                    "total": False,
                    "values": True,
                },
                "lines": True,
                "linewidth": 1,
                "NonePointMode": "None as zero",
                "options": {"alertThreshold": True},
                "percentage": False,
                "pluginVersion": "8.2.6",
                "pointradius": 2,
                "points": False,
                "renderer": "flot",
                "seriesOverrides": [{"alias": "/.*TX.*/", "transform": "negative-Y"}],
                "spaceLength": 10,
                "stack": False,
                "steppedLine": False,
                "targets": [
                    {
                        "expr": 'topk(5, sum(rate(proxy_upstream_total{job="vipen-server",src_as=~"$as",instance=~"$server"}[1m]) * 8) by (src_as, src_as_name))',
                        "instant": False,
                        "interval": "",
                        "intervalFactor": 1,
                        "legendFormat": "{{src_as_name}} (AS{{src_as}})",
                        "refId": "A",
                    }
                ],
                "thresholds": [],
                "timeFrom": None,
                "timeRegions": [],
                "timeShift": None,
                "title": "Upstream Traffic by AS",
                "tooltip": {"shared": False, "sort": 1, "value_type": "individual"},
                "type": "graph",
                "xaxis": {
                    "buckets": None,
                    "mode": "time",
                    "name": None,
                    "show": True,
                    "values": [],
                },
                "yaxes": [
                    {
                        "format": "bps",
                        "label": "",
                        "logBase": 1,
                        "max": None,
                        "min": None,
                        "show": True,
                    },
                    {
                        "format": "short",
                        "label": None,
                        "logBase": 1,
                        "max": None,
                        "min": None,
                        "show": False,
                    },
                ],
                "yaxis": {"align": False, "alignLevel": None},
            },
            {
                "cacheTimeout": None,
                "columns": [],
                "datasource": "Prometheus",
                "fontSize": "100%",
                "gridPos": {"h": 11, "w": 12, "x": 0, "y": 12},
                "id": 5,
                "links": [],
                "pageSize": None,
                "pluginVersion": "6.3.6",
                "scroll": True,
                "showHeader": True,
                "sort": {"col": 8, "desc": True},
                "styles": [
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "Time",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "Bandwidth",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "link": False,
                        "linkUrl": "",
                        "mappingType": 1,
                        "pattern": "Value",
                        "thresholds": [],
                        "type": "number",
                        "unit": "bps",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "__name__",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "src_as",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "src_as_name",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "instance",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "job",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "ASN",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 0,
                        "link": True,
                        "linkTargetBlank": True,
                        "linkTooltip": "PeeringDB",
                        "linkUrl": "https://as${__cell}.peeringdb.com",
                        "mappingType": 1,
                        "pattern": "src_as",
                        "thresholds": [],
                        "type": "number",
                        "unit": "none",
                    },
                    {
                        "alias": "AS Name",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "src_as_name",
                        "thresholds": [],
                        "type": "string",
                        "unit": "short",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "hostname",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                ],
                "targets": [
                    {
                        "expr": 'topk(10, sum(rate(proxy_downstream_total{job="vipen-server",src_as=~"$as",instance=~"$server"}[$__range]) * 8) by (src_as, src_as_name))',
                        "format": "table",
                        "instant": True,
                        "legendFormat": "{{src_as}}",
                        "refId": "A",
                    }
                ],
                "timeFrom": None,
                "timeShift": None,
                "title": "Top Downstream ASNs",
                "transform": "table",
                "type": "table-old",
            },
            {
                "cacheTimeout": None,
                "columns": [],
                "datasource": "Prometheus",
                "fontSize": "100%",
                "gridPos": {"h": 11, "w": 12, "x": 12, "y": 12},
                "id": 6,
                "links": [],
                "pageSize": None,
                "pluginVersion": "6.3.6",
                "scroll": True,
                "showHeader": True,
                "sort": {"col": 8, "desc": True},
                "styles": [
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "Time",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "Bandwidth",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "Value",
                        "thresholds": [],
                        "type": "number",
                        "unit": "bps",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "__name__",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "src_as",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "src_as_name",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "instance",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "job",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                    {
                        "alias": "ASN",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 0,
                        "link": True,
                        "linkTargetBlank": True,
                        "linkTooltip": "PeeringDB",
                        "linkUrl": "https://as${__cell}.peeringdb.com",
                        "mappingType": 1,
                        "pattern": "src_as",
                        "thresholds": [],
                        "type": "number",
                        "unit": "none",
                    },
                    {
                        "alias": "AS Name",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "src_as_name",
                        "thresholds": [],
                        "type": "string",
                        "unit": "short",
                    },
                    {
                        "alias": "",
                        "align": "auto",
                        "colorMode": None,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)",
                        ],
                        "dateFormat": "YYYY-MM-DD HH:mm:ss",
                        "decimals": 2,
                        "mappingType": 1,
                        "pattern": "hostname",
                        "thresholds": [],
                        "type": "hidden",
                        "unit": "short",
                    },
                ],
                "targets": [
                    {
                        "expr": 'topk(10, sum(rate(proxy_upstream_total{job="vipen-server",src_as=~"$as",instance=~"$server"}[$__range]) * 8) by (src_as, src_as_name))',
                        "format": "table",
                        "instant": True,
                        "legendFormat": "",
                        "refId": "A",
                    }
                ],
                "timeFrom": None,
                "timeShift": None,
                "title": "Top Upstream ASNs",
                "transform": "table",
                "type": "table-old",
            },
        ],
        "refresh": "30s",
        "schemaVersion": 32,
        "style": "dark",
        "tags": [],
        "templating": {
            "list": [
                {
                    "allValue": ".*",
                    "current": {"selected": False, "text": "All", "value": "$__all"},
                    "datasource": "Prometheus",
                    "definition": 'label_values(proxy_upstream_total{job="vipen-server"}, src_as)',
                    "description": None,
                    "error": None,
                    "hide": 0,
                    "includeAll": True,
                    "label": "ASN",
                    "multi": False,
                    "name": "as",
                    "options": [],
                    "query": {
                        "query": 'label_values(proxy_upstream_total{job="vipen-server"}, src_as)',
                        "refId": "Prometheus-as-Variable-Query",
                    },
                    "refresh": 1,
                    "regex": "",
                    "skipUrlSync": False,
                    "sort": 0,
                    "tagValuesQuery": "",
                    "tagsQuery": "",
                    "type": "query",
                    "useTags": False,
                },
                {
                    "allValue": ".*",
                    "current": {"selected": False, "text": "All", "value": "$__all"},
                    "datasource": "Prometheus",
                    "definition": 'label_values(proxy_downstream_total{job="vipen-server"}, cluster)',
                    "description": None,
                    "error": None,
                    "hide": 0,
                    "includeAll": True,
                    "label": "Cluster",
                    "multi": False,
                    "name": "cluster",
                    "options": [],
                    "query": {
                        "query": 'label_values(proxy_downstream_total{job="vipen-server"}, cluster)',
                        "refId": "Prometheus-host-Variable-Query",
                    },
                    "refresh": 1,
                    "regex": "",
                    "skipUrlSync": False,
                    "sort": 0,
                    "tagValuesQuery": "",
                    "tagsQuery": "",
                    "type": "query",
                    "useTags": False,
                },
                {
                    "allValue": ".*",
                    "current": {"selected": False, "text": "All", "value": "$__all"},
                    "datasource": "Prometheus",
                    "definition": 'label_values(proxy_downstream_total{job="vipen-server",cluster="$cluster"}, instance)',
                    "description": None,
                    "error": None,
                    "hide": 0,
                    "includeAll": True,
                    "label": "Server",
                    "multi": False,
                    "name": "server",
                    "options": [],
                    "query": {
                        "query": 'label_values(proxy_downstream_total{job="vipen-server",cluster="$cluster"}, instance)',
                        "refId": "Prometheus-host-Variable-Query",
                    },
                    "refresh": 1,
                    "regex": "",
                    "skipUrlSync": False,
                    "sort": 0,
                    "tagValuesQuery": "",
                    "tagsQuery": "",
                    "type": "query",
                    "useTags": False,
                },
                {
                    "datasource": None,
                    "description": None,
                    "error": None,
                    "filters": [],
                    "hide": 0,
                    "label": "",
                    "name": "Filters",
                    "skipUrlSync": False,
                    "type": "adhoc",
                },
            ]
        },
        "time": {"from": "now-1h", "to": "now"},
        "timepicker": {
            "refresh_intervals": [
                "5s",
                "10s",
                "30s",
                "1m",
                "5m",
                "15m",
                "30m",
                "1h",
                "2h",
                "1d",
            ]
        },
        "timezone": "",
        "title": "Trafic By AS",
        "uid": "txUPy4Rnz",
        "version": 1,
    },
    indent=4,
)
