Software Development Kit (SDK) and API Discussions

Perl child_get_string in net_ipspace-get-iter returning undef for vserver-name and others

arminwiesel_fts
2,430 Views

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.

 

 

1 ACCEPTED SOLUTION

arminwiesel_fts
2,323 Views

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.

View solution in original post

2 REPLIES 2

asulliva
2,416 Views

Hello @arminwiesel_fts,

 

There was a similar post to this recently, I believe the behavior you're seeing is expected.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

arminwiesel_fts
2,324 Views

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.

Public