jnpr.junos.exception.RpcTimeoutError: RpcTimeoutError(10.1.1.1,request-snapshot,30)

650 views
Skip to first unread message

Stefan Vogt

unread,
Dec 18, 2014, 11:00:29 AM12/18/14
to junos-p...@googlegroups.com
Hello,

I'm trying to execute a "request system snapshot media internal slice alternate" via RPC.

>>> from pprint import pprint as pp
>>> dev = Device('10.1.1.1', user='testuser', password='Pass')
>>> dev.open()
Device(10.1.1.1)
>>> pp(dev.rpc.request_snapshot( slice='alternate', media='internal'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/rpcmeta.py", line 137, in _exec_rpc
    return self._junos.execute(rpc)
  File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/decorators.py", line 25, in wrapper
    return function(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/device.py", line 516, in execute
    raise EzErrors.RpcTimeoutError(self, rpc_cmd_e.tag, self.timeout)
jnpr.junos.exception.RpcTimeoutError: RpcTimeoutError(10.1.1.1,request-snapshot,30)
>>> 

What am I missing?

Thanks,
Stefan

NitinKumar

unread,
Dec 18, 2014, 12:33:43 PM12/18/14
to Stefan Vogt, junos-p...@googlegroups.com
Hi Stefan,

Its just the rpc taking more time. By default its 30 seconds. So do try:

>>> from pprint import pprint as pp
>>> dev = Device('10.1.1.1', user='testuser', password='Pass')
>>> dev.open()
Device(10.1.1.1)
>>> dev.timeout = 300  #5 minutes
>>> pp(dev.rpc.request_snapshot( slice='alternate', media='internal'))
--
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.
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/c508281b-75c9-4b3e-a9f7-7b93fefc3dd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rick Sherman

unread,
Dec 18, 2014, 12:42:19 PM12/18/14
to junos-p...@googlegroups.com, min...@gmail.com, nit...@juniper.net
Hi Stefan,

This is indeed because the RPC you are executing takes a fair amount of time.

It also looks like you are using the 1.1.0.dev branch which includes per RPC timeout.

It would be great if you could use the following command to test and confirm:

pp(dev.rpc.request_snapshot( slice='alternate', media='internal', dev_timeout=300))

Thanks,
-Rick
To unsubscribe from this group and stop receiving emails from it, send an email to junos-python-ez+unsubscribe@googlegroups.com.

Stefan Vogt

unread,
Dec 19, 2014, 2:46:51 AM12/19/14
to junos-p...@googlegroups.com, min...@gmail.com, nit...@juniper.net
Hi Nitin,

many thanks for your response.

I tried that, but with not much success:
>>> dev.timeout = 300
>>> pp(dev.rpc.request_snapshot( slice='alternate', media='internal'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/rpcmeta.py", line 137, in _exec_rpc
    return self._junos.execute(rpc)
  File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/decorators.py", line 25, in wrapper
    return function(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/device.py", line 516, in execute
    raise EzErrors.RpcTimeoutError(self, rpc_cmd_e.tag, self.timeout)
jnpr.junos.exception.RpcTimeoutError: RpcTimeoutError(10.101.208.16,request-snapshot,300)
>>> 

Just to confirm that I used the correct RPC syntax:
{master:0}
testuser@switch> request system snapshot media internal | display xml rpc 
    <rpc>
        <request-snapshot>
                <media>internal</media>
        </request-snapshot>
         </rpc>
        <cli>
            <banner>{master:0}</banner>
        </cli>
    </rpc-reply>

{master:0}
testuser@switch>

When looking at the switch itself after the RPCTimoutError, then it looks like that the backup partition is gone:

{master:0}
testuser@switch> show system snapshot media internal    
fpc0:
--------------------------------------------------------------------------
Information for snapshot on       internal (/dev/da0s1a) (primary)
Creation date: Dec 17 16:39:14 2014
JUNOS version on snapshot:
  jbase  : ex-12.3R6.6
  jkernel-ex-2200: 12.3R6.6
  jweb-ex: 12.3R6.6
  jcrypto-ex: 12.3R6.6
  jdocs-ex: 12.3R6.6
  jswitch-ex: 12.3R6.6
  jpfe-ex22x: 12.3R6.6
  jroute-ex: 12.3R6.6
  fips-mode-arm: 12.3R6.6
error: cannot mount /dev/da0s2a

{master:0}
testuser@switch>

Rebooting the switch resolves this and  the backup partition appears again.

What am I missing? Any possibility to further troubleshoot the RPC call?

Thanks in advance,
Stefan

NitinKumar

unread,
Dec 19, 2014, 3:28:19 AM12/19/14
to Stefan Vogt, junos-p...@googlegroups.com
Hi Stefan,

Are you sure your device support slice option.
Give a try without it

from jnpr.junos import Device
from lxml import etree

dev = Device(host='xxxx', user='xxxx', password='xxxx')
dev.open()
dev.timeout=300
print etree.tostring(dev.rpc.request_snapshot(media='internal')) #without slice
I am getting output from the above code.
Also please send me the output of dev.facts

Thanks
Nitin Kr

Stefan Vogt

unread,
Dec 19, 2014, 10:54:06 AM12/19/14
to junos-p...@googlegroups.com, min...@gmail.com, nit...@juniper.net
Hi Nitin,

Many thanks for your valued input. I increased the timeout to 10 min and it's working fine for me as well.

>>> dev = Device('10.1.1.1, user='local-admin', password='XXXX')

>>> dev.open()

Device(10.1.1.1)

>>> dev.timeout = 600

>>>

>>> print etree.tostring(dev.rpc.request_snapshot(media='internal', slice='alternate'))

<multi-routing-engine-results>

 

<multi-routing-engine-item>

 

<re-name>fpc0</re-name>

 

<snapshot-information>

<inform>

<message>Formatting alternate root (/dev/da0s2a)...</message>

</inform>

/dev/da0s2a: 186.9MB (382716 sectors) block size 16384, fragment size 2048

       using 4 cylinder groups of 46.72MB, 2990 blks, 6016 inodes.

super-block backups (for fsck -b #) at:

 32, 95712, 191392, 287072<snapshot-copy>

<source-directory>/dev/da0s1a</source-directory>

<destination-directory>/dev/da0s2a</destination-directory>

</snapshot-copy>

<archived-directory-list>

<directory-name>/</directory-name>

</archived-directory-list>

</snapshot-information>

</multi-routing-engine-item>

 

</multi-routing-engine-results>

 

>>> 


Many thanks,

Stefan

Stefan Vogt

unread,
Dec 19, 2014, 11:04:25 AM12/19/14
to junos-p...@googlegroups.com, min...@gmail.com, nit...@juniper.net
Hi Rick,

Looks like that increasing the timeout to 600 resolved the issue:

>>> pp(dev.rpc.request_snapshot( slice='alternate', media='internal', dev_timeout=600))
<Element multi-routing-engine-results at 0xa77052c>
>>> 

Thanks for your response,
Stefan
To unsubscribe from this group and stop receiving emails from it, send an email to junos-python-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages