Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
udanap
Explorer

How to merge policy packages in one R80.10 CMS to another existing R80.10 CMS using python tool?

Hi All,

I need to import some policy packages from one R80.10 CMS to another R80.10 CMS. I used the python tool to export each and every policy packages from the first CMS. But when I tried to import them one by one to the 2nd CMS, first policy package was imported with its objects without any issues but when importing the 2nd policy package, new  objects were created with the name of  "NAME_COLLISION_RESOLVED_". I think it is because during the import of 1st policy package, majority of the objects were imported and during the 2nd policy package import, it tried to import same objects again and  met with name collisions. Then all those duplicated objects were renamed as NAME_COLLISION_RESOLVED_objects and saved as new objects. Is there anyway to overcome this issue? 
Or any other successful method to import those policies? I really appreciate you responds

Thanks and Regards,

udanap

0 Kudos
4 Replies
PhoneBoy
Admin
Admin

The tool doesn't understand that the "duplicate" objects were the same ones it already imported, thus it uses the NAME_COLLISION_RESOLVED naming so you can see them.
You right-click on the relevant object in the Object Explorer, select Where Used, and do a search/replace for the relevant object.
Rinse and repeat for all affected objects.
0 Kudos
udanap
Explorer

Thanks for the reply. However I have few more questions.
I saw in the description of python tool for importing/exporting thread, it does not export/import cluster objects and gateways. Is it updated in the further releases or still does it have that limitation? Another thing is that when importing VPN communities, it does not import them properly. As an example the participated gateways tab is empty in all the VPN domains. Is that because of the above limitation of cannot export/import gateways and cluster objects?
Finally is there any other recommended way to complete this task? There are 5 policy packages (from same SMS) that need to be imported and the problem is, in each and every time I import a policy, it is needed to re-arrange all the objects which get duplicated and it is like re-creating the rules from the beginning.

Thanks and Regards,
udanap
0 Kudos
PNH
Participant

Hi

I just did import of 4-5 rulebases from same management to a (empty) different one at a customer, and modified the script a bit to get rid of the name collision handling.

 

Search for NAME_COLLISION_RESOLVED in the file importing/import_objects.py

Then remove the whole block checking and doing the rename.

Result is that it will spit out error message for each object that already exist, but not import it.

In the rules, the object that already exists in the management database will be used (which is what you want in your scenario I think)

 

Remove (or put comment # in front of each line) the block, it is around line 220 I think.

Line before it is

api_reply = client.api_call(api_call, payload)

and you remove from

if not api_reply.success and "name" in payload and "More than one object" in api_reply.error_message:

and all lines up to, but not including this one:

if not api_reply.success:

at about line 237

 

Would have been nice to have this as an "official" option in future versions.

 

Suggest testing i something not production first as usual..

 

Regards

Petter

 

 

0 Kudos
PhoneBoy
Admin
Admin

It comes down to the APIs not supporting clusters, which explains why your VPN communities are empty as well.
API support for clusters was added in R80.40.
I don't believe this script has been updated to take advantage of this.
0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events