Commit Graph

13 Commits

Author SHA1 Message Date
Igor Ryzhov
10eac0a54d lib: fix oper data leaf creation
When creating an initial tree trunk for oper data walk, if the xpath
represents a leaf, the leaf is created with an incorrect empty value.
If it doesn't actually exist in daemon's oper data, its value is not
overwritten later and an empty value is returned in the result.

For example, when requesting
`/frr-interface:lib/interface[name='eth0']/description`, the result is:
```
{
  "frr-interface:lib": {
    "interface": [
      {
        "name": "eth0",
        "description": ""
      }
    ]
  }
}
```
instead of an empty JSON that it should be.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-15 10:27:33 +02:00
Christian Hopps
008ba3e3fb
lib: fix coverity issue
** CID 1575595:  Null pointer dereferences  (REVERSE_INULL)

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-12 16:37:30 +00:00
Christian Hopps
7b7725f7b8
lib: change type of inner to struct lyd_node *, cleaner code
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-11 13:51:23 +00:00
Christian Hopps
32a4c4019e lib: implement missing YANG choice/case statements.
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-11 13:38:57 +00:00
Donatas Abraitis
4c875482a5
Merge pull request #15123 from LabNConsulting/chopps/fix-oper-state-memleak
lib: fix oper-state memleak
2024-01-10 12:16:37 +02:00
Christian Hopps
5519c0fbe6
lib: fix oper-state memleak
Fix memleak when a key-ed query was done for which the key didn't exist.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-09 21:52:41 +00:00
Christian Hopps
1e4229fc1f lib: use libyang functions if they are present
Add configure.ac tests for libyang functions, if not present supply the
functionality ourselves in yang.[ch]

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-07 15:17:56 +00:00
Christian Hopps
cf67a7e265 lib: mgmtd: implement full XPath 1.0 predicate functionality
Allow user to specify full YANG compatible XPath 1.0 predicates. This
allows for trimming results of generic queries using functions and other
non-key predicates from XPath 1.0

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-07 15:17:30 +00:00
Christian Hopps
00138ffb47 lib: fix clang SA warnings
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-07 15:04:18 +00:00
Donald Sharp
60f099657f
Merge pull request #15073 from LabNConsulting/chopps/fix-yang-key-queries
lib: fix specific entry queries
2024-01-02 10:06:22 -05:00
Christian Hopps
412eec1bed
lib: don't count on scheme key nodes being first children
Heard back from libyang folks that this is not something they consider part of
the API and/or are going to guarantee. So we cannot count on it. Expect keys at
any location on the child sibling list.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-02 11:34:34 +00:00
Christian Hopps
7e6595698b
lib: fix specific entry queries
- fix key leaf queries
- fix specific list entry with non-key leaf top element

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-02 09:47:15 +00:00
Christian Hopps
ad1ccb6e62 lib: northbound: add yielding and batching to oper-state queries
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-28 17:52:57 +00:00