Automation

 View Only
last person joined: 6 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Pulling info from an SRX

    Posted 02-25-2021 12:09
    Hello, I'm not sure if I'm in the correct thread for this, but we'll see.  I want to script something from a Linux server to pull some info from our SRX.  I see lots of scripting and automation information for on the SRX, but I haven't found anything about pulling things from it. 

    A simple example would be to get the router's latest ARP data. I just want to pull something basic like that out and into another format. 

    Any suggestions?

    Thanks,
    Joe


  • 2.  RE: Pulling info from an SRX

    Posted 02-25-2021 12:13
    Hi Joe,
    the scripts can be used for almost all Juniper Devices because all Devices share the same JunOS :)
    What you want to look at is either scripting with Ansible or (if you don't want to use the Ansible Framework) paramiko / pyEZ.
    There are a lot of Examples throughout the forum, solving these tasks starting from very simple things (like getting the Host-OS-Version) up to mass-editing VLANs and such.
    Are you looking for Python? Pure bash? Everything is possible :)

    BR
    Christian

    ------------------------------
    Christian Scholz
    Juniper Networks Ambassador | JNCIE-SEC #374
    Mail: chs@ip4.de
    Blog: jncie.eu | Twitter: @chsjuniper | YT-Channel: netchron
    ------------------------------



  • 3.  RE: Pulling info from an SRX

    Posted 02-25-2021 13:25
    OK thanks I'll start searching.  At this point I'm hoping to find something just using bash since it's basic information and text manipulation I'm looking to do.  Hoping to stay away from big things like Ansible, etc.  I just have a few routers...
    Thanks,
    Joe


  • 4.  RE: Pulling info from an SRX

    Posted 02-25-2021 13:42
    This seems to be a lot easier than I thought after finding a couple of posts about it.  I guess bash was the search term I should have used in the first place.  I can just do this:

    sshpass -p "password" ssh -l user router_ip "show arp" >arp.tmp

    Super easy!  Not sure why I didn't think of ding that before.  Thanks again!

    Joe


  • 5.  RE: Pulling info from an SRX

    Posted 02-25-2021 13:45
    Joe,

    Here is also a link for doing the same via RPC.

    https://subscription.packtpub.com/book/networking_and_servers/9781788290999/1/ch01lvl1sec9/making-netconf-rpc-requests-and-replies

    ------------------------------
    Benjamin Griffin
    ------------------------------



  • 6.  RE: Pulling info from an SRX

    Posted 02-25-2021 15:53

    Glad you found what you are looking for :)

    If you need more Info towards a specific Topic feel free to always reach out to us here in the Forum :)



    ------------------------------
    Christian Scholz
    Juniper Networks Ambassador | JNCIE-SEC #374
    Mail: chs@ip4.de
    Blog: jncie.eu | Twitter: @chsjuniper | YT-Channel: netchron
    ------------------------------