How to use the netflow.ipfix.IPFIXDataTypes.by_name function in netflow

To help you get started, we’ve selected a few netflow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitkeks / python-netflow-v9-softflowd / netflow / ipfix.py View on Github external
def get_type_unpack(cls, key: Union[int, str]) -> Optional[DataType]:
        """
        This method covers the mapping from a field type to a struct.unpack format string.
        BLOCKED: due to Reduced-Size Encoding, fields may be exported with a smaller length than defined in
        the standard. Because of this mismatch, the parser in `IPFIXDataRecord.__init__` cannot use this method.
        :param key:
        :return:
        """
        item = None
        if type(key) == int:
            item = cls.by_id(key)
        elif type(key) == str:
            item = cls.by_name(key)
        if not item:
            return None
        return IPFIXDataTypes.by_name(item.type)