def get_mac_address_table(self):
RE_MACTABLE_DEFAULT = r"<STR_LIT>" + MAC_REGEX<EOL>RE_MACTABLE_6500_1 = r"<STR_LIT>".format(VLAN_REGEX, MAC_REGEX)  <EOL>RE_MACTABLE_6500_2 = r"<STR_LIT>".format(VLAN_REGEX, MAC_REGEX)   <EOL>RE_MACTABLE_6500_3 = r"<STR_LIT>"                               <EOL>RE_MACTABLE_4500_1 = r"<STR_LIT>".format(VLAN_REGEX, MAC_REGEX)     <EOL>RE_MACTABLE_4500_2 = r"<STR_LIT>"                               <EOL>RE_MACTABLE_2960_1 = r"<STR_LIT>".format(MAC_REGEX)<EOL>RE_MACTABLE_GEN_1 = r"<STR_LIT>".format(VLAN_REGEX, MAC_REGEX)   <EOL>def process_mac_fields(vlan, mac, mac_type, interface):<EOL><INDENT>"""<STR_LIT>"""<EOL>if mac_type.lower() in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>static = True<EOL>if vlan.lower() == '<STR_LIT:all>':<EOL><INDENT>vlan = <NUM_LIT:0><EOL><DEDENT>if interface.lower() == '<STR_LIT>' or re.search(r'<STR_LIT>', interface.lower()) orre.search(r'<STR_LIT>', interface.lower()):<EOL><INDENT>interface = '<STR_LIT>'<EOL><DEDENT><DEDENT>else:<EOL><INDENT>static = False<EOL><DEDENT>if mac_type.lower() in ['<STR_LIT>']:<EOL><INDENT>active = True<EOL><DEDENT>else:<EOL><INDENT>active = False<EOL><DEDENT>return {<EOL>'<STR_LIT>': napalm_base.helpers.mac(mac),<EOL>'<STR_LIT>': interface,<EOL>'<STR_LIT>': int(vlan),<EOL>'<STR_LIT>': static,<EOL>'<STR_LIT>': active,<EOL>'<STR_LIT>': -<NUM_LIT:1>,<EOL>'<STR_LIT>': -<NUM_LIT:1.0><EOL>}<EOL><DEDENT>mac_address_table = []<EOL>command = IOS_COMMANDS['<STR_LIT>']<EOL>output = self._send_command(command)<EOL>output = re.split(r'<STR_LIT>', output, flags=re.M)[<NUM_LIT:1>:]<EOL>output = "<STR_LIT:\n>".join(output).strip()<EOL>output = re.sub(r"<STR_LIT>", "<STR_LIT>", output, flags=re.M)<EOL>fill_down_vlan = fill_down_mac = fill_down_mac_type = '<STR_LIT>'<EOL>for line in output.splitlines():<EOL><INDENT>if (re.search(RE_MACTABLE_6500_3, line) or re.search(RE_MACTABLE_4500_2, line)):<EOL><INDENT>interface = line.strip()<EOL>if '<STR_LIT:U+002C>' in interface:<EOL><INDENT>interfaces = interface.split('<STR_LIT:U+002C>')<EOL><DEDENT>else:<EOL><INDENT>interfaces = []<EOL>interfaces.append(interface)<EOL><DEDENT>for single_interface in interfaces:<EOL><INDENT>mac_address_table.append(process_mac_fields(fill_down_vlan, fill_down_mac,<EOL>fill_down_mac_type,<EOL>single_interface))<EOL><DEDENT>continue<EOL><DEDENT>line = line.strip()<EOL>if line == '<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>if re.search(r"<STR_LIT>", line):<EOL><INDENT>line = re.sub(r"<STR_LIT>", "<STR_LIT:0>", line, flags=re.M)<EOL><DEDENT>if re.search(RE_MACTABLE_DEFAULT, line):<EOL><INDENT>if len(line.split()) == <NUM_LIT:4>:<EOL><INDENT>mac, mac_type, vlan, interface = line.split()<EOL>mac_address_table.append(process_mac_fields(vlan, mac, mac_type, interface))<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>".format(line.split()))<EOL><DEDENT><DEDENT>elif (re.search(RE_MACTABLE_6500_1, line) or re.search(RE_MACTABLE_6500_2, line)) andlen(line.split()) >= <NUM_LIT:6>:<EOL><INDENT>if len(line.split()) == <NUM_LIT:7>:<EOL><INDENT>_, vlan, mac, mac_type, _, _, interface = line.split()<EOL><DEDENT>elif len(line.split()) == <NUM_LIT:6>:<EOL><INDENT>vlan, mac, mac_type, _, _, interface = line.split()<EOL><DEDENT>if '<STR_LIT:U+002C>' in interface:<EOL><INDENT>interfaces = interface.split('<STR_LIT:U+002C>')<EOL>fill_down_vlan = vlan<EOL>fill_down_mac = mac<EOL>fill_down_mac_type = mac_type<EOL>for single_interface in interfaces:<EOL><INDENT>mac_address_table.append(process_mac_fields(vlan, mac, mac_type,<EOL>single_interface))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>mac_address_table.append(process_mac_fields(vlan, mac, mac_type, interface))<EOL><DEDENT><DEDENT>elif re.search(RE_MACTABLE_4500_1, line) and len(line.split()) == <NUM_LIT:5>:<EOL><INDENT>vlan, mac, mac_type, _, interface = line.split()<EOL>mac_address_table.append(process_mac_fields(vlan, mac, mac_type, interface))<EOL><DEDENT>elif re.search(r"<STR_LIT>", line):<EOL><INDENT>continue<EOL><DEDENT>elif (re.search(RE_MACTABLE_2960_1, line) or re.search(RE_MACTABLE_GEN_1, line)) andlen(line.split()) == <NUM_LIT:4>:<EOL><INDENT>vlan, mac, mac_type, interface = line.split()<EOL>if '<STR_LIT:U+002C>' in interface:<EOL><INDENT>interfaces = interface.split('<STR_LIT:U+002C>')<EOL>fill_down_vlan = vlan<EOL>fill_down_mac = mac<EOL>fill_down_mac_type = mac_type<EOL>for single_interface in interfaces:<EOL><INDENT>mac_address_table.append(process_mac_fields(vlan, mac, mac_type,<EOL>single_interface))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>mac_address_table.append(process_mac_fields(vlan, mac, mac_type, interface))<EOL><DEDENT><DEDENT>elif re.search(r"<STR_LIT>", line):<EOL><INDENT>continue<EOL><DEDENT>elif re.search(r"<STR_LIT>", line):<EOL><INDENT>continue<EOL><DEDENT>elif re.search(r"<STR_LIT>", line):<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>".format(repr(line)))<EOL><DEDENT><DEDENT>return mac_address_table<EOL>
Returns a lists of dictionaries. Each dictionary represents an entry in the MAC Address
Table, having the following keys
    * mac (string)
    * interface (string)
    * vlan (int)
    * active (boolean)
    * static (boolean)
    * moves (int)
    * last_move (float)

Format1:
Destination Address  Address Type  VLAN  Destination Port
-------------------  ------------  ----  --------------------
6400.f1cf.2cc6          Dynamic       1     Wlan-GigabitEthernet0

Cat 6500:
Legend: * - primary entry
        age - seconds since last seen
        n/a - not available

  vlan   mac address     type    learn     age              ports
------+----------------+--------+-----+----------+--------------------------
*  999  1111.2222.3333   dynamic  Yes          0   Port-channel1
   999  1111.2222.3333   dynamic  Yes          0   Port-channel1

Cat 4948
Unicast Entries
 vlan   mac address     type        protocols               port
-------+---------------+--------+---------------------+--------------------
 999    1111.2222.3333   dynamic ip                    Port-channel1

Cat 2960
Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
All    1111.2222.3333    STATIC      CPU