Net::SNMPをつかってCisco機器からCDP情報を収集(4)

1.3.6.1.4.1.9.9.23.1.2.1.1.3.1.2		 1
1.3.6.1.4.1.9.9.23.1.2.1.1.4.1.2		 0xc0a801fc
1.3.6.1.4.1.9.9.23.1.2.1.1.9.1.2		    )
1.3.6.1.4.1.9.9.23.1.2.1.1.12.1.2		 3

今回は
cdpCacheCapabilities OCTET STRING
cdpCacheDuplex INTEGER,
についてCISCO-CDP-MIBファイルから確認していく。

  • cdpCacheDuplex
cdpCacheDuplex OBJECT-TYPE	
    SYNTAX    INTEGER {
                  unknown(1),
                  halfduplex(2),
                  fullduplex(3)
              }
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
        "The remote device's interface's duplex mode, as reported in the 
        most recent CDP message.  The value unknown(1) indicates
        no duplex mode field (TLV) was reported in the most
        recent CDP message."
    ::= { cdpCacheEntry 12 }

1.3.6.1.4.1.9.9.23.1.2.1.1.12.1.2           3 ⇒ (3)なのでfullduplex
と読み解ける。


  • cdpCacheCapabilities
cdpCacheCapabilities OBJECT-TYPE
    SYNTAX     OCTET STRING (SIZE (0..4))
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
            "The Device's Functional Capabilities as reported in the
            most recent CDP message.  For latest set of specific
            values, see the latest version of the CDP specification.
            The zero-length string indicates no Capabilities field
            (TLV) was reported in the most recent CDP message."
    REFERENCE "Cisco Discovery Protocol Specification, 10/19/94."

    ::= { cdpCacheEntry 9 }

問題なのはcdpCacheCapabilities
これについてはOCTET STRING(SIZE (0..4)) の内容について記載がない。
正直これ以上MIBファイルからは確認できない。しかし、実際のCDPパケットの内部にヒントがあった。
Wireshark」にてCDPパケットをキャプチャwikipedia:Wireshark

    Capabilities
        Type: Capabilities (0x0004)
        Length: 8
        Capabilities: 0x00000029
            .... .... .... .... .... .... .... ...1 = Is  a Router
            .... .... .... .... .... .... .... ..0. = Not a Transparent Bridge
            .... .... .... .... .... .... .... .0.. = Not a Source Route Bridge
            .... .... .... .... .... .... .... 1... = Is  a Switch
            .... .... .... .... .... .... ...0 .... = Not a Host
            .... .... .... .... .... .... ..1. .... = Is  IGMP capable
            .... .... .... .... .... .... .0.. .... = Not a Repeater

32ビット(4octets)中どのビットが何を意味しているかがわかる

1.3.6.1.4.1.9.9.23.1.2.1.1.9.1.2        ) "   )"=0x00000029
" )"が0x00000029なのはNet::SNMPモジュールが無理やり変換してしまっているため
Router
Switch
IGMP capable
上記の3つのビットが立っており R S I の表記になる。

ちなみに
1.3.6.1.4.1.9.9.23.1.2.1.1.9.3.1            0x00000001
これはRouterのビットしか立ってないので
R のみの表記となる。