# Path: pysnmp/entity/rfc3413/oneliner/cmdgen.py
# class AsynCommandGenerator:
# class CommandGenerator:
#     def __init__(self, snmpEngine=None):
#     def __del__(self): self.uncfgCmdGen()
#     def cfgCmdGen(self, authData, transportTarget):
#     def uncfgCmdGen(self):
#     def makeReadVarBinds(self, varNames):
#     def unmakeVarBinds(self, varBinds, lookupNames=True, lookupValues=True):
#     def getCmd(self, authData, transportTarget, varNames, cbInfo):
#     def setCmd(self, authData, transportTarget, varBinds, cbInfo):
#     def nextCmd(self, authData, transportTarget, varNames, cbInfo):
#     def bulkCmd(self, authData, transportTarget, nonRepeaters, maxRepetitions,
#                 varNames, cbInfo):
#     def __init__(self, snmpEngine=None, asynCmdGen=None):
#     def getCmd(self, authData, transportTarget, *varNames, **kwargs):
#         def __cbFun(
#             sendRequestHandle, errorIndication, errorStatus, errorIndex,
#             varBinds, appReturn
#             ):
#     def setCmd(self, authData, transportTarget, *varBinds, **kwargs):
#         def __cbFun(
#             sendRequestHandle, errorIndication, errorStatus, errorIndex,
#             varBinds, appReturn
#             ):
#     def nextCmd(self, authData, transportTarget, *varNames, **kwargs):
#         def __cbFun(sendRequestHandle, errorIndication,
#                     errorStatus, errorIndex, varBindTable, cbCtx):
#     def bulkCmd(self, authData, transportTarget,
#                 nonRepeaters, maxRepetitions, *varNames, **kwargs):
#         def __cbFun(sendRequestHandle, errorIndication,
#                     errorStatus, errorIndex, varBindTable, cbCtx):
# 
# Path: pysnmp/proto/rfc1902.py
# class Integer(univ.Integer):
# class Integer32(univ.Integer):
# class OctetString(univ.OctetString):
# class IpAddress(univ.OctetString):
# class Counter32(univ.Integer):
# class Gauge32(univ.Integer):
# class Unsigned32(univ.Integer):
# class TimeTicks(univ.Integer):
# class Opaque(univ.OctetString):
# class Counter64(univ.Integer):
# class Bits(univ.OctetString):
# class ObjectName(univ.ObjectIdentifier): pass
# class SimpleSyntax(rfc1155.TypeCoercionHackMixIn, univ.Choice):
# class ApplicationSyntax(rfc1155.TypeCoercionHackMixIn, univ.Choice):
# class ObjectSyntax(univ.Choice):
#     def setFixedLength(self, value):
#     def isFixedLength(self):
#     def getFixedLength(self):
#     def prettyIn(self, value):
#     def prettyOut(self, value):
#     def __init__(self, value=None, tagSet=None, subtypeSpec=None,
#                  namedValues=None):
#     def prettyIn(self, bits):
#     def prettyOut(self, value):
#     def clone(self, value=None, tagSet=None, subtypeSpec=None,
#               namedValues=None):
#     def subtype(self, value=None, implicitTag=None, explicitTag=None,
#                 subtypeSpec=None, namedValues=None):


from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp.proto import rfc1902
#     setting SNMPv2-MIB::sysName.0 to new value (type taken from MIB)
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.setCmd(
    cmdgen.CommunityData('public'),
    cmdgen.UdpTransportTarget(('localhost', 161)),
    (cmdgen.MibVariable('SNMPv2-MIB', 'sysName', 0), 'new system name')
)

# Check for errors and print out results
if errorIndication:
    print(errorIndication)
else:
    if errorStatus:
        print('%s at %s' % (
            errorStatus.prettyPrint(),
            errorIndex and varBinds[int(errorIndex)-1] or '?'
            )
        )
    else:
        for name, val in varBinds:
            print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))


