Escribo un administrador de SNMP y un agente SNMP simulado de una MIB (para probar un administrador). Tengo una tabla similar a la siguiente que el administrador debe poder agregar/eliminar filas. ¿Cuál es la forma habitual de hacerlo con RowStatus? ¿RowStatus se establece primero? ¿Se pueden incluir otros OID en la PDU?¿Cómo usar RowStatus?
Mi caso de uso inicial es que la tabla está vacía al inicio. Así que si envío una PDU SET así:
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
En caso de que el trabajo para la definición más adelante? ¿Qué debería pasar si cRowStatus queda fuera?
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 }
Nota esta es una MIB v1 SMI usando RowStatus como un tipo definido, similar a la descrita here. Por lo tanto, leer-crear es implícito, en lugar de indicarlo aquí.
En el n. ° 2, ¿espera el agente que la variable de estado de fila sea la primera que se cargó en la PDU? ¿Deberia importar? –
** No debe ** importarse, pero lo único que aprendí a lo largo de los años es que las personas escriben códigos que no siguen las reglas y hacen expectativas de que no deberían hacerlo. Entonces ... lo pondría primero porque algunos agentes probablemente lo esperan. –
Tuve que lidiar con Agentes SNMP de Nortel que no podían distinguir entre objetos escalares y columnares y agentes de Cisco que podían hacer caer un conmutador ATM empresarial. SNMP es bastante simple y es sorprendente la poca cantidad de implementadores que realmente leen los RFC. –