我正在编写一个 SNMP 管理器和一个来自 MIB 的模拟 SNMP 代理(以测试管理器)。我有一个类似于下面的表格,经理应该能够添加/删除行。使用 RowStatus 执行此操作的习惯方法是什么?是先设置 RowStatus 吗?PDU 中是否可以包含其他 OID?
我最初的用例是表在启动时是空的。因此,如果我发送这样的 SET PDU:
createStuffEntry.1.1.1 = 1
createStuffEntry.2.1.1 = 1
createStuffEntry.3.1.1 = 99
createStuffEntry.4.1.1 = "Dustbunnies"
createStuffEntry.5.1.1 = 5
这应该适用于下面的定义吗?如果排除 cRowStatus 会发生什么?
createStuffTable OBJECT-TYPE
SYNTAX SEQUENCE OF CreateStuffEntry
ACCESS not-accessible
STATUS mandatory
DESCRIPTION
"A table for creating stuff."
::= { parentGroup 1 }
createStuffEntry OBJECT-TYPE
SYNTAX CreateStuffEntry
ACCESS not-accessible
STATUS mandatory
DESCRIPTION
"An entry for building a stuff to create."
INDEX { cPlanID, cID }
::= { createStuffTable 1 }
CreateStuffEntry ::=
SEQUENCE {
cPlanID
INTEGER,
cID
INTEGER,
cTemplateID
INTEGER,
cStuffName
DisplayString,
cRowStatus
RowStatus
}
cPlanID OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-write
STATUS mandatory
DESCRIPTION
"The plan ID (cpPlanID)"
::= { createStuffEntry 1 }
cID OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-write
STATUS mandatory
DESCRIPTION
"The table entry index."
::= { createStuffEntry 2 }
cTemplateID OBJECT-TYPE
SYNTAX INTEGER
ACCESS read-write
STATUS mandatory
DESCRIPTION
"The ID of the stuff template to create this stuff from."
::= { createStuffEntry 3 }
cStuffName OBJECT-TYPE
SYNTAX DisplayString
ACCESS read-write
STATUS mandatory
DESCRIPTION
"The stuff name."
::= { createStuffEntry 4 }
cRowStatus OBJECT-TYPE
SYNTAX RowStatus
ACCESS read-write
STATUS current
DESCRIPTION
"This OID uses six main statuses:
active(1) is in use and available in stuffTable
notinService(2) it is present but not yet created
notReady(3) it is present but missing info
createAndGo(4) create stuff in stuffTable. Row will be
added to this table if necessary.
createAndWait(5) add stuff row to this table
destroy(6) will remove the stuff row
This OID is used to add/remove rows for stuff creation.
It can also be used to determine if a stuff has been
created successfully."
::= { createStuffEntry 5 }
请注意,这是一个使用 RowStatus 作为定义类型的 SMI v1 MIB,与此处描述的类似。因此 read-create 是隐含的,而不是在这里陈述。