def get_mac_address_table(self):
<EOL>RE_MACTABLE_FORMAT1 = r"<STR_LIT>".format(<EOL>VLAN_REGEX, MAC_REGEX<EOL>)<EOL>RE_MACTABLE_FORMAT2 = r"<STR_LIT>".format(<EOL>"<STR_LIT:->", MAC_REGEX<EOL>)<EOL>RE_MACTABLE_FORMAT3 = r"<STR_LIT>"<EOL>mac_address_table = []<EOL>command = "<STR_LIT>"<EOL>output = self._send_command(command)<EOL>def remove_prefix(s, prefix):<EOL><INDENT>return s[len(prefix) :] if s.startswith(prefix) else s<EOL><DEDENT>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>elif vlan == "<STR_LIT:->":<EOL><INDENT>vlan = <NUM_LIT:0><EOL><DEDENT>if (<EOL>interface.lower() == "<STR_LIT>"<EOL>or re.search(r"<STR_LIT>", interface.lower())<EOL>or re.search(r"<STR_LIT>", interface.lower())<EOL>):<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>": helpers.mac(mac),<EOL>"<STR_LIT>": helpers.canonical_interface_name(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>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>output = re.sub(r"<STR_LIT>", "<STR_LIT>", output, flags=re.M)<EOL>output = re.sub(r"<STR_LIT>", "<STR_LIT>", output, flags=re.M)<EOL>output = re.sub(r"<STR_LIT>", "<STR_LIT>", output, flags=re.M)<EOL>output = re.sub(r"<STR_LIT>", "<STR_LIT>", output, flags=re.M)<EOL>for line in output.splitlines():<EOL><INDENT>if 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>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>for pattern in [<EOL>RE_MACTABLE_FORMAT1,<EOL>RE_MACTABLE_FORMAT2,<EOL>RE_MACTABLE_FORMAT3,<EOL>]:<EOL><INDENT>if re.search(pattern, line):<EOL><INDENT>fields = line.split()<EOL>if len(fields) >= <NUM_LIT:7>:<EOL><INDENT>vlan, mac, mac_type, _, _, _, interface = fields[:<NUM_LIT:7>]<EOL>mac_address_table.append(<EOL>process_mac_fields(vlan, mac, mac_type, interface)<EOL>)<EOL>for interface in fields[<NUM_LIT:7>:]:<EOL><INDENT>mac_address_table.append(<EOL>process_mac_fields(vlan, mac, mac_type, interface)<EOL>)<EOL><DEDENT>break<EOL><DEDENT>elif len(fields) < <NUM_LIT:7>:<EOL><INDENT>for interface in fields:<EOL><INDENT>mac_address_table.append(<EOL>process_mac_fields(vlan, mac, mac_type, interface)<EOL>)<EOL><DEDENT>break<EOL><DEDENT><DEDENT><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:

Legend:
* - primary entry, G - Gateway MAC, (R) - Routed MAC, O - Overlay MAC
age - seconds since last seen,+ - primary entry using vPC Peer-Link,
(T) - True, (F) - False
   VLAN     MAC Address      Type      age     Secure NTFY Ports/SWID.SSID.LID
---------+-----------------+--------+---------+------+----+------------------
* 27       0026.f064.0000    dynamic      -       F    F    po1
* 27       001b.54c2.2644    dynamic      -       F    F    po1
* 27       0000.0c9f.f2bc    dynamic      -       F    F    po1
* 27       0026.980a.df44    dynamic      -       F    F    po1
* 16       0050.56bb.0164    dynamic      -       F    F    po2
* 13       90e2.ba5a.9f30    dynamic      -       F    F    eth1/2
* 13       90e2.ba4b.fc78    dynamic      -       F    F    eth1/1
  39       0100.5e00.4b4b    igmp         0       F    F    Po1 Po2 Po22
  110      0100.5e00.0118    igmp         0       F    F    Po1 Po2
                                                            Eth142/1/3 Eth112/1/5
                                                            Eth112/1/6 Eth122/1/5