napalm icon indicating copy to clipboard operation
napalm copied to clipboard

Proposal: new getter: `get_filesystems`

Open decoupca opened this issue 1 year ago • 7 comments

Based on this discussion.

I propose a new getter called get_filesystems.

Example data structure for IOS:

{
    'flash:': {
        'capacity': 1621966848,
        'space_used': 878018560,
        'space_remaining': 743948288,
        'is_primary': True, # derived from `show file systems`, denoted with asterisk
        'mount_point': 'flash:', # Redundant for IOS but useful for junos or others
        'flags': 'rw',
        'file_list': [
            {
                'file_name': 'cat3k_caa-universalk9.16.12.05b.SPA.bin',
                'size': 480018036,
                'mtime': '2021-08-12T23:53:40Z', # Should be a datetime object
                'mode': '-rw-',
            },
            {
                ...
            }
        ],
    },
    'crashinfo:': {
        'capacity': 248354816,
        'space_used': 19483648,
        'space_free': 228871168,
        'is_primary': False,
        'mount_point': 'crashinfo:',
        'flags': 'rw',
        'file_list': [
            {
                'file_name': 'last_systemreport_log',
                'size': 357,
                'mtime': '2021-08-12T23:53:40Z',
                'mode': '-rwx',
            },
            {
                ...
            }
        ]
    }
}

I don't have enough experience with Junos, Arista, etc. to know if/how they could support this data structure. IMO the most important values are the filesystem name, its capacity, space used, and its flags (rw/ro/etc). The file listing would be nice but I would give that up if it's not feasible. Also some way to determine which filesystem is "primary", i.e., which is used for main storage of images, etc.

decoupca avatar Aug 29 '23 20:08 decoupca