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

93
Views
0
Helpful
0
Replies
viskansa
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

0 REPLIES 0
Create
Recognize Your Peers
Content for Community-Ad