SystemStorageTable returns Empty on devices attempted
Every switch we have attempted to use the SystemStorageTable to interrogate has returned an empty table. This appears to be because the YAML (https://github.com/Juniper/py-junos-eznc/tree/master/lib/jnpr/junos/op/systemstorage.yml) does not take into account that the filesystem information is returned per RE by a lot of switches.
Eg the supplied YAML works with an MX104 which repliex in the following format:
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/20.4R0/junos">
<system-storage-information junos:style="brief">
<filesystem>
<filesystem-name>/dev/da0s1a</filesystem-name>
<total-blocks junos:format="904M">1850456</total-blocks>
<used-blocks junos:format="314M">642792</used-blocks>
<available-blocks junos:format="517M">1059628</available-blocks>
<used-percent> 38</used-percent>
<mounted-on>/</mounted-on>
</filesystem>
....
It does not work with a QFX which replies in this format:
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/22.2R0/junos">
<multi-routing-engine-results xmlns:junos="http://xml.juniper.net/junos/*/junos">
<multi-routing-engine-item>
<re-name>localre</re-name>
<system-storage-information junos:style="brief">
<filesystem>
<filesystem-name>/dev/gpt/junos</filesystem-name>
<total-blocks junos:format="6.0G">12540924</total-blocks>
<used-blocks junos:format="1.1G">2315388</used-blocks>
<available-blocks junos:format="4.4G">9222264</available-blocks>
<used-percent> 20</used-percent>
<mounted-on>/.mount</mounted-on>
</filesystem>
....
I have written the following naive modification as a suggested fix. It works on EX3400s (standalone and stacked), a QFX5120 series, as well as an MX104. I'm sure someone can make it better for integration :) It might be hard to change without breaking working downstream code, but I'll leave that to the pros!
---
SystemStorageTable:
rpc: get-system-storage
item: //multi-routing-engine-item | //rpc-reply/system-storage-information
key: re-name | Null
view: SystemStorageView
SystemStorageView:
fields:
re-name: re-name
filesystems: _FsTable
_FsTable:
item: system-storage-information/filesystem | //rpc-reply/system-storage-information/filesystem
key: filesystem-name
view: _FsView
_FsView:
fields:
name: filesystem-name
total_blocks: total-blocks
used_blocks: used-blocks
available_blocks: available-blocks
used_percent: used-percent
mounted_on: mounted-on