Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemStorageTable returns Empty on devices attempted #1244

Closed
csucbg opened this issue Apr 20, 2023 · 2 comments
Closed

SystemStorageTable returns Empty on devices attempted #1244

csucbg opened this issue Apr 20, 2023 · 2 comments
Assignees

Comments

@csucbg
Copy link

csucbg commented Apr 20, 2023

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
@chidanandpujar
Copy link
Collaborator

Fixed via #1336, hence closing the request

1 similar comment
@chidanandpujar
Copy link
Collaborator

Fixed via #1336, hence closing the request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants