import re


def parse_show_interface_subinterface_brief(raw_result):
    """
    Parse the 'show interface subinterface brief' command raw output.

    :param str raw_result: vtysh raw result string.
    :rtype: dict
    :return: The parsed result of the show interface subinterface brief \
        command in a list of dictionaries of the form:

     ::

        [
            {
                'vlan_id': 40,
                'subinterface': '4.1',
                'type': 'eth',
                'mode': 'routed',
                'status': 'down',
                'reason': 'Administratively down    ',
                'speed': 'auto',
                'port_ch': '--'
            },
            {
                'vlan_id': 20,
                'subinterface': '4.2',
                'type': 'eth',
                'mode': 'routed',
                'status': 'down',
                'reason': 'Administratively down    ',
                'speed': 'auto',
                'port_ch': '--'
            }
        ]
    """
    result = {}

    subinterface_re = (
        r'(?P<subinterface>\d+[-.]?\d*[.]?\d*)\s+(?P<vlan_id>[0-9]+)\s+'
        r'(?P<type>\w+)\s+(?P<mode>\w+)\s+(?P<status>\w+)\s+'
        r'(?P<reason>.*)\s+(?P<speed>\w+)\s+(?P<port_ch>--)'
    )

    result = []
    for line in raw_result.splitlines():
        line = line.strip()
        re_result = re.search(subinterface_re, line)
        if re_result:
            subinterface_match = re_result.groupdict()
            for key, value in subinterface_match.items():
                if value and value.isdigit():
                    subinterface_match[key] = int(value)
            result.append(subinterface_match)
    return result