Esempio n. 1
0
    def __init__(self, tag=None, request_id=None, error_status=None, error_index=None, variable_bindings=None):
        if request_id is None:
            # TODO: when Integer() is fixed, use wider range of values
            request_id = Integer.from_int(randint(1 << 24, 1 << 31)).get_object()
        assert isinstance(request_id.value, Integer)
        self.request_id = request_id

        if error_status is None:
            error_status = Integer.from_int(ErrorStatus.no_error).get_object()
        assert isinstance(error_status.value, Integer)
        self.error_status = error_status

        if error_index is None:
            error_index = Integer.from_int(0).get_object()
        assert isinstance(error_index.value, Integer)
        self.error_index = error_index

        assert variable_bindings is not None
        self.variable_bindings = variable_bindings

        Object.__init__(
            self,
            self.get_object_tag() if tag is None else tag,
            [self.request_id, self.error_status, self.error_index, self.variable_bindings],
        )
Esempio n. 2
0
    def __init__(self, tag=None, request_id=None, error_status=None, error_index=None, variable_bindings=None):
        if request_id is None:
            # TODO: when Integer() is fixed, use wider range of values
            request_id = Integer.from_int(randint(1 << 24, 1 << 31)).get_object()
        assert isinstance(request_id.value, Integer)
        self.request_id = request_id

        if error_status is None:
            error_status = Integer.from_int(ErrorStatus.no_error).get_object()
        assert isinstance(error_status.value, Integer)
        self.error_status = error_status

        if error_index is None:
            error_index = Integer.from_int(0).get_object()
        assert isinstance(error_index.value, Integer)
        self.error_index = error_index

        assert variable_bindings is not None
        self.variable_bindings = variable_bindings

        Object.__init__(self, self.get_object_tag() if tag is None else tag,
                        [self.request_id, self.error_status, self.error_index, self.variable_bindings])
Esempio n. 3
0
    def __init__(self, version=None, community=None, pdu=None):
        if version is None:
            version = Integer.from_int(self.snmp_version).get_object()
        if community is None:
            community = OctetString(b'public').get_object()
        if pdu is None:
            pass

        Object.__init__(self, ObjectTag(TagClassEnum.universal, True, UniversalClassTags.sequence_of),
                        [version, community, pdu])

        self.version = version
        self.community = community
        self.pdu = pdu
Esempio n. 4
0
    def __init__(self, version=None, community=None, pdu=None):
        if version is None:
            version = Integer.from_int(self.snmp_version).get_object()
        if community is None:
            community = OctetString(b'public').get_object()
        if pdu is None:
            pass

        Object.__init__(
            self,
            ObjectTag(TagClassEnum.universal, True,
                      UniversalClassTags.sequence_of),
            [version, community, pdu])

        self.version = version
        self.community = community
        self.pdu = pdu