Database conversion from yang v1 to v2 with different keys and cdb-oper

Hello,

I am stuck with an issue and hopefully someone can make some suggestion. Thanks in advance.

I have a yang version 1 which uses a string as a key.

module a-yang-v1 {
key “conn-id”;
leaf conn-id {
type inet:uri {
length “1…200”;
}
mandatory true;
}
leaf direction {
config false;
type enumeration {
enum “BI” {
value 1;
}
enum “UNI” {
value 2;
}
}
}

In the annotation file I have the direction defined as oper data stored in cdb.

tailf:annotate /a-yang-v1/directtion {
tailf:cdb-oper {
tailf:persistent true;
}
}

Now I need to introduce a version 2 and the keys are different. The leaf “direction” remains unchanged.

module a-yang-v2 {

key “shelf slot”;

leaf shelf {
type string;
}
leaf slot {
type string;
}
leaf direction {
config false;
type enumeration {
enum “BI” {
value 1;
}
enum “UNI” {
value 2;
}
}
}

tailf:annotate /a-yang-v2/directtion {
tailf:cdb-oper {
tailf:persistent true;
}
}

I am writing a database conversion proc to convert the entity from V1 to V2. It seems I am able to create the V2 entity however I am not able to set the “direction” in the conversion proc.

If I bring up the system with V2, I am able to set the direction in the hook handler.

I am not sure why there is a difference in my conversion proc and the hook handler.

Any help is greatly appreciated. Many thanks.

Hello,

If you are doing an upgrade, in your upgrade client, after you have called maapi_attach_init(ms, &th) you should use that transaction “th” handle to set both config and operational data, i.e. both config true and false data, using maapi commands.