如何使用RowStatus?

时间:2011-02-03 21:33:33

标签: snmp mib

我正在从MIB编写SNMP管理器和模拟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,类似于here所述。因此,隐含了read-create,而不是在此声明。

1 个答案:

答案 0 :(得分:3)

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

  1. 连续的PDU:
    1. 将行状态变量设置为“createAndWait”
    2. 设置您想要设置的所有列(在一个PDU或多个PDU中)
    3. 将行状态变量设置为“活动”
    4. 将行状态变量设置为“createAndGo”,并将** all **设置为单个PDU所需的变量
    5. 不幸的是,经理需要聪明,并且知道如何与支持其中一方的代理商交谈。人们普遍认为,管理者比规范代理人更大,并且有更多的空间来处理问题。许多小型设备仅支持#2以上。