<?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 print some aggr info in text format using API in Software Development Kit (SDK) and API Discussions</title>
    <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-print-some-aggr-info-in-text-format-using-API/m-p/128733#M2301</link>
    <description>&lt;P&gt;Worked!! Thank you very much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2017 18:38:24 GMT</pubDate>
    <dc:creator>PBRam</dc:creator>
    <dc:date>2017-03-06T18:38:24Z</dc:date>
    <item>
      <title>How to print some aggr info in text format using API</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-print-some-aggr-info-in-text-format-using-API/m-p/128675#M2298</link>
      <description>&lt;P&gt;I am trying to print the aggregate info (size and used space) in text format . Can some one help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ontap: 8.3.2 p2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;api&lt;/SPAN&gt; = NaElement(&lt;SPAN&gt;"aggr-space-get-iter"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;xi = NaElement(&lt;SPAN&gt;"desired-attributes"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;api&lt;/SPAN&gt;.child_add(xi)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;xi1 = NaElement(&lt;SPAN&gt;"space-information"&lt;/SPAN&gt;)&lt;BR /&gt;xi.child_add(xi1)&lt;BR /&gt;&lt;BR /&gt;xi1.child_add_string(&lt;SPAN&gt;"aggregate"&lt;/SPAN&gt;,&lt;SPAN&gt;"&amp;lt;aggregate&amp;gt;"&lt;/SPAN&gt;)&lt;BR /&gt;xi1.child_add_string(&lt;SPAN&gt;"aggregate-size"&lt;/SPAN&gt;,&lt;SPAN&gt;"&amp;lt;aggregate-size&amp;gt;"&lt;/SPAN&gt;)&lt;BR /&gt;xi1.child_add_string(&lt;SPAN&gt;"physical-used"&lt;/SPAN&gt;,&lt;SPAN&gt;"&amp;lt;physical-used&amp;gt;"&lt;/SPAN&gt;)&lt;BR /&gt;xi1.child_add_string(&lt;SPAN&gt;"physical-used-percent"&lt;/SPAN&gt;,&lt;SPAN&gt;"&amp;lt;physical-used-percent&amp;gt;"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;xi2 = NaElement(&lt;SPAN&gt;"query"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;api&lt;/SPAN&gt;.child_add(xi2)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;xi3 = NaElement(&lt;SPAN&gt;"space-information"&lt;/SPAN&gt;)&lt;BR /&gt;xi2.child_add(xi3)&lt;BR /&gt;&lt;BR /&gt;xi3.child_add_string(&lt;SPAN&gt;"aggregate"&lt;/SPAN&gt;,&lt;SPAN&gt;"aggr1*"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;xo = s.invoke_elem(&lt;SPAN&gt;api&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;if &lt;/SPAN&gt;(xo.results_status() == &lt;SPAN&gt;"failed"&lt;/SPAN&gt;) :&lt;BR /&gt;    &lt;SPAN&gt;print &lt;/SPAN&gt;(&lt;SPAN&gt;"Error:&lt;/SPAN&gt;&lt;SPAN&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;)&lt;BR /&gt;    &lt;SPAN&gt;print &lt;/SPAN&gt;(xo.sprintf())&lt;BR /&gt;    sys.exit (&lt;SPAN&gt;1&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;aggrs= xo.child_get(&lt;SPAN&gt;"attributes-list"&lt;/SPAN&gt;).child_get(&lt;SPAN&gt;"space-information"&lt;/SPAN&gt;).children_get()&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;aggr &lt;SPAN&gt;in &lt;/SPAN&gt;aggrs:&lt;BR /&gt;    &lt;SPAN&gt;print &lt;/SPAN&gt;(aggrs.child_get(&lt;SPAN&gt;"aggregate"&lt;/SPAN&gt;))&lt;BR /&gt;&lt;BR /&gt;Getting following error,&lt;BR /&gt;&lt;BR /&gt;print (aggrs.child_get("aggregate"))&lt;BR /&gt;AttributeError: 'list' object has no attribute 'child_get'&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 22:17:39 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-print-some-aggr-info-in-text-format-using-API/m-p/128675#M2298</guid>
      <dc:creator>PBRam</dc:creator>
      <dc:date>2017-03-03T22:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to print some aggr info in text format using API</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-print-some-aggr-info-in-text-format-using-API/m-p/128711#M2299</link>
      <description>&lt;P&gt;You have to iterate through attributes-list&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;aggrs= xo.child_get(&lt;SPAN&gt;"attributes-list"&lt;/SPAN&gt;).children_get()&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;aggr &lt;SPAN&gt;in &lt;/SPAN&gt;aggrs:&lt;BR /&gt;    &lt;SPAN&gt;print &lt;/SPAN&gt;(&lt;SPAN&gt;'name {} {}'&lt;/SPAN&gt;.format(aggr.child_get_string(&lt;SPAN&gt;"aggregate"&lt;/SPAN&gt;),aggr.child_get_string(&lt;SPAN&gt;"physical-used"&lt;/SPAN&gt;)))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;hope that help&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 12:06:27 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-print-some-aggr-info-in-text-format-using-API/m-p/128711#M2299</guid>
      <dc:creator>francoisbnc</dc:creator>
      <dc:date>2017-03-06T12:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to print some aggr info in text format using API</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-print-some-aggr-info-in-text-format-using-API/m-p/128733#M2301</link>
      <description>&lt;P&gt;Worked!! Thank you very much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 18:38:24 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-print-some-aggr-info-in-text-format-using-API/m-p/128733#M2301</guid>
      <dc:creator>PBRam</dc:creator>
      <dc:date>2017-03-06T18:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to print some aggr info in text format using API</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-print-some-aggr-info-in-text-format-using-API/m-p/155153#M3016</link>
      <description>&lt;P&gt;i m getting the similar issue.tried the below suggestion.still no luck. Cna some one help me?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;EM&gt;&lt;SPAN class="s1"&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;EM&gt;&lt;SPAN class="s1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;File "5_aggrstatuinfo.py", line 29, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;EM&gt;&lt;SPAN class="s1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;aggr_list = out.child_get("attributes-list").children_get()&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN class="s1"&gt;AttributeError: 'NoneType' object has no attribute 'children_get'&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp;my code is:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;from NaServer import *&lt;/P&gt;
&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;obj = NaServer(“IPaddress”,1,150)&lt;/P&gt;
&lt;P class="p1"&gt;obj.set_server_type("FILER")&lt;/P&gt;
&lt;P class="p1"&gt;obj.set_transport_type("HTTPS")&lt;/P&gt;
&lt;P class="p1"&gt;obj.set_port("443")&lt;/P&gt;
&lt;P class="p1"&gt;obj.set_style("LOGIN")&lt;/P&gt;
&lt;P class="p1"&gt;obj.set_admin_user("admin”,”XXXXXXXX”)&lt;/P&gt;
&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;api = NaElement("aggr-space-get-iter")&lt;/P&gt;
&lt;P class="p1"&gt;#xo = NaElement("desired-attributes")&lt;/P&gt;
&lt;P class="p1"&gt;#api.child_add(xo)&lt;/P&gt;
&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;xi = NaElement("query")&lt;/P&gt;
&lt;P class="p1"&gt;api.child_add(xi)&lt;/P&gt;
&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;xo1 = NaElement("space-information")&lt;/P&gt;
&lt;P class="p1"&gt;xi.child_add(xo1)&lt;/P&gt;
&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;xo1.child_add_string("aggregate","&amp;lt;aggregate-Name&amp;gt;")&lt;/P&gt;
&lt;P class="p1"&gt;xo1.child_add_string("aggregate-size","&amp;lt;aggregate-size&amp;gt;")&lt;/P&gt;
&lt;P class="p1"&gt;xo1.child_add_string("physical-used","&amp;lt;physical-used&amp;gt;")&lt;/P&gt;
&lt;P class="p1"&gt;xo1.child_add_string("physical-used-percentage","&amp;lt;physical-used-percentage&amp;gt;")&lt;/P&gt;
&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;out= obj.invoke_elem(api)&lt;/P&gt;
&lt;P class="p1"&gt;aggr_list = out.child_get("aggregates")&lt;/P&gt;
&lt;P class="p1"&gt;if (out.results_status == "failed"):&lt;/P&gt;
&lt;P class="p1"&gt;print("error\n")&lt;/P&gt;
&lt;P class="p1"&gt;print(out.sprintf())&lt;/P&gt;
&lt;P class="p1"&gt;sys.exit()&lt;/P&gt;
&lt;P class="p1"&gt;for aggrs in aggr_list.children_get():&lt;/P&gt;
&lt;P class="p1"&gt;print("a\n")&lt;/P&gt;
&lt;P class="p1"&gt;print ('name {} {}'.format(aggr.child_get_string("aggregate"),aggr.child_get_string("physical-used")))&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 05:31:56 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-print-some-aggr-info-in-text-format-using-API/m-p/155153#M3016</guid>
      <dc:creator>Srinu_mar</dc:creator>
      <dc:date>2020-03-30T05:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to print some aggr info in text format using API</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-print-some-aggr-info-in-text-format-using-API/m-p/155156#M3017</link>
      <description>&lt;P&gt;desired-attributes and query are two different things&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here an example where you need aggregate space information without query (filter).&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;api = NaElement("aggr-get-iter")
xi = NaElement("desired-attributes")
api.child_add(xi)
xo1 = NaElement("aggr-attributes")
xi.child_add(xo1)
xo2 = NaElement("aggr-space-attributes");
xo2.child_add_string("size-total", "&amp;lt;size-total&amp;gt;")
xo1.child_add(xo2);

print(xi.sprintf())
out = obj.invoke_elem(api)
print(out.sprintf())
aggr_list = out.child_get("aggregates")
if (out.results_status == "failed"):
    print("error\n")
    print(out.sprintf())

aggrslist = out.child_get("attributes-list")
aggrs = aggrslist.children_get()

for aggr in aggrs:
    aggrname = aggr.child_get_string("aggregate-name")
    aggrspaceattr = aggr.child_get("aggr-space-attributes")
    aggrspace = aggrspaceattr.child_get_string("size-total")
    print(f'{aggrname}  {aggrspace}')
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;I just added size-total information, you can add more.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Considere to use to have the full overview.&lt;/P&gt;
&lt;P&gt;ZExplore Development Interface&lt;/P&gt;
&lt;P&gt;Version : 2.3.1&lt;BR /&gt;NetApp Manageability SDK release 9.7P1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 09:14:25 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/How-to-print-some-aggr-info-in-text-format-using-API/m-p/155156#M3017</guid>
      <dc:creator>francoisbnc</dc:creator>
      <dc:date>2020-03-30T09:14:25Z</dc:date>
    </item>
  </channel>
</rss>

