Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modification to running db using datastore_client #38

Closed
victor74 opened this issue Aug 29, 2018 · 2 comments
Closed

Modification to running db using datastore_client #38

victor74 opened this issue Aug 29, 2018 · 2 comments

Comments

@victor74
Copy link

Hi,
I have been learning clixon for last few days and it is an impressive project. I am following the readme, and I got to the Datastore section. I am probably missing something, but my current mental model on how datastore_client should work is as follows:

  1. I modify data in any datastore using the datastore_client app
  2. Changes are reflected in cli

At this point it seems that the above assumption is not valid:

  1. I created a basic configuration using cli:
    root@lebox> show configuration interfaces { interface { name eth1; type ex:loopback; enabled true; } }
  2. I can retrieve that configuration using datastore_client:
    sudo ./datastore_client -d running -b /usr/local/var/example/ -p /home/victor/clixon/datastore/text/text.so -y /usr/local/share/example/yang/ -m example get /
    <config><interfaces><interface><name>eth1</name><type>ex:loopback</type><enabled>true</enabled></interface></interfaces></config>
  3. I can add an item to the configuration:
    victor@lebox:~/clixon/datastore$ sudo ./datastore_client -d running -b /usr/local/var/example/ -p /home/victor/clixon/datastore/text/text.so -y /usr/local/share/example/yang/ -m ietf-ip put merge '<config><interfaces><interface><name>eth2</name><type>ex:loopback</type><enabled>true</enabled></interface></interfaces></config>' victor@lebox:~/clixon/datastore$ sudo ./datastore_client -d running -b /usr/local/var/example/ -p /home/victor/clixon/datastore/text/text.so -y /usr/local/share/example/yang/ -m example get / <config><interfaces><interface><name>eth1</name><type>ex:loopback</type><enabled>true</enabled></interface><interface><name>eth2</name><type>ex:loopback</type><enabled>true</enabled></interface></interfaces></config>
  4. The configuration change made in step 3 is not reflected in cli.
    Please advise what did I miss in that workflow, or is my understanding on how datastore_client should work flawed.

Regards
Jan

@olofhagsand
Copy link
Member

Jan,
The datastore client is a direct low-level interface to the datastore. It is intended as a debug tool. However, if used without caching it should work as you describe (I haven't verified your example in detail though).
But the datastore client has a per-process write-through cache CLICON_XMLDB_CACHE which is true by default.
This means that if you write in the datastore with the low-level datastore client, the cache in the backend/cli will not be invalidated and the cli will read stale data.
At least this is what I guess is happening. I could look at it in more detail at a later time.
I am curious on your use-case. Usually, the datastore client is not used except for debugging. Editing directly in the files are also possible.
The usual usecase is that you access the datastore via the backend and the cli/restconf/netconf clients.
There may also be some older documentation that gives another view on this, if so, please point me to it , and I can update it.
Thanks for using clixon!

@victor74
Copy link
Author

Olof,
I want to use clixon to configure a system that I am trying to build. The main datastore is going to be a relational database, and was considering how to synchronise the backend and the database. As it usually happens, after I sent the email to you I got the idea to use netconf/restconf as an interface between those two data sources. Which makes a perfect sense and keeps everything coherent. And now you validated that assumption, thanks for that.

Again, I really appreciate the effort you put in this project, it is a great stuff

Jan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants