def get_interfaces_ip(self):
interfaces = {}<EOL>command = "<STR_LIT>"<EOL>show_ip_interface = self._send_command(command)<EOL>command = "<STR_LIT>"<EOL>show_ipv6_interface = self._send_command(command)<EOL>INTERNET_ADDRESS = r"<STR_LIT>"<EOL>INTERNET_ADDRESS += r"<STR_LIT>".format(IPV4_ADDR_REGEX)<EOL>LINK_LOCAL_ADDRESS = (<EOL>r"<STR_LIT>"<EOL>)<EOL>GLOBAL_ADDRESS = (<EOL>r"<STR_LIT>"<EOL>)<EOL>interfaces = {}<EOL>for line in show_ip_interface.splitlines():<EOL><INDENT>if len(line.strip()) == <NUM_LIT:0>:<EOL><INDENT>continue<EOL><DEDENT>if line[<NUM_LIT:0>] != "<STR_LIT:U+0020>":<EOL><INDENT>ipv4 = {}<EOL>interface_name = line.split()[<NUM_LIT:0>]<EOL><DEDENT>m = re.match(INTERNET_ADDRESS, line)<EOL>if m:<EOL><INDENT>ip, prefix = m.groups()<EOL>ipv4.update({ip: {"<STR_LIT>": int(prefix)}})<EOL>interfaces[interface_name] = {"<STR_LIT>": ipv4}<EOL><DEDENT><DEDENT>if "<STR_LIT>" not in show_ipv6_interface:<EOL><INDENT>for line in show_ipv6_interface.splitlines():<EOL><INDENT>if len(line.strip()) == <NUM_LIT:0>:<EOL><INDENT>continue<EOL><DEDENT>if line[<NUM_LIT:0>] != "<STR_LIT:U+0020>":<EOL><INDENT>ifname = line.split()[<NUM_LIT:0>]<EOL>ipv6 = {}<EOL>if ifname not in interfaces:<EOL><INDENT>interfaces[ifname] = {"<STR_LIT>": ipv6}<EOL><DEDENT>else:<EOL><INDENT>interfaces[ifname].update({"<STR_LIT>": ipv6})<EOL><DEDENT><DEDENT>m = re.match(LINK_LOCAL_ADDRESS, line)<EOL>if m:<EOL><INDENT>ip = m.group(<NUM_LIT:1>)<EOL>ipv6.update({ip: {"<STR_LIT>": <NUM_LIT:10>}})<EOL><DEDENT>m = re.match(GLOBAL_ADDRESS, line)<EOL>if m:<EOL><INDENT>ip, prefix = m.groups()<EOL>ipv6.update({ip: {"<STR_LIT>": int(prefix)}})<EOL><DEDENT><DEDENT><DEDENT>return interfaces<EOL>
Get interface ip details.

Returns a dict of dicts

Example Output:

{   u'FastEthernet8': {   'ipv4': {   u'10.66.43.169': {   'prefix_length': 22}}},
    u'Loopback555': {   'ipv4': {   u'192.168.1.1': {   'prefix_length': 24}},
                        'ipv6': {   u'1::1': {   'prefix_length': 64},
                                    u'2001:DB8:1::1': {   'prefix_length': 64},
                                    u'2::': {   'prefix_length': 64},
                                    u'FE80::3': {   'prefix_length': 10}}},
    u'Tunnel0': {   'ipv4': {   u'10.63.100.9': {   'prefix_length': 24}}},
    u'Tunnel1': {   'ipv4': {   u'10.63.101.9': {   'prefix_length': 24}}},
    u'Vlan100': {   'ipv4': {   u'10.40.0.1': {   'prefix_length': 24},
                                u'10.41.0.1': {   'prefix_length': 24},
                                u'10.65.0.1': {   'prefix_length': 24}}},
    u'Vlan200': {   'ipv4': {   u'10.63.176.57': {   'prefix_length': 29}}}}