<?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: Using expect script to automate building firewall templates in Panorama in General Topics</title>
    <link>https://live.paloaltonetworks.com/t5/general-topics/using-expect-script-to-automate-building-firewall-templates-in/m-p/63778#M38326</link>
    <description>&lt;P&gt;Hi Benson,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you share a sample usage that you attempted? Where does it break, what output do you get, how far does it work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Luciano&lt;/P&gt;</description>
    <pubDate>Fri, 28 Aug 2015 06:08:02 GMT</pubDate>
    <dc:creator>Lucky</dc:creator>
    <dc:date>2015-08-28T06:08:02Z</dc:date>
    <item>
      <title>Using expect script to automate building firewall templates in Panorama</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/using-expect-script-to-automate-building-firewall-templates-in/m-p/63763#M38323</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been struggling with this for weeks, and have tried various means, including setting the Panorama CLI parameters. However, I always get random results, which ends up either the cmdline was entered prematurely or truncated. A support ticket was logged but proved to less than helpful, as the answer given was to lessen the number of lines in the text file. The script will read in a text file with the commandlines to be run. I have use the similar script and run against SRX, and i do not encountered any issue with such. Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Contents of my expect script:&lt;/P&gt;&lt;P&gt;#!/usr/bin/expect -f&lt;BR /&gt;# Set up various other variables here ($user, $password)&lt;BR /&gt;set force_conservative 0&lt;/P&gt;&lt;P&gt;log_file -noappend sendlog.log&lt;/P&gt;&lt;P&gt;if {$force_conservative} {&lt;BR /&gt;set send_slow {1 1}&lt;BR /&gt;proc send {ignore arg} {&lt;BR /&gt;exp_send -s -- $arg&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;set timeout 60&lt;BR /&gt;spawn $env(SHELL)&lt;BR /&gt;match_max 100000&lt;/P&gt;&lt;P&gt;set user [lindex $argv 0]&lt;BR /&gt;set password [lindex $argv 1]&lt;BR /&gt;set host [lindex $argv 2]&lt;BR /&gt;set exec [lindex $argv 3]&lt;BR /&gt;set exp_internal 1&lt;/P&gt;&lt;P&gt;# Iterate over the cmdline&lt;BR /&gt;proc sendcmds {PA_CMD} {&lt;BR /&gt;send -- "$PA_CMD\r"&lt;BR /&gt;expect -exact "# "&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Get the commands to run, one per line&lt;BR /&gt;spawn ssh $user@$host&lt;BR /&gt;expect -exact "Password: "&lt;BR /&gt;send -- "$password\r"&lt;BR /&gt;expect -exact "&amp;gt; "&lt;BR /&gt;send -- "set cli terminal width 200\r"&lt;BR /&gt;expect -exact "&amp;gt; "&lt;BR /&gt;send -- "set cli terminal type xterm\r"&lt;BR /&gt;expect -exact "&amp;gt; "&lt;BR /&gt;send -- "configure\r"&lt;BR /&gt;expect -exact "# "&lt;/P&gt;&lt;P&gt;set fr [open $exec r]&lt;BR /&gt;while {[gets $fr line] != -1} {&lt;BR /&gt;sendcmds $line&lt;BR /&gt;sleep 1&lt;BR /&gt;}&lt;BR /&gt;close $fr&lt;/P&gt;&lt;P&gt;# Tidy up&lt;BR /&gt;expect -exact "# "&lt;BR /&gt;send -- "exit\r"&lt;BR /&gt;expect -exact "&amp;gt; "&lt;BR /&gt;send -- "exit\r"&lt;BR /&gt;close&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 02:16:25 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/using-expect-script-to-automate-building-firewall-templates-in/m-p/63763#M38323</guid>
      <dc:creator>benson</dc:creator>
      <dc:date>2015-08-28T02:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using expect script to automate building firewall templates in Panorama</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/using-expect-script-to-automate-building-firewall-templates-in/m-p/63778#M38326</link>
      <description>&lt;P&gt;Hi Benson,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you share a sample usage that you attempted? Where does it break, what output do you get, how far does it work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Luciano&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 06:08:02 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/using-expect-script-to-automate-building-firewall-templates-in/m-p/63778#M38326</guid>
      <dc:creator>Lucky</dc:creator>
      <dc:date>2015-08-28T06:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using expect script to automate building firewall templates in Panorama</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/using-expect-script-to-automate-building-firewall-templates-in/m-p/63868#M38375</link>
      <description>&lt;P&gt;Hi Luciano,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, i have managed to resolve the issue, there is a scripting mode in panorama which i need to turn it on. After I have done that, everything plays out nice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rgrds,&lt;/P&gt;&lt;P&gt;Benson&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2015 01:23:56 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/using-expect-script-to-automate-building-firewall-templates-in/m-p/63868#M38375</guid>
      <dc:creator>benson</dc:creator>
      <dc:date>2015-08-31T01:23:56Z</dc:date>
    </item>
  </channel>
</rss>

