<?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: Devicegroup hierarchy dump in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/devicegroup-hierarchy-dump/m-p/551043#M3404</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;finally found, based my testing on the article&amp;nbsp;&lt;A href="https://live.paloaltonetworks.com/t5/automation-api-discussions/pan-os-sdk-device-group-hierarchy/td-p/514432" target="_self"&gt;pan-os-sdk-device-group-hierarchy&lt;/A&gt;&amp;nbsp; So digging deep in the options under __ inside the dg_hierachy properties i got the getattriute and after some testing i got a way to go form the lowest dg to the upper one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This time starting from device-groupB that is the lower prio one in the tree.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;In [3]: dg=panorama.DeviceGroup('device-groupB')
In [4]: pano.add(dg)
Out[4]: &amp;lt;DeviceGroup device-groupB 0x7fa910a4e588&amp;gt;
In [5]: scope.opstate.dg_hierarchy.refresh()
In [6]: dg.opstate.dg_hierarchy.refresh()
In [8]: print(dg.opstate.dg_hierarchy.__getattribute__('parent'))
device-groupA

In [9]: dg=panorama.DeviceGroup('device-groupA')
In [10]: pano.add(dg)
Out[10]: &amp;lt;DeviceGroup device-groupA 0x7fa9109f49b0&amp;gt;
In [11]: dg.opstate.dg_hierarchy.refresh()
In [12]: print(dg.opstate.dg_hierarchy.__getattribute__('parent'))
None&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;&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jul 2023 08:17:15 GMT</pubDate>
    <dc:creator>JavierSanchezLlera</dc:creator>
    <dc:date>2023-07-26T08:17:15Z</dc:date>
    <item>
      <title>Devicegroup hierarchy dump</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/devicegroup-hierarchy-dump/m-p/550632#M3403</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;im trying to come with a way to being provided with a devicegroup name, be able to get the objects from the current devidegroup, but&lt;/P&gt;&lt;P&gt;also form each parent devicegroup. With the idea ti try to clean duplicated objects, the issue here is that no matter how i try to get to that i find no method or property to be able to identify parent info.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have few dgs on my lab, but i have tried the following based on the following 2.&lt;/P&gt;&lt;P&gt;- device-groupA&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;- device-groupB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;   ...: dg=panorama.DeviceGroup('device-groupA')
   ...: pano.add(dg)
   ...:
Out[1]: &amp;lt;DeviceGroup device-groupA 0x7f9a0e73c278&amp;gt;

In [3]: print(dg.parent)
172.18.0.14
In [4]:
In [4]: pano.remove(dg)
In [5]: dg=panorama.DeviceGroup('device-groupB')
In [6]: print(dg.about())
{'tag': None, 'name': 'device-groupB'}
In [7]: print(dg.parent)
None&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No matter what i try im not able to get any attribute do show the parent devicegroup, any ideas or tips please ?&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;</description>
      <pubDate>Mon, 24 Jul 2023 12:35:44 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/devicegroup-hierarchy-dump/m-p/550632#M3403</guid>
      <dc:creator>JavierSanchezLlera</dc:creator>
      <dc:date>2023-07-24T12:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Devicegroup hierarchy dump</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/devicegroup-hierarchy-dump/m-p/551043#M3404</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;finally found, based my testing on the article&amp;nbsp;&lt;A href="https://live.paloaltonetworks.com/t5/automation-api-discussions/pan-os-sdk-device-group-hierarchy/td-p/514432" target="_self"&gt;pan-os-sdk-device-group-hierarchy&lt;/A&gt;&amp;nbsp; So digging deep in the options under __ inside the dg_hierachy properties i got the getattriute and after some testing i got a way to go form the lowest dg to the upper one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This time starting from device-groupB that is the lower prio one in the tree.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;In [3]: dg=panorama.DeviceGroup('device-groupB')
In [4]: pano.add(dg)
Out[4]: &amp;lt;DeviceGroup device-groupB 0x7fa910a4e588&amp;gt;
In [5]: scope.opstate.dg_hierarchy.refresh()
In [6]: dg.opstate.dg_hierarchy.refresh()
In [8]: print(dg.opstate.dg_hierarchy.__getattribute__('parent'))
device-groupA

In [9]: dg=panorama.DeviceGroup('device-groupA')
In [10]: pano.add(dg)
Out[10]: &amp;lt;DeviceGroup device-groupA 0x7fa9109f49b0&amp;gt;
In [11]: dg.opstate.dg_hierarchy.refresh()
In [12]: print(dg.opstate.dg_hierarchy.__getattribute__('parent'))
None&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;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 08:17:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/devicegroup-hierarchy-dump/m-p/551043#M3404</guid>
      <dc:creator>JavierSanchezLlera</dc:creator>
      <dc:date>2023-07-26T08:17:15Z</dc:date>
    </item>
  </channel>
</rss>

