ConfD User Community

ERROR: Store values in YANG model via CDB


#1

Here is my yang model:

list a {
    key name
    leaf name{
        description "update to the firmware";
        tailf:info "reference ";
        type leafref {
            path "/system/abc/xyz/name";
        }

    list component-name{
        key component;

        leaf component {
            type string;
            config false;
        }

        leaf upgrade-from {
            description "Firmware update version";
            tailf:info "Firmware update version";
            config false;
            tailf:cdb-oper {
                tailf:persistent true;
            }
            type string {
                pattern "[a-zA-Z0-9\\-\\.]+";
                length 1..40;
            }
         }     

    }    
}

I am trying to store value in the leaf upgrade-from. I am getting an error “Error: badly formatted or nonexistent path (8): Not a cdb operational data path”

This is my python code snippet for storing it:

cdb.cd(wsock, "/system/fwupdate/apply-image/{%s}" % image_name)     #works fine till here
cdb.create(wsock, "component-name/{cimc}")     #error over here
cdb.cd(wsock, "component-name/cimc")
str1 = "v-1"
cdb.set_elem(wsock, str1, "upgrade-from")

#2

Looks to me like you are CDing to the wrong path.
You have “list a” as the parent to “component-name” so the path should not be what you CDed to.

Should be something like l /a{}” that you cd to if a is the top-level node.


#3

Yes, the path for cdb.cd() doesn’t match the data model, but I’d guess that’s just a mistake when simplifying the model for posting. As far as I understand, it is he cdb.create() that fails, and the reason for that should be that the component-name list is configuration, since neither it nor its ancestors have a config false statement - and you can’t change configuration via the CDB API. I.e. component-name/{cimc} is (probably) a CDB data path, but it is not a CDB operational data path, hence the error message.