Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Kumar_Manoj
Participant

Python library for using R80 management server APIsExportImportPolicyPackage

Jump to solution

Hi All,

Can someone please help me? I am trying to merge two separate R80.10 SMC into a single R80.10 using  ExportImportPolicyPackage-master, while using script i am getting below errors, 

File "import_export_package.py", line 5, in <module>
from cp_mgmt_api_python_sdk.lib import APIClientArgs
ImportError: cannot import name 'APIClientArgs'

I tried to fix but no luck, would really appreciate if someone can help

1 Solution

Accepted Solutions
Art_Zalenekas
Employee
Employee
0 Kudos
8 Replies
Martin_Valenta
Advisor

Make sure that cp_mgmt_api_python_sdk is in same folder as your script, otherwise it will fail to load those modules.

Kumar_Manoj
Participant

Thank you Martin, Its working for me now. one doubt about something VPN and NAT as completely not merged even it did not copied any gateways as well, finally i had manual work to complete these items, so is it a normal behavior with this script ?

0 Kudos
PhoneBoy
Admin
Admin

I'm assuming you're referring to this script: Python tool for exporting/importing a policy package or parts of it

The script does have some limitations, namely because the API does not expose everything you need to export and import.

Read the discussion attached to the script for details.

This means some items will have to be done manually.

0 Kudos
Kumar_Manoj
Participant

@Dameon Welch-Abernathy  thank you so much for your response. 

Fiqri_kurniawan
Participant

Hi guys,

As well as adding others, if an error like this still appears, first install the cp_mgmt_api_python_sdk-master. By way of cmd, move to that directory, run setup.py

the details: C: \cp_mgmt_api_python_sdk-master> setup.py

Hope this helps us all.

Thanks

0 Kudos
2lnetworks
Explorer

I'm having the same issue as this thread. Does this need to be run from a remote host, or can i run this from the management server itself? the directions is a bit iffy.

 

Thanks,

0 Kudos
Art_Zalenekas
Employee
Employee
0 Kudos
2lnetworks
Explorer

I did that but still no luck.

echo $PYTHONPATH
:/home/admin/cp_mgmt_api_python_sdk-master/:/home/admin/cp_mgmt_api_python_sdk-master/:/home/admin/cp_mgmt_api_python_sdk-master/

 

 

ls -lh
total 104M
drwxr-xr-x 3 admin root 4.0K Feb 18 19:42 ExportImportPolicyPackage-master
-rwxr----- 1 admin root 1.6M Nov 27 2019 IPSUpdateRevert
drwxr-xr-x 3 admin root 4.0K Feb 18 20:11 cp_mgmt_api_python_sdk-master

 

/opt/CPsuite-R80/fw1/Python/bin/python2.7 /home/admin/ExportImportP olicyPackage-master/ExportImportPolicyPackage-master/import_export_package.py
Traceback (most recent call last):
File "/home/admin/ExportImportPolicyPackage-master/ExportImportPolicyPackage-master/im port_export_package.py", line 5, in <module>
from cpapi import APIClient, APIClientArgs
ImportError: No module named cpapi

 

 

0 Kudos