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

transapi_init() #123

Open
i95der opened this issue Jun 30, 2016 · 3 comments
Open

transapi_init() #123

i95der opened this issue Jun 30, 2016 · 3 comments

Comments

@i95der
Copy link

i95der commented Jun 30, 2016

I'm using the transapi_init() function to change the startup configuration of my device, I'm writing my tree in the *running xmlDocPtr and I know it's correct because I'm dumping it in a text file (using xmlDocDump), and then I'm reading this file and I'm putting its content inside a const char * data, and it is copied to the string data successfully because I'm printing it in another file, and I'm using the below function to edit the startup config :

rpc = nc_rpc_editconfig(NC_DATASTORE_STARTUP, NC_DATASTORE_CONFIG,0,0,0,data);
if(rpc==NULL) system("mkdir /root/logs/rpcerror");
else system("mkdir /root/logs/rpcedited");

rpcedited directory is created which means the rpc value is not NULL but the startup configuration never changes. Can you help me please?
Note that I transformed the xmlDocPtr to a const char * because that's what nc_rpc_editconfig requires.

@michalvasko
Copy link
Member

Hi,
if I understand your problem correctly then you are mistaken about what transapi_init() is supposed to do, because you cannot change startup using it. What it is supposed to do is analyze the current system state, create the configuration accordingly so that afterwards, when startup is copied into running, the final state really conforms to startup. This is also written in our tutorial, point 3.

Regards,
Michal

@i95der
Copy link
Author

i95der commented Jun 30, 2016

So if I want to editconfig of a datastore, I should do it from a node callback or what? Am I using the nc_rpc_editconfig the right way?

@michalvasko
Copy link
Member

If you want to execute edit-config on a datastore, you generally must send such an RPC to the server. You can do (fake) this from inside the server using dummy sessions. You can find an example of this in our netopeer cfgsystem init utility.

Regards,
Michal

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