def cli(self, ip, output=None):
    if (output is None):
        out = self.device.execute(self.cli_command.format(ip=ip))
    else:
        out = output
    interface_dict = {}
    p = re.compile('^\\s*(?P<interface>[a-zA-Z0-9\\/\\.\\-]+) +(?P<ip_address>[a-z0-9\\.]+) +(?P<interface_ok>[A-Z]+) +(?P<method>[a-zA-Z]+) +(?P<interface_status>[a-z\\s]+) +(?P<protocol_status>[a-z]+)$')
    for line in out.splitlines():
        line = line.strip()
        m = p.match(line)
        if m:
            interface = m.groupdict()['interface']
            if ('interface' not in interface_dict):
                interface_dict['interface'] = {}
            if (interface not in interface_dict['interface']):
                interface_dict['interface'][interface] = {}
            interface_dict['interface'][interface]['ip_address'] = m.groupdict()['ip_address']
            interface_dict['interface'][interface]['interface_ok'] = m.groupdict()['interface_ok']
            interface_dict['interface'][interface]['method'] = m.groupdict()['method']
            interface_dict['interface'][interface]['interface_status'] = m.groupdict()['interface_status'].strip()
            interface_dict['interface'][interface]['protocol_status'] = m.groupdict()['protocol_status']
            continue
    return interface_dict
def cli(self, ip, output=None):
    if (output is None):
        out = self.device.execute(self.cli_command.format(ip=ip))
    else:
        out = output
    interface_dict = {}
    p = re.compile('^\\s*(?P<interface>[a-zA-Z0-9\\/\\.\\-]+) +(?P<ip_address>[a-z0-9\\.]+) +(?P<interface_ok>[A-Z]+) +(?P<method>[a-zA-Z]+) +(?P<interface_status>[a-z\\s]+) +(?P<protocol_status>[a-z]+)$')
    for line in out.splitlines():
        line = line.strip()
        m = p.match(line)
        if m:
            interface = m.groupdict()['interface']
            if ('interface' not in interface_dict):
                interface_dict['interface'] = {}
            if (interface not in interface_dict['interface']):
                interface_dict['interface'][interface] = {}
            interface_dict['interface'][interface]['ip_address'] = m.groupdict()['ip_address']
            interface_dict['interface'][interface]['interface_ok'] = m.groupdict()['interface_ok']
            interface_dict['interface'][interface]['method'] = m.groupdict()['method']
            interface_dict['interface'][interface]['interface_status'] = m.groupdict()['interface_status'].strip()
            interface_dict['interface'][interface]['protocol_status'] = m.groupdict()['protocol_status']
            continue
    return interface_dict