<?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: Get Tunnel ProxyID - panos python SDK in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/get-tunnel-proxyid-panos-python-sdk/m-p/511311#M3087</link>
    <description>&lt;P&gt;You're adding the class itself, not an instance of the class.&amp;nbsp; I'd recommend looking over the scripts in the examples directory to get a feel for how to use the SDK:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from panos.firewall import Firewall
from panos.network import IpsecTunnel

host = '127.0.0.1'
username = 'admin'
password = 'admin'

fw = Firewall(host, username, password)

listing = IpsecTunnel.refreshall(fw)
print('Found {0} tunnels'.format(len(listing)))&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 09 Aug 2022 14:59:14 GMT</pubDate>
    <dc:creator>gfreeman</dc:creator>
    <dc:date>2022-08-09T14:59:14Z</dc:date>
    <item>
      <title>Get Tunnel ProxyID - panos python SDK</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/get-tunnel-proxyid-panos-python-sdk/m-p/511303#M3086</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi all,&lt;BR /&gt;i really need for some help.&lt;/P&gt;&lt;P&gt;I´m trying to retrieve the proxy_id configured in the firewall using SDK, it´s not working:&lt;/P&gt;&lt;DIV class=""&gt;&lt;PRE&gt;import getpass
from panos import network
from panos import policies
from panos import firewall
from panos import objects
from termcolor import colored
import pandas as pd
import re

user = 'admin'
password = 'admin'
firewall_name = 'fw.abc.com'
fw_device = firewall.Firewall(firewall_name, api_username=api_user, api_password=password)

network.IpsecTunnel.refreshall(fw_device)
ipsec = fw_device.add(network.IpsecTunnel)
print(ipsec.findall(fw_device, network.IpsecTunnelIpv4ProxyId))&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;However i´m receiving an empty list.&lt;/P&gt;&lt;P&gt;I´m spending days just trying to get the proxy id from Tunnels, and I don´t know if the script is correct, i tried a lot of commands combinations, and in this moment i´m trying anything... Please, can someone help me?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;João Victor&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2022 13:19:09 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/get-tunnel-proxyid-panos-python-sdk/m-p/511303#M3086</guid>
      <dc:creator>joaovictor</dc:creator>
      <dc:date>2022-08-09T13:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Get Tunnel ProxyID - panos python SDK</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/get-tunnel-proxyid-panos-python-sdk/m-p/511311#M3087</link>
      <description>&lt;P&gt;You're adding the class itself, not an instance of the class.&amp;nbsp; I'd recommend looking over the scripts in the examples directory to get a feel for how to use the SDK:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from panos.firewall import Firewall
from panos.network import IpsecTunnel

host = '127.0.0.1'
username = 'admin'
password = 'admin'

fw = Firewall(host, username, password)

listing = IpsecTunnel.refreshall(fw)
print('Found {0} tunnels'.format(len(listing)))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 09 Aug 2022 14:59:14 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/get-tunnel-proxyid-panos-python-sdk/m-p/511311#M3087</guid>
      <dc:creator>gfreeman</dc:creator>
      <dc:date>2022-08-09T14:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get Tunnel ProxyID - panos python SDK</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/get-tunnel-proxyid-panos-python-sdk/m-p/511506#M3092</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/46544"&gt;@gfreeman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I´m starting in this journey of Palo Alto SDK. I saw in the documentation that there is an hierarchy between the classes. My problem is not retrieve the actual vpn in use, i can do this. My problem is how can i get the PROXY ID of each vpn. This is not working, i tried a lot of scripts that make sense, however it didn´t worked.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;tunnels = network.IpsecTunnel()&lt;BR /&gt;fw_device.add(tunnels)&lt;BR /&gt;proxy = network.IpsecTunnelIpv4ProxyId.refreshall(tunnels)&lt;BR /&gt;vpn = fw_device.find('VPN-123', network.IpsecTunnelIpv4ProxyId)&lt;BR /&gt;print(vpn)&lt;/P&gt;&lt;P&gt;[Output]: None&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;################################&lt;/P&gt;&lt;P&gt;tunnels = network.IpsecTunnel.refreshall(fw_device)&lt;BR /&gt;for tunnel in tunnels:&lt;BR /&gt;#fw_device.add(tunnels)&lt;BR /&gt;proxy = network.IpsecTunnelIpv4ProxyId.refreshall(fw_device)&lt;BR /&gt;vpn = fw_device.find(tunnel, network.IpsecTunnelIpv4ProxyId)&lt;BR /&gt;print(vpn)&lt;/P&gt;&lt;P&gt;** for each tunnel in tunnels, i receive None as output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However i have 2 proxies-ids configured for 'VPN-123'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If someone knows how can i get the proxies ids, i would be very grateful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;João Victor&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 21:49:22 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/get-tunnel-proxyid-panos-python-sdk/m-p/511506#M3092</guid>
      <dc:creator>joaovictor</dc:creator>
      <dc:date>2022-08-10T21:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get Tunnel ProxyID - panos python SDK</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/get-tunnel-proxyid-panos-python-sdk/m-p/511509#M3093</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Good and excelent news!!! I can retrieve the proxies-ids. And also, now i learned how to retrieve static routes from specific vrouter, and l3 interface from specific aggregate interface. Bellow follow the script for the three cases. I hope no one lose half night sleep, as i did.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from panos import firewall
from panos import network

######## fw credentials ###########
api_user = 'admin'
api_password = 'admin'
firewall_ip = 'fw.abc.com'
fw_device = firewall.Firewall(firewall_ip, api_username=api_user, api_password=api_password)

######## Pull proxy-Id from a specific VPN ########################
ipsec = network.IpsecTunnel(name='VPN-123')
fw_device.add(ipsec)
proxy = network.IpsecTunnelIpv4ProxyId.refreshall(ipsec)
for p in proxy:
print(p.about())

##### Pull static routes from a specific vrouter ########
vr = network.VirtualRouter(name='vr-customer-1')
fw_device.add(vr)
static_routes = network.StaticRoute.refreshall(vr)
for route in static_routes:
print(route.about())

##### Pull l3 interfaces from an specific AGGREGATE INTERFACE #####
ae = network.AggregateInterface(name='ae2')
fw_device.add(ae)
sub = network.Layer3Subinterface.refreshall(ae)
for s in sub:
print(s.about())

##### Also you can get a list of configured vrouter/vpn/interface as bellow: #####
'''This will return a list of the VPN Tunnels configured in your firewall '''
tunnels = network.IpsecTunnel.refreshall(fw_device)

'''Once you have a list of vpn names, you can iterate over it: '''

for tunnel in tunnels:
ipsec = network.IpsecTunnel(name=tunnel)
fw_device.add(ipsec)
proxy = network.IpsecTunnelIpv4ProxyId.refreshall(ipsec)
print(f'Pulling proxy id configuration from tunnel {tunnel}')
for p in proxy:
print(p.about())
print('*' * 60)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Nov 2022 22:23:02 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/get-tunnel-proxyid-panos-python-sdk/m-p/511509#M3093</guid>
      <dc:creator>joaovictor</dc:creator>
      <dc:date>2022-11-19T22:23:02Z</dc:date>
    </item>
  </channel>
</rss>

