def cli(self, interface='', output=None):
    if (output is None):
        if interface:
            cmd = self.cli_command[1].format(interface=interface)
        else:
            cmd = self.cli_command[0]
        out = self.device.execute(cmd)
    else:
        out = output
    result_dict = {}
    p1 = re.compile('^\\s*(?P<interface>[\\w./]+)$')
    p2 = re.compile('^\\s*(?P<path>[\\w\\- ]*?) +(?P<pkts_in>[\\d]+) +(?P<chars_in>[\\d]+) +(?P<pkts_out>[\\d]+) +(?P<chars_out>[\\d]+)$')
    for line in out.splitlines():
        line = line.rstrip()
        m = p1.match(line)
        if m:
            interface = m.groupdict()['interface']
            path_dict = result_dict.setdefault(interface, {}).setdefault('switching_path', {})
            continue
        m = p2.match(line)
        if m:
            group = m.groupdict()
            path = group.pop('path').replace(' ', '_').replace('-', '_').lower()
            tmp_dict = path_dict.setdefault(path, {})
            tmp_dict.update({k: int(v) for (k, v) in group.items()})
            continue
    return result_dict
def cli(self, interface=, output=None):
    if (output is None):
        if interface:
            cmd = self.cli_command[1].format(interface=interface)
        else:
            cmd = self.cli_command[0]
        out = self.device.execute(cmd)
    else:
        out = output
    result_dict = {}
    p1 = re.compile('^\\s*(?P<interface>[\\w./]+)$')
    p2 = re.compile('^\\s*(?P<path>[\\w\\- ]*?) +(?P<pkts_in>[\\d]+) +(?P<chars_in>[\\d]+) +(?P<pkts_out>[\\d]+) +(?P<chars_out>[\\d]+)$')
    for line in out.splitlines():
        line = line.rstrip()
        m = p1.match(line)
        if m:
            interface = m.groupdict()['interface']
            path_dict = result_dict.setdefault(interface, {}).setdefault('switching_path', {})
            continue
        m = p2.match(line)
        if m:
            group = m.groupdict()
            path = group.pop('path').replace(' ', '_').replace('-', '_').lower()
            tmp_dict = path_dict.setdefault(path, {})
            tmp_dict.update({k: int(v) for (k, v) in group.items()})
            continue
    return result_dict