def cli(self, output=None):
    if (output is None):
        out = self.device.execute(self.cli_command)
    else:
        out = output
    result_dict = {}
    p1 = re.compile('^(?P<interfaces>\\S+)(?:\\s+(?P<name>([\\S\\s]+)))?\\s+(?P<status>(connected|notconnect|suspended|inactive|disabled|err-disabled|monitoring))\\s+(?P<vlan>\\S+)\\s+(?P<duplex_code>[\\S\\-]+)\\s+(?P<port_speed>[\\S\\-]+)(\\s+(?P<type>.+))?$')
    for line in out.splitlines():
        line = line.strip()
        m = p1.match(line)
        if m:
            group = m.groupdict()
            intf_dict = result_dict.setdefault('interfaces', {}).setdefault(Common.convert_intf_name(group['interfaces']), {})
            name_val = group['name'].strip()
            if (len(name_val) > 0):
                intf_dict['name'] = name_val
            keys = ['status', 'vlan', 'duplex_code', 'port_speed', 'type']
            for k in keys:
                if group[k]:
                    intf_dict[k] = group[k].strip()
            continue
    return result_dict
def cli(self, output=None):
    if (output is None):
        out = self.device.execute(self.cli_command)
    else:
        out = output
    result_dict = {}
    p1 = re.compile('^(?P<interfaces>\\S+)(?:\\s+(?P<name>([\\S\\s]+)))?\\s+(?P<status>(connected|notconnect|suspended|inactive|disabled|err-disabled|monitoring))\\s+(?P<vlan>\\S+)\\s+(?P<duplex_code>[\\S\\-]+)\\s+(?P<port_speed>[\\S\\-]+)(\\s+(?P<type>.+))?$')
    for line in out.splitlines():
        line = line.strip()
        m = p1.match(line)
        if m:
            group = m.groupdict()
            intf_dict = result_dict.setdefault('interfaces', {}).setdefault(Common.convert_intf_name(group['interfaces']), {})
            name_val = group['name'].strip()
            if (len(name_val) > 0):
                intf_dict['name'] = name_val
            keys = ['status', 'vlan', 'duplex_code', 'port_speed', 'type']
            for k in keys:
                if group[k]:
                    intf_dict[k] = group[k].strip()
            continue
    return result_dict