# Send SNMP SET request
#     with SNMPv1, community 'public'
#     over IPv4/UDP
#     to an Agent at localhost:161
#     setting two OIDs to new values (types explicitly specified)
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.setCmd(
    cmdgen.CommunityData('public'),
    cmdgen.UdpTransportTarget(('localhost', 161)),

# Path: pysnmp/entity/rfc3413/oneliner/cmdgen.py
# class AsynCommandGenerator:
# class CommandGenerator:
#     def __init__(self, snmpEngine=None):
#     def __del__(self): self.uncfgCmdGen()
#     def cfgCmdGen(self, authData, transportTarget):
#     def uncfgCmdGen(self):
#     def makeReadVarBinds(self, varNames):
#     def unmakeVarBinds(self, varBinds, lookupNames=True, lookupValues=True):
#     def getCmd(self, authData, transportTarget, varNames, cbInfo):
#     def setCmd(self, authData, transportTarget, varBinds, cbInfo):
#     def nextCmd(self, authData, transportTarget, varNames, cbInfo):
#     def bulkCmd(self, authData, transportTarget, nonRepeaters, maxRepetitions,
#                 varNames, cbInfo):
#     def __init__(self, snmpEngine=None, asynCmdGen=None):
#     def getCmd(self, authData, transportTarget, *varNames, **kwargs):
#         def __cbFun(
#             sendRequestHandle, errorIndication, errorStatus, errorIndex,
#             varBinds, appReturn
#             ):
#     def setCmd(self, authData, transportTarget, *varBinds, **kwargs):
#         def __cbFun(
#             sendRequestHandle, errorIndication, errorStatus, errorIndex,
#             varBinds, appReturn
#             ):
#     def nextCmd(self, authData, transportTarget, *varNames, **kwargs):
#         def __cbFun(sendRequestHandle, errorIndication,
#                     errorStatus, errorIndex, varBindTable, cbCtx):
#     def bulkCmd(self, authData, transportTarget,
#                 nonRepeaters, maxRepetitions, *varNames, **kwargs):
#         def __cbFun(sendRequestHandle, errorIndication,
#                     errorStatus, errorIndex, varBindTable, cbCtx):
# 
# Path: pysnmp/proto/rfc1902.py
# class Integer(univ.Integer):
# class Integer32(univ.Integer):
# class OctetString(univ.OctetString):
# class IpAddress(univ.OctetString):
# class Counter32(univ.Integer):
# class Gauge32(univ.Integer):
# class Unsigned32(univ.Integer):
# class TimeTicks(univ.Integer):
# class Opaque(univ.OctetString):
# class Counter64(univ.Integer):
# class Bits(univ.OctetString):
# class ObjectName(univ.ObjectIdentifier): pass
# class SimpleSyntax(rfc1155.TypeCoercionHackMixIn, univ.Choice):
# class ApplicationSyntax(rfc1155.TypeCoercionHackMixIn, univ.Choice):
# class ObjectSyntax(univ.Choice):
#     def setFixedLength(self, value):
#     def isFixedLength(self):
#     def getFixedLength(self):
#     def prettyIn(self, value):
#     def prettyOut(self, value):
#     def __init__(self, value=None, tagSet=None, subtypeSpec=None,
#                  namedValues=None):
#     def prettyIn(self, bits):
#     def prettyOut(self, value):
#     def clone(self, value=None, tagSet=None, subtypeSpec=None,
#               namedValues=None):
#     def subtype(self, value=None, implicitTag=None, explicitTag=None,
#                 subtypeSpec=None, namedValues=None):


# Path: examples/v3arch/oneliner/manager/setgen.py
from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp.proto import rfc1902

#     setting SNMPv2-MIB::sysName.0 to new value (type taken from MIB)
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.setCmd(
    cmdgen.CommunityData('public'),
    cmdgen.UdpTransportTarget(('localhost', 161)),
    (cmdgen.MibVariable('SNMPv2-MIB', 'sysName', 0), 'new system name')
)

# Check for errors and print out results
if errorIndication:
    print(errorIndication)
else:
    if errorStatus:
        print('%s at %s' % (
            errorStatus.prettyPrint(),
            errorIndex and varBinds[int(errorIndex)-1] or '?'
            )
        )
    else:
        for name, val in varBinds:
            print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))


# Send SNMP SET request
#     with SNMPv1, community 'public'
#     over IPv4/UDP
#     to an Agent at localhost:161
#     setting two OIDs to new values (types explicitly specified)
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.setCmd(
    cmdgen.CommunityData('public'),
    cmdgen.UdpTransportTarget(('localhost', 161)),

    ('1.3.6.1.2.1.1.2.0', rfc1902.ObjectName('1.3.6.1.4.1.20408.1.1')),