6

我正在编写一个 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 是隐含的,而不是在这里陈述。

4

1 回答 1

4

RowStatus 文本约定实际上为代理在如何实现它方面提供了相当大的余地。因此,经理必须支持这两种方式,而代理人必须只支持一种(但可以支持两种):

  1. 连续 PDU:
    1. 将行状态变量设置为“createAndWait”
    2. 设置您要设置的所有列(在一个或多个 PDU 中)
    3. 将行状态变量设置为“活动”
  2. 将行状态变量设置为“createAndGo”并包含**所有**您需要设置到单个 PDU 中的变量

不幸的是,经理需要聪明,并且知道如何与支持其中一个或另一个的座席交谈。普遍的看法是,与微不足道的代理人相比,经理们更大,有更多的空间来解决问题。但是,许多小型设备仅支持上面的#2。

于 2011-02-03T22:27:16.663 回答