Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

transapi_init() #123

Open
Open

Description

@i95der

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.

Activity

  1. michalvasko commented on Jun 30, 2016

    @michalvasko
    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

  2. i95der commented on Jun 30, 2016

    @i95der
    Author

    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?

  3. michalvasko commented on Jun 30, 2016

    @michalvasko
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions