cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

129
Views
0
Helpful
2
Replies
khgrant
Cisco Employee

Copying NavuContainer from one device to another device using maapi api

 

Hi Expert,

 

 

I have a use case where I need to copy some configuration from source device to target device using maapi and nauv api. I can copy configuration leaf by leaf iterating through the navucontainer but my requirement is to copy the whole container from source to target device in one go. Below is java code which I am using:

 

  s = new Socket("localhost", Conf.NCS_PORT);

  maapi = new Maapi(s);

  maapi.startUserSession("admin",

                        InetAddress.getLocalHost(),

                        "maapi",

                        new String[] { "admin" },

                        MaapiUserSessionFlag.PROTO_TCP);

  // Start a read transaction towards maapi

  int th   = maapi.startTrans(Conf.DB_RUNNING,

                              Conf.MODE_READ_WRITE);

  NavuContainer ncsContainer = getNcsContainer(maapi, th);

  NavuList devlist = ncsContainer.container(Ncs._devices).list(Ncs._device);

  NavuContainer targetdevice = devlist.elem("pe01.350ecermak.il");

  NavuContainer sourcedevice = devlist.elem("seg1.bglab000ur1.nj.panjde.comcast.net");

  NavuContainer clock=sourcedevice.container("config").container("ios", "clock");

//Now I want to copy clock NavuContainer to target device..?????

   maapi.applyTrans(th,true);

   s.close();

 

Any idea??

 

 

Thanks for help in advance!

 

 

Regards,

 

Vishesh Kansal

 

1 ACCEPTED SOLUTION

Accepted Solutions
khgrant
Cisco Employee

 

Hi,

 

 

You can do it with the mappi copy_tree method:

 

 

m.copy_tree(th, originpath, destpath);

 

 

Regards,

 

Roque

 

View solution in original post

2 REPLIES 2
khgrant
Cisco Employee

 

Hi,

 

 

You can do it with the mappi copy_tree method:

 

 

m.copy_tree(th, originpath, destpath);

 

 

Regards,

 

Roque

 

Thank you Roque for great help!!

Regards,

Vishesh Kansal

Create
Recognize Your Peers
Content for Community-Ad