| |
- message(ber)
-
- session
class session(message) |
|
Depricated PySNMP 1.x compatibility SNMP engine class. Build & send
SNMP request, receive & parse SNMP response. |
|
- Method resolution order:
- session
- message
- ber
- Base
Methods defined here:
- __init__(self, agent, community='public')
- Initialize session object
- close(self)
- close()
Close UDP socket used to communicate with remote SNMP agent.
- get_socket(self)
- get_socket() -> socket
Return socket object previously created with open() method.
- open(self)
- open()
Initialize transport layer (UDP socket) to be used
for further communication with remote SNMP process.
- read(self)
- read() -> message
Read data from the socket (assuming there's some data ready
for reading), return SNMP message (as string).
- receive(self)
- receive() -> message
Receive SNMP message from remote SNMP process or timeout
(and return None).
- send(self, request=None)
- send([message])
Send SNMP message (the specified one or previously submitted
with store() method) to remote SNMP process specified on
session object creation.
- send_and_receive(self, message)
- send_and_receive(message) -> message
Send SNMP message to remote SNMP process (as specified on
session object creation) and receive a response message
or timeout (and raise NoResponse exception).
- store(self, request)
- store(message)
Store SNMP message for later transmission.
Methods inherited from message:
- decode_bindings(self, octetString)
- Compatibility method: BER decode bindings up to oids & values
- decode_response(self, message, mtype='GETRESPONSE')
- decode_response(message[, type]) -> (encoded_oids, encoded_values)
Decode SNMP message (string) of specified type (default is
'GETRESPONSE'), return lists of encoded Object IDs and their
values (lists of strings).
- decode_response_sequence(self, octetStream)
- Compatibility method: BER decode SNMP response sequence
- decode_snmp_pdu(self, octetString)
- Compatibility method: BER decode SNMP PDU
- decode_snmp_trap_pdu(self, octetString)
- Compatibility method: BER decode SNMP TRAP PDU
- decode_trap(self, octetStream)
- decode_trap(message) -> (enterprise, address, generic,
specific, timeticks, encoded_oids,
encoded_vals)
Decode SNMP TRAP message (string).
- encode_bindings(self, encoded_oids, encoded_vals)
- Compatibility method: BER encode oids & values
- encode_request(self, pduType, encoded_oids, encoded_values)
- encode_request(type, encoded_oids, encoded_values) -> SNMP message
Encode Object IDs and values (lists of strings) into variables
bindings, then encode bindings into SNMP PDU (of specified type
(string)), then encode SNMP PDU into SNMP message.
- encode_request_sequence(self, pdu)
- Compatibility method: BER encode SNMP request sequence
- encode_snmp_pdu(self, pduType, bindings)
- Compatibility method: BER encode SNMP PDU
- encode_snmp_trap_pdu(self, enterprise, address, generic, specific, timeticks, bindings)
- Compatibility method: BER encode SNMP TRAP PDU
- encode_trap(self, enterprise, address, generic, specific, timeticks, encoded_oids=[], encoded_vals=[])
- encode_trap(type, encoded_oids, encoded_values) -> SNMP message
Encode Object IDs and values (lists of strings) into variables
bindings, then encode bindings into SNMP PDU (of specified type
(string)), then encode SNMP PDU into SNMP message.
Methods inherited from ber:
- decode_integer(self, octetStream)
- decode_integer(stream) -> integer
Decode octet stream into signed ASN.1 integer.
- decode_ipaddr(self, octetStream)
- decode_ipaddr(stream) -> IP address
Decode octet stream into ASN.1 IP address (in dotted notation)
- decode_null(self, octetStream)
- decode_null(stream) -> Null
Decode octet stream into ASN.1 Null
- decode_oid(self, octetStream)
- decode_oid(stream) -> object id
Decode octet stream into ASN.1 Object ID (returned as a list of
integer subIDs).
- decode_string(self, octetStream)
- decode_string(stream) -> string
Decode octet stream into signed ASN.1 string.
- decode_timeticks(self, octetStream)
- decode_timeticks(stream) -> timeticks
Decode octet stream into ASN.1 timeticks
- decode_uptime = decode_timeticks(self, octetStream)
- decode_timeticks(stream) -> timeticks
Decode octet stream into ASN.1 timeticks
- decode_value(self, octetStream)
- decode_value(stream) -> value
Decode octet stream into ASN.1 value (its ASN.1 type is
determined from included BER tag). The type of returned
value is context dependent.
- encode_integer(self, integer)
- encode_integer(integer) -> octet stream
Encode ASN.1 integer into octet stream.
- encode_ipaddr(self, addr)
- encode_addr(addr) -> octet stream
Encode ASN.1 IP address (in dotted notation) into octet stream.
- encode_null(self)
- encode_null() -> octet stream
Encode ASN.1 Null into octet stream.
- encode_oid(self, noids)
- encode_oid(oids) -> octet stream
Encode ASN.1 Object ID (specified as a list of integer subIDs)
into octet stream.
- encode_string(self, string)
- encode_string(string) -> octet stream
Encode ASN.1 string into octet stream.
- encode_timeticks(self, timeticks)
- encode_timeticks(timeticks) -> octet stream
Encode ASN.1 timeticks into octet stream.
- nums2str(self, objid_n, aliases=None)
- nums2str(obj_id) -> object id
Convert Object ID (given as a list of integer sub Object IDs) into
string representation.
- oid_prefix_check(self, enc_oid_1, enc_oid_2)
- oid_prefix_check(encoded_oid_1, encoded_oid_2) -> boolean
Compare encoded OIDs (given as lists), return non-None if
OID1 is a prefix of OID2.
This is intended to be used for MIB tables retrieval.
- str2nums(self, txt, aliases=None)
- str2nums(obj_id) -> object id
Convert Object ID (given as string) into a list of integer
sub IDs.
| |