This article describes how to skip an output of GET callbacks, GET1 or GET2 callbacks.


There could be different reasons to avoid specific callback output. For example, in case the YANG data module dictates that the node can only be outputted in case some special constraint is met.


Assume we have the following data module:


...

  container ports-test {
    config true;

    list port {
      key display-name;

      leaf display-name {
        mandatory true;
        type string;
      }

      leaf port-type {
        mandatory true;
        type enumeration {
          enum front-port;
          enum cpu-port;
          enum loopback-port;
        }
      }

      leaf active {
        config false;
        when "../port-type = 'front-port' or " +
             "../port-type = 'loopback-port'";
        type boolean;
      }

      leaf admin-state {
        when "../port-type = 'front-port'";
        type boolean;
        default false;
      }

      leaf loopback {
        when "../port-type = 'front-port'";
        type boolean;
        default false;
      }

      leaf link-state {
        config false;
        when "../port-type = 'front-port'";
        type string;
      }
    }
  }

...



Now assume, we want to skip the node that does not meet the "when" statement criteria.

In this case, the GET2 or GET1 callback can return ERR_NCX_NO_INSTANCE or ERR_NCX_SKIPPED error status to avoid any output of this node and continue to the next object.