This lesson will show you how Operational Data is created and used in YumaPro SDK.


Pre-Requisites


You should have completed "Installing YumaPro SDK” and “Building and Installing the SIL”.


 Example operational data instrumentation


Now let’s look at how the instrumentation is created for a leaf using “in-octets” as an example. If you look at the ietf-interfaces.yang module you will see the leaf for in-octets defined as:



        leaf in-octets {
          type yang:counter64;
          description
            "The total number of octets received on the interface,
             including framing characters.

             Discontinuities in the value of this counter can occur
             at re-initialization of the management system, and at
             other times as indicated by the value of
             'discontinuity-time'.";
          reference
            "RFC 2863: The Interfaces Group MIB - ifHCInOctets";
        }



In u_ietf-interfaces.c you will find the stub for the code:



    status_t u_ietf_interfaces_interfaces_state_interface_statistics_get (
    ...

       for (; childobj; childobj =
           getcb_next_requested_child(get2cb, childobj)) {

           /* Retrieve the value of this terminal node and 
            * add with getcb_add_return_val */

           /* leaf discontinuity-time (string) */

           /* leaf in-octets (uint64) */

            ...


The stub is the comment “/* leaf in-octets (uint64) */” and this is where you add the code that gets the in-octets data for interfaces. The pre-built example code for in-octets is:



        /* leaf in-octets (uint64) */
        if (!xml_strcmp(objname, (const xmlChar *)"in-octets") &&
            entry->stats->inbytes_set){

            retval=
                agt_make_uint64_leaf(obj,
                                     objname,
                                     entry->stats->inbytes,
                                     &res);
            if (retval && res == NO_ERR) {
                getcb_add_return_val(get2cb, retval);
            }
        }


Linux system Operational State data is provided by if_linux_* functions in the libif-linux.so library. You will see in the function u_ietf_interfaces_interfaces_state_interface_statistics_get contains the code for the leaf in-octets and sets the interface structure:



    interface_entry_t*entry = if_linux_match_ifentry(curindex);


then entry->stats->inbytes can be retrieved every time a GET request is received for the in-octets leaf.


More details on how the netconfd-pro server works and how the SIL and SIL-SA features provides configuration and operational state data see the YumaPro Developer Manual
Also the YumaWorks’ Knowledge Base has a section on Working with SIL or SIL-SA Code



Next Lesson: Configuration Data