SSH timeout on 'request system snapshot slice alternate all-members'

436 views
Skip to first unread message

Christophe

unread,
Oct 25, 2020, 1:41:19 PM10/25/20
to Junos Python EZ
Hello,

I'm writing some playbooks to upgrade a bunch of EX. After the upgrade, I would like to make sure the alternat boot partition is also upgraded. To do so, usually I'doing a 'request system snapshot slice alternate all-members' via cli. Now, I'm trying to do it via my ansible playbook. 

The issue seems to be that the RPC call takes too long and the underlying SSH (or console via telnet) session times out after +/- 5 minutes while the snapshot takes up to 15 minutes on EX. 

Changing the timeout default value for the juniper_junos_command module does not help and I've not found any ansible parameter to help on this... Is there a way for EZ to setup a TCP keep alive ? Or another way to prevent ansible to terminate the TCP session ?

Regards,
Christophe

Nitin Kumar

unread,
Oct 27, 2020, 1:41:17 PM10/27/20
to Christophe, Junos Python EZ, Rahul Kumar

Hi Christophe,

 

Can you use RPC module with kwargs options (dev_timeout: x) where x is number of seconds to wait.

You can find equivalent rpc using

 

<command> | display xml rpc

 

Thanks

Nitin Kr

 

From: <junos-p...@googlegroups.com> on behalf of Christophe <lemaire.c...@gmail.com>
Date: Sunday, 25 October 2020 at 11:11 PM
To: Junos Python EZ <junos-p...@googlegroups.com>
Subject: SSH timeout on 'request system snapshot slice alternate all-members'

 

[External Email. Be cautious of content]

 

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/junos-python-ez/1ed6bac1-1255-4206-b3a0-28b007ee26d1n%40googlegroups.com.


Juniper Business Use Only

Christophe

unread,
Oct 27, 2020, 2:24:18 PM10/27/20
to Nitin Kumar, Junos Python EZ, Rahul Kumar
Hi Nithin,

Thank you for your response. 

I've tried this : 

- name: Copy Junos OS on alternate slice
when:
- snapshot is defined
- snapshot | bool
juniper_junos_rpc: ## RPC required to set RPC dev_timeout
rpc: request-snapshot
kwargs:
slice: alternate
dev_timeout: '1800'

But I got an error saying dev-timeout is a bad element. 

fatal: [ex-5]: FAILED! => {"attrs": null, "changed": false, "format": "xml", "kwargs": {"dev_timeout": "1800", "slice": "alternate"}, "msg": "Unable to execute the RPC: b'<request-snapshot xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\" format=\"xml\">\\n  <slice>alternate</slice>\\n  <dev-timeout>1800</dev-timeout>\\n</request-snapshot>\\n'. Error: RpcError(severity: error, bad_element: dev-timeout, message: error: syntax error\nerror: syntax error)", "rpc": "request-snapshot"}

Did I do something wrong?

Regards,
Christophe
________________________________
Christophe Lemaire
Network & Security Engineer

Nitin Kumar

unread,
Oct 28, 2020, 10:27:00 AM10/28/20
to Christophe, Rahul Kumar, Junos Python EZ

Hi Christophe,

 

Will check this and get back to you.

+@Rahul Kumar

 

Thanks

Nitin Kr


Juniper Business Use Only

Rahul Kumar

unread,
Oct 29, 2020, 7:57:44 AM10/29/20
to Nitin Kumar, Christophe, Junos Python EZ
Hi Christophe, 

Did you try timeout for juniper_junos_rpc, 

Sample Example - 
- name: 'Explicit host argument'
  hosts: junos
  connection: local
  gather_facts: no
  roles:
    - Juniper.junos

  tasks:
    - name: "Execute RPC"
      juniper_junos_rpc:
        rpcs:
           - "request-snapshot"
        timeout: "1200"
      register: test1

    - name: Check TEST 1
      debug:
        var: test1

Regards
Rahul Kumar


From: Nitin Kumar <nit...@juniper.net>
Sent: 27 October 2020 23:11
To: Christophe <lemaire.c...@gmail.com>; Junos Python EZ <junos-p...@googlegroups.com>
Cc: Rahul Kumar <rahk...@juniper.net>
Subject: Re: SSH timeout on 'request system snapshot slice alternate all-members'
 

Juniper Business Use Only

Christophe

unread,
Oct 29, 2020, 10:02:17 AM10/29/20
to Junos Python EZ
Hi Rahul,

Increasing the timeout for juniper_junos_rpc does not help. 

fatal: [exoob-jum-5.net.voo.intra]: FAILED! => {"attrs": null, "changed": false, "format": "xml", "kwargs": {"slice": "alternate"}, "msg": "Unable to execute the RPC: b'<request-snapshot xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\" format=\"xml\">\\n  <slice>alternate</slice>\\n</request-snapshot>\\n'. Error: ConnectClosedError(ex-5)", "rpc": "request-snapshot"}

Regards,
Christophe
Reply all
Reply to author
Forward
0 new messages