View Only
last person joined: 2 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  XPath basics

    Posted 11-11-2018 07:22



    Need some assistance here please:

    I am running an rpc against my qfx switch:


    results = dev.rpc.get_evpn_database_information(mac_address='18:66:da:94:ab:23',normalize=True)

    this is returning correctly.

    when there is no entry the results is None.

    But when there is an entry a etree.dump(results) gives me:

    <evpn-database-instance style="normal">
    <mac-entry style="normal">
    <active-source-timestamp>Nov 02 13:37:51</active-source-timestamp>

     yet when I try to access an element by using a results.find() or results.findall() etc I always get back None??


    example I have tried so far:

    str1 = results.find("mac-entry")

    str1 = results.find("evpn-database-information/evpn-database-instance/mac-entry")


    I wish to access some elements of the response to use as input for further rpc calls.


    I have used an external XPath checker website to check the syntax and all looks ok.


    any comments please.


  • 2.  RE: XPath basics
    Best Answer

    Posted 11-11-2018 09:01



    I think it should be results.find("evpn-database-instance/mac-entry") as the result is parked at <evpn-database-information> element. Let me know if it works.