diff options
| author | Russ White <russ@riw.us> | 2022-03-29 10:51:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-29 10:51:02 -0400 |
| commit | dcaba5ae1a94484b5f1a1351dfad5dbb41d97652 (patch) | |
| tree | 2492b10e9652032a0e74d74646d6a655223f93d1 /lib/northbound.c | |
| parent | f06b9fee95b3b42651f6a601f1a9eda63d1d2e72 (diff) | |
| parent | 1c9bd416f4fb91abfed12a654fef802712e2db2e (diff) | |
Merge pull request #10719 from opensourcerouting/nb-show-fixes
lib: fix and improve yang operational data display
Diffstat (limited to 'lib/northbound.c')
| -rw-r--r-- | lib/northbound.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/northbound.c b/lib/northbound.c index 49adea6d53..2cc7ac6ea1 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -1649,10 +1649,12 @@ static int nb_oper_data_iter_container(const struct nb_node *nb_node, uint32_t flags, nb_oper_data_cb cb, void *arg) { + const struct lysc_node *snode = nb_node->snode; + if (CHECK_FLAG(nb_node->flags, F_NB_NODE_CONFIG_ONLY)) return NB_OK; - /* Presence containers. */ + /* Read-only presence containers. */ if (nb_node->cbs.get_elem) { struct yang_data *data; int ret; @@ -1662,15 +1664,24 @@ static int nb_oper_data_iter_container(const struct nb_node *nb_node, /* Presence container is not present. */ return NB_OK; - ret = (*cb)(nb_node->snode, translator, data, arg); + ret = (*cb)(snode, translator, data, arg); if (ret != NB_OK) return ret; } + /* Read-write presence containers. */ + if (CHECK_FLAG(snode->flags, LYS_CONFIG_W)) { + struct lysc_node_container *scontainer; + + scontainer = (struct lysc_node_container *)snode; + if (CHECK_FLAG(scontainer->flags, LYS_PRESENCE) + && !yang_dnode_get(running_config->dnode, xpath)) + return NB_OK; + } + /* Iterate over the child nodes. */ - return nb_oper_data_iter_children(nb_node->snode, xpath, list_entry, - list_keys, translator, false, flags, - cb, arg); + return nb_oper_data_iter_children(snode, xpath, list_entry, list_keys, + translator, false, flags, cb, arg); } static int |
