How do I submit a command that does not have an RPC equivalent?

538 views
Skip to first unread message

Mike Strube

unread,
Mar 31, 2015, 2:10:23 PM3/31/15
to junos-p...@googlegroups.com
How do I submit a command that does not have an RPC equivalent?  Support wants the output of "show system processes extensive" on multiple devices, but that CLI does not have an RPC equivalent...

Mike Strube

Rick Sherman

unread,
Mar 31, 2015, 2:15:52 PM3/31/15
to junos-p...@googlegroups.com
Hi Mike,

You can use the device.cli() command for this.  In the rare instances of commands that do not have an RPC equivalent this the appropriate function.


-Rick

Michael Strube

unread,
Mar 31, 2015, 2:51:32 PM3/31/15
to Rick Sherman, junos-p...@googlegroups.com
With all the warnings about not using the device.cli except for debugging purposes, I wondered if there was a more “acceptable” method.

Any way to suppress the warning messages?


--
You received this message because you are subscribed to a topic in the Google Groups "Junos Python EZ" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/junos-python-ez/38wQrcy6hzY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to junos-python-...@googlegroups.com.
Visit this group at http://groups.google.com/group/junos-python-ez.
To view this discussion on the web visit https://groups.google.com/d/msgid/junos-python-ez/a60d8519-8959-4493-abc2-a6d26db6258e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nitin Kumar

unread,
Mar 31, 2015, 11:29:15 PM3/31/15
to Michael Strube, junos-p...@googlegroups.com, Rick Sherman

You can pass warning=False to the function.

You received this message because you are subscribed to the Google Groups "Junos Python EZ" group.
To unsubscribe from this group and stop receiving emails from it, send an email to junos-python-...@googlegroups.com.

zhiqiang fang

unread,
Dec 7, 2015, 11:48:38 AM12/7/15
to Junos Python EZ, mst...@gmail.com, rshe...@juniper.net
Some commands work, for example, "restart snmp"; but some commands don't, an example as following, says "invalid command":
>>> dev.cli("request chassis fpc restart slot 1")
/usr/lib/python2.6/site-packages/jnpr/junos/device.py:652: RuntimeWarning: CLI command is for debug use only!
  warnings.warn("CLI command is for debug use only!", RuntimeWarning)
'invalid command: request chassis fpc restart slot 1'

Would you please give some advice?

Thanks!

Fang

Nitin Kumar

unread,
Dec 14, 2015, 1:27:45 AM12/14/15
to zhiqiang fang, Junos Python EZ, mst...@gmail.com
Hi Fang,

In that case, please share the output below command from your device of
> request chassis fpc restart slot 1

I am expecting this to error out. Hence PyEZ too is breaking.

Also for such command we have rpc
> request chassis fpc restart slot 1 | display xml rpc 
    <rpc>
        <request-chassis-fpc>
                <slot>1</slot>
                <restart/>
        </request-chassis-fpc>
    </rpc>

So you can call it in below manner (preferred way)

rsp = dev.rpc.request_chassis_fpc(slot='1', restart=True)
from lxml import etree
print etree.tostring(rsp)

Thanks
Nitin Kr

Reply all
Reply to author
Forward
0 new messages