<?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: Adding device to Panorama Using Python SDK in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/adding-device-to-panorama-using-python-sdk/m-p/519748#M3231</link>
    <description>&lt;P&gt;Talking about your script, follow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from panos.panorama import Panorama
from panos.firewall import Firewall
from panos.device import SystemSettings

fw = Firewall("fw.mylab.com", "admin", "admin")
sys_setting = SystemSettings(panorama="192.168.254.1")
fw.add(sys_setting)
sys_setting.create()
fw.commit()&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 31 Oct 2022 20:27:09 GMT</pubDate>
    <dc:creator>joaovictor</dc:creator>
    <dc:date>2022-10-31T20:27:09Z</dc:date>
    <item>
      <title>Adding device to Panorama Using Python SDK</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/adding-device-to-panorama-using-python-sdk/m-p/411345#M2684</link>
      <description>&lt;P&gt;I am trying to add a device to Panorama using Python SDK (panos). I was able to configure the device side using below code but cannot do the same Panorama side.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is greatly appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from panos.panorama import Panorama
from panos.firewall import Firewall
from panos.device import SystemSettings

panorama = Panorama("192.168.254.1", "admin", "admin")
fw= Firewall("192.168.254.2", "admin", "admin")
sys_setting = SystemSettings(panorama="192.168.254.1")
pa.add(sys)
sys.create()
pa.commit()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 23:11:43 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/adding-device-to-panorama-using-python-sdk/m-p/411345#M2684</guid>
      <dc:creator>Armen</dc:creator>
      <dc:date>2021-06-04T23:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Adding device to Panorama Using Python SDK</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/adding-device-to-panorama-using-python-sdk/m-p/519743#M3230</link>
      <description>&lt;P&gt;Hi Armen,&lt;/P&gt;&lt;P&gt;i hope that the script below be useful to you:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#Import Modules:
from panos import base
from panos import firewall
from panos import panorama
from panos import policies
from panos import objects
from panos import network
from panos import device
import getpass
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#Credentials
username = input('Admin: ')
password = getpass.getpass('Type your password: ')
device_name = input('Type Panorama address or name: ')

#You need to instanciate a panorama login object:
pano = panorama.Panorama(device_name, username, password)

#You can use the bellow script to pull all Templates:
templates_pan = panorama.Template.refreshall(pano)

#You can use the bellow script to pull all DeviceGroups from Panorama:
device_grp_pan = panorama.DeviceGroup.refreshall(pano)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#You will receive a list with Templates or Devicegroup python objects:
print(templates_pan)
print(device_grp_pan)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#Since that the objects are an iterable object, you can do a 'for' through each object in the list:
for template in templates_pan:
    '''You can use the "about" method to verify some Template parameters'''
    print(template.about())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;#Since that the objects are an iterable object, you can do a 'for' through each object in the list:
for dg in device_grp_pan:
    '''You can use the "about" method to verify some Device-Group parameters'''
    print(dg.about())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#Once you have the template/device group, you can set a template/device-group that you want to configure:
template_definition = panorama.Template('Asimov_office_template')
pano.add(template_definition)
#Once you have the template/device group, you can set a template/device-group that you want to configure:
dg_definition = panorama.DeviceGroup('Asimov_office_dg')
pano.add(dg_definition)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Ok, from this point you can start push configuration to Template/Device Groups defined above:
#For example, lets push a network interface configuration:
interface_to_be_created = {'tag': 999, 
                           'ip': ['172.16.0.1/24'], 
                           'comment': 'Testing-Python', 
                           'name': 'ae1.999'}

interface_obj = network.Layer3Subinterface(**interface_to_be_created)
template_definition.add(interface_obj)
interface_obj.create()&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 31 Oct 2022 19:56:53 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/adding-device-to-panorama-using-python-sdk/m-p/519743#M3230</guid>
      <dc:creator>joaovictor</dc:creator>
      <dc:date>2022-10-31T19:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Adding device to Panorama Using Python SDK</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/adding-device-to-panorama-using-python-sdk/m-p/519748#M3231</link>
      <description>&lt;P&gt;Talking about your script, follow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from panos.panorama import Panorama
from panos.firewall import Firewall
from panos.device import SystemSettings

fw = Firewall("fw.mylab.com", "admin", "admin")
sys_setting = SystemSettings(panorama="192.168.254.1")
fw.add(sys_setting)
sys_setting.create()
fw.commit()&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 31 Oct 2022 20:27:09 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/adding-device-to-panorama-using-python-sdk/m-p/519748#M3231</guid>
      <dc:creator>joaovictor</dc:creator>
      <dc:date>2022-10-31T20:27:09Z</dc:date>
    </item>
  </channel>
</rss>

