Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Configurable NETCONF Proxy for Junos Telemetry Interface

    The Junos Telemetry Interface provides the capability to stream statistics for various defined attributes at a high scale. For a definition of these attributes, see Guidelines for gRPC Sensors (Junos Telemetry Interface). Additionally, you can stream the result of NETCONF requests executed locally on the system at a lower scale by using configurable XML proxy. The NETCONF XML management protocol and Junos XML API fully document all options for every supported Junos OS operational request. This feature provides access to thousands of attributes available through NETCONF “get” remote procedure calls (RPCs). For more information about using these RPCs, see Sending Requests to the NETCONF Server.

    Starting with Junos OS Release 17.3R1 on MX Series and PTX Series routers, you can add configurable, user-defined YANG files. YANG is a standards-based, extensible, hierarchical data modeling language that is used to model the configuration and state data used by NETCONF operations, RPCs, and server event notifications

    Best Practice: Juniper Networks recommends that you not use YANG files that map to a extensive or verbose Junos OS operational commands, such as show interfaces or show route. The use of such a file could result in very slow or no streaming of telemetry data or very high CPU usage for various processes.

    Creating a User-Defined YANG File

    To use the xmlproxyd process, also known as daemon, to translate telemetry data, create a render.yang file where the dr:command-app is set to xmlproxyd.

    Note: The filename and module name included in the file must start with xmlproxyd_

    • For the filename, add the extension .yang, for example, xmlproxyd_ldpstats.yang

    • For the module name, use the filename without the extension .yang, for example, xmlproxyd_ldpstats

    Custom YANG files for Junos OS conform to the YANG file syntax defined in RFC 6020, YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF). Certain directives need to be present in the file that configure NETCONF proxy.

    1. Provide a name for the module. It must start with xmlproxy_

      For example, for a YANG File for Packet Forwarding Engine traffic statistics:

      module xmlproxy_pfestatistics_oc {
      . . .

    2. Include the dame of the process, also known as the daemon, that provides the operational state. For the Junos Telemetry Interface, you must always use xmlproxyd:

      dr:command-app "xmlproxyd";

    3. Specify the RPC for the NETCONF get request:

      rpc juniper-netconf-get {

    4. Specify the location of the output of the RPC:

      dr:command-top-of-output "/junos";

    5. Specify the command to execute the RPC:

      dr:command-full-name "drend juniper-netconf-get";

    6. Specify the CLI command to execute for retrieving data.

      For example, to retrieve Packet Forwarding Engine traffic statistics:

      dr:cli-command "show pfe statistics traffic";

    7. Specify help for an RPC:

      dr: command-help “default <get> rpc”;

    8. Specify the OpenConfig hierarchy and use the dr:source command to map to a container, a list, or a specific leaf.

      For example, specify Packet Forwarding Engine statistics, including input packets and output packets:

      output {
      container oc-pfe {
      dr:source "/pfe-statistics";
      list pfe-traffic {
      dr:source "pfe-traffic-statistics";
      leaf "pfe-ipackets" {
      type string;
      dr:source "pfe-input-packets"; // XML tag name
      }
      leaf "pfe-opackets" {
      type string;
      dr:source "pfe-output-packets"; // XML tag name
      }
      }
      }
      }
    9. The following example shows how to include these commands in a YANG file to enable the xmlproxyd process to retrieve the full operational state and render it in the OpenConfig format:
      dr:command-app "xmlproxyd";
        rpc juniper-netconf-get {
          dr:command-top-of-output "/junos";
          dr:command-full-name "drend juniper-netconf-get";
          dr:cli-command "show krt state";
          dr:command-help "default <get> rpc";
          output {
            container junos {
            container oc-pfe {
              dr:source "/pfe-statistics";
      

    Example: Kernel Routing Table (KRT) Statistics

    This example shows a YANG file created to stream KRT statistics.

    /*
     * Example yang for generating OC equivalent of internal meta tree
       save as "xmlproxyd_krtState.yang" on router.
       cli : show krt state
     */
     
    module xmlproxyd_krtState {
      yang-version 1;
     
      namespace "http://juniper.net/yang/software";
     
      prefix "krt";
     
      import drend {
        prefix dr;
      }
     
      grouping krt-state-information-grouping {
     
        list krt-queue-state {
          key "operations-queued";
          dr:source "krt-queue-state";
          leaf operations-queued {
            type uint32;
            dr:source krtq-operations-queued;
          }
          leaf rt-table-adds {
            dr:source krtq-rt-table-adds;
            type uint32;
          }    
          leaf interface-routes {
            dr:source krtq-interface-routes;
            type uint32;
          }
          leaf high-multicast-adds-changes {
            dr:source krtq-high-multicast-adds-changes;
            type uint32;
          }
          leaf top-indirect-adds-changes {
            dr:source krtq-top-indirect-adds-changes;
            type uint32;
          } 
          leaf indirect-adds-changes {
            dr:source krtq-indirect-adds-changes;
            type uint32;
          } 
          leaf indirect-deletes {
            dr:source krtq-indirect-deletes;
            type uint32;
          } 
          leaf high-mpls-adds {
            dr:source krtq-high-mpls-adds;
            type uint32;
          } 
          leaf high-mpls-changes {
            dr:source krtq-high-mpls-changes;
            type uint32;
          }  
          leaf top-priority-adds {
            dr:source krtq-top-priority-adds;
            type uint32;
          }  
          leaf top-priority-changes {
            dr:source krtq-top-priority-changes;
            type uint32;
          }  
          leaf top-priority-deletes {
            dr:source krtq-top-priority-deletes;
            type uint32;
          }  
          leaf high-priority-adds {
            dr:source krtq-high-priority-adds;
            type uint32;
          }  
          leaf high-priority-changes {
            dr:source krtq-high-priority-changes;
            type uint32;
          }  
          leaf high-priority-deletes {
            dr:source krtq-high-priority-deletes;
            type uint32;
          }  
          leaf normal-priority-indirects {
            dr:source krtq-normal-priority-indirects;
            type uint32;
          }  
          leaf normal-priority-adds {
            dr:source krtq-normal-priority-adds;
            type uint32;
          }  
          leaf normal-priority-changes {
            dr:source krtq-normal-priority-changes;
            type uint32;
          }  
          leaf normal-priority-deletes {
            dr:source krtq-normal-priority-deletes;
            type uint32;
          }  
          leaf least-priority-adds {
            dr:source krtq-least-priority-adds;
            type uint32;
          }  
          leaf least-priority-changes {
            dr:source krtq-least-priority-changes;
            type uint32;
          }  
          leaf least-priority-deletes {
            dr:source krtq-least-priority-deletes;
            type uint32;
          } 
           leaf normal-priority-cnh-deletes {
            dr:source krtq-normal-priority-cnh-deletes;
            type uint32;
          } 
          leaf normal-priority-gmp {
            dr:source krtq-normal-priority-gmp;
            type uint32;
          } 
          leaf rt-table-deletes {
            dr:source krtq-rt-table-deletes;
            type uint32;
          } 
          leaf operations-deferred {
            dr:source krtq-operations-deferred;
            type uint32;
          } 
          leaf operations-canceled {
            dr:source krtq-operations-canceled;
            type uint32;
          } 
          leaf async-count {
            dr:source krtq-async-count;
            type uint32;
          } 
          leaf async-non-q-count {
            dr:source krtq-async-non-q-count;
            type uint32;
          } 
          leaf time-until-next-run {
            dr:source krtq-time-until-next-run;
            type uint32;
          } 
           leaf kernel-rt-learnt {
            dr:source krtq-kernel-rt-learnt;
            type uint32;
          } 
        }
      }
     
      dr:command-app "xmlproxyd";
      rpc juniper-netconf-get {
        dr:command-top-of-output "/junos";
        dr:command-full-name "drend juniper-netconf-get";
        dr:cli-command "show krt state";
        dr:command-help "default <get> rpc";
        output {
          container junos {
          container krt-state-information {
            dr:source "/krt-state-information";
            uses krt-state-information-grouping;
          }
        }
       }
      }
    }

    Installing a User-Defined YANG File

    To add, validate, modify, or delete a user-defined YANG file for XML Proxy for the Junos Telemetry Interface, use the request system yang set of commands from the operational mode:

    1. Specify the name of the YANG file and the file path to install. This command creates .json file in the opt/lib/render directory.
      user@host> request system yang add package package-name proxy-xml module file-path-name

      Note: This command can be performed only on the current Routing Engine.

      To add multiple YANG modules with the request system yang add package package-name proxy-xml module command, enclose the file-path-names in brackets: [ file-path-name 1 file-path-name 2 ]

    2. (Optional) Validate a YANG package you have added.
      user@host> request system yang validate proxy-xml module file-path-name
    3. (Optional) Update an existing YANG file that was previously added.
      user@host> request system yang update package-name proxy-xml file-path-name
    4. Delete an existing YANG file.
      user@host> request system yang delete package-name
    5. Verify that the YANG file has been installed by entering the show system yang package command.
      user@host> show system yang package package-name

    Release History Table

    Release
    Description
    Starting with Junos OS Release 17.3R1 on MX Series and PTX Series routers, you can add configurable, user-defined YANG files.

    Modified: 2018-03-21