<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python scripts to clone objects from local domain to global domain in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Python-scripts-to-clone-objects-from-local-domain-to-global/m-p/75346#M4388</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This tool seem to be very useful to us and I did a quick test and got this error. Any idea what is wrong?&lt;/P&gt;&lt;P&gt;# python local_group_to_global.py -o bc731f48-e21e-4955-93de-6a6ce4e614c4 -d XXX -n G&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "local_group_to_global.py", line 119, in &amp;lt;module&amp;gt;&lt;BR /&gt;LocalGroupToGlobal(args)&lt;BR /&gt;File "local_group_to_global.py", line 31, in __init__&lt;BR /&gt;self.group_details = GroupDetails()&lt;BR /&gt;NameError: global name 'GroupDetails' is not defined&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 14 Feb 2020 22:04:46 GMT</pubDate>
    <dc:creator>Jin_Zhou</dc:creator>
    <dc:date>2020-02-14T22:04:46Z</dc:date>
    <item>
      <title>Python scripts to clone objects from local domain to global domain</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Python-scripts-to-clone-objects-from-local-domain-to-global/m-p/38924#M2377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H2&gt;Overview&lt;/H2&gt;&lt;P&gt;These scripts copy objects from a given local domain to the global domain.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;These scripts use the Python library &lt;/SPAN&gt;&lt;A _jive_internal="true" data-containerid="2007" data-containertype="14" data-objectid="1091" data-objecttype="102" href="https://community.checkpoint.com/docs/DOC-1091" style="color: #6d6e71;"&gt;Python library for using the management APIs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Description&lt;/H2&gt;&lt;UL&gt;&lt;LI&gt;In order to clone single object that his type is known&amp;nbsp;run&amp;nbsp;&lt;SPAN&gt;'local_&amp;lt;object type&amp;gt;_to_global.py' -o &amp;lt;Object id&amp;gt; &amp;lt;Flags&amp;gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;In order to clone&lt;/SPAN&gt;&amp;nbsp;single object that his type is unknown run&amp;nbsp;&lt;SPAN&gt;'local_object_to_global.py' -o &amp;lt;Object id&amp;gt;&amp;nbsp;&amp;lt;Flags&amp;gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;In order to clone&amp;nbsp;more than&amp;nbsp;one&amp;nbsp;&lt;/SPAN&gt;object :&lt;UL&gt;&lt;LI&gt;Add tag with&amp;nbsp;&lt;SPAN&gt;&amp;lt;Tag name&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(using SmartConsole or add-tag command on the command line) to the objects that need to be cloned.&lt;/LI&gt;&lt;LI&gt;Run&amp;nbsp;&lt;SPAN&gt;'local_global_by_tag.py' &amp;lt;Tag name&amp;gt; &amp;lt;Flags&amp;gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Flags:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;mandatory:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;-d &amp;lt;local domain name&amp;gt; : The local domain that contains the object that need to be cloned.&lt;/LI&gt;&lt;LI&gt;-n &amp;lt;prefix&amp;gt;:&amp;nbsp;&lt;SPAN&gt;The new global object name will be as follow : prefix_&amp;lt;local_object_name&amp;gt;.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;mandatory if running the script not&amp;nbsp;on the management&amp;nbsp;server:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;-s &amp;lt;Server IP&amp;gt; :The IP address or name of the Check Point Management Server.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;-u &amp;lt;User name&amp;gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;optional&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;-p &amp;lt;port number&amp;gt; : Default value '443'&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;-g &amp;lt;Global domain name&amp;gt; : Default value 'Global'&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Notes :&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1. The script supports only the following objects types: host, network, address_range, network group, tcp service, udp service, service group.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For objects that are not one of these types, the script will not clone them and print an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2. In case a group object needs to be cloned, the script will clone the group and all the objects it contains.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;3. Objects that contain the 'nat-settings' field will be cloned without this filed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scripts creates:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1. logfile.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2. json_objects.json contains list of&amp;nbsp; {&amp;lt;original object uid&amp;gt; : &amp;lt;cloned global object uid&amp;gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3. csv_file.csv contains {&amp;lt;original object uid&amp;gt;, &amp;lt;original object name&amp;gt;, &amp;lt;cloned global object name&amp;gt; &amp;lt;cloned global object uid&amp;gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In case the global object wasn't created the &amp;lt;cloned global object name&amp;gt; &amp;lt;cloned global object uid&amp;gt; will remain empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Instructions&lt;/H2&gt;&lt;P style="color: #333333;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 15.3333px; font-family: Helvetica, sans-serif;"&gt;Follow the steps below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #333333;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 15.3333px; font-family: Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1. Unzip attached zip file&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #333333;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 15.3333px; font-family: Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2. &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Download the Python library from the link above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #333333;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3. Extract the &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Python library folder to the &lt;/SPAN&gt;folder containing the script.&lt;/P&gt;&lt;P style="color: #333333;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4. Use the html guide (localToGlobal.html) to run the relevant script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Tested on version&lt;/H2&gt;&lt;P&gt;R80, API version 1.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;STRONG&gt;Source Code Availability&lt;/STRONG&gt;&lt;/H2&gt;&lt;P&gt;The source code is now public on GitHub repository:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/CheckPoint-APIs-Team/LocalToGlobal" title="https://github.com/CheckPoint-APIs-Team/LocalToGlobal"&gt;GitHub - CheckPoint-APIs-Team/LocalToGlobal: Check Point LocalToGlobal tool enables you to copy objects from a local dom…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="font-size: 13px; color: #ff0000;"&gt;&lt;STRONG&gt;NOTICE: &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.6667px; color: #999999;"&gt;&lt;STRONG&gt;By using this sample code you agree to terms and conditions in this &lt;A href="https://community.checkpoint.com/docs/DOC-1042"&gt;Not authorized to view the specified document 1042&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;...&lt;/SPAN&gt;&lt;/H2&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2017 13:35:08 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Python-scripts-to-clone-objects-from-local-domain-to-global/m-p/38924#M2377</guid>
      <dc:creator>Inbar_Moskovich</dc:creator>
      <dc:date>2017-01-09T13:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Python scripts to clone objects from local domain to global domain</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Python-scripts-to-clone-objects-from-local-domain-to-global/m-p/75346#M4388</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This tool seem to be very useful to us and I did a quick test and got this error. Any idea what is wrong?&lt;/P&gt;&lt;P&gt;# python local_group_to_global.py -o bc731f48-e21e-4955-93de-6a6ce4e614c4 -d XXX -n G&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "local_group_to_global.py", line 119, in &amp;lt;module&amp;gt;&lt;BR /&gt;LocalGroupToGlobal(args)&lt;BR /&gt;File "local_group_to_global.py", line 31, in __init__&lt;BR /&gt;self.group_details = GroupDetails()&lt;BR /&gt;NameError: global name 'GroupDetails' is not defined&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 22:04:46 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Python-scripts-to-clone-objects-from-local-domain-to-global/m-p/75346#M4388</guid>
      <dc:creator>Jin_Zhou</dc:creator>
      <dc:date>2020-02-14T22:04:46Z</dc:date>
    </item>
  </channel>
</rss>

