Forum Discussion

Anthony_Gerace_'s avatar
Anthony_Gerace_
Historic F5 Account
Nov 16, 2004

Retrieve vlan mac address with get_true_mac_address method

Hi!

 

I was tasked with the project to retrieve the MAC addresses in use by BIG-IP. I have attempted to use the get_true_mac_address method in ITCMNetworking/VLAN. I am getting nothing coming back.

 

Any ideas?

 

 

Thanks,

 

 

Anthony

 

 

String get_true_mac_address(

 

in SessionCredentials creds, <== CORBA Specific

 

in String vlan_name

 

);

 

 

 

$soap = SOAP::Lite

 

-> uri('urn:iControl:ITCMNetworking/VLAN')

 

-> proxy("https://$sHost/iControl/iControlPortal.cgi");

 

 

$vName = "external";

 

$soap_response = $soap->get_true_mac_address(SOAP::Data->name(vlan_name => $vName ) );

 

$macAddr = $soap_response->result;

 

print "\nVlan Name: $vName MAC Address: $macAddr\n";

 

  • By default, VLANs don't have a Layer 2 static forwarding table defined. If your query on the VLAN for the true mac address and it hasn't been defined then the iControl request will return an empty string. Take a look at the Administration GUI and drill down into the VLAN in question and my guess that the forwarding table is empty.

     

     

    I'll have to check into the code but I would think that get_true_mac_address() would go and query the physical mac address that the VLAN is sitting on but for some reason it is returning an empty string. I'm not sure if this is tied to the l2 forwarding table or not.

     

     

    Another way to approach this is to get the interface the VLAN is configured on and use the ITCMNetworking::Interfaces interface to query the mac address of the physical adapter.

     

     

    Here's some code that will query all VLANs, and for each one, query the interfaces associated with it and, from there, use the ITCMNetworking::Interfaces interface to query the mac of that interface.

     

     

    &getVLANMacAddresses(); 
      
     ----------------------------------------------------- 
      checkResponse 
     ----------------------------------------------------- 
     sub checkResponse() 
     { 
       my ($soapResponse) = (@_); 
       if ( $soapResponse->fault ) 
       { 
         print $soapResponse->faultcode, " ", 
           $soapResponse->faultstring, "\n"; 
         exit(); 
       } 
     } 
      
     ----------------------------------------------------- 
      Query Interface List 
     ----------------------------------------------------- 
     sub getVLANMacAddresses() 
     { 
       $soapResponse = $VLAN->get_list(); 
       &checkResponse($soapResponse); 
      
       @vlanList = @{$soapResponse->result}; 
       foreach $vlan (@vlanList) 
       { 
         print "VLAN : $vlan\n"; 
         $soapResponse = $VLAN->get_interfaces 
         ( 
           SOAP::Data->name(vlan_name => $vlan) 
         ); 
         &checkResponse($soapResponse); 
      
         @InterfaceEntryList = @{$soapResponse->result}; 
         foreach $InterfaceEntry (@InterfaceEntryList) 
         { 
           $intf_name = $InterfaceEntry->{"intf_name"}; 
           $intf_type = $InterfaceEntry->{"intf_type"}; 
      
           $iType = "UNTAGGED"; 
           if ( $intf_type == 0 ) 
           { 
             $iType = "  TAGGED"; 
           } 
           $soapResponse = $Interfaces->get_mac_address 
           ( 
             SOAP::Data->name(intf_name => $intf_name) 
           ); 
           &checkResponse($soapResponse); 
           $macAddress = $soapResponse->result; 
           print "  Interface $intf_name ($iType) : $macAddress\n"; 
         } 
       } 
     }

     

     

    -Joe
  • Anthony_Gerace_'s avatar
    Anthony_Gerace_
    Historic F5 Account
    Hi Joe,

     

    Thanks for the information. I thought the get_true_mac_address would be the mac address being used for a given VLAN (I wasn't thinking of L2 forwarding and such). If you do a search for that MAC address, you will not find it attached to any interface. How can I come up with the vlan mac address?

     

     

    Thanks again.

     

     

    Anthony

     

     

     

     

    bip5klab02:~ ifconfig external

     

    external: (vlan0) flags=8843

     

    link type vlan 0:1:d7:1:39:c1 mtu 1500

     

  • Didn't the code I provided query the VLAN mac addresses? It queries the vlan list, and for each it finds the interfaces that it's associated with and then uses the Interfaces::get_mac_address() method to get the mac address.

     

     

    -Joe
  • bknotwell_12713's avatar
    bknotwell_12713
    Historic F5 Account
    CRs have been added for this issue on both the 4.5 (42750) and 4.6 (42751) branches.

     

     

    They're targetted to 4.5.12 and 4.6.3 respectively but that's subject to change.
  • bknotwell_12713's avatar
    bknotwell_12713
    Historic F5 Account
    CR42750* is checked into 4.6.3.

     

     

    I got the releases switched in my earlier post.