Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Inbar_Moskovich
Employee Alumnus
Employee Alumnus

Python scripts to clone objects from local domain to global domain

Overview

These scripts copy objects from a given local domain to the global domain.

These scripts use the Python library Python library for using the management APIs

Description

  • In order to clone single object that his type is known run 'local_<object type>_to_global.py' -o <Object id> <Flags>
  • In order to clone single object that his type is unknown run 'local_object_to_global.py' -o <Object id> <Flags>
  • In order to clone more than one object :
    • Add tag with <Tag name> (using SmartConsole or add-tag command on the command line) to the objects that need to be cloned.
    • Run 'local_global_by_tag.py' <Tag name> <Flags> 

Flags:

   mandatory:

  • -d <local domain name> : The local domain that contains the object that need to be cloned.
  • -n <prefix>: The new global object name will be as follow : prefix_<local_object_name>.

mandatory if running the script not on the management server:

  • -s <Server IP> :The IP address or name of the Check Point Management Server.
  • -u <User name>

optional

  • -p <port number> : Default value '443' 
  • -g <Global domain name> : Default value 'Global' 

Notes :

     1. The script supports only the following objects types: host, network, address_range, network group, tcp service, udp service, service group.

          For objects that are not one of these types, the script will not clone them and print an error.

     2. In case a group object needs to be cloned, the script will clone the group and all the objects it contains.

     3. Objects that contain the 'nat-settings' field will be cloned without this filed.

The scripts creates:

     1. logfile.txt

     2. json_objects.json contains list of  {<original object uid> : <cloned global object uid>}

     3. csv_file.csv contains {<original object uid>, <original object name>, <cloned global object name> <cloned global object uid>}

          In case the global object wasn't created the <cloned global object name> <cloned global object uid> will remain empty.

Instructions

Follow the steps below:

     1. Unzip attached zip file

     2. Download the Python library from the link above.

     3. Extract the Python library folder to the folder containing the script.

     4. Use the html guide (localToGlobal.html) to run the relevant script

Tested on version

R80, API version 1.0

Source Code Availability

The source code is now public on GitHub repository:

GitHub - CheckPoint-APIs-Team/LocalToGlobal: Check Point LocalToGlobal tool enables you to copy obje... 

NOTICE: By using this sample code you agree to terms and conditions in this Not authorized to view the specified document 1042...

1 Reply
Jin_Zhou
Contributor

Hi,

 

This tool seem to be very useful to us and I did a quick test and got this error. Any idea what is wrong?

# python local_group_to_global.py -o bc731f48-e21e-4955-93de-6a6ce4e614c4 -d XXX -n G
Traceback (most recent call last):
File "local_group_to_global.py", line 119, in <module>
LocalGroupToGlobal(args)
File "local_group_to_global.py", line 31, in __init__
self.group_details = GroupDetails()
NameError: global name 'GroupDetails' is not defined

 

Thanks.

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events