datastore_read: bind yang when reading from cache

The cached xml version might be missing the yang information. This
breaks netconf validation of the running database:

yangcli admin@192.168.0.1> validate source=startup

RPC Error Reply 3 for session 3:

rpc-reply {
  rpc-error {
    error-type application
    error-tag operation-failed
    error-severity error
    error-message 'No spec found radio-dn'
  }
}

Make sure that the cached database respects the yb parameter.
This commit is contained in:
Baruch Siach 2020-12-28 16:10:52 +02:00
parent 006580cdc1
commit 0289569586

View file

@ -675,6 +675,10 @@ xmldb_get_cache(clicon_handle h,
else else
x0t = de->de_xml; x0t = de->de_xml;
if (yb == YB_MODULE && !xml_spec(x0t))
if (xml_bind_yang(x0t, YB_MODULE, yspec, NULL) < 0)
goto done;
/* Here x0t looks like: <config>...</config> */ /* Here x0t looks like: <config>...</config> */
/* Given the xpath, return a vector of matches in xvec /* Given the xpath, return a vector of matches in xvec
* Can we do everything in one go? * Can we do everything in one go?