vlan get_members

Doesanyone have a perl example for getting the memberlist from a vlan via iControl? Using Data::Dumper it looks like the first element of each array in the multi-dimentional array is empty… e.g.

processVlans: Whole list

$VAR1 = bless( [], ‘Networking::VLAN::MemberEntry[]’ );

$VAR2 = bless( [], ‘Networking::VLAN::MemberEntry[]’ );

Thisis from the sequence

my $soapResponse = $Vlan->get_member( SOAP::Data->name(vlans => [@vlanList]));

my ($status, $text)=&checkResponse($soapResponse);

my @vlanMemberList = @{$soapResponse->result};

print “processVlans: Whole list\n”;

print Dumper(@vlanMemberList);

Which doesn’t seem to match the docs…

And if I’m reading this correctly I’m getting back a 3 dimensional array? A list of lists of lists? Shouldn’t that be?

$VAR1 = bless( ‘Networking::VLAN::MemberEntry’, ‘Networking::VLAN::MemberEntry’);

$VAR2 = bless( ‘Networking::VLAN::MemberEntry’, ‘Networking::VLAN::MemberEntry’);

(Sorry. My perl programming book is circa 1999 and doesn’t include arrays of arrays).

TIA

Hamish.

Hamish,

The method does indeed return a 2-d array. You can tell with the SOAP tracing on:

Where “x” is the size of the input VLAN array.

Here’s some code to process the member list in a VLAN. There are many ways to access AofA’s but here’s one of them.

sub handle_get()
{
  (@VLANList) = @_;
  if ( 0 == scalar(@VLANList) )
  {
    return;
  }
  $soapResponse = $VLAN->get_member
  (
    SOAP::Data->name(vlans => [@VLANList])
  );
  &checkResponse($soapResponse);
  @MemberEntryAofA = @{$soapResponse->result};
  $i = 0;
  foreach $VLAN (@VLANList)
  {
    print "VLAN '$VLAN'\n";
    print "    Members          : ";
     Extract the List of MemberEntrys for VLAN i
    @MemberEntryList = @{$MemberEntryAofA[$i]}
     Loop over MemberEntrys for VLAN i
    foreach $MemberEntry (@MemberEntryList)
    {
       Extrace structure members from MemberEntry
      $member_name = $MemberEntry->{"member_name"};
      $member_type = $MemberEntry->{"member_type"};
      $tag_state = $MemberEntry->{"tag_state"};
      print "name=$member_name, type=$member_type, state=$tag_state";
      print "\n                       ";
    }
    $i++;
  }
}

Good luck!

-Joe

Ho hum… Embarrased grin… I’m not as stupid as I thought I was… Or maybe…

The F5 didn’t have any interfaces configured in the internal or external vlan… Bugger…

H