<?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: How to start with pandievice and API in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/248675#M1857</link>
    <description>&lt;P&gt;Can anyone assist? Let me rephrase the question: can you please recomend a method of creating a large amount of security policy from csv input file?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Feb 2019 17:21:52 GMT</pubDate>
    <dc:creator>BatD</dc:creator>
    <dc:date>2019-02-04T17:21:52Z</dc:date>
    <item>
      <title>How to start with pandievice and API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/247563#M1854</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;I feel a bit stupid asking the question, but surely, others had the same problem as me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create multiple address objects, service objects and rules from a CSV file input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;People are recommending using “pandevice”, however reading the documentation, it kind of assumes that the user is fluent with python. I did a lot of reading, but I am failing at just the basics of how to setup the python environment and create a script. Is there a simple guide of how to do, if you don’t have any python knowledge?&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 10:20:49 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/247563#M1854</guid>
      <dc:creator>BatD</dc:creator>
      <dc:date>2019-01-25T10:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to start with pandievice and API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/247649#M1855</link>
      <description>&lt;P&gt;Hey, just trying to clarify:&amp;nbsp; are you asking for help getting a basic pandevice script to work?&amp;nbsp; Or are you asking for help setting up python itself in your environment?&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 00:16:25 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/247649#M1855</guid>
      <dc:creator>gfreeman</dc:creator>
      <dc:date>2019-01-26T00:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to start with pandievice and API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/247745#M1856</link>
      <description>&lt;P&gt;Thank you for your response&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/46544"&gt;@gfreeman&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I have some scripting understanding, but no Python knowledge and was looking for some simpler scripts which I can then modify. Reading the pandevice documentation makes sense, but I am a bit lost of how to actually practiclly use the modules. There are some examples in the pandevcie github page, but they seem to be a bit more complicated with some advanced functions and checks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am just looking for crating bulk configuration items taking variables from file input. For example,&amp;nbsp;a few hundred secruity polices from excel/csv file paramters.&lt;/P&gt;&lt;P&gt;I guess then principally it will be the same for any other configuration item, e.g. address and service objects.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 07:55:06 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/247745#M1856</guid>
      <dc:creator>BatD</dc:creator>
      <dc:date>2019-01-28T07:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to start with pandievice and API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/248675#M1857</link>
      <description>&lt;P&gt;Can anyone assist? Let me rephrase the question: can you please recomend a method of creating a large amount of security policy from csv input file?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 17:21:52 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/248675#M1857</guid>
      <dc:creator>BatD</dc:creator>
      <dc:date>2019-02-04T17:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to start with pandievice and API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/248767#M1858</link>
      <description>&lt;P&gt;Ok, so python has a &lt;CODE&gt;csv&lt;/CODE&gt; module.&amp;nbsp; You use that to parse the csv file, then using pandevice to create the security policies.&amp;nbsp; So let me give the pandevice code you'll be using once you've parsed the csv file itself.&amp;nbsp; In this example, the variable &lt;CODE&gt;configs&lt;/CODE&gt; is a &lt;CODE&gt;list&lt;/CODE&gt; of the parsed values from the csv file, and each entry in configs is a python &lt;CODE&gt;dict&lt;/CODE&gt;, where the key is the security rule parameter name, and the value is the value for that security rule.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;
from pandevice.firewall import Firewall
from pandevice.policies import Rulebase, SecurityRule

# Connect to the firewall.
fw = Firewall(hostname, username, password)

# Security rules are children of a rulebase, so create the rulebase object and
# add it to the firewall as a child object.
rb = Rulebase()
fw.add(rb)

# Load up the "configs" value here.  Each entry in "configs" is a python dict, but you could
# also just make it a list, it's up to you.
configs = []

# Now just iterate over each security rule and add it to the firewall.
for con_dict in configs:
    rule = SecurityRule(**con_dict)
    rb.add(rule)
    rule.create()

# Commit only after you're sure the above code works.
#fw.commit(sync=True)
&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Feb 2019 18:16:23 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/248767#M1858</guid>
      <dc:creator>gfreeman</dc:creator>
      <dc:date>2019-02-04T18:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to start with pandievice and API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/248984#M1859</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/46544"&gt;@gfreeman&lt;/a&gt;&amp;nbsp;Thank you for your reponse.&amp;nbsp;It gives me better understanding and a good place to start.&amp;nbsp;&amp;nbsp;I will spend some time working on that over the next week.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 07:51:39 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-start-with-pandievice-and-api/m-p/248984#M1859</guid>
      <dc:creator>BatD</dc:creator>
      <dc:date>2019-02-06T07:51:39Z</dc:date>
    </item>
  </channel>
</rss>

