get_snmp_action() Function (Python)
Syntax
Python Syntax
snmp_action = jcs.get_snmp_action()
Description
Retrieve the SNMP action passed to a Python SNMP script.
Return Value
snmp_action |
SNMP action value passed to the script. |
Usage Examples
The following example Python SNMP script processes unsupported
object identifiers (OIDs) that are mapped to the script in the Junos
OS configuration. The get_snmp_action() function returns the value of the action argument passed into the
script.
import jcs
def main():
snmp_action = jcs.get_snmp_action()
snmp_oid = jcs.get_snmp_oid()
jcs.syslog("8", "snmp_action = ", snmp_action, " snmp_oid = ", snmp_oid)
if snmp_action == 'get':
if snmp_oid == '.1.3.6.1.4.1.2636.13.61.1.9.1.1.1':
jcs.emit_snmp_attributes(snmp_oid, "Integer32", "211")
elif snmp_oid == '.1.3.6.1.4.1.2636.13.61.1.9.1.1.2':
jcs.emit_snmp_attributes(snmp_oid, "Integer32", "429")
elif snmp_action == 'get-next':
if snmp_oid == '.1.3.6.1.4.1.2636.13.61.1.9.1.1':
jcs.emit_snmp_attributes(".1.3.6.1.4.1.2636.13.61.1.9.1.1.1", "Integer32", "211")
elif snmp_oid == '.1.3.6.1.4.1.2636.13.61.1.9.1.1.1':
jcs.emit_snmp_attributes(".1.3.6.1.4.1.2636.13.61.1.9.1.1.2", "Integer32", "429")
if __name__ == '__main__':
main()
Release Information
Function introduced in Junos OS Release 16.1R1.