Software Development Kit (SDK) and API Discussions
Software Development Kit (SDK) and API Discussions
Using netapp-manageability-sdk-5.7 with Perl to access a simulated cdot cluster with 9.1, I get undefined values with child_get_string in net_ipspace-get-iter.
It occurs not everywhere, only in <ports>, <vservers> or <broadcast-domains> and I'm using the same construct to get the values I use in igroup-get-iter to get <initiator-name>, which is similar and works fine there.
Code snippet:
my $List=$xo->child_get("attributes-list");
my @Attributes=$List->children_get();
my $Count=0;
foreach my $Attr (@Attributes) {
print "\n".$Attr->sprintf();
my $UUID=$Attr->child_get_string("uuid"); # works as expected
my $Vservers=$Attr->child_get("vservers");
my @VserverList=$Vservers->children_get();
foreach my $Vserver (@VserverList) {
print "\n".$Vserver->sprintf(); # shows the value I want
my $VserverName=$Vserver->child_get_string("vserver-name"); # returns undef
print "$VserverName\n";
}output:
<net-ipspaces-info>
<broadcast-domains>
<broadcast-domain-name>prod_smc</broadcast-domain-name>
</broadcast-domains>
<id>23</id>
<ipspace>ips_smc</ipspace>
<ports>
<net-qualified-port-name>smc-na010-01:a0a</net-qualified-port-name>
</ports>
<uuid>3c213daa-4b97-11e7-bef5-005056be73f9</uuid>
<vservers>
<vserver-name>ips_smc</vserver-name>
</vservers>
</net-ipspaces-info>
<vserver-name>ips_smc</vserver-name>
Use of uninitialized value $VserverName in concatenation (.) or string at ./na_cdot.pl line 1311.It's not a show stopper, since I'm able to get the data I want with a workaround. But I'm really curious if this is an error in the API or if I have overlooked something.
Solved! See The Solution
Hi asulliva,
thanks for the hint. I'm not familliar with Python and the functions in the Perl API are different too, but I found a solution using get_content instead of child_get_string.
my $Ports=$Attr->child_get("ports");
my @PortList=$Ports->children_get();
foreach my $Port (@PortList) {
my $Name=$Port->get_content("net-qualified-port-name");
print "$Name\n";
}This gets the values I want.
Hello @arminwiesel_fts,
There was a similar post to this recently, I believe the behavior you're seeing is expected.
Andrew
Hi asulliva,
thanks for the hint. I'm not familliar with Python and the functions in the Perl API are different too, but I found a solution using get_content instead of child_get_string.
my $Ports=$Attr->child_get("ports");
my @PortList=$Ports->children_get();
foreach my $Port (@PortList) {
my $Name=$Port->get_content("net-qualified-port-name");
print "$Name\n";
}This gets the values I want.