Forum Discussion
Hamish_Marson_3
Nimbostratus
Oct 12, 2005vlan 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....
Oct 12, 2005
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
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects