<?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 update an address object using pan-os sdk python in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-update-an-address-object-using-pan-os-sdk-python/m-p/458320#M2881</link>
    <description>&lt;P&gt;I was able to rename the address object using rename() , but unable to change the IP, tag, description of the address object using the python sdk. Requesting some help on this&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jan 2022 13:27:43 GMT</pubDate>
    <dc:creator>devsrm</dc:creator>
    <dc:date>2022-01-12T13:27:43Z</dc:date>
    <item>
      <title>How to update an address object using pan-os sdk python</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-update-an-address-object-using-pan-os-sdk-python/m-p/457636#M2876</link>
      <description>&lt;P&gt;Can someone help me with some code snippets to update the name, ip , description and tag of a specific address object in panorama using pan-os python SDK &lt;LI-PRODUCT title="Panorama" id="Panorama"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jan 2022 15:16:02 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-update-an-address-object-using-pan-os-sdk-python/m-p/457636#M2876</guid>
      <dc:creator>devsrm</dc:creator>
      <dc:date>2022-01-08T15:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to update an address object using pan-os sdk python</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-update-an-address-object-using-pan-os-sdk-python/m-p/458320#M2881</link>
      <description>&lt;P&gt;I was able to rename the address object using rename() , but unable to change the IP, tag, description of the address object using the python sdk. Requesting some help on this&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 13:27:43 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-update-an-address-object-using-pan-os-sdk-python/m-p/458320#M2881</guid>
      <dc:creator>devsrm</dc:creator>
      <dc:date>2022-01-12T13:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to update an address object using pan-os sdk python</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-update-an-address-object-using-pan-os-sdk-python/m-p/475354#M2974</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/205644"&gt;@devsrm&lt;/a&gt;&amp;nbsp;Did you found any way to do it with python SDK?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to update an address group to add more objects on panorama but I am staring with this sdk&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tip?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 22:45:50 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-update-an-address-object-using-pan-os-sdk-python/m-p/475354#M2974</guid>
      <dc:creator>itsNetwork</dc:creator>
      <dc:date>2022-03-23T22:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to update an address object using pan-os sdk python</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-update-an-address-object-using-pan-os-sdk-python/m-p/512461#M3097</link>
      <description>&lt;P&gt;Hello, i know that this topic is old, but let me try help showing the script that i use.&lt;/P&gt;&lt;P&gt;Would be there a more efficient way, but this one is working fine to me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1- Import tclasses:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;from panos import firewall
from panos import objects
import getpass&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2- provide the login credentials:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;api_user = 'admin'
api_password = getpass.getpass('Type your password: ')
device = 'firewall_name_or_ip'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3- fw instance object:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fw = firewall.Firewall(device, api_username=api_user, api_password=api_password)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4- Pull the actual objects from the firewall:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;objects.AddressObject.refreshall(fw)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;5- (optional) Search and find the address object or address group that you want to replace some attribute:&lt;/P&gt;&lt;P&gt;Address Objects:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;to_replace_value = fw.find('isaacasimov', objects.AddressObject)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If required, you can see whats the attributes are configured in the objects:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;print(to_replace_value.about())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{'value': '10.10.10.10', 'type': 'ip-netmask', 'description': 'Multivac', 'tag': None, 'name': 'isaacasimov'}&lt;/PRE&gt;&lt;P&gt;Address Groups:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;groups = objects.AddressGroup.refreshall(fw)
to_replace_members = fw.find('Foundation', objects.AddressGroup)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{'static_value': ['FOUNDATION', 'FOUNDATION_AND_EMPIRE', 'SECOND_FOUNDATION', '&lt;SPAN&gt;RENDEZVOUSWITHRAMA&lt;/SPAN&gt;'], 'dynamic_value': None, 'description': None, 'tag': None, 'name': 'Foundation'}&lt;/PRE&gt;&lt;P&gt;6- Ok the goal is replace, or edit an value, so:&lt;/P&gt;&lt;P&gt;- to change/replace a value in address object, it´s not required to remove the value, just choose the attribute to be changed, and include the new value:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;to_replace_value.value = '10.40.40.0/24'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- to change/replace a value in address object group, i use to pull the actual members, keep in a variable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;members_list = to_replace_members.static_value
print(members_list)
Output: ['FOUNDATION', 'FOUNDATION_AND_EMPIRE', 'SECOND_FOUNDATION', 'RENDEZVOUSWITHRAMA']&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to remove some item from the list, you can use the list methods:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;members_list.remove('RENDEZVOUSWITHRAMA') #from A. Clarke &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/LI-CODE&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;del members_list[-1] #If you know the index of the item.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or if you just want to include a new one address in the address group object, use the list methods to include a new item in the list:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;members_list.append('new_item')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;OR&lt;BR /&gt;if you need include more than one item:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;new_items = ['new_item1', 'new_item2', 'new_item3']
members_list.extend(new_items)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So now, finally you set new address:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;to_replace_members.static_value = members_list&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To ensure that the static_value is changed:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;print(to_replace_members.about())&lt;/LI-CODE&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;</description>
      <pubDate>Sun, 21 Aug 2022 22:18:12 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-update-an-address-object-using-pan-os-sdk-python/m-p/512461#M3097</guid>
      <dc:creator>joaovictor</dc:creator>
      <dc:date>2022-08-21T22:18:12Z</dc:date>
    </item>
  </channel>
</rss>

