取消
显示结果 
搜索替代 
您的意思是: 
cancel
1604
查看次数
0
有帮助
4
回复

Move configuration with Copy_tree() method

igotni
Level 1
Level 1

Hi everyone,

I have a problem with the copy_tree() function.

It works when trying to copy configuration from one port to another port or from one lag to another lag, but it doesn't work with services. in the example below I try to copy configuration from a given service customer in device 1 to another service customer in device 2.

cust1 = root.devices.device[_input.device1].config.alu__service.customer["99"]
cust2 = root.devices.device[_input.device2].config.alu__service.customer["99"]
m.copy_tree(t.th, cust1._path, cust2._path)

It generates the folowing error :

Error: badly formatted or nonexistent path (8): Data model mismatch

If you have any idea, don't hesitate to reply pkease.

Thanks in advance.

 

 

 

 

 

 

 

4 条回复4

yfherzog
Cisco Employee
Cisco Employee

Hi,

 

Have you created the list entry on device 2 before using copy_tree?

Hi,

Yes, of course.

azhasale
Cisco Employee
Cisco Employee

I am looking something like

this NSO cli

rename devices device abc xyz 

In this case we don’t need to create new device. Copy tree works fine but for that I have create new device first that I don’t want to do.

 

may be move is not correct method, I did not find any maapi method for renaming device without creating a new one. Rename does make a copy of same device with new name with the need of list entry present

I have list of 7k devices that I have to rename.

thanks

gmuloche
Cisco Employee
Cisco Employee
I think this is another questin you are asking but the answer to yours is:
you can't rename the device without creating a new one because you are changing the KEY of the device in the device list so by changing the "name" you change the unique identifier of the device in the list and so you need to create a new element.
Regards