ConfD User Community

Cannot maapi.create() a list entry that is keyed on a yang:date-and-time object


#1

I have a list that contains an element of type yang:date-and-time, and that element is the key for the list.

Using the Java API Maapi.create(), when I try to create an element in that list, it throws an Exception:

/abc/user{jude}/history{2018-06-19T11:08:12.911000-07:00}: Bad key “2018-06-19T11:08:12.911000-07:0-420” (“2018-06-19T11:08:12.911000-07:0-420” is not a valid value.) at: /abc/user/history

In the example above, “2018-06-19T11:08:12.911000-07:00” is the key. However, when that same string appears in the error, it has been slightly transformed (see the last few characters – “-07:00” becomes “-07:0-420” in both places where that string is shown in the Exception’s message).

Should it be possible to create a list that is keyed on a yang:date-and-time element?


#2

Here is what i have used in one of the maapi examples:

ConfDatetime dt = ConfDatetime.getConfDatetime();
maapi.create(tr, start_log_keypath_string + "{" + dt + "}");

The part of YANG

       list start-log {
            key time;
            leaf time {
                type yang:date-and-time;
            }
        }