nanog mailing list archives

[NANOG] Re: The Network CLI -- Love it ? Hate it? Needed?


From: Saku Ytti via NANOG <nanog () lists nanog org>
Date: Thu, 20 Mar 2025 18:37:19 +0200

On Thu, 20 Mar 2025 at 15:24, jeffm--- via NANOG <nanog () lists nanog org> wrote:

Yes, all of this, but it's probably worth noting that there, at least in
the past, have been some JunOS management cli commands that just ran a
shell command and dumped the output, therefore not supporting "| display
json". A lot of the NTP commands used to be this way, though I think in
later releases they've updated that to support the json display on them.
Are there other commands that still do this?  I'm personally not aware
of
anything, but it's posslbe.

Yeah there are gaps, particularly on shell/3rd_party commands.

It is kinda hard to fix problem. Either you write your own 'ps' or you
give users familiar output. Even those shell things which are XMLRPC
tend to be <blob>output</blob> instead of properly serialised data.


Juniper did take steps to fix the root cause - https://github.com/Juniper/libxo


So you can do things like this:
    command = '''start shell command "ps --libxo json -Saxo 'pid ppid
comm etimes dsiz rss time majflt msgrcv msgsnd inblk oublk nsigs
nivcsw nswap'"'''

To get json output from 'ps'.


Strangely, they don't use it themselves, but 'show system process'
output just returns a blob. So you can't do 'show system processes |
display json', but have to do it like above :)


-- 
  ++ytti
_______________________________________________
NANOG mailing list 
https://lists.nanog.org/archives/list/nanog () lists nanog org/message/6OA3SOD6JGIKLD4IQAR4BMOISW4FSXIE/


Current thread: