Commit graph

15 commits

Author SHA1 Message Date
David Lamparter 552a0a3a28 lib: fix time_t print without cast
The gcc plugin wasn't warning about printing `suseconds_t` (which is
`time_t`, but in `struct timeval`.)  It needs to be printed with a cast,
just like `time_t`.  Luckily there is only one such usage.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-05-02 22:26:53 +02:00
Igor Ryzhov 1196d947d3 mgmtd: add support for native 'edit' operation
This operation basically implements support for RESTCONF operations. It
receives an xpath and a data tree in JSON/XML format, instead of a list
of (xpath, value) tuples as required by the current protobuf interface.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-26 17:00:15 +02:00
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