SNMP get vlan information

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered
Hi everybody!

I'd like to get some information about vlans on ports. Unfortunately, XOS doesn't respond to standard dot1qVLanStaticTable OID (. So, I've decided to use extremePortVlanInfoTable private OID. But I can't find tagged/untagged information.

Can anybody suggest something?
Photo of eyeV


  • 2,484 Points 2k badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of Frank


  • 3,836 Points 3k badge 2x thumb
Official Response
I have a homegrown little app for switchports and what VLAN they're in, and which ports are tagged/untagged.

"vname"     => ".",   //extremeVlanIfDescr.vlan_no = string NOT the tag
"vport"     => ".",    //extremePortVlanInfoDescr.port.vlan_no = string
"vtag"      => ".",  //extremeVlanIfVlanId.vlan_no = integer
"tagged"    => ".",   //extremeVlanOpaqueTaggedPorts .VLANid.SLOT = Hex-String
"untagged"  => "."    //extremeVlanOpaqueUntaggedPorts .VLANid.SLOT = Hex-String

Caveat programmer: That hex string is as mean as those hex strings can get. Basically it's a hex representation of a 256 bit binary string, where the Nth position of the binary "1" or "0" means that port N is tagged (untagged) or not respectively.
For instance: "01 00 00.....00" would mean:
00000001 00000000 00000000 ...., which in turn means "port 8 is (un)tagged" (depending on which OID you query)

Code snippet in PHP (for string-to-hex-to-bin conversion): $value being the value of the OID query, in this case "untagged"

$hex=trim(substr(strstr($value,":"),1));   // converting string to hex
$hex = preg_replace("/[ \n]/","",$hex);    // step two, get rid of spaces and newlines
$bin = gmp_convert($hex, 16, 2);           // convert hex to binary
$bin = str_pad($bin,256,"0", STR_PAD_LEFT); // left-pad the binary string with zeros,
                                           // so that we don't converting "01 00 hex" to "1 00000000" binary

And that might be the reason why things never tell you "this port is in VLAN X, tagged/untagged", but only "here are the tagged/untagged ports of a vlan".

Hope that helps - oh, and if anyone has a better way of skinning this particular cat, please share! :)