ConfD User Community

CDB set_values fails when KeyPath refers to a "conditionally augmented" data

I’m using CDB Operational to keep inventory data based on openconfig-platform model.

A given model augments openconfig-platform.yang:

augment "/oc-platform:components/oc-platform:component/oc-platform:port" {
    description
      "Adding port operational-modes data to port component.";

    uses cfp2-top {
      when "../oc-platform:state/oc-platform:type = 'oc-platform-types:PORT' and " +
           "../oc-platform:port/oc-line-com:optical-port/oc-line-com:state/" +
              "oc-line-com:optical-port-type = 'oc-opt-types:TERMINAL_LINE'";
    }
}

The cfp2-top grouping inserts:

container cfp2 {
  container 'operational-modes' {
    list mode {}
 }
}

The “when” statament is being properly evaluated by the CLI. The node is visible only when conditions are true.

Then I try to populate the operational data with one entry:

TV = [{id, ?CONFD_UINT16(Value#port_cfp2_op_modes.id)},
      {description, ?CONFD_BUF(Value#port_cfp2_op_modes.description)}].
IKP = [mode, 'operational-modes', [?openconfig_platform_augments__ns_uri|cfp2], port, {Name}, component, [?oc_platform__ns_uri|components]].

econfd_cdb:set_values(Session, TV, IKP) .

So I get an error:

Ecode = 8 Reason = <<"/oc-platform:components/component{line0/4/1}/port/cfp2 does not exist">>.

Changing the “when” statement get same behavior:

when "../oc-platform:state/oc-platform:type = 'oc-platform-types:PORT' and " +
           "../oc-platform:port/oc-line-com:optical-port/oc-line-com:state/" +
              "oc-line-com:optical-port-type = 'oc-opt-types:TERMINAL_LINE'";
      uses cfp2-top;

If I remove the “when” statement, econfd_cdb:set_values(Session, TV, IKP) works fine.

augment "/oc-platform:components/oc-platform:component/oc-platform:port" {
    description
      "Adding port operational-modes data to port component.";

    uses cfp2-top; 
  }

Am I missing something regarding Yang modeling or ConfD behavior?

Any help would be greatly appreciated.

Please put together a small demo that can be used to reproduce your issue and post it to a Tail-f RT support ticket.
I can’t reproduce your issue, and I can’t see how a when expression would affect the CDB API setting oper data values.

Thanks @cohult. I will open a support ticket.

I’m not sure if it matters but that “when” depends on another augment statement:

augment "/oc-platform:components/oc-platform:component" +
    "/oc-platform:port" {
    description
      "Adding optical port data to platform components model";

    uses transport-line-common-port-top;
  }

The CLI can resolve the path /oc-platform:components/component{line0/4/1}/port/cfp2. But set_values complains.