Skip to content

Commit

Permalink
examples: Transceiver Serial Number list based on regex match
Browse files Browse the repository at this point in the history
Change-Id: I0b6479d1cd7109ea4de5679238387806dd69f4bb
  • Loading branch information
noredistribution committed Apr 11, 2024
1 parent caf5d83 commit df30274
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docsrc/examples/system_health/xcvr_sn_list_filtered.aql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let data = `*:/Sysdb/hardware/archer/xcvr/status/all/*`
let xcvrStatus = data | map(_value | mapne(_value, _value | field("goVendorInfo") | field("vendorSn")))
let xcvrStatus = xcvrStatus | map(_value | mapne(_value[0], _value))

xcvrStatus | map(_value | where(reMatch(_value, _regexInput))) | where(length(_value) > 0)
71 changes: 71 additions & 0 deletions docsrc/examples/system_health/xcvr_sn_list_filtered.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"dashboards": [
{
"key": "93b5abba-7807-453a-be77-56a1fde055fd",
"createdAt": [
977361740,
1579
],
"createdBy": "cvpadmin",
"metaData": {
"schemaVersion": "3",
"legacyKey": "",
"legacyVersion": "",
"fromPackage": ""
},
"name": "Filtered Transcevier Data",
"description": "",
"widgets": [
{
"id": "0c08fed5-cd5a-44be-b083-ab950e8c93e8",
"name": "",
"position": {
"x": 0,
"y": 0
},
"dimensions": {
"width": 10,
"height": 14
},
"type": "aql-query-widget",
"inputs": {
"expression": "let data = `*:/Sysdb/hardware/archer/xcvr/status/all/*`\nlet xcvrStatus = data | map(_value | mapne(_value, _value | field(\"goVendorInfo\") | field(\"vendorSn\")))\nlet xcvrStatus = xcvrStatus | map(_value | mapne(_value[0], _value))\n\nlet filteredXcvrStat = newDict()\n\nfor deviceKey, deviceValue in xcvrStatus {\n filteredXcvrStat[deviceKey] = newDict()\n for interfaceKey, interfaceValue in deviceValue {\n if reMatch(interfaceValue, _regexInput){\n filteredXcvrStat[deviceKey][interfaceKey] = interfaceValue\n\n }\n }\n if length(filteredXcvrStat[deviceKey]) == 0 {\n dictRemove(filteredXcvrStat, deviceKey)\n }\n}\n\nfilteredXcvrStat\n",
"graphConfig": {
"columns": {
"key": {
"mapToHostname": true
}
}
},
"visualization": "table"
},
"location": "main",
"parent": ""
},
{
"id": "85920a17-dd18-47b0-a315-ba350f6f0a6d",
"name": "",
"position": {
"x": 0,
"y": 0
},
"dimensions": {
"width": 6,
"height": 2
},
"type": "variable-widget",
"inputs": {
"defaultValue": "",
"inputName": "regexInput",
"inputType": "FreeForm",
"variableType": "String"
},
"location": "inputs",
"parent": ""
}
],
"lastUpdated": 1696513262320,
"lastUpdatedBy": "cvpadmin"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions docsrc/examples/system_health/xcvr_sn_list_filtered.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
List the serial numbers for all transceivers
--------------------------------------------

.. literalinclude:: xcvr_sn_list_filtered.aql
:language: aql

.. image:: xcvr_sn_list_filtered.png
:width: 600
:alt: List the serial numbers for all transceivers that match the regex

:download:`Download the Dashboard JSON here <xcvr_sn_list_filtered.json>`

0 comments on commit df30274

Please sign in to comment.