Automation

 View Only
last person joined: 5 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Question on PyEZ

     
    Posted 09-27-2023 10:21

    Hi.

    By default, a PyEZ RPC call, eg r0.rpc.get_system_information()returns information in XML format.

    How do I get the response to be in text or JSON format?

    Thanks,

    Deepak



  • 2.  RE: Question on PyEZ

    Posted 09-27-2023 10:51

    Hi Deepak,

    You mean like this:

    from jnpr.junos import Device
    from pprint import pprint
    with Device(host='router1.example.com') as dev:
    sw_info_json = dev.rpc.get_software_information({'format':'json'})
    pprint(sw_info_json)

    Thanks,
    Adrian.



    ------------------------------
    Teodor Adrian Soroceanu
    ------------------------------



  • 3.  RE: Question on PyEZ

     
    Posted 09-30-2023 04:12

    Thanks Teodor.

    That rpc calls returns a Python dictionary, not a JSON object.

    Which is fine.. I just have to add an extra step converting the Python dictionary to a JSON object.