设计一个互联网交换设备的SNMP MIB库“X-MIB”:
问题描述
-
设备型号:字符串类型
-
设备生产厂商:字符串类型
-
设备名称:字符串类型
-
设备位置:字符串类型
-
设备运行时间:Timeticks 类型
-
设备队列数:整数类型
-
设备网络地址:IP地址类型
-
设备转发队列表:包含如下的列:
-
队列索引:整数类型,索引列
-
队列最大长度:整数类型
-
队列当前长度:Guage类型
-
队列一共收到的数据包数量:Counter 类型
-
队列一共转发出去的数据包数量:Counter 类型
-
由于队列满而丢弃的数据包数量:Counter 类型
-
-
活跃通信连接表,包含如下的列:
-
网络连接的唯一标识符:整数,索引列
-
发起方地址:IP地址
-
发起方端口:整数
-
接收方地址:IP地址
-
接收方端口:整数
-
要求:
1、X-MIB 库的“根”为 1.3.6.1.4.1.123,(即:iso.org.dod.internet.private.enterprises.123),其中123是你的学号的最后 3 位。
如果学号最后 3 位是 025 这样的格式,则取 25 即可。
2、能够用 MIB Browser 正确编译并加载此 MIB 库
X-MIB DEFINITIONS ::= BEGIN
IMPORTS
enterprises
FROM RFC1155;
FROM RFC1212;
--X-MIB 库的“根”为 1.3.6.1.4.1.123,(即:iso.org.dod.internet.private.enterprises.123),其中123是你的学号的最后 3 位。
internet OBJECT IDENTIFIER :: = { iso org(3) dod(6) 1 }
private OBJECT IDENTIFIER :: = { internet 4 }
enterprises OBJECT IDENTIFIER :: = { private 1 }
info OBJECT IDENTIFIER :: = { enterprises 24 }
--这里填学号末三位或两位
String ::= OCTET STRING
Int ::= INTEGER
--设备型号 – 字符串,只读
Type OBJECT-TYPE
SYNTAX String (SIZE(0..10))
ACCESS read-only
STATUS mandatory
DESCRIPTION "TPLINK E3288"
::= { info 1 }
--设备生产厂商 - 字符串,只读
Vendor OBJECT-TYPE
SYNTAX String (SIZE(0..10))
ACCESS read-only
STATUS mandatory
DESCRIPTION "TPLINK"
::= { info 2 }
--设备名称 - 字符串,只读
Name OBJECT-TYPE
SYNTAX String (SIZE(0..10))
ACCESS read-only
STATUS mandatory
DESCRIPTION "Wide Switch"
::= { info 3 }
--设备位置 - 字符串,只读
Location OBJECT-TYPE
SYNTAX String (SIZE(0..10))
ACCESS read-only
STATUS mandatory
DESCRIPTION "China"
::= { info 4 }
--设备运行时间 - 字符串,读写
Uptime OBJECT-TYPE
SYNTAX TimeTicks
ACCESS read-write
STATUS mandatory
DESCRIPTION "device uptime"
::= { info 5 }
--设备队列数 – 整数,读写
QueueNumber OBJECT-TYPE
SYNTAX Int (1..64)
ACCESS read-write
STATUS mandatory
DESCRIPTION "QueueNumber"
::= { info 6 }
--设备网络地址 - IP地址类型,只读
IP OBJECT-TYPE
SYNTAX IpAddress
ACCESS read-only
STATUS mandatory
DESCRIPTION "IP Address"
::= { info 7 }
--设备转发队列表
ForwardingTable OBJECT-TYPE
SYNTAX SEQUENCE OF Forwarding
ACCESS not-accessible
STATUS mandatory
DESCRIPTION "ForwardingTable"
::= { info 8 }
--子对象
TableOne OBJECT-TYPE
SYNTAX Forwarding
ACCESS not-accessible
STATUS mandatory
DESCRIPTION "The Subobject of ForwardingTable"
INDEX { ForwardingIndex }
::= { ForwardingTable 1 }
--声明ForwardingTable所包含的对象及类型,用sequence创建表格类型的对象
Forwarding ::=
SEQUENCE {
ForwardingIndex
Int,
MaxLength
Int,
Length
Gauge,
PDU-Get
Counter,
PDU-Forwarding
Counter,
PDU-Loss
Counter
}
--队列索引 - 整数,具备唯一性,为索引列
ForwardingIndex OBJECT-TYPE
SYNTAX Int(0..1024)
ACCESS read-only
STATUS mandatory
DESCRIPTION "The Index Of Queues"
::= { TableOne 1 }
--队列最大长度 – 整数,只读
MaxLength OBJECT-TYPE
SYNTAX Int(0..1024)
ACCESS read-only
STATUS mandatory
DESCRIPTION "The MaxLength Of Queues"
::= { TableOne 2 }
--队列当前长度 – Gauge类型,读写
Length OBJECT-TYPE
SYNTAX Gauge
ACCESS read-only
STATUS mandatory
DESCRIPTION "The Length Of Queues"
::= { TableOne 3 }
--队列一共收到的数据包数量 - Counter类型
PDU-Get OBJECT-TYPE
SYNTAX Counter
ACCESS read-only
STATUS mandatory
DESCRIPTION "The number Of PDU-Get"
::= { TableOne 4 }
--队列一共转发出去的数据包数量 - Counter类型
PDU-Forwarding OBJECT-TYPE
SYNTAX Counter
ACCESS read-only
STATUS mandatory
DESCRIPTION "The number Of PDU-Forwarding"
::= { TableOne 5 }
--由于队列满而丢弃的数据包数量 - Counter类型
PDU-Loss OBJECT-TYPE
SYNTAX Counter
ACCESS read-only
STATUS mandatory
DESCRIPTION "The number Of PDU-Loss"
::= { TableOne 6 }
--活跃通信连接表
ACC-Table OBJECT-TYPE
SYNTAX SEQUENCE OF ACC
ACCESS not-accessible
STATUS mandatory
DESCRIPTION "Active Communication Connections Table"
::= { info 9 }
--子对象
TableTwo OBJECT-TYPE
SYNTAX ACC
ACCESS not-accessible
STATUS mandatory
DESCRIPTION "The Subobject of ACC-Table"
INDEX { UID }
::= { ACC-Table 1 }
SEQUENCE {
UID
Int,
Sender-Ad
IpAddress,
Sender-Port
Int,
Receiver-Ad
IpAddress,
Receiver-Port
Int
}
--队列索引 - 整数,具备唯一性,为索引列
UID OBJECT-TYPE
SYNTAX Int(0..1024)
ACCESS read-only
STATUS mandatory
DESCRIPTION "The Index Of Queues"
::= { TableTwo 1 }
--发起方地址 - IP地址
Sender-Ad OBJECT-TYPE
SYNTAX IpAddress
ACCESS read-only
STATUS mandatory
DESCRIPTION "Sender's IP Address"
::= { TableTwo 2 }
--发起方端口 - 整数
Sender-Port OBJECT-TYPE
SYNTAX Int
ACCESS read-only
STATUS mandatory
DESCRIPTION "Sender's Port"
::= { TableTwo 3 }
--接收方地址 - IP地址
Receiver-Ad OBJECT-TYPE
SYNTAX IpAddress
ACCESS read-only
STATUS mandatory
DESCRIPTION "Receiver's IP Address"
::= { TableTwo 4 }
--接收方端口 - 整数
Receiver-Port OBJECT-TYPE
SYNTAX Int
ACCESS read-only
STATUS mandatory
DESCRIPTION "Receiver's Port"
::= { TableTwo 5 }
END