Automation

 View Only
last person joined: yesterday 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Referencing attribute node for custom telemetry sensor

    Posted 02-07-2024 09:27

    Hello Everyone, 
    I would like to ask some help in referencing a value of an attribute node for a NETCONF Proxy Telemetry Sensor!

    I'm following the corresponding documentation , so I'm using it as example here too, because it includes exactly the same challange I'm facing with currently.  
    This example creates a yang module which creates a sensor using the output of  the show system users command to provide telemetry data. 

    My challenge is around this line of the command's XML output: 

    <up-time junos:seconds="17710200">204 days, 23:30</up-time>


    The aforementioned example is using the up-time XML tag to reference the uptime in the output: 

          leaf up-time { // YANG model leaf
            type string; // Type of value
            dr:source up-time; // Exact name of the XML tag
          }

    Problem is the following: the streamed value via the sensor data is the "204 days, 23:30" in this case. But I would like to have streamed the value of the "junos:second" attribute node rather. 
    My assumption is the dr:source should be followed  by an Xpath expression point to this node, but I could not find a working one until now. 
    If anyone could help to reference this value in this context with an example, that would be awesome!
    I have tried varous XPath expressions, but without success until now.  
    Many thanks, 



    ------------------------------
    BALAZS SZALAI
    ------------------------------


  • 2.  RE: Referencing attribute node for custom telemetry sensor

     
    Posted 02-09-2024 19:42
    Edited by asharp 02-10-2024 16:18

    To reference an attribute in Xpath would be in this example:

    up-time/@junos:seconds

    A great source of information about XML and Junos can be found here in the Day One books archive:

    Day One Books Archive

    Navigating the Junos XML Hierarchy, it is an old book, I first read it many years ago, but was a great introduction back then when I was first learning SLAX.

    Juniper remove preview
    Day One Books Archive
    The following Day One Books are outdated, soon to be out of print, and no longer support by Juniper Networks. This archive is provided as a courtesy to customers using earlier versions of our software.
    View this on Juniper >




    ------------------------------
    Andy Sharp
    ------------------------